PORTSDIR use-before-define fix

Kris Kennaway kris at obsecurity.org
Sun Aug 5 05:53:41 UTC 2007


Previous DESTDIR commits introduced dereferences of ${PORTSDIR} before
it was set (via .include), which broke e.g. portmaster.  This diff
shuffles some things around to hopefully restore everything to being
defined before it is used.  It also cleans up some stale cruft.  It
has only been lightly tested.

Kris

Index: bsd.port.mk
===================================================================
RCS file: /home/pcvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.579
diff -u -r1.579 bsd.port.mk
--- bsd.port.mk	4 Aug 2007 19:48:34 -0000	1.579
+++ bsd.port.mk	5 Aug 2007 05:50:10 -0000
@@ -1089,6 +1089,17 @@
 # Most port authors should not need to understand anything after this point.
 #
 
+# These need to be absolute since we don't know how deep in the ports
+# tree we are and thus can't go relative.  They can, of course, be overridden
+# by individual Makefiles or local system make configuration.
+PORTSDIR?=		/usr/ports
+LOCALBASE?=		/usr/local
+X11BASE?=		${LOCALBASE}
+LINUXBASE?=		/compat/linux
+DISTDIR?=		${PORTSDIR}/distfiles
+_DISTDIR?=		${DISTDIR}/${DIST_SUBDIR}
+INDEXDIR?=		${PORTSDIR}
+
 .include "${PORTSDIR}/Mk/bsd.commands.mk"
 
 #
@@ -1294,16 +1305,6 @@
 PKGNAME=	${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}-${PKGVERSION}
 DISTNAME?=	${PORTNAME}-${DISTVERSIONPREFIX}${DISTVERSION:C/:(.)/\1/g}${DISTVERSIONSUFFIX}
 
-# These need to be absolute since we don't know how deep in the ports
-# tree we are and thus can't go relative.  They can, of course, be overridden
-# by individual Makefiles or local system make configuration.
-PORTSDIR?=		/usr/ports
-LOCALBASE?=		/usr/local
-X11BASE?=		${LOCALBASE}
-LINUXBASE?=		/compat/linux
-DISTDIR?=		${PORTSDIR}/distfiles
-_DISTDIR?=		${DISTDIR}/${DIST_SUBDIR}
-INDEXDIR?=		${PORTSDIR}
 INDEXFILE?=		INDEX-${OSVERSION:C/([0-9]).*/\1/}
 
 DOCSDIR?=		${PREFIX}/share/doc/${PORTNAME}
@@ -2300,7 +2301,6 @@
 .undef NO_PACKAGE
 .endif
 
-COMMENTFILE?=	${PKGDIR}/pkg-comment
 DESCR?=			${PKGDIR}/pkg-descr
 PLIST?=			${PKGDIR}/pkg-plist
 PKGINSTALL?=	${PKGDIR}/pkg-install
Index: bsd.port.subdir.mk
===================================================================
RCS file: /home/pcvs/ports/Mk/bsd.port.subdir.mk,v
retrieving revision 1.71
diff -u -r1.71 bsd.port.subdir.mk
--- bsd.port.subdir.mk	4 Aug 2007 11:37:24 -0000	1.71
+++ bsd.port.subdir.mk	5 Aug 2007 05:50:10 -0000
@@ -40,6 +40,21 @@
 #		Search for ports using either 'make search key=<keyword>'
 #		or 'make search name=<keyword>'.
 
+PORTSDIR?=		/usr/ports
+TEMPLATES?=		${PORTSDIR}/Templates
+.if defined(PORTSTOP)
+README=			${TEMPLATES}/README.top
+.else
+README=			${TEMPLATES}/README.category
+.endif
+MOVEDDIR?=		${PORTSDIR}
+MOVEDFILE?=		MOVED
+
+# XXX Are these needed here?  DESCR was set wrong for a few years
+MASTERDIR?=     ${.CURDIR}
+PKGDIR?=		${MASTERDIR}
+DESCR?=			${PKGDIR}/pkg-descr
+
 .include "${PORTSDIR}/Mk/bsd.commands.mk"
 
 .MAIN: all
@@ -66,6 +81,9 @@
 .endif
 .endif
 
+INDEXDIR?=	${PORTSDIR}
+INDEXFILE?=	INDEX-${OSVERSION:C/([0-9]).*/\1/}
+
 UID!=	${ID} -u
 .if exists(${LOCALBASE}/sbin/pkg_info)
 PKG_INFO?=	${LOCALBASE}/sbin/pkg_info
@@ -249,28 +267,6 @@
 	@${MAKE} README.html
 .endif
 
-.if (${OPSYS} == "NetBSD")
-PORTSDIR ?= /usr/opt
-.else
-PORTSDIR ?= /usr/ports
-.endif
-TEMPLATES ?= ${PORTSDIR}/Templates
-.if defined(PORTSTOP)
-README=	${TEMPLATES}/README.top
-.else
-README=	${TEMPLATES}/README.category
-.endif
-COMMENTFILE?=	${.CURDIR}/pkg/COMMENT
-DESCR?=		${.CURDIR}/pkg/DESCR
-INDEXDIR?=	${PORTSDIR}
-.if ${OSVERSION} >= 500036
-INDEXFILE?=	INDEX-${OSVERSION:C/([0-9]).*/\1/}
-.else
-INDEXFILE?=	INDEX
-.endif
-MOVEDDIR?=	${PORTSDIR}
-MOVEDFILE?=	MOVED
-
 HTMLIFY=	${SED} -e 's/&/\&amp;/g' -e 's/>/\&gt;/g' -e 's/</\&lt;/g'
 
 package-name:
@@ -298,9 +294,6 @@
 .if defined(COMMENT)
 	@${ECHO_CMD} "${COMMENT}" | ${HTMLIFY} > $@.tmp4
 .else
-.if exists(${COMMENTFILE})
-	@${HTMLIFY} ${COMMENTFILE} > $@.tmp4
-.else
 	@> $@.tmp4
 .endif
 .endif
@@ -415,7 +408,7 @@
                        break; \
                  }\
 	      } \
-      	    if (toprint == 1 ) disp[fields[d[i]]] = 1; \
+	    if (toprint == 1 ) disp[fields[d[i]]] = 1; \
 	    } \
 	  } \
 	  { \
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20070805/550aadff/attachment.pgp


More information about the freebsd-ports mailing list