Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Nov 2001 06:51:43 +0900
From:      "Akinori MUSHA" <knu@iDaemons.org>
To:        portmgr@FreeBSD.org
Cc:        ports@FreeBSD.org
Subject:   patches for bsd.port.mk
Message-ID:  <86lmheb8gg.wl@archon.local.idaemons.org>

next in thread | raw e-mail | index | archive | help
Hi,

Here's several patches for bsd.port.mk I want you portmgr's to review.
Can I have some comments?


1) Fix PKG_IGNORE_DEPENDS so it matches the latest XFree86 3.x port.
As I didn't see why the full package name is needed there, I changed
it to a simple regexp.

Index: bsd.port.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.387
diff -u -r1.387 bsd.port.mk
--- bsd.port.mk	9 Nov 2001 15:48:40 -0000	1.387
+++ bsd.port.mk	10 Nov 2001 19:33:46 -0000
@@ -848,7 +848,7 @@
 LIB_DEPENDS+=			GL.14:${PORTSDIR}/graphics/Mesa3
 .endif
 XAWVER=					6
-PKG_IGNORE_DEPENDS?=	'(XFree86-3\.3\.6_9)'
+PKG_IGNORE_DEPENDS?=	'^XFree86-3\.'
 .else
 .if defined(USE_IMAKE)
 BUILD_DEPENDS+=			imake:${PORTSDIR}/devel/imake-4



2) Add EXAMPLESDIR.

Index: bsd.port.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.387
diff -u -r1.387 bsd.port.mk
--- bsd.port.mk	9 Nov 2001 15:48:40 -0000	1.387
+++ bsd.port.mk	10 Nov 2001 19:37:21 -0000
@@ -440,6 +440,8 @@
 #				  ${LOCALBASE} and %%X11BASE%% for ${X11BASE}.
 # DOCSDIR		- Name of the directory to install the packages docs in
 #				  (default: ${PREFIX}/share/doc/${PORTNAME}).
+# EXAMPLESDIR		- Name of the directory to install the packages examples in
+#				  (default: ${PREFIX}/share/examples/${PORTNAME}).
 # DATADIR		- Name of the directory to install the packages shared data
 #				  in (default: ${PREFIX}/share/${PORTNAME}).
 # 
@@ -1395,6 +1397,7 @@
 .endif
 
 DOCSDIR?=	${PREFIX}/share/doc/${PORTNAME}
+EXAMPLESDIR?=	${PREFIX}/share/examples/${PORTNAME}
 DATADIR?=	${PREFIX}/share/${PORTNAME}
 
 .MAIN: all



3) Add a bunch of generally used commands, and use shell (ash or ksh)
builtins where available for efficiency.

Index: bsd.port.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.387
diff -u -r1.387 bsd.port.mk
--- bsd.port.mk	9 Nov 2001 15:48:40 -0000	1.387
+++ bsd.port.mk	10 Nov 2001 19:45:16 -0000
@@ -469,7 +469,7 @@
 # are for debugging purposes.  Don't set them in your Makefile.
 #
 # ECHO_MSG		- Used to print all the '===>' style prompts - override this
-#				  to turn them off (default: /bin/echo).
+#				  to turn them off (default: ${ECHO}).
 # PATCH_DEBUG	- If set, print out more information about the patches as
 #				  it attempts to apply them.
 # PKG_DBDIR		- Where package installation is recorded (default: /var/db/pkg)
@@ -495,20 +495,37 @@
 
 AWK?=		/usr/bin/awk
 BASENAME?=	/usr/bin/basename
+.if exists(/usr/bin/bzip2)
+BZCAT?=		/usr/bin/bzcat
+BZIP2_CMD?=	/usr/bin/bzip2
+.else
+BZCAT?=		${LOCALBASE}/bin/bzcat
+BZIP2_CMD?=	${LOCALBASE}/bin/bzip2
+.endif
 CAT?=		/bin/cat
+CHGRP?=		/usr/bin/chgrp
 CHMOD?=		/bin/chmod
 CHOWN?=		/usr/sbin/chown
 CP?=		/bin/cp
-ECHO?=		/bin/echo
+CUT?=		/usr/bin/cut
+DC?=		/usr/bin/dc
+ECHO?=		echo				# Shell builtin
+EGREP?=		/usr/bin/egrep
 EXPR?=		/bin/expr
