Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: build.sh vs. LD_RUN_PATH



    Date:        Tue, 23 Sep 2008 11:46:19 +0200
    From:        Alan Barrett <apb%cequrux.com@localhost>
    Message-ID:  <20080923094619.GF356%apb-laptoy.apb.alt.za@localhost>

  | On Tue, 23 Sep 2008, Hubert Feyrer wrote:
  | > Can build.sh be made to erase the environment, to not pick up random 
stuff?
  | > (think 'env -i')?
  | 
  | Some people expect build.sh to pick up BSDOBJDIR and other variables
  | from the environment, so erasing the environment probably won't be
  | acceptable.  We'd need either a list of approved variables not to unset,
  | or a list of dangerous variables to unset.

I do all my builds with a script that (amongst a whole bunch of other
stuff not important here) runs build.sh as ...

cd "$TARGET/usr/src" || fin 4   # fin() is just cleanup and exit
EMPTY=`mktemp -d /tmp/build-XXXXXXX`
env -i \
        PATH=/sbin:/bin:/usr/sbin:/usr/bin \
                "USER=$USER" \
                "HOME=$EMPTY" \
                "LOGNAME=$LOGNAME" \
                "DISPLAY=$DISPLAY" \
                "MAKECONF=/dev/null" \
        /bin/sh build.sh "$@" \ 
                -V "CHECKFLIST_FLAGS=-e"                \
                        -D "${TARGET}"                  \
                        -O "/usr/obj/$REL"              \
                        -R "$SNAP"                      \
                        -T "/usr/obj/$REL/tools"        \
                        -X "$TARGET/usr/src/xsrc"       \
                -u -x                                   \
                        $BUILDING

Stuff like setting TARGET REL SNAP is what the script is working out
for me before starting, BUILDING is what I want to make (defaults to release)
the HOME=$EMPTY nonsense (with EMPTY being a newly made empty directory)
was to satisfy some program build in the XFree86 set (I forget which one
needed to access $HOME or why...)   I haven't tested whether it is still
needed with the new Xorg version.   DISPLAY gets set for a similar reason.

In any case this lot seems to generally allow me to build in an environment
totally unaffected by the outside world (whateevr I have in my env, in mk.conf
or just about anything else).   The particular variables settings are
likely to want to vary for other users, but this pasic procedure seems
like a useful way to make things.

I need CHECKFLIST_FLAGS=-e as I have the sources to compile in
the target directory (TARGET/usr/src - as the initial cd implies)
and the checkflist stuff really doesn't expect to find stuff in /usr/src
of its output directory...   Still, that way allow me to trivially have
a whole bunch of (complete) different compiled systems I can easily
chroot into, and find a complete (though basic, no packages) NetBSD
ready to use (man pages, sources, and all binaries).

kre



Home | Main Index | Thread Index | Old Index