pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk Split the variable BUILD_DEFS into those that are d...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/8a2c486f2c0f
branches:  trunk
changeset: 516171:8a2c486f2c0f
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sat Jul 15 23:58:52 2006 +0000

description:
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.

diffstat:

 mk/bsd.hacks.mk                   |   4 +-
 mk/bsd.pkg.mk                     |  59 +++++++++-----------------------------
 mk/configure/configure.mk         |   4 +-
 mk/fetch/fetch.mk                 |   4 +-
 mk/flavor/pkg/metadata.mk         |   4 +-
 mk/internal/build-defs-message.mk |  37 ++++++++++++++++++++++++
 mk/plist/plist.mk                 |   4 +-
 7 files changed, 62 insertions(+), 54 deletions(-)

diffs (240 lines):

diff -r 993256a6f53b -r 8a2c486f2c0f mk/bsd.hacks.mk
--- a/mk/bsd.hacks.mk   Sat Jul 15 21:19:36 2006 +0000
+++ b/mk/bsd.hacks.mk   Sat Jul 15 23:58:52 2006 +0000
@@ -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 @@
 
 # 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 -r 993256a6f53b -r 8a2c486f2c0f mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk     Sat Jul 15 21:19:36 2006 +0000
+++ b/mk/bsd.pkg.mk     Sat Jul 15 23:58:52 2006 +0000
@@ -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+=      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_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 @@
 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 @@
 .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 @@
 changes-entry:
        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
        ${ECHO} ${_CTYPE1}${_CTYPE2}${_CTYPE3} >> ${PKGSRC_CHANGES:Q}
+
+.include "${PKGSRCDIR}/mk/internal/build-defs-message.mk"
diff -r 993256a6f53b -r 8a2c486f2c0f mk/configure/configure.mk
--- a/mk/configure/configure.mk Sat Jul 15 21:19:36 2006 +0000
+++ b/mk/configure/configure.mk Sat Jul 15 23:58:52 2006 +0000
@@ -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 -r 993256a6f53b -r 8a2c486f2c0f mk/fetch/fetch.mk
--- a/mk/fetch/fetch.mk Sat Jul 15 21:19:36 2006 +0000
+++ b/mk/fetch/fetch.mk Sat Jul 15 23:58:52 2006 +0000
@@ -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 @@
 .endif
 _ALLFILES?=    ${_DISTFILES} ${_PATCHFILES}
 
-BUILD_DEFS+=   _DISTFILES _PATCHFILES
+_BUILD_DEFS+=  _DISTFILES _PATCHFILES
 
 ###
 ### _RESUME_TRANSFER:
diff -r 993256a6f53b -r 8a2c486f2c0f mk/flavor/pkg/metadata.mk
--- a/mk/flavor/pkg/metadata.mk Sat Jul 15 21:19:36 2006 +0000
+++ b/mk/flavor/pkg/metadata.mk Sat Jul 15 23:58:52 2006 +0000
@@ -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 @@
 ${_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 -r 993256a6f53b -r 8a2c486f2c0f mk/internal/build-defs-message.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/mk/internal/build-defs-message.mk Sat Jul 15 23:58:52 2006 +0000
@@ -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 -r 993256a6f53b -r 8a2c486f2c0f mk/plist/plist.mk
--- a/mk/plist/plist.mk Sat Jul 15 21:19:36 2006 +0000
+++ b/mk/plist/plist.mk Sat Jul 15 23:58:52 2006 +0000
@@ -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 @@
 .  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=                                                     \



Home | Main Index | Thread Index | Old Index