bsd.port.mk LATEST_LINK / UNIQUENAME questions & patch

Brandon D. Valentine brandon at dvalentine.com
Thu Feb 12 00:22:11 PST 2004


I'm updating some ports to fix duplicate LATEST_LINKs and have observed
the following.  I would appreciate feedback on it.

UNIQUENAME (line 1039) is defined before LATEST_LINK (line 2618) in
bsd.port.mk but the definition of UNIQUE_NAME is wrapped in a
conditional test for the existence of LATEST_LINK.

If a port sets LATEST_LINK in it's Makefile before including bsd.port.mk
then UNIQUENAME gets set to LATEST_LINK.  If a port does not set
LATEST_LINK, then UNIQUENAME gets set to ${PKGNAMEPREFIX}${PORTNAME} and
LATEST_LINK gets set to ${PKGBASE}, which expands to
${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}.

In the case where a port does not set LATEST_LINK, LATEST_LINK and
UNIQUENAME can have different values.  It seems to me that UNIQUENAME
should include PKGNAMESUFFIX as well or by default be equivalent to
LATEST_LINK.  The current behavior could cause master / slave ports that
set PKGNAMESUFFIX to have the same UNIQUENAME.  Is this desirable?  Do
we assume master / slave ports always conflict?  If they don't already
exist I can forsee master / slave ports which need to coexist.

The attached patch defines PKGBASE and LATEST_LINK near the top of the
Makefile, just above the definition of UNIQUENAME and does away with the
conditional around UNIQUENAME's definition.  This patch is untested as
the only box currently at my disposal for testing at this moment is in
the middle of a massive portupgrade.

I have also noticed that DOCSDIR, EXAMPLESDIR, and DATADIR are set to
${PREFIX}/share/doc/${PORTNAME} right now.  My patch changes them to
${PREFIX}/share/doc/${UNIQUENAME} so that the documentation will not
collide in ports where different versions of a product may share the
same PORTNAME.  I didn't see any other obvious places where PORTNAME
should become UNIQUENAME.

Thanks,

Brandon D. Valentine
-- 
brandon at dvalentine.com                           http://www.geekpunk.net
Pseudo-Random Googlism:  winter is "for the birds"
-------------- next part --------------
Index: ports/Mk/bsd.port.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.484
diff -u -r1.484 bsd.port.mk
--- ports/Mk/bsd.port.mk	4 Feb 2004 04:27:04 -0000	1.484
+++ ports/Mk/bsd.port.mk	12 Feb 2004 07:50:27 -0000
@@ -1035,11 +1035,9 @@
 # where 'make config' records user configuration options
 PORT_DBDIR?=	/var/db/ports
 
-.if defined(LATEST_LINK)
+PKGBASE?=			${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}
+LATEST_LINK?=		${PKGBASE}
 UNIQUENAME?=	${LATEST_LINK}
-.else
-UNIQUENAME?=	${PKGNAMEPREFIX}${PORTNAME}
-.endif
 OPTIONSFILE?=	${PORT_DBDIR}/${UNIQUENAME}/options
 _OPTIONSFILE!=	${ECHO_CMD} "${OPTIONSFILE}"
 .if defined(OPTIONS)
@@ -2614,8 +2612,6 @@
 
 # The "latest version" link -- ${PKGNAME} minus everthing after the last '-'
 PKGLATESTREPOSITORY?=	${PACKAGES}/Latest
-PKGBASE?=			${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}
-LATEST_LINK?=		${PKGBASE}
 PKGLATESTFILE=		${PKGLATESTREPOSITORY}/${LATEST_LINK}${PKG_SUFX}
 
 .if defined(PERL_CONFIGURE)
@@ -2760,9 +2756,9 @@
 .endif
 .endif
 
-DOCSDIR?=	${PREFIX}/share/doc/${PORTNAME}
-EXAMPLESDIR?=	${PREFIX}/share/examples/${PORTNAME}
-DATADIR?=	${PREFIX}/share/${PORTNAME}
+DOCSDIR?=	${PREFIX}/share/doc/${UNIQUENAME}
+EXAMPLESDIR?=	${PREFIX}/share/examples/${UNIQUENAME}
+DATADIR?=	${PREFIX}/share/${UNIQUENAME}
 
 PLIST_SUB+=	DOCSDIR="${DOCSDIR:S,^${PREFIX}/,,}" \
 		EXAMPLESDIR="${EXAMPLESDIR:S,^${PREFIX}/,,}" \


More information about the freebsd-ports mailing list