Roland's homepage

My random knot in the Web

Building ports with local modifications

Sometimes I have to build ports with local modifications. This can be for testing purposes, before submitting a PR or for improvements that only I consider important.

To build ports out of the ports tree, a modification to /usr/ports/Mk/bsd.sanity.mk is necessary:

--- /usr/ports/Mk/bsd.sanity.mk (revision 476014)
+++ /usr/ports/Mk/bsd.sanity.mk (working copy)
@@ -60,7 +60,7 @@

.if exists(${.CURDIR}/../../Mk/bsd.port.mk)
.if ${.CURDIR:H:T} != ${PKGCATEGORY}
-DEV_ERROR+=    "The first entry in CATEGORIES should be the directory where the port lives"
+#DEV_ERROR+=   "The first entry in CATEGORIES should be the directory where the port lives"
.endif
.else
DEV_WARNING+=  "Not validating first entry in CATEGORIES due to being outside of PORTSDIR. Please ensure this is proper when committing."

After that I created a directory ~/src/freebsd/ports-changes/ where I keep locally modified ports.

Permissions

When building such local ports as a normal user, remember to first run umask 022 before starting the build with make package! Otherwise the files in the package might have the wrong permissions.

Locking

I don’t want such modified packages to be automatically updated. So I generally lock them;

Running as root this is done as follows in tcsh:

foreach PKG (calculix calculix-ccx gnuplot netgen)
   pkg lock -y ${PKG}
end

For comments, please send me an e-mail.


Related articles


←  Install ntpsec on FreeBSD Automating package updates on FreeBSD  →