Subject: Re: pax be named optionally as "pax-as-tar"?
To: NetBSD Packages Technical Discussion List <tech-pkg@NetBSD.ORG>
From: Jeremy C. Reed <reed@reedmedia.net>
List: tech-pkg
Date: 04/03/2004 16:14:52
On Sat, 3 Apr 2004, Greg A. Woods wrote:

> 1. Register a conflict "if empty(GNU_PROGRAM_PREFIX)"
>
> 2. always install GNU tar as gtar regardless of the GNU_PROGRAM_PREFIX
>    setting (IIUC there are other precedents for expecting GNU tar to
>    have the name "gtar")

Thank you, Greg, for your "better solutions".

Well here is an idea tested twice: one with GTAR_PROGRAM_PREFIX=jcr and
one with GNU_PROGRAM_PREFIX= (defined as nothing).

The following always installs gtar as gtar unless GNU_PROGRAM_PREFIX is
not empty and not "g" or if the pkgsrc user specifically forces "g" (using
GTAR_PROGRAM_PREFIX).

Please share your feedback. (I'd never use GTAR_PROGRAM_PREFIX so maybe
that is not needed.)

I hope to use this idea also for gcpio package which also has pax
conflict.

cvs diff: Diffing archivers/gtar-base
Index: archivers/gtar-base/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/archivers/gtar-base/Makefile,v
retrieving revision 1.33
diff -b -u -r1.33 Makefile
--- archivers/gtar-base/Makefile	11 Mar 2004 18:03:49 -0000	1.33
+++ archivers/gtar-base/Makefile	4 Apr 2004 00:09:26 -0000
@@ -3,7 +3,7 @@

 DISTNAME=       tar-1.13.25
 PKGNAME=	gtar-base-1.13.25
-PKGREVISION=	1
+PKGREVISION=	2
 SVR4_PKGNAME=	gtarb
 CATEGORIES=	archivers
 MASTER_SITES=	ftp://alpha.gnu.org/gnu/tar/ \
@@ -22,14 +22,25 @@

 .include "../../mk/bsd.prefs.mk"

-.if defined(GNU_PROGRAM_PREFIX)
-CONFIGURE_ARGS+=	--program-prefix=${GNU_PROGRAM_PREFIX}
+.if defined(GNU_PROGRAM_PREFIX) && ${GNU_PROGRAM_PREFIX} != ""
+GTAR_PROGRAM_PREFIX?=	${GNU_PROGRAM_PREFIX}
+.else
+GTAR_PROGRAM_PREFIX?=	g
 .endif
+
+.if ${GTAR_PROGRAM_PREFIX} == ""
+# pax installs a "tar" also
+CONFLICTS+=		pax-[0-9]*
+.else
+CONFIGURE_ARGS+=	--program-prefix=${GTAR_PROGRAM_PREFIX}
+.endif
+
 CONFIGURE_ARGS+=	--with-catgets
-PLIST_SUBST+=		GNU_PROGRAM_PREFIX=${GNU_PROGRAM_PREFIX}
+PLIST_SUBST+=		GTAR_PROGRAM_PREFIX=${GTAR_PROGRAM_PREFIX}
 BUILD_DEFS+=		GNU_PROGRAM_PREFIX
+BUILD_DEFS+=		GTAR_PROGRAM_PREFIX

-.if !defined(GNU_PROGRAM_PREFIX) || ${GNU_PROGRAM_PREFIX} != "g"
+.if ${GTAR_PROGRAM_PREFIX} != "g"
 PLIST_SUBST+=           GTAR_LINK=""
 .else
 PLIST_SUBST+=           GTAR_LINK="@comment "
@@ -40,9 +51,9 @@

 post-install:
 	${INSTALL_DATA} ${FILESDIR}/gtar.1 \
-		${PREFIX}/man/man1/${GNU_PROGRAM_PREFIX}tar.1
-.if !defined(GNU_PROGRAM_PREFIX) || ${GNU_PROGRAM_PREFIX} != "g"
-	${LN} -sf ${GNU_PROGRAM_PREFIX}tar ${PREFIX}/bin/gtar
+		${PREFIX}/man/man1/${GTAR_PROGRAM_PREFIX}tar.1
+.if ${GTAR_PROGRAM_PREFIX} != "g"
+	${LN} -sf ${GTAR_PROGRAM_PREFIX}tar ${PREFIX}/bin/gtar
 .endif

 .include "../../mk/bsd.pkg.mk"
Index: archivers/gtar-base/PLIST
===================================================================
RCS file: /cvsroot/pkgsrc/archivers/gtar-base/PLIST,v
retrieving revision 1.5
diff -b -u -r1.5 PLIST
--- archivers/gtar-base/PLIST	20 Jan 2003 23:23:57 -0000	1.5
+++ archivers/gtar-base/PLIST	4 Apr 2004 00:09:26 -0000
@@ -1,7 +1,7 @@
 @comment $NetBSD: PLIST,v 1.5 2003/01/20 23:23:57 jschauma Exp $
-bin/${GNU_PROGRAM_PREFIX}tar
+bin/${GTAR_PROGRAM_PREFIX}tar
 ${GTAR_LINK}bin/gtar
-man/man1/${GNU_PROGRAM_PREFIX}tar.1
+man/man1/${GTAR_PROGRAM_PREFIX}tar.1
 ${PKGLOCALEDIR}/locale/cs/LC_MESSAGES/tar.mo
 ${PKGLOCALEDIR}/locale/da/LC_MESSAGES/tar.mo
 ${PKGLOCALEDIR}/locale/de/LC_MESSAGES/tar.mo
Index: archivers/gtar-base/PLIST.Darwin
===================================================================
RCS file: /cvsroot/pkgsrc/archivers/gtar-base/PLIST.Darwin,v
retrieving revision 1.2
diff -b -u -r1.2 PLIST.Darwin
--- archivers/gtar-base/PLIST.Darwin	22 Dec 2002 01:34:38 -0000	1.2
+++ archivers/gtar-base/PLIST.Darwin	4 Apr 2004 00:09:26 -0000
@@ -1,3 +1,3 @@
 @comment $NetBSD: PLIST.Darwin,v 1.2 2002/12/22 01:34:38 wiz Exp $
-bin/${GNU_PROGRAM_PREFIX}tar
-man/man1/${GNU_PROGRAM_PREFIX}tar.1
+bin/${GTAR_PROGRAM_PREFIX}tar
+man/man1/${GTAR_PROGRAM_PREFIX}tar.1
cvs diff: Diffing archivers/gtar-base/files
cvs diff: Diffing archivers/gtar-base/patches

   Jeremy C. Reed
   http://www.reedmedia.net/