[nycbug-talk] creating "local" ports (fwd)

Craig Boston craig at yekse.gank.org
Fri Nov 3 23:12:01 UTC 2006


On Fri, Nov 03, 2006 at 03:30:47PM -0500, Charles Sprickman wrote:
> I'm finding that there are a number of ports that we need to patch for 
> some functionality that's unique to our business (qmail, mailfront, etc.). 
> Currently we just do "make patch" and then apply our patches.  This works, 
> but is a bit of a pain to maintain.

The easiest way is to make patch-* files and put them in the 'files'
directory under a port, as already mentioned.  cvsup will leave them
alone but I think portsnap might delete them.

A few times I've wanted to rm -rf /usr/ports and recreate it for
whatever reason without losing my patches, so nowadays I'm using the
following (ugly) hack:

----- BEGIN /usr/Makefile.inc ------
.include "/usr/ports-patches/Makefile"
----- END /usr/Makefile.inc ------

----- BEGIN /usr/ports-patches/Makefile -----
TMPCURDIR=${.CURDIR:S/\/usr\/ports//}
.ifmake do-patch
TPATCHES!=echo /usr/ports-patches${TMPCURDIR}/patch-*
.if ! ${TPATCHES:M*\*}
EXTRA_PATCHES+= ${TPATCHES}
.endif
.endif
----- END /usr/ports-patches/Makefile -----

Under /usr/ports-patches I set up a hierarchy mirroring /usr/ports
except it only contains local patch files that I want to apply.  The
layout works something like this:

$ cd /usr/ports-patches && find . -type f | sort
./Makefile
./devel/sdl12/patch-cmb-joystick
./graphics/png/patch-apng
./net/rdesktop/patch-seamless-fixes
./net-im/gaim/patch-cmb-jep0008
./www/firefox/patch-apng
./x11/kdebase3/patch-cmb-bsdmonitors
./x11/kdebase3/patch-cmb-unbreak-bargraph

Actually mine is slightly different since I have ports under a different
directory and define TMPCURDIR in /etc/make.conf (in order to do
conditional settings), but the above should work for a stock install.

The /usr/Makefile.inc hack is really bad, but bsd.port.mk doesn't seem
to import any other top-level local Makefiles.  It would be nice if
there was a better hook to do this sort of thing.  make.conf might work
as well but I was trying to minimize the impact on non-FreeBSD
makefiles.

Craig


More information about the freebsd-ports mailing list