Date: Tue, 27 Oct 1998 12:58:26 -0800 (PST) From: asami@cs.berkeley.edu (Satoshi Asami) To: ports@FreeBSD.ORG Subject: Re: package-loop Message-ID: <199810272058.MAA17528@silvia.hip.berkeley.edu>
next in thread | raw e-mail | index | archive | help
Here's a new patch. I decided against having package turn into package-loop when PACKAGE_BUILDING is set, we can just use an alias if that's what we want to do. Instead, package-loop is now a full target (complete with entries in bsd.port.subdir.mk), which defaults to package when LOOP_VARIABLE is not set. I don't particularly like the part about checking ${PACKAGE_COOKIE}, but since ${WRKDIR} gets blown away after make clean, that was the only way I could think of of not doing a build over and over when the recursive make steps on a port that is already package-loop'ed. What do people think? Honestly, I don't like this very much (having a few "skeleton" ports that set whatever variable and include "../realport/Makefile" seems much simpler in design) but I know some people hate that. One point though, this is not going to help any for dependencies. For example, if portA with RESOLUTION=X depends on portB with RESOLUTION=X, then if you run a loop on portA, the second iteration will run into portB already installed and won't do anything. It won't be a problem if the dependency is just for packages (like the */pkfonts ports we currently have) but if it's really something it needs for building or installation, we're in trouble. Satoshi === Index: Makefile =================================================================== RCS file: /home/ncvs/ports/print/a2ps43/Makefile,v retrieving revision 1.16 diff -u -r1.16 Makefile --- Makefile 1998/04/04 07:36:44 1.16 +++ Makefile 1998/10/19 23:59:49 @@ -15,7 +15,8 @@ MAINTAINER= obrien@FreeBSD.org NO_LATEST_LINK= yes -MANUAL_PACKAGE_BUILD= PAPERSIZE has to be set to Letter A4 +LOOP_VARIABLE= PAPERSIZE +LOOP_OPTIONS= letter a4 MAKE_FLAGS?= WIDTH=${WIDTH} HEIGHT=${HEIGHT} A4_PAPERSIZE=${A4_PAPERSIZE} -f NO_WRKSUBDIR= yes MAN1= a2ps.1 === === Index: bsd.port.mk =================================================================== RCS file: /home/ncvs/src/share/mk/bsd.port.mk,v retrieving revision 1.227.2.57 diff -u -r1.227.2.57 bsd.port.mk --- bsd.port.mk 1998/10/09 01:27:55 1.227.2.57 +++ bsd.port.mk 1998/10/21 08:23:34 @@ -246,6 +246,18 @@ # is set and NO_INSTALL_MANPAGES is not set, and # "no" otherwise. # +# If your port wants the package to be built with several options, +# set the following variables. +# +# LOOP_VAR - The name of the variable. +# LOOP_OPTIONS - The value of the options. +# +# If they are set, there will be a target "package-loop" which will +# iterate several times, each time cleaning up afterwards, with the +# value of ${LOOP_VAR} set to one of ${LOOP_OPTIONS}. In addition, +# the "describe" target will print out multiple lines with the variable +# set accordingly. +# # Default targets and their behaviors: # # fetch - Retrieves ${DISTFILES} (and ${PATCHFILES} if defined) @@ -1761,6 +1774,26 @@ @cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} PACKAGE_NOINSTALL=yes real-package .endif +# Loop through several options for package building + +.if !target(package-loop) +.if defined(LOOP_VAR) +package-loop: +.if !exists(${PACKAGE_COOKIE}) +.for option in ${LOOP_OPTIONS} + @cd ${.CURDIR} && ${SETENV} ${LOOP_VAR}=${option} LOOP=yes \ + ${MAKE} ${.MAKEFLAGS} clean + @cd ${.CURDIR} && ${SETENV} ${LOOP_VAR}=${option} LOOP=yes \ + ${MAKE} ${.MAKEFLAGS} package +.endfor +.else + @${DO_NADA} +.endif +.else +package-loop: package +.endif +.endif + ################################################################ # Dependency checking ################################################################ @@ -1934,8 +1967,22 @@ # distribution-name|port-path|installation-prefix|comment| \ # description-file|maintainer|categories|build deps|run deps # +# If LOOP_VAR is set, multiple lines will be printed with the +# variable set to each value of LOOP_OPTIONS. + .if !target(describe) describe: +.if !defined(LOOP_VAR) + @cd ${.CURDIR} && ${MAKE} do-describe +.else +.for option in ${LOOP_OPTIONS} + @cd ${.CURDIR} && ${SETENV} ${LOOP_VAR}=${option} ${MAKE} do-describe +.endfor +.endif +.endif + +.if !target(do-describe) +do-describe: @${ECHO} -n "${PKGNAME}|${.CURDIR}|"; \ ${ECHO} -n "${PREFIX}|"; \ if [ -f ${COMMENT} ]; then \ Index: bsd.port.subdir.mk =================================================================== RCS file: /home/ncvs/src/share/mk/bsd.port.subdir.mk,v retrieving revision 1.15.2.4 diff -u -r1.15.2.4 bsd.port.subdir.mk --- bsd.port.subdir.mk 1998/08/26 23:46:56 1.15.2.4 +++ bsd.port.subdir.mk 1998/10/20 02:54:46 @@ -29,7 +29,7 @@ # # afterinstall, all, beforeinstall, build, checksum, clean, # configure, deinstall, depend, describe, extract, fetch, fetch-list, -# install, package, readmes, realinstall, reinstall, tags +# install, package, package-loop, readmes, realinstall, reinstall, tags # @@ -78,7 +78,7 @@ fi; \ ${MAKE} all -.for __target in all fetch fetch-list package extract configure \ +.for __target in all fetch fetch-list package package-loop extract configure \ build clean deinstall depend describe distclean \ reinstall tags checksum .if !target(${__target}) === 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?199810272058.MAA17528>