-FALSE?=		/usr/bin/false
+FALSE?=		false				# Shell builtin
+FILE?=		/usr/bin/file
+FIND?=		/usr/bin/find
 GREP?=		/usr/bin/grep
 GUNZIP_CMD?=	/usr/bin/gunzip -f
 GZCAT?=		/usr/bin/gzcat
 GZIP?=		-9
 GZIP_CMD?=	/usr/bin/gzip -nf ${GZIP}
+HEAD?=		/usr/bin/head
+ID?=		/usr/bin/id
+IDENT?=		/usr/bin/ident
 LDCONFIG?=	/sbin/ldconfig
 LN?=		/bin/ln
+LS?=		/bin/ls
 MKDIR?=		/bin/mkdir -p
 MV?=		/bin/mv
 RM?=		/bin/rm
@@ -516,10 +533,15 @@
 SED?=		/usr/bin/sed
 SETENV?=	/usr/bin/env
 SH?=		/bin/sh
+STRIP_CMD?=	/usr/bin/strip
+SU?=		/usr/bin/su
+TAIL?=		/usr/bin/tail
+TEST?=		test				# Shell builtin
 TR?=		/usr/bin/tr
-TRUE?=		/usr/bin/true
+TRUE?=		true				# Shell builtin
 UNAME?=		/usr/bin/uname
 WHICH?=		/usr/bin/which
+XARGS?=		/usr/bin/xargs
 
 # Used to print all the '===>' style prompts - override this to turn them off.
 ECHO_MSG?=		${ECHO}
@@ -934,7 +956,7 @@
 
 # How to do nothing.  Override if you, for some strange reason, would rather
 # do something.
-DO_NADA?=		/usr/bin/true
+DO_NADA?=		${TRUE}
 
 # Use this as the first operand to always build dependency.
 NONEXISTENT?=	/nonexistent
@@ -1020,7 +1042,7 @@
 EXTRACT_BEFORE_ARGS?=	-dc
 EXTRACT_AFTER_ARGS?=	| ${TAR} -xf -
 .if defined(USE_BZIP2)
-EXTRACT_CMD?=			bzip2
+EXTRACT_CMD?=			${BZIP2_CMD}
 .else
 EXTRACT_CMD?=			${GZIP_CMD}
 .endif
@@ -2105,7 +2127,7 @@
 	@cd ${.CURDIR} && ${MAKE} ${__softMAKEFLAGS} real-install
 # Scan PLIST for setugid files and startup scripts
 	-@for i in `${GREP} -v '^@' ${TMPPLIST}`; do \
-		/usr/bin/find ${PREFIX}/$$i -prune -type f \( -perm -4000 -o -perm -2000 \) \( -perm -0010 -o -perm -0001 \) -ls 2>/dev/null; \
+		${FIND} ${PREFIX}/$$i -prune -type f \( -perm -4000 -o -perm -2000 \) \( -perm -0010 -o -perm -0001 \) -ls 2>/dev/null; \
 	done > ${WRKDIR}/.PLIST.setuid; \
 	${GREP} '^etc/rc.d/' ${TMPPLIST} > ${WRKDIR}/.PLIST.startup; \
 	if [ -s ${WRKDIR}/.PLIST.setuid -o -s ${WRKDIR}/.PLIST.startup ]; then \
@@ -2800,7 +2822,7 @@
 
 www-site:
 .if exists(${DESCR})
-	@${GREP} '^WWW:[ 	]' ${DESCR} | ${AWK} '{print $$2}' | head -1
+	@${GREP} '^WWW:[ 	]' ${DESCR} | ${AWK} '{print $$2}' | ${HEAD} -1
 .else
 	@${ECHO}
 .endif
@@ -2960,7 +2982,7 @@
 		if [ -f ${PKGMESSAGE} ]; then \
 			${CP} ${PKGMESSAGE} ${PKG_DBDIR}/${PKGNAME}/+DISPLAY; \
 		fi; \
-		for dep in `cd ${.CURDIR} && ${MAKE} ${__softMAKEFLAGS} package-depends ECHO_MSG=/usr/bin/true | sort -u`; do \
+		for dep in `cd ${.CURDIR} && ${MAKE} ${__softMAKEFLAGS} package-depends ECHO_MSG=${TRUE} | sort -u`; do \
 			if [ -d ${PKG_DBDIR}/$$dep -a -z `echo $$dep | ${GREP} -E ${PKG_IGNORE_DEPENDS}` ]; then \
 				if ! ${GREP} ^${PKGNAME}$$ ${PKG_DBDIR}/$$dep/+REQUIRED_BY \
 					>/dev/null 2>&1; then \



