DISTFILE is a .c, gets patched in /usr/ports/distfiles

Oliver Eikemeier eikemeier at fillmore-labs.com
Fri Apr 23 05:25:55 PDT 2004

Paul Chvostek wrote:

> I'm trying to make a port for an old (1998) piece of software that is
> currently available as a C program downloadable from a variety of places
> that archived it when it was originally posted to a mailing list.  There
> is no .tar.gz, no autoconf -- just a .c that needs mail headers stripped
> off and a couple of changes to the source.

You might put the source file directly into ${MASTERDIR}/files if it is
not too large, or you package it and put it on a server. Getting source
files from mailing list archives seems not to be the most reliable way,
and misses the point of distfiles - retrieving updated versions from the
same location.

> So...  DISTNAME is example.c (for example), and EXTRACT_SUFX and
> EXTRACT_ONLY are both nulled.  I've set NO_WRKSUBDIR=yes, and built a
> patch that does everything needed to the .c file.

setting EXTRACT_ONLY to be empty should do the trick.

> The problem is ... when the "patch" make target runs, it modifies the .c
> file (/usr/ports/distfiles/example.c) IN PLACE, leaving the original as
> /usr/ports/distfiles/example.c.orig.

That should not happen. A wrong PATCH_WRKSRC maybe? /usr/ports/distfiles
should be considered read-only.

> This is fine for a build (I have a
> "pre-build" target that copies the patched file to $WRKSRC), but if you
> then clean and try to rebuild, you'll fail because the copy of example.c
> in /usr/ports/distfiles/ has a mismatched checksum and is more recent
> than the original.

You should do this in the post-extract or pre-patch phase.

> I suppose I could get around this by replacing the "patch" target with a
> manual one that copies example.c to $WRKSRC and does the patch there,
> but this seems unnecessarily grotty.  I must be missing something.

That is exactly the way to go, except that you should use pre-patch. See
security/digest or devel/portlint for an example.


More information about the freebsd-ports mailing list