Skip to content
Browse files

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.
  • Loading branch information...
1 parent 2cfc40a commit e2f08faba5fa540e0130e053c29da908dbbcded5 rillig committed Jul 15, 2006
Showing with 62 additions and 54 deletions.
  1. +2 −2 mk/bsd.hacks.mk
  2. +15 −44 mk/bsd.pkg.mk
  3. +2 −2 mk/configure/configure.mk
  4. +2 −2 mk/fetch/fetch.mk
  5. +2 −2 mk/flavor/pkg/metadata.mk
  6. +37 −0 mk/internal/build-defs-message.mk
  7. +2 −2 mk/plist/plist.mk
View
4 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
View
59 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"
View
4 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"
View
4 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:
View
4 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
View
37 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
View
4 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= \

0 comments on commit e2f08fa

Please sign in to comment.
Something went wrong with that request. Please try again.