4) Add support for bzip2'ed patches. (Look at the PRs you are assigned
to!)  Apply this patch after the patch 3.

--- bsd.port.mk.prev	Sun Nov 11 04:54:56 2001
+++ bsd.port.mk	Sun Nov 11 04:58:41 2001
@@ -68,7 +68,7 @@
 #				  patches (default: none).  make will look for them at
 #				  PATCH_SITES (see below).  They will automatically be
 #				  uncompressed before patching if the names end with
-#				  ".gz" or ".Z".
+#				  ".gz", ".bz2" or ".Z".
 # PATCH_SITES	- Primary location(s) for distribution patch files
 #				  if not found locally.
 # DIST_SUBDIR	- Suffix to ${DISTDIR}.  If set, all ${DISTFILES} 
@@ -803,7 +803,13 @@
 MANCOMPRESSED?=	no
 .endif
 
-.if defined(USE_BZIP2) && !exists(/usr/bin/bzip2)
+.if defined(PATCHFILES)
+.if ${PATCHFILES:M*.bz2}x != x
+HAVE_BZIP2_PATCHES=	yes
+.endif
+.endif
+
+.if (defined(USE_BZIP2) || defined(HAVE_BZIP2_PATCHES)) && !exists(/usr/bin/bzip2)
 BUILD_DEPENDS+=		bzip2:${PORTSDIR}/archivers/bzip2
 .endif
 .if defined(USE_ZIP)
@@ -1780,6 +1786,9 @@
 		case $$i in \
 			*.Z|*.gz) \
 				${GZCAT} $$i | ${PATCH} ${PATCH_DIST_ARGS}; \
+				;; \
+			*.bz2) \
+				${BZCAT} $$i | ${PATCH} ${PATCH_DIST_ARGS}; \
 				;; \
 			*) \
 				${PATCH} ${PATCH_DIST_ARGS} < $$i; \



5) Add a optional field to *DEPENDS, to pass arbitrary arguments to
make when building depend target.

Index: bsd.port.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.387
diff -u -u -r1.387 bsd.port.mk
--- bsd.port.mk	9 Nov 2001 15:48:40 -0000	1.387
+++ bsd.port.mk	10 Nov 2001 21:35:27 -0000
@@ -179,40 +179,54 @@
 # Dependency checking.  Use these if your port requires another port
 # not in the list above.
 #
-# FETCH_DEPENDS - A list of "path:dir[:target]" tuples of other ports this
-#				  package depends in the "fetch" stage.  "path" is the
-#				  name of a file if it starts with a slash (/), an
-#				  executable otherwise.  make will test for the
+# FETCH_DEPENDS - A list of "path:dir[:target[:args]]" tuples of other
+#				  ports this package depends in the "fetch" stage.
+#				  "path" is the name of a file if it starts with a slash (/),
+#				  an executable otherwise.  make will test for the
 #				  existence (if it is a full pathname) or search for
 #				  it in your $PATH (if it is an executable) and go
 #				  into "dir" to do a "make all install" if it's not
 #				  found.  If the third field ("target") exists, it will
-#				  be used instead of ${DEPENDS_TARGET}.
-# BUILD_DEPENDS - A list of "path:dir[:target]" tuples of other ports this
-#				  package depends to build (between the "extract" and
-#				  "build" stages, inclusive).  The test done to
-#				  determine the existence of the dependency is the
+#				  be used instead of ${DEPENDS_TARGET}.  If the fourth
+#				  field ("args") exists, it will be used instead of
+#				  ${DEPENDS_ARGS}.  Use comma (,) to separate multiple
+#				  arguments.
+# BUILD_DEPENDS - A list of "path:dir[:target[:args]]" tuples of other
+#				  ports this package depends to build (between the
+#				  "extract" and "build" stages, inclusive).  The test
+#				  done to determine the existence of the dependency is the
 #				  same as FETCH_DEPENDS.  If the third field ("target")
 #				  exists, it will be used instead of ${DEPENDS_TARGET}.
