Subject: Re: additional distribution patches in an archive file
To: Klaus Heinz <>
From: Johnny C. Lam <>
List: tech-pkg
Date: 10/23/2005 11:08:03
Klaus Heinz wrote:
> the patch framework assumes that additional distribution patches are
> simple files which can be downloaded to $DISTDIR, decompressed if
> necessary and then piped through the patch command.

I extended the patch framework a bit a few months back to handle these 
types of situations.

> I do not see how I could use a .tar.gz archive which _contains_ the
> patch to be applied.

Take a look at pkgsrc/graphics/xv for an example of how to do it.  The 
relevant variables are PATCH_DIST_CAT and PATCH_DIST_STRIP.  If you need 
to have separate variables per-patch, you can do it by setting 
PATCH_DIST_{CAT,STRIP}.<patch> (see

> I can add the patch archive to DISTFILES and have it extracted alongside
> the main distfile but how can I tell pkgsrc that the patch is _not_
> available relative to $DISTDIR but is located in a different directory,
> $WRKDIR/patch-archive/the-patch? Copying the patch file to $DISTDIR
> in a pre-patch target may not work if DISTDIR is not writable.
> Would it be worthwhile to change so that another
> patch-specific variable PATCH_DIST_PATCHDIR.patch specifies the directory
> for "patch"?

That might be a good idea.  For now, you have the option to set 
PATCH_DIST_ARGS to the full set of arguments to the patch command.

> One proposed solution treats the whole patch tar archive as the patch
> itself and pipes it (decompressed) through the patch command. It seems
> to work for .tar files but I would not like to rely on this behaviour.

The example provided by pkgsrc/graphics/xv only extracts the patches 
from the tar.bz2 archive.

	-- Johnny Lam <>