diff options
author | rillig <rillig@pkgsrc.org> | 2006-07-15 23:58:52 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2006-07-15 23:58:52 +0000 |
commit | 222182789245b6c9f6c8cff1c0c35283bc1cba4d (patch) | |
tree | a4b93f8fac3a6f560860ad528f5b8c399b8d67b1 | |
parent | 0666bf8a6bfe69284c2b32f1fc53121b284bc10a (diff) | |
download | pkgsrc-222182789245b6c9f6c8cff1c0c35283bc1cba4d.tar.gz |
Split the variable BUILD_DEFS into those that are defined by packages
and those that are defined by the infrastructure (_BUILD_DEFS). This
allows the build-defs-message target to be moved to the end of
bsd.pkg.mk. Now it prints the correct result even in unprivileged
builds, which had been wrong due to the order in which the files have
been included. For example, ${UNPRIVILEGED_USER} was displayed as (not
defined) although its value was defined, which could be checked with
"bmake show-var".
Tested with one package that _does_ define BUILD_DEFS and with one that
doesn't. The behavior stays the same.
-rw-r--r-- | mk/bsd.hacks.mk | 4 | ||||
-rw-r--r-- | mk/bsd.pkg.mk | 59 | ||||
-rw-r--r-- | mk/configure/configure.mk | 4 | ||||
-rw-r--r-- | mk/fetch/fetch.mk | 4 | ||||
-rw-r--r-- | mk/flavor/pkg/metadata.mk | 4 | ||||
-rw-r--r-- | mk/internal/build-defs-message.mk | 37 | ||||
-rw-r--r-- | mk/plist/plist.mk | 4 |
7 files changed, 62 insertions, 54 deletions
diff --git a/mk/bsd.hacks.mk b/mk/bsd.hacks.mk index 36c00cd5033..87f2d00d7b7 100644 --- a/mk/bsd.hacks.mk +++ b/mk/bsd.hacks.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.hacks.mk,v 1.2 2004/11/30 15:09:45 tv Exp $ +# $NetBSD: bsd.hacks.mk,v 1.3 2006/07/15 23:58:52 rillig Exp $ # # Copyright (c) 2004 The NetBSD Foundation, Inc. # All rights reserved. @@ -65,5 +65,5 @@ PKG_HACKS?= # empty # Record any package hacks that we use in the installed package. .if !empty(PKG_HACKS) -BUILD_DEFS+= PKG_HACKS +_BUILD_DEFS+= PKG_HACKS .endif diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk index b919b935813..7cfa3e01e1e 100644 --- a/mk/bsd.pkg.mk +++ b/mk/bsd.pkg.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.pkg.mk,v 1.1870 2006/07/13 14:04:41 jlam Exp $ +# $NetBSD: bsd.pkg.mk,v 1.1871 2006/07/15 23:58:52 rillig Exp $ # # This file is in the public domain. # @@ -42,39 +42,6 @@ .include "../../mk/bsd.hacks.mk" -# This has to come first to avoid showing all BUILD_DEFS added by this -# Makefile, which are usually not customizable. -.PHONY: build-defs-message -pre-depends-hook: build-defs-message -.if empty(PKGSRC_SHOW_BUILD_DEFS:M[yY][eE][sS]) -build-defs-message: -.elif !target(build-defs-message) -build-defs-message: ${WRKDIR} -. if defined(BUILD_DEFS) && !empty(BUILD_DEFS) -. if !exists(${WRKDIR}/.bdm_done) - @${ECHO} "==========================================================================" - @${ECHO} "The following variables will affect the build process of this package," - @${ECHO} "${PKGNAME}. Their current value is shown below:" - @${ECHO} "" -. for var in ${BUILD_DEFS:O} -. if !defined(${var}) - @${ECHO} " * ${var} (not defined)" -. elif defined(${var}) && empty(${var}) - @${ECHO} " * ${var} (defined)" -. else - @${ECHO} " * ${var} = ${${var}}" -. endif -. endfor - @${ECHO} "" - @${ECHO} "You may want to abort the process now with CTRL-C and change their value" - @${ECHO} "before continuing. Be sure to run \`${MAKE} clean' after" - @${ECHO} "the changes." - @${ECHO} "==========================================================================" - @${TOUCH} ${WRKDIR}/.bdm_done -. endif -. endif -.endif - ############################################################################ # Transform package Makefile variables and set defaults ############################################################################ @@ -240,11 +207,13 @@ ALL_ENV+= LINKER_RPATH_FLAG=${LINKER_RPATH_FLAG:Q} ALL_ENV+= PATH=${PATH:Q}:${LOCALBASE}/bin:${X11BASE}/bin ALL_ENV+= PREFIX=${PREFIX} +_BUILD_DEFS= ${BUILD_DEFS} + # Store the result in the +BUILD_INFO file so we can query for the build # options using "pkg_info -Q PKG_OPTIONS <pkg>". # .if defined(PKG_SUPPORTED_OPTIONS) && defined(PKG_OPTIONS) -BUILD_DEFS+= PKG_OPTIONS +_BUILD_DEFS+= PKG_OPTIONS .endif .if empty(DEPOT_SUBDIR) @@ -416,7 +385,7 @@ PKG_SYSCONFDEPOTBASE= # empty PKG_SYSCONFDIR_PERMS?= ${ROOT_USER} ${ROOT_GROUP} 755 ALL_ENV+= PKG_SYSCONFDIR=${PKG_SYSCONFDIR:Q} -BUILD_DEFS+= PKG_SYSCONFBASEDIR PKG_SYSCONFDIR +_BUILD_DEFS+= PKG_SYSCONFBASEDIR PKG_SYSCONFDIR # These are all of the tools use by pkgsrc Makefiles. This should # eventually be split up into lists of tools required by different @@ -471,7 +440,7 @@ USE_LANGUAGES?= # empty DEPENDS+= ${ABI_DEPENDS} BUILD_DEPENDS+= ${BUILD_ABI_DEPENDS} . else -BUILD_DEFS+= USE_ABI_DEPENDS +_BUILD_DEFS+= USE_ABI_DEPENDS . endif .endif @@ -609,15 +578,15 @@ do-check-pkg-fail-reason: do-check-pkg-fail-or-skip-reason .endif # Add these defs to the ones dumped into +BUILD_DEFS -BUILD_DEFS+= PKGPATH -BUILD_DEFS+= OPSYS OS_VERSION MACHINE_ARCH MACHINE_GNU_ARCH -BUILD_DEFS+= CPPFLAGS CFLAGS FFLAGS LDFLAGS -BUILD_DEFS+= OBJECT_FMT LICENSE RESTRICTED -BUILD_DEFS+= NO_SRC_ON_FTP NO_SRC_ON_CDROM -BUILD_DEFS+= NO_BIN_ON_FTP NO_BIN_ON_CDROM +_BUILD_DEFS+= PKGPATH +_BUILD_DEFS+= OPSYS OS_VERSION MACHINE_ARCH MACHINE_GNU_ARCH +_BUILD_DEFS+= CPPFLAGS CFLAGS FFLAGS LDFLAGS +_BUILD_DEFS+= OBJECT_FMT LICENSE RESTRICTED +_BUILD_DEFS+= NO_SRC_ON_FTP NO_SRC_ON_CDROM +_BUILD_DEFS+= NO_BIN_ON_FTP NO_BIN_ON_CDROM .if defined(OSVERSION_SPECIFIC) -BUILD_DEFS+= OSVERSION_SPECIFIC +_BUILD_DEFS+= OSVERSION_SPECIFIC .endif # OSVERSION_SPECIFIC .PHONY: all @@ -1042,3 +1011,5 @@ _CTYPE3= " ["${NETBSD_LOGIN_NAME:Q}" "${_CDATE_cmd:sh:Q}"]" changes-entry: ${_PKG_SILENT}${_PKG_DEBUG} \ ${ECHO} ${_CTYPE1}${_CTYPE2}${_CTYPE3} >> ${PKGSRC_CHANGES:Q} + +.include "${PKGSRCDIR}/mk/internal/build-defs-message.mk" diff --git a/mk/configure/configure.mk b/mk/configure/configure.mk index d7ead1ea5fd..832368212bc 100644 --- a/mk/configure/configure.mk +++ b/mk/configure/configure.mk @@ -1,4 +1,4 @@ -# $NetBSD: configure.mk,v 1.5 2006/07/15 09:52:00 rillig Exp $ +# $NetBSD: configure.mk,v 1.6 2006/07/15 23:58:52 rillig Exp $ # # CONFIGURE_SCRIPT is the path to the script to run in order to # configure the software for building. If the path is relative, @@ -14,7 +14,7 @@ CONFIGURE_SCRIPT?= ./configure CONFIGURE_ENV+= ${ALL_ENV} CONFIGURE_ARGS?= # empty -BUILD_DEFS+= CONFIGURE_ENV CONFIGURE_ARGS +_BUILD_DEFS+= CONFIGURE_ENV CONFIGURE_ARGS .if defined(GNU_CONFIGURE) . include "${PKGSRCDIR}/mk/configure/gnu-configure.mk" diff --git a/mk/fetch/fetch.mk b/mk/fetch/fetch.mk index 54150f5d0b9..04724f2cf6c 100644 --- a/mk/fetch/fetch.mk +++ b/mk/fetch/fetch.mk @@ -1,4 +1,4 @@ -# $NetBSD: fetch.mk,v 1.7 2006/07/13 15:23:18 jlam Exp $ +# $NetBSD: fetch.mk,v 1.8 2006/07/15 23:58:52 rillig Exp $ ###################################################################### ### fetch (PUBLIC) @@ -40,7 +40,7 @@ _PATCHFILES?= ${PATCHFILES} .endif _ALLFILES?= ${_DISTFILES} ${_PATCHFILES} -BUILD_DEFS+= _DISTFILES _PATCHFILES +_BUILD_DEFS+= _DISTFILES _PATCHFILES ### ### _RESUME_TRANSFER: diff --git a/mk/flavor/pkg/metadata.mk b/mk/flavor/pkg/metadata.mk index 2f207fb5e13..256fd8b0771 100644 --- a/mk/flavor/pkg/metadata.mk +++ b/mk/flavor/pkg/metadata.mk @@ -1,4 +1,4 @@ -# $NetBSD: metadata.mk,v 1.7 2006/07/07 21:24:28 jlam Exp $ +# $NetBSD: metadata.mk,v 1.8 2006/07/15 23:58:52 rillig Exp $ ###################################################################### ### The targets below are all PRIVATE. @@ -26,7 +26,7 @@ _METADATA_TARGETS+= ${_BUILD_INFO_FILE} ${_BUILD_INFO_FILE}: plist ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H} ${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${.TARGET}.tmp -.for _def_ in ${BUILD_DEFS} +.for _def_ in ${_BUILD_DEFS} ${_PKG_SILENT}${_PKG_DEBUG}${ECHO} ${_def_}=${${_def_}:Q} | \ ${SED} -e 's|^PATH=[^ ]*|PATH=...|' \ >> ${.TARGET}.tmp diff --git a/mk/internal/build-defs-message.mk b/mk/internal/build-defs-message.mk new file mode 100644 index 00000000000..7cd032c6121 --- /dev/null +++ b/mk/internal/build-defs-message.mk @@ -0,0 +1,37 @@ +# $NetBSD: build-defs-message.mk,v 1.1 2006/07/15 23:58:52 rillig Exp $ +# + +# The build-defs-message target shows the variables that can be configured +# by the pkgsrc user in mk.conf. +# + +.PHONY: build-defs-message +pre-depends-hook: build-defs-message +.if empty(PKGSRC_SHOW_BUILD_DEFS:M[yY][eE][sS]) +build-defs-message: +.elif !target(build-defs-message) +build-defs-message: ${WRKDIR} +. if defined(BUILD_DEFS) && !empty(BUILD_DEFS) +. if !exists(${WRKDIR}/.bdm_done) + @${ECHO} "==========================================================================" + @${ECHO} "The following variables will affect the build process of this package," + @${ECHO} "${PKGNAME}. Their current value is shown below:" + @${ECHO} "" +. for var in ${BUILD_DEFS:O} +. if !defined(${var}) + @${ECHO} " * ${var} (not defined)" +. elif defined(${var}) && empty(${var}) + @${ECHO} " * ${var} (defined)" +. else + @${ECHO} " * ${var} = ${${var}}" +. endif +. endfor + @${ECHO} "" + @${ECHO} "You may want to abort the process now with CTRL-C and change their value" + @${ECHO} "before continuing. Be sure to run \`${MAKE} clean' after" + @${ECHO} "the changes." + @${ECHO} "==========================================================================" + @${TOUCH} ${WRKDIR}/.bdm_done +. endif +. endif +.endif diff --git a/mk/plist/plist.mk b/mk/plist/plist.mk index 5ea26ed098f..131e57a6d5b 100644 --- a/mk/plist/plist.mk +++ b/mk/plist/plist.mk @@ -1,4 +1,4 @@ -# $NetBSD: plist.mk,v 1.13 2006/06/08 03:11:17 jlam Exp $ +# $NetBSD: plist.mk,v 1.14 2006/07/15 23:58:52 rillig Exp $ # # This Makefile fragment handles the creation of PLISTs for use by # pkg_create(8). @@ -192,7 +192,7 @@ _PLIST_IGNORE_FILES+= ${PKG_SYSCONFDIR:S,^${PREFIX}/,,} . endif _PLIST_IGNORE_FILES+= ${PLIST_IGNORE_FILES} .endif -BUILD_DEFS+= _PLIST_IGNORE_FILES +_BUILD_DEFS+= _PLIST_IGNORE_FILES .if ${PLIST_TYPE} == "dynamic" _PLIST_IGNORE_CMD= \ |