Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Apr 2004 14:25:50 +0200
From:      Oliver Eikemeier <eikemeier@fillmore-labs.com>
To:        Paul Chvostek <paul+fbsd@it.ca>
Cc:        ports@freebsd.org
Subject:   Re: DISTFILE is a .c, gets patched in /usr/ports/distfiles
Message-ID:  <40890B4E.1060602@fillmore-labs.com>
In-Reply-To: <20040423114039.GA16265@mail.it.ca>
References:  <20040423114039.GA16265@mail.it.ca>

next in thread | previous in thread | raw e-mail | index | archive | help
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.

-Oliver



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?40890B4E.1060602>