NetBSD-Users archive

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

Re: Does build.sh dump things into /usr/obj/ ?



Jan Danielsson wrote:

I don't suppose, you'd care to share that script?
   I use this:

First of all, thanks for sharing! :-)

I just have a few questions, so I'm sure I understand the script fully...

--[prep_build_env.sh]------------------------
#!/bin/sh
#ARCH=`uname -m`
BASE=`pwd`

Good idea. In my case maybe not so much because I am sometimes a little distracted and that would lead to funny results. :-) Bu I could change BASE to anything else (static).

if [ $# -gt 0 ] ; then
        ARCH=$1
fi

Which in any case assumes that the user gives a valid plattform and only the one argument (if he gives one). As long as only I am using this script no problem.

if ! [  -n "$ARCH" ] ; then
        ARCH=`uname -m`
fi

Ok, this part I don't quite get. Why another "if"? I would have done that by just using an "else" within the first if, something like this:

  if [ $# -gt 0 ] ; then
    ARCH=$1
  else
    ARCH=`uname -m`
  fi

Or won't that work?
BTW. Just trying to learn here, not complain.

export TOOLDIR=$BASE/tools
export DESTDIR=$BASE/dest.$ARCH
export RELEASEDIR=$BASE/release
export MAKEOBJDIRPREFIX=$BASE/obj.$ARCH
export MKUNPRIVED=yes
export MACHINE=$ARCH

That's all pretty straight forward.

if ! [ -d $TOOLDIR ] ; then
        mkdir -p $TOOLDIR
fi

if ! [ -d $DESTDIR ] ; then
        mkdir -p $DESTDIR
fi

if ! [ -d $RELEASEDIR ] ; then
        mkdir -p $RELEASEDIR
fi

if ! [ -d $MAKEOBJDIRPREFIX ] ; then
        mkdir -p $MAKEOBJDIRPREFIX
fi

Maybe it would be a good idea to check if the current user has write privileges in the Basedir *before* trying to create all the directories. The error messages mkdir would spit out could give a hint :-) but the script should be able to give a hint to the user too.

--[prep_build_env.sh]------------------------

   Just go into the directory where you want all of the files to be
stored. Run this script, then run build.sh with the appropriate flags.
Obviously, you need to run the script in the shell's process:
$ . prep_build_env.sh

Not sure what you mean by that. :-(
-v please

Regards
Chris


Home | Main Index | Thread Index | Old Index