pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/mk Make a distinction between the tools that pkgsrc ne...
details: https://anonhg.NetBSD.org/pkgsrc/rev/0f12a0b06275
branches: trunk
changeset: 493618:0f12a0b06275
user: jlam <jlam%pkgsrc.org@localhost>
date: Tue May 10 19:06:58 2005 +0000
description:
Make a distinction between the tools that pkgsrc needs and the tools
that a package needs. Tools that pkgsrc needs are listed in
PKGSRC_USE_TOOLS, and tools that a package needs on top of that are
listed in USE_TOOLS.
Define "TOOL" variables, e.g. SED, AWK, MKDIR, etc. for each of the
tools that pkgsrc needs, and "TOOLS_TOOL" variables, e.g. TOOLS_SED,
TOOLS_AWK, TOOLS_MKDIR, etc. for each of the tools that a package
needs. These variables contain the full command line to the real
command and arguments needed to invoke the tool.
diffstat:
mk/bsd.pkg.mk | 63 ++++++------
mk/bsd.prefs.mk | 9 +-
mk/tools/defaults.mk | 10 +-
mk/tools/imake.mk | 14 ++-
mk/tools/replace.mk | 248 ++++++++++++++++++++++++++++++--------------------
5 files changed, 203 insertions(+), 141 deletions(-)
diffs (truncated from 945 to 300 lines):
diff -r 7b4a49f4ee4b -r 0f12a0b06275 mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk Tue May 10 19:04:53 2005 +0000
+++ b/mk/bsd.pkg.mk Tue May 10 19:06:58 2005 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.mk,v 1.1632 2005/05/10 01:34:04 jlam Exp $
+# $NetBSD: bsd.pkg.mk,v 1.1633 2005/05/10 19:06:58 jlam Exp $
#
# This file is in the public domain.
#
@@ -453,27 +453,28 @@
TOUCH_FLAGS?= -f
-# determine if we need a working patch(1).
-.if defined(_OPSYS_GPATCH_REQD) && !empty(_OPSYS_GPATCH_REQD:M[yY][eE][sS])
-_NEED_PATCH= YES
-.else
-_NEED_PATCH!= if [ -d ${PATCHDIR} ]; then \
- if [ "`${ECHO} ${PATCHDIR}/patch-*`" != "${PATCHDIR}/patch-*" ]; then \
- ${ECHO} YES; \
- else \
- ${ECHO} NO; \
- fi \
- else \
- ${ECHO} NO; \
- fi
-.endif
-
-.if defined(PATCHFILES)
-_NEED_PATCH= YES
-.endif
-
-.if ${_NEED_PATCH} == "YES"
+.if !defined(_PKGSRC_USE_PATCH)
+. if defined(PATCHFILES) && !empty(PATCHFILES)
+_PKGSRC_USE_PATCH= yes
+. elif !exists(${PATCHDIR})
+_PKGSRC_USE_PATCH= no
+. else
+_PKGSRC_USE_PATCH!= \
+ if ${TEST} "`${ECHO} ${PATCHDIR}/patch-*`" != "${PATCHDIR}/patch-*"; then \
+ ${ECHO} yes; \
+ else \
+ ${ECHO} no; \
+ fi
+. endif
+.endif
+MAKE_VARS+= _PKGSRC_USE_PATCH
+
+.if !empty(_PKGSRC_USE_PATCH:M[yY][eE][sS])
+. if empty(_USE_NEW_TOOLS:M[yY][eE][sS])
USE_GNU_TOOLS+= patch
+. else
+PKGSRC_USE_TOOLS+= patch
+. endif
.endif
.if defined(PATCH_DEBUG) || defined(PKG_VERBOSE)
@@ -557,7 +558,7 @@
.if defined(PATCHFILES)
. if !empty(PATCHFILES:M*.bz2) && ${EXTRACT_SUFX} != ".tar.bz2"
. if !empty(_USE_NEW_TOOLS:M[yY][eE][sS])
-USE_TOOLS+= bzcat
+PKGSRC_USE_TOOLS+= bzcat
. elif exists(/usr/bin/bzcat)
BZCAT= /usr/bin/bzcat
. else
@@ -961,16 +962,16 @@
# eventually be split up into lists of tools required by different
# phases of a pkgsrc build.
#
-USE_TOOLS+= [ awk basename cat chgrp chmod chown cmp cp cut date \
- dirname echo egrep env expr false fgrep file find grep \
- gtar gunzip gzcat gzip head hostname id install \
- ldconfig ln ls m4 mkdir mtree mv nice pax pwd rm rmdir \
- sed sh shlock sort strip tail tee test touch tr true \
- tsort wc xargs
+PKGSRC_USE_TOOLS+= \
+ [ awk basename cat chgrp chmod chown cmp cp cut date dirname \
+ echo egrep env expr false fgrep file find grep gtar gunzip \
+ gzcat gzip head hostname id install ldconfig ln ls m4 mkdir \
+ mtree mv nice pax pwd rm rmdir sed sh shlock sort strip tail \
+ tee test touch tr true tsort wc xargs
# We need a mail command to send mail to ${PKGSRC_MESSAGE_RECIPIENTS}.
.if !empty(PKGSRC_MESSAGE_RECIPIENTS)
-USE_TOOLS+= mail
+PKGSRC_USE_TOOLS+= mail
.endif
.if !empty(_USE_NEW_TOOLS:M[yY][eE][sS])
@@ -1768,7 +1769,7 @@
.if !empty(EXTRACT_ONLY:M*.bz2) || !empty(EXTRACT_ONLY:M*.tbz) || \
!empty(EXTRACT_SUFX:M*.bz2) || !empty(EXTRACT_SUFX:M*.tbz)
. if !empty(_USE_NEW_TOOLS:M[yY][eE][sS])
-USE_TOOLS+= bzcat
+PKGSRC_USE_TOOLS+= bzcat
. elif exists(/usr/bin/bzcat)
BZCAT= /usr/bin/bzcat <
. else
@@ -1786,7 +1787,7 @@
.if !empty(EXTRACT_ONLY:M*.gz) || !empty(EXTRACT_ONLY:M*.tgz) || \
!empty(EXTRACT_SUFX:M*.gz) || !empty(EXTRACT_SUFX:M*.tgz)
. if !empty(_USE_NEW_TOOLS:M[yY][eE][sS])
-USE_TOOLS+= gzcat
+PKGSRC_USE_TOOLS+= gzcat
. elif !defined(GZCAT)
BUILD_DEPENDS+= gzip-base>=1.2.4b:../../archivers/gzip-base
GZCAT= ${LOCALBASE}/bin/zcat
diff -r 7b4a49f4ee4b -r 0f12a0b06275 mk/bsd.prefs.mk
--- a/mk/bsd.prefs.mk Tue May 10 19:04:53 2005 +0000
+++ b/mk/bsd.prefs.mk Tue May 10 19:06:58 2005 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.prefs.mk,v 1.189 2005/05/09 05:06:55 jlam Exp $
+# $NetBSD: bsd.prefs.mk,v 1.190 2005/05/10 19:06:58 jlam Exp $
#
# Make file, included to get the site preferences, if any. Should
# only be included by package Makefiles before any .if defined()
@@ -267,13 +267,16 @@
. include "${_PKGSRC_TOPDIR}/mk/defaults/mk.conf"
.endif
+PKGSRC_USE_TOOLS?= # empty
+USE_TOOLS?= # empty
+
# Provide default values for TOOLs used by the top-level make.
-USE_TOOLS+= [ awk dirname echo grep pwd sed test true
+PKGSRC_USE_TOOLS+= [ awk dirname echo grep pwd sed test true
# These tools are used by the top-level make only in certain packages and
# should eventually be moved into those particular package Makefiles.
#
-USE_TOOLS+= date tr
+PKGSRC_USE_TOOLS+= date tr
_USE_NEW_TOOLS?= no
.if !empty(_USE_NEW_TOOLS:M[yY][eE][sS])
diff -r 7b4a49f4ee4b -r 0f12a0b06275 mk/tools/defaults.mk
--- a/mk/tools/defaults.mk Tue May 10 19:04:53 2005 +0000
+++ b/mk/tools/defaults.mk Tue May 10 19:06:58 2005 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: defaults.mk,v 1.7 2005/05/04 06:42:43 jlam Exp $
+# $NetBSD: defaults.mk,v 1.8 2005/05/10 19:06:59 jlam Exp $
.if !defined(TOOLS_DEFAULTS_MK)
TOOLS_DEFAULTS_MK= defined
@@ -85,10 +85,12 @@
######################################################################
# Set a default value for the TOOL names for each of the tools we claim
-# we'll use in USE_TOOLS to point to the platform command, e.g., TBL,
-# YACC, etc.
+# we'll use in PKGSRC_USE_TOOLS to point to the platform command, e.g.,
+# TBL, YACC, etc. These tools are used in the top-level make(1), not
+# just in the targets, so these must be defined here, and this file be
+# included by bsd.prefs.mk.
#
-.for _t_ in ${USE_TOOLS}
+.for _t_ in ${PKGSRC_USE_TOOLS:O:u}
. if defined(_TOOLS_VARNAME.${_t_}) && \
defined(TOOLS_PLATFORM.${_t_}) && !empty(TOOLS_PLATFORM.${_t_})
${_TOOLS_VARNAME.${_t_}}?= ${TOOLS_PLATFORM.${_t_}}
diff -r 7b4a49f4ee4b -r 0f12a0b06275 mk/tools/imake.mk
--- a/mk/tools/imake.mk Tue May 10 19:04:53 2005 +0000
+++ b/mk/tools/imake.mk Tue May 10 19:06:58 2005 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: imake.mk,v 1.4 2005/05/09 01:11:58 jlam Exp $
+# $NetBSD: imake.mk,v 1.5 2005/05/10 19:06:59 jlam Exp $
#
# This Makefile fragment handles packages that need imake and xmkmf
# to build X11-related packages. The correct imake and xmkmf tools
@@ -13,6 +13,9 @@
# XMKMF command to create all Makefiles from Imakefiles,
# usually "xmkmf -a".
#
+# TOOLS_IMAKE, TOOLS_XMKMF_CMD and TOOLS_XMKMF are set to the same
+# corresponding values.
+#
# Optional variables that may be defined by the package are:
#
# IMAKEOPTS Options to pass to imake
@@ -81,8 +84,11 @@
# to imake and xmkmf.
#
TOOLS_CREATE+= imake xmkmf
-${_TOOLS_VARNAME.imake}= ${TOOLS_REAL_CMD.imake} ${TOOLS_REAL_ARGS.imake}
-${_TOOLS_VARNAME.xmkmf}= ${TOOLS_REAL_CMD.xmkmf} ${TOOLS_REAL_ARGS.xmkmf}
-XMKMF= ${${_TOOLS_VARNAME.xmkmf}} -a
+TOOLS_${_TOOLS_VARNAME.imake}= ${TOOLS_REAL_CMD.imake} ${TOOLS_REAL_ARGS.imake}
+TOOLS_${_TOOLS_VARNAME.xmkmf}= ${TOOLS_REAL_CMD.xmkmf} ${TOOLS_REAL_ARGS.xmkmf}
+TOOLS_XMKMF= ${${_TOOLS_VARNAME.xmkmf}} -a
+${_TOOLS_VARNAME.imake}= ${TOOLS_${_TOOLS_VARNAME.imake}}
+${_TOOLS_VARNAME.xmkmf}= ${TOOLS_${_TOOLS_VARNAME.xmkmf}}
+XMKMF= ${TOOLS_XMKMF}
. endif
.endif
diff -r 7b4a49f4ee4b -r 0f12a0b06275 mk/tools/replace.mk
--- a/mk/tools/replace.mk Tue May 10 19:04:53 2005 +0000
+++ b/mk/tools/replace.mk Tue May 10 19:06:58 2005 +0000
@@ -1,14 +1,29 @@
-# $NetBSD: replace.mk,v 1.64 2005/05/09 01:11:58 jlam Exp $
+# $NetBSD: replace.mk,v 1.65 2005/05/10 19:06:59 jlam Exp $
#
# This Makefile fragment handles "replacements" of system-supplied
-# tools with pkgsrc versions. The replacements are placed under
-# ${TOOLS_DIR} so that they appear earlier in the search path when
-# invoked using the bare name of the tool. Also, any "TOOL" variables,
-# e.g. AWK, SED, etc. are set properly to the replacement tool.
+# tools with pkgsrc versions.
+#
+# The replacement tools are placed under ${TOOLS_DIR} so that they
+# appear earlier in the search path when invoked using the bare name
+# of the tool.
+#
+# "TOOLS_TOOL" variables, e.g. TOOLS_AWK, TOOLS_SED, etc. are set to
+# the full command lines necessary to invoke the real tools on the
+# filesystem, and represent the tools required by the package.
+#
+# "TOOL" variables, e.g. AWK, SED, etc. are set to the full command
+# lines necessary to invoke the real tools on the filesystem, and
+# represent the tools required by pkgsrc itself.
#
# The tools that could be replaced with pkgsrc counterparts (usually
-# GNU versions of the tools) should be listed in each package Makefile
-# as:
+# GNU versions of the tools) that are required by pkgsrc itself, i.e.
+# in targets that are part of pkgsrc infrastructure or part of the
+# package Makefile, should be listed as:
+#
+# PKGSRC_USE_TOOLS+= awk sed
+#
+# The tools that are required by the package itself, i.e. within the
+# software's own build system, should be listed as:
#
# USE_TOOLS+= gawk gmake lex
#
@@ -42,22 +57,27 @@
######################################################################
-# Create _USE_TOOLS, a sanitized version of USE_TOOLS that removes the
-# tools that are overridden by superseding ones.
-
-_USE_TOOLS:= ${USE_TOOLS:O:u}
-.if !empty(USE_TOOLS:Mbison) # bison > yacc
+# Create _USE_TOOLS, a sanitized version of PKGSRC_USE_TOOLS and
+# USE_TOOLS that removes the ones that are overridden by superseding
+# ones.
+#
+.if !defined(_USE_TOOLS)
+_USE_TOOLS:= ${PKGSRC_USE_TOOLS} ${USE_TOOLS}
+_USE_TOOLS:= ${_USE_TOOLS:O:u}
+. if !empty(USE_TOOLS:Mbison) # bison > yacc
_USE_TOOLS:= ${_USE_TOOLS:Nyacc}
+. endif
+. if !empty(USE_TOOLS:Mgawk) # gawk > awk
+_USE_TOOLS:= ${_USE_TOOLS:Nawk}
+. endif
+. if !empty(USE_TOOLS:Mgm4) # gm4 > m4
+_USE_TOOLS:= ${_USE_TOOLS:Nm4}
+. endif
+. if !empty(USE_TOOLS:Mgsed) # gsed > sed
+_USE_TOOLS:= ${_USE_TOOLS:Nsed}
+. endif
.endif
-.if !empty(USE_TOOLS:Mgawk) # gawk > awk
-_USE_TOOLS:= ${_USE_TOOLS:Nawk}
-.endif
-.if !empty(USE_TOOLS:Mgm4) # gm4 > m4
-_USE_TOOLS:= ${_USE_TOOLS:Nm4}
-.endif
-.if !empty(USE_TOOLS:Mgsed) # gsed > sed
-_USE_TOOLS:= ${_USE_TOOLS:Nsed}
-.endif
+MAKE_VARS+= _USE_TOOLS
######################################################################
@@ -85,9 +105,13 @@
# For each of the blocks below, we create either symlinks or wrappers
# for each of the tools requested. We need to be careful that we don't
# get into dependency loops; do this by setting and checking the value
-# of TOOLS_IGNORE.<tool>. If we're using the system-supplied tool, we
-# defer the setting of TOOLS_REAL_CMD.<tool> until the loop at the end.
-
+# of TOOLS_IGNORE.<tool>. These blocks handle the case where we are
+# using the pkgsrc-supplied tool.
+#
+# Always set the "TOOLS_TOOL" name for each tool to point to the real
+# command, e.g., TOOLS_TBL, TOOLS_YACC, etc., provided that "TOOL" has
+# been associated with <tool>.
+#
.if !defined(TOOLS_IGNORE.[) && !empty(_USE_TOOLS:M\[)
. if !empty(PKGPATH:Msysutils/coreutils)
MAKEFLAGS+= TOOLS_IGNORE.[=
@@ -105,7 +129,7 @@
TOOLS_DEPENDS.awk?= gawk>=3.1.1:../../lang/gawk
TOOLS_CREATE+= awk
TOOLS_REAL_CMD.awk= ${LOCALBASE}/bin/${GNU_PROGRAM_PREFIX}awk
-${_TOOLS_VARNAME.awk}= ${TOOLS_REAL_CMD.awk}
Home |
Main Index |
Thread Index |
Old Index