Re: rescue/ broke cross compiles

From: Tim Kientzle <kientzle_at_acm.org>
Date: Mon, 30 Jun 2003 20:10:02 -0700
Marcel Moolenaar wrote:
> On Mon, Jun 30, 2003 at 04:54:02PM -0700, Gordon Tetlow wrote:
>>>That's why ru_at_ suggested to add a build-tools target. That way you
>>>populate the seperate tree in sync with the phases of a world,
>>>thereby avoiding the phase ordering problem.
>>
>>Is there a way to leverage the existing build-tools so we don't have
>>to do extra compiling that isn't necessary?
> 
> Build tools are most of the time so small or trivial (gcc is
> probably the exception, before that perl probably was) that
> building them again is lost in creating the rescue bits itself.
> We could possibly copy the object directory of those tools that
> have build tools, but if there are paths embedded in generated
> scripts, we have to regenerate them anyway.
> 
> What about this: rebuild the build tools to get things sorted
> out and working and then look if we can optimize?

Looking through the build tools for /bin/sh, it's definitely
not worth the effort to try copying build tools around.
Although it sounds easy to add a build-tools target to
handle this, I'm not sure I see exactly how to do this.
Any suggestions?

For the longer term, perhaps it would be desirable to
simply eliminate as many of the build-tools as possible?
For example, the attached is a pretty close substitute for
mkinit.c in the /bin/sh build.  It's crude, but it seems to work
and eliminates the need to compile mkinit at build time.

I'll see if I can scrape together something similar for
the other /bin/sh tools.

Tim Kientzle

#!/bin/sh

echo "/*"
echo " * This file was generated by the mkinit program."
echo " */"
echo ""
echo '#include "shell.h"'
echo '#include "mystring.h"'

cat $_at_ | grep '^INCLUDE' | sed -e "s/INCLUDE/#include/"

echo
echo
echo

cat $_at_ | sed -n -e '/^#define/ s/#define //p' | grep -v '\\$' | egrep -v '^[A-Z_]+\(' | awk '{print "#undef ",$1; print "#define",$0; }'

echo
echo

for f in $_at_
do
    cat $f | sed -n -e '/^MKINIT$/,/^}/ p'  -e '/^MKINIT / s/^MKINIT/extern/p' | grep -v '^MKINIT$'
    echo
done

echo
echo
echo "/*"
echo " * Initialization code."
echo " */"

echo
echo "void"
echo "init() {"

for f in $_at_
do
    echo "      /* from $f: */"
    cat $f | sed -n -e '/^INIT/,/^}/ p' | sed -e 's/INIT //' | \
    awk '{print "	",$0;}' OFS=''
    echo
done

echo "}"

echo
echo
echo

echo "/*"
echo " * This routine is called when an error or an interrupt occurs in an"
echo " * interactive shell and control is returned to the main command loop."
echo " */"
echo
echo "void"
echo "reset() {"

for f in $_at_
do
    echo "      /* from $f: */"
    cat $f | sed -n -e '/^RESET/,/^}/ p' | sed -e 's/RESET //' | \
    awk '{print "	",$0;}' OFS=''
    echo
done
echo "}"

echo
echo
echo
echo "/*"
echo " * This routine is called to initialize the shell to run a shell procedure."
echo " */"
echo
echo "void"
echo "initshellproc() {"


for f in $_at_
do
    echo "      /* from $f: */"
    cat $f | sed -n -e '/^SHELLPROC/,/^}/ p' | sed -e 's/SHELLPROC //' | \
    awk '{print "	",$0;}' OFS=''
    echo
done
echo "}"
Received on Mon Jun 30 2003 - 18:07:23 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:13 UTC