Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Jun 2003 20:10:02 -0700
From:      Tim Kientzle <kientzle@acm.org>
To:        Marcel Moolenaar <marcel@xcllnt.net>
Cc:        current@freebsd.org
Subject:   Re: rescue/ broke cross compiles
Message-ID:  <3F00FB8A.10607@acm.org>
References:  <20030630222353.GH57432@sunbay.com> <20030630222820.GV70590@roark.gnf.org> <20030630225206.GA57854@ns1.xcllnt.net> <20030630235402.GC70590@roark.gnf.org> <20030701003516.GA3516@dhcp01.pn.xcllnt.net>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------090203060106090001000100
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Marcel Moolenaar wrote:
> On Mon, Jun 30, 2003 at 04:54:02PM -0700, Gordon Tetlow wrote:
>>>That's why ru@ 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

--------------090203060106090001000100
Content-Type: text/plain;
 name="mkinit.sh"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="mkinit.sh"

#!/bin/sh

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

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

echo
echo
echo

cat $@ | 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 $@
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 $@
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 $@
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 $@
do
    echo "      /* from $f: */"
    cat $f | sed -n -e '/^SHELLPROC/,/^}/ p' | sed -e 's/SHELLPROC //' | \
    awk '{print "	",$0;}' OFS=''
    echo
done
echo "}"




--------------090203060106090001000100--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3F00FB8A.10607>