Elegant way to hack port source

Roland Smith rsmith at xs4all.nl
Fri Mar 19 17:02:08 UTC 2010


On Fri, Mar 19, 2010 at 12:35:30PM -0400, Alejandro Imass wrote:
> Hi,
> 
> I need to modify a file from a port before building. Specifically, the
> sane-backends pnm.c driver has a bug and the folks at the original
> project has not fixed for a while. I need to modify pnm.c in the work
> directory before compiling. What is an elegant way of doing this? If I
> make and then modify, the main make file does not see the change made
> in the file and will not recompile. And since there is no actual
> makefile in the work subdirectory I can't compile there either!
> 
> There must be a FreeBSD way of dealing with modifying a port source
> before compiling. Please advise.
 
Add the patch to the files/ directory of the port. The patch should be
relative to the main source directory of the port, e.g. work/foo-x.y for the
foo port. Use a name for the patch that doesn't exist yet.

After creating the patch, use chflags to set the uschg and uunlnk flags for
your patch. This way, if the port is updated, your patch cannot be
removed. But you might need to update it.

Roland
-- 
R.F.Smith                                   http://www.xs4all.nl/~rsmith/
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914  B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20100319/e4c89e4e/attachment.pgp


More information about the freebsd-questions mailing list