Elegant way to hack port source

Greg Larkin glarkin at FreeBSD.org
Tue Mar 23 19:45:58 UTC 2010

Hash: SHA1

Paul Schmehl wrote:
> --On Friday, March 19, 2010 19:02:45 -0400 Greg Larkin
> <glarkin at FreeBSD.org> wrote:
>> Here's something else that I've found really useful as a port creator,
>> maintainer and troubleshooter.  If I want to make some additional
>> changes to a source file that is patched by a file stored in
>> files/patch-...., I'll do this:
>> make patch          # extracts source and patches files
>> cd work/foobar/...
>> # Now make additional edits in patched file, leaving the
>> # .orig file alone
>> cd ../back/to/port/directory
>> make makepatch
>> The makepatch target recurses through the work/foobar directory and
>> creates diffs for all file.ext/file.ext.orig pairs.  It writes them to
>> the files/ directory with the patch- prefix on each so the patch target
>> processes them.
>> The only thing to watch out for here, is that makepatch has its own file
>> naming convention that doesn't always mirror the port creator's.  For
>> instance, some ports have patch files named "patch-aa", "patch-ab", etc.
>>  The makepatch target will recreate them with filenames based on the
>> directory and filename of the file to be patched during the build.
>> Hope that helps,
> Man, does it ever.  Thanks for that.
> Which brings me to an obvious question.  Where can I go to find out what
> all of the make targets are?  Is it in /usr/ports/Mk/?

Hi Paul,

Yes, that's the first place to look, and there's a lot of documentation
about the different variable that control the build process at the top
of that file, too.  Here's a command that gives a rough list of the
available targets:

egrep '^[a-zA-Z0-9-]+:$' /usr/ports/Mk/bsd.port.mk | sort -u

bsd.port.mk includes various other .mk files depending on what flags are
set in the port Makefile, /etc/make.conf and the environment.

Hmm, I just found a new target named "update-patches", and I have to go
investigate what that does!

- --
Greg Larkin

http://www.FreeBSD.org/           - The Power To Serve
http://www.sourcehosting.net/     - Ready. Set. Code.
http://twitter.com/sourcehosting/ - Follow me, follow you
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/


More information about the freebsd-questions mailing list