Building ports on old FreeBSDs - revised
This is a revision of an earlier post which has instructions that no longer work.
Are you running an older version of FreeBSD, and getting errors like this when you try to build a port?
"/usr/ports/Mk/bsd.port.mk", line 2416: warning: String comparison operator should be either == or !=
"/usr/ports/Mk/bsd.port.mk", line 2416: warning: String comparison operator should be either == or !=
"/usr/ports/Mk/bsd.port.mk", line 2416: Malformed conditional (((${OSVERSION} < 504105 || (${OSVERSION}
>= 600000 && ${OSVERSION} < 600103) || (${OSVERSION} >= 700000 && ${OSVERSION} < 700012)) &&
${PKGORIGIN} != "ports-mgmt/pkg_install") || exists(${LOCALBASE}/sbin/pkg_info))
If so, it's because the ports maintainers have started using expressions in the ports Makefiles which are not understood by the versions of make
that come with old FreeBSDs.
The official recommended fix would be to upgrade your FreeBSD, but if that's not practical you can at least install a newer version of make
to get by for a bit longer. This can be done in just a few minutes with two main steps: temporarily bring back an older /usr/ports/Mk
which is compatible with FreeBSD 4.x - and then build and install the devel/make
port which used to be present in the ports tree.
The ports tree is in CVS, so it's possible to checkout older revisions of selected directories. This FreeBSD Handbook page lists the anonymous CVS repositories available. For this example I'm going to use anoncvs@anoncvs1.FreeBSD.org:/home/ncvs
We only need two small directories, so it probably doesn't really matter which one you use.
It seems like the first commit to the ports infrastructure which broke compatibility happened around Feb 5th, 2007 - so let's backup the current /usr/ports/Mk
and check out one from Feb 4th:
cd /usr/ports
mv Mk Mk.original
cvs -d anoncvs@anoncvs1.FreeBSD.org:/home/ncvs co -D "04 Feb 2007" -d Mk ports/Mk
You should now be able to build some ports, at least those that don't use incompatible syntax in their individual Makefiles and don't require a newer ports infrastructure. Now, if you don't already have a devel/make
port, use CVS to bring that back too, then build and install it:
cd /usr/ports/devel
cvs -d anoncvs@anoncvs1.FreeBSD.org:/home/ncvs co -D "04 Feb 2007" -d make ports/devel/make
cd make
make install
make clean
Lastly, set your system to use the new ports make
in place of the old
system make
, and do some cleanup:
cd /usr/bin
mv make make.old
ln -s /usr/local/bin/make .
cd /usr/ports
rm -rf Mk
mv Mk.original Mk
rm -rf /usr/ports/devel/make
You should now be in better shape for trying to build new ports. 4.x isn't officially supported anymore by the ports maintainers, so there may be some individual port breakage - but at least you're over the first hurdle.