Subject: bootstrapping bmake, etc. on MacOS X 10.3.9 and 10.2.8
To: None <>
From: John D. Baker <>
List: tech-pkg
Date: 12/11/2005 13:23:47
I played around with bmake and the bootstrap process on MacOS X 10.3.9
and 10.2.8 and discovered a few things.  As suggested in:

I boot-strapped bmake outside of pkgsrc.  This ran just fine, but I'm
pretty sure it wouldn't be appropriate for use in pkgsrc.  So I built it
again but passed in the appropriate arguments for my pkg setup, just
like the bootstrap script (or devel/bmake/Makefile) would do:

    ./bmake/boot-strap --prefix=/usr/pkg --sysconfdir=/usr/pkg/etc \
        --mksrc none --with-def-sys-path=/usr/pkg/share/mk

What I found was that if ${PREFIX}/share/mk exists and is populated,
bmake fails its unit tests in the same manner as described in:


I still had a populated /usr/pkg/share/mk left over from the failed
bootstrap attempt.  I deleted all the files from it and the
bmake/boot-strap ran to completion.  Or, in the case of my 10.2.8 system,
which has an existing pkgsrc system on it, I temporarily renamed
/usr/pkg/share/mk to move it out of the way and again the bmake/boot-strap

I then manually installed Darwin/bmake into /usr/pkg/bin.  (And restored
/usr/pkg/share/mk on the 10.2.8 system.)

Looking at the bootstrap/bootstrap script, I saw that bmake was not
actually needed to build any subsequent tools/utilities, so I just
commented those lines out:

--- /usr/pkgsrc/bootstrap/bootstrap	Sat Dec 10 23:20:50 2005
+++ /usr/pkgsrc/bootstrap/bootstrap.hack	Sat Dec 10 23:03:35 2005
@@ -657,10 +657,10 @@
 	run_cmd "$shprog $wrkdir/install-sh -c -o $user -g $group -m 755 files/mkdir-sh $prefix/sbin/mkdir-sh"

-echo_msg "Installing bmake"
-copy_src ../devel/bmake/files bmake
-run_cmd "(cd $wrkdir/bmake && env CPPFLAGS='$CPPFLAGS -I../../libnbcompat' LDFLAGS='$LDFLAGS -L../../libnbcompat' LIBS='-lnbcompat' $shprog ./boot-strap -q -o $opsys --prefix=$prefix --sysconfdir=$sysconfdir --mksrc none --with-default-sys-path="$prefix/share/mk")"
-run_cmd "$shprog $wrkdir/install-sh -c -o $user -g $group -m 755 $wrkdir/bmake/$opsys/bmake $prefix/bin/bmake"
+#echo_msg "Installing bmake"
+#copy_src ../devel/bmake/files bmake
+#run_cmd "(cd $wrkdir/bmake && env CPPFLAGS='$CPPFLAGS -I../../libnbcompat' LDFLAGS='$LDFLAGS -L../../libnbcompat' LIBS='-lnbcompat' $shprog ./boot-strap -q -o $opsys --prefix=$prefix --sysconfdir=$sysconfdir --mksrc none --with-default-sys-path="$prefix/share/mk")"
+#run_cmd "$shprog $wrkdir/install-sh -c -o $user -g $group -m 755 $wrkdir/bmake/$opsys/bmake $prefix/bin/bmake"
 #run_cmd "$shprog $wrkdir/install-sh -c -o $user -g $group -m 644 $wrkdir/bmake/$opsys/bmake.1 $prefix/man/man1/bmake.1"

 # bootstrap tnftp

This modified bootstrap/bootstrap script then ran to completion.  In this
manner, I finally managed to bootstrap pkgsrc on my MacOS X 10.3.9 system
and update the bootstrap kit on my 10.2.8 system.

I've built several packages on the 10.3.9 system since then and bmake
seems to be functioning properly with /usr/pkg/share/mk repopulated
by the bootstrap.hack script.

I hope this helps someone else who is struggling with bootstrapping
pkgsrc on a MacOS X 10.3.9 or earlier system.  And, I hope it helps
point to a solution so this workaround/hack isn't necessary anymore.

John D. Baker, KN5UKS                    NetBSD     Darwin/MacOS X
jdbaker(at)mylinuxisp(dot)com                 OpenBSD            FreeBSD
BSD -- It just sits there and _works_!
GPG fingerprint:  D703 4A7E 479F 63F8 D3F4  BD99 9572 8F23 E4AD 1645