-# RUN_DEPENDS	- A list of "path:dir[:target]" tuples of other ports this
-#				  package depends to run.  The test done to determine
-#				  the existence of the dependency is the same as
-#				  FETCH_DEPENDS.  This will be checked during the
+#				  If the fourth field ("args") exists, it will be used
+#				  instead of ${DEPENDS_ARGS}.  Use comma (,) to separate
+#				  multiple arguments.
+# RUN_DEPENDS	- A list of "path:dir[:target[:args]]" tuples of other
+#				  ports this package depends to run.  The test done to
+#				  determine the existence of the dependency is the same
+#				  as FETCH_DEPENDS.  This will be checked during the
 #				  "install" stage and the name of the dependency will
 #				  be put into the package as well.  If the third field
 #				  ("target") exists, it will be used instead of
-#				  ${DEPENDS_TARGET}.
-# LIB_DEPENDS	- A list of "lib:dir[:target]" tuples of other ports this
-#				  package depends on.  "lib" is the name of a shared library.
-#				  make will use "ldconfig -r" to search for the
-#				  library.  Note that lib can not contain regular expressions.
-# DEPENDS		- A list of "dir[:target]" tuples of other ports this
+#				  ${DEPENDS_TARGET}.  If the fourth field ("args") exists,
+#				  it will be used instead of ${DEPENDS_ARGS}.  Use
+#				  comma (,) to separate multiple arguments.
+# LIB_DEPENDS	- A list of "lib:dir[:target[:args]]" tuples of other
+#				  ports this package depends on.  "lib" is the name of
+#				  a shared library.  make will use "ldconfig -r" to search
+#				  for the library.  Note that lib can not contain regular
+#				  expressions.
+# DEPENDS		- A list of "dir[:target[:args]]" tuples of other ports this
 #				  package depends on being made first.  Use this only for
 #				  things that don't fall into the above four categories.
 #				  If the second field ("target") exists, it will be used
-#				  instead of ${DEPENDS_TARGET}.
+#				  instead of ${DEPENDS_TARGET}.  If the fourth field
+#				  ("args") exists, it will be used instead of
+#				  ${DEPENDS_ARGS}.  Use comma (,) to separate multiple
+#				  arguments.
 # DEPENDS_TARGET - The default target to execute when a port is calling a
 #				  dependency (default: "install").
+# DEPENDS_ARGS  - The default args to pass to make when building
+#				  ${DEPENDS_TARGET}.
 #
 # Various directory definitions and variables to control them.
 # You rarely need to redefine any of these except WRKSRC and NO_WRKSUBDIR.
@@ -2496,15 +2510,10 @@
 .if defined(DEPENDS_TMP)
 .if !defined(NO_DEPENDS)
 	@for i in ${DEPENDS_TMP}; do \
-		prog=`${ECHO} $$i | ${SED} -e 's/:.*//'`; \
-		dir=`${ECHO} $$i | ${SED} -e 's/[^:]*://'`; \
-		if ${EXPR} "$$dir" : '.*:' > /dev/null; then \
-			target=`${ECHO} $$dir | ${SED} -e 's/.*://'`; \
-			dir=`${ECHO} $$dir | ${SED} -e 's/:.*//'`; \
-		else \
-			target="${DEPENDS_TARGET}"; \
-			depends_args="${DEPENDS_ARGS}"; \
-		fi; \
+		prog=`${EXPR} "/$$i" : '/\([^:]*\)'`; \
+		dir=`${EXPR} "/$$i" : '/[^:]*:\([^:]*\)'`; \
+		target=`${EXPR} "/$$i" : '/[^:]*:[^:]*:\([^:]*\)' || ${ECHO} "${DEPENDS_TARGET}"`; \
+		depends_args=`${EXPR} "/$$i" : '/[^:]*:[^:]*:[^:]*:\(.*\)' | ${SED} -e 's/,/ /g' || ${ECHO} "${DEPENDS_ARGS}"`; \
 		if ${EXPR} "$$prog" : \\/ >/dev/null; then \
 			if [ -e "$$prog" ]; then \
 				${ECHO_MSG} "===>   ${PKGNAME} depends on file: $$prog - found"; \



-- 
                     /
                    /__  __            Akinori.org / MUSHA.org
                   / )  )  ) )  /     FreeBSD.org / Ruby-lang.org
Akinori MUSHA aka / (_ /  ( (__(  @ iDaemons.org / and.or.jp

"Somewhere out of a memory.. of lighted streets on quiet nights.."

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86lmheb8gg.wl>