Subject: include GNU patch from pkgsrc unnecessarily
To: None <>
From: Klaus Heinz <>
List: tech-pkg
Date: 03/08/2004 00:49:27
Hi, tries to decide, whether we need GNU patch. Maybe I do not
quite understand the test; it seems to look for _any_ patches in the
directory patches/. Why this  should be a reason to need GNU patch from
pkgsrc escapes me.

  # determine if we need GNU patch from pkgsrc.
  _NEED_PATCH!=           if [ -d ${PATCHDIR} ]; then \
                                  if [ "`${ECHO} ${PATCHDIR}/patch-*`" != "${PATCHDIR}/patch-*" ]; then \
                                          ${ECHO} YES; \
                                  else \
                                          ${ECHO} NO; \
                                  fi \
                          else \
                                  ${ECHO} NO; \

  .if ${_NEED_PATCH} == "YES"
  USE_GNU_TOOLS+=         patch
  .endif defines

  _TOOLS_REPLACE_OPSYS.patch+=    SunOS-*-*

and the descriptions says, SunOS/Solaris has a "GNUish" version of patch
(ie /usr/bin/gpatch, used in, so there is _no_ need to
pull in the pkgsrc version.

In contrast to that, the following fragments in come to
the conclusion that every package with patches (according to the test
above in needs a dependence on GNU patch from pkgsrc,
although it's already available in /usr/bin/.

  .for _tool_ in ${USE_GNU_TOOLS}  
  # What GNU tools did the package or user ask for, and does the base
  # system already have it?
  _TOOLS_NEED_GNU.${_tool_}=      YES


  .if (${_TOOLS_NEED_GNU.patch} == "YES") && empty(PKGPATH:Mdevel/patch)
  BUILD_DEPENDS+=         patch>=2.2:../../devel/patch
  _TOOLS_PROGNAME.patch=  ${LOCALBASE}/bin/gpatch # "gpatch" always exists
  .  if exists(${_TOOLS_PROGNAME.patch})
  PATCH:=                 ${_TOOLS_PROGNAME.patch}
  .  endif

This is also confirmed by my test:

  $ cd /opt/pkgsrc/games
  $ make show-var VARNAME=PATCH
Here, PATCH is /usr/bin/gpatch if the package has no patches, otherwise
it is /opt/pkg/bin/gpatch.