NetBSD-Users archive

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

Re: empty vs. reuse /usr/obj & /usr/tools for different crossbuilds?



On Mon, Dec 08, 2025 at 23:25:43 -0800, Steve Rikli wrote:

> I was looking through src/BUILDING in the meantime for hints about it,
> and found this passage in the "-O obj" description:
> 
>     Note: The use of one of -M or -O is the only means of building
>     multiple machine architecture userlands from the same source
>     tree without cleaning between builds (in which case, one would
>     specify distinct obj locations for each).
> 
> It doesn't spell it out quite as succinctly as you did, but still pretty
> clear; it did lead me to think my attempt was likely not supported. :)
> 
> > The -T tooldir may be shared between architectures, as all the tools 
> > have archtiecture-qualified names (or are identical, only specific to
> > the host).
> 
> Good deal; that helps keep things simple in my setup. I'll adjust my
> methods for /usr/obj/*/ and have another go at it.

I use a simple wrapper that does, essentially:

b=/home/uwe/work/netbsd/build
m="$1"

./build.sh -m $m                        \
        -T $b/tools -R $b/release       \
        -O $b/obj/$m -D $b/distrib/$m   \
        -X ../xsrc                      \
        -V USE_XZ_SETS=no               \
        "$@"

Note separate objdirs, but common tooldir.  -X argument and the $b dir
are tweaked for other branches.

That tooldir goes way back :)

$ ls *-gcc-[0-9]* | wc -l
63
$ ls -lrt *-gcc-[0-9]* | sed -n -e '1p' -e '$p'
-rwxr-xr-x 1 uwe uwe  277389 Jun  3  2014 shle--netbsdelf-gcc-4.5.4
-rwxr-xr-x 2 uwe uwe 1497224 Jan 10  2025 sparc64--netbsd-gcc-12.4.0


You might also want to mount you srcdir readonly (null mount on a
netbsd host, bind mount on a linux host) and start build.sh from that
read-only view, not from the writable one.  Helps a lot with stray
build artifacts polluting your tree accidentally and causing trouble
later on for other builds.

-uwe


Home | Main Index | Thread Index | Old Index