pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk Split replace.mk into two parts, one of which is in...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/5fd046c58f44
branches:  trunk
changeset: 493224:5fd046c58f44
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Sat Apr 30 04:35:54 2005 +0000

description:
Split replace.mk into two parts, one of which is included by bsd.prefs.mk
to provide "TOOL" definitions for tools used by a top-level make process
(usually because it uses them in a != variable definition).  This allows
USE_TOOLS to be defined before bsd.prefs.mk is included by a package
Makefile, where USE_TOOLS lists the additional (non-default) tools that
are required to build the package.

Also, drop the fallback to existing "TOOL" definitions because we now
have TOOLS_PLATFORM.* for each platform in pkgsr/mk/tools/tools.*.mk.

diffstat:

 mk/bsd.pkg.mk        |  20 +++++++++-
 mk/bsd.prefs.mk      |  15 +++++++-
 mk/tools/defaults.mk |  92 ++++++++++++++++++++++++++++++++++++++++++++++++++
 mk/tools/replace.mk  |  95 +++------------------------------------------------
 4 files changed, 129 insertions(+), 93 deletions(-)

diffs (294 lines):

diff -r 4ac1296b4aca -r 5fd046c58f44 mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk     Sat Apr 30 03:38:29 2005 +0000
+++ b/mk/bsd.pkg.mk     Sat Apr 30 04:35:54 2005 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.pkg.mk,v 1.1617 2005/04/25 16:47:18 drochner Exp $
+#      $NetBSD: bsd.pkg.mk,v 1.1618 2005/04/30 04:35:54 jlam Exp $
 #
 # This file is in the public domain.
 #
@@ -931,7 +931,16 @@
 #
 .include "../../mk/compiler.mk"
 
-_USE_NEW_TOOLS?=       no
+# These are all of the tools use by pkgsrc Makefiles.  This should
+# 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 ln ls m4 mkdir  \
+               mtree mv nice pax pwd rm rmdir sed sh shlock sort tail  \
+               tee test touch tr true tsort wc xargs
+
 .if !empty(_USE_NEW_TOOLS:M[yY][eE][sS])
 .include "../../mk/tools/bsd.tools.mk"
 .else
@@ -1740,7 +1749,12 @@
     !empty(EXTRACT_SUFX:M*.lzh) || !empty(EXTRACT_SUFX:M*.lha)
 BUILD_DEPENDS+=                lha>=114.9:../../archivers/lha
 .endif
-.if !defined(GZCAT)
+.if !empty(_USE_NEW_TOOLS:M[yY][eE][sS])
+.  if !empty(EXTRACT_ONLY:M*.gz) || !empty(EXTRACT_ONLY:M*.tgz) || \
+      !empty(EXTRACT_SUFX:M*.gz) || !empty(EXTRACT_SUFX:M*.tgz)
+USE_TOOLS+=            gzcat
+.  endif
+.elif !defined(GZCAT)
 .  if !empty(EXTRACT_ONLY:M*.gz) || !empty(EXTRACT_ONLY:M*.tgz) || \
       !empty(EXTRACT_SUFX:M*.gz) || !empty(EXTRACT_SUFX:M*.tgz)
 BUILD_DEPENDS+=         gzip-base>=1.2.4b:../../archivers/gzip-base
diff -r 4ac1296b4aca -r 5fd046c58f44 mk/bsd.prefs.mk
--- a/mk/bsd.prefs.mk   Sat Apr 30 03:38:29 2005 +0000
+++ b/mk/bsd.prefs.mk   Sat Apr 30 04:35:54 2005 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.prefs.mk,v 1.184 2005/04/08 20:11:53 tv Exp $
+# $NetBSD: bsd.prefs.mk,v 1.185 2005/04/30 04:35:54 jlam Exp $
 #
 # Make file, included to get the site preferences, if any.  Should
 # only be included by package Makefiles before any .if defined()
@@ -267,6 +267,19 @@
 .  include "${_PKGSRC_TOPDIR}/mk/defaults/mk.conf"
 .endif
 
+# Provide default values for TOOLs used by the top-level make.
+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 expr find wc tr
+
+_USE_NEW_TOOLS?=       no
+.if !empty(_USE_NEW_TOOLS:M[yY][eE][sS])
+.include "${_PKGSRC_TOPDIR}/mk/tools/defaults.mk"
+.endif
+
 .if ${OPSYS} == "NetBSD"
 .  if ${OBJECT_FMT} == "ELF" && \
    (${MACHINE_GNU_ARCH} == "arm" || \
diff -r 4ac1296b4aca -r 5fd046c58f44 mk/tools/defaults.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/mk/tools/defaults.mk      Sat Apr 30 04:35:54 2005 +0000
@@ -0,0 +1,92 @@
+# $NetBSD: defaults.mk,v 1.1 2005/04/30 04:35:54 jlam Exp $
+
+.if !defined(TOOLS_DEFAULTS_MK)
+TOOLS_DEFAULTS_MK=     defined
+
+# These are the platform-specific lists of system-supplied tools.
+#
+# XXX These should eventually just migrate over to the appropriate
+# XXX pkgsrc/mk/platform/${OPSYS}.mk file.
+#
+.include "../../mk/tools/bootstrap.mk"
+.if exists(../../mk/tools/tools.${OPSYS}.mk)
+.  include "../../mk/tools/tools.${OPSYS}.mk"
+.endif
+
+# "TOOL" variable names associated with each of the tools
+_TOOLS_VARNAME.awk=            AWK
+_TOOLS_VARNAME.basename=       BASENAME
+_TOOLS_VARNAME.bison=          YACC
+_TOOLS_VARNAME.cat=            CAT
+_TOOLS_VARNAME.chgrp=          CHGRP
+_TOOLS_VARNAME.chmod=          CHMOD
+_TOOLS_VARNAME.chown=          CHOWN
+_TOOLS_VARNAME.cmp=            CMP
+_TOOLS_VARNAME.cp=             CP
+_TOOLS_VARNAME.cut=            CUT
+_TOOLS_VARNAME.date=           DATE
+_TOOLS_VARNAME.dirname=                DIRNAME
+_TOOLS_VARNAME.echo=           ECHO
+_TOOLS_VARNAME.egrep=          EGREP
+_TOOLS_VARNAME.env=            SETENV
+_TOOLS_VARNAME.expr=           EXPR
+_TOOLS_VARNAME.false=          FALSE
+_TOOLS_VARNAME.fgrep=          FGREP
+_TOOLS_VARNAME.file=           FILE_CMD
+_TOOLS_VARNAME.find=           FIND
+_TOOLS_VARNAME.gawk=           AWK
+_TOOLS_VARNAME.gm4=            M4
+_TOOLS_VARNAME.gmake=          GMAKE
+_TOOLS_VARNAME.grep=           GREP
+_TOOLS_VARNAME.gsed=           SED
+_TOOLS_VARNAME.gtar=           GTAR
+_TOOLS_VARNAME.gunzip=         GUNZIP_CMD
+_TOOLS_VARNAME.gzcat=          GZCAT
+_TOOLS_VARNAME.gzip=           GZIP_CMD
+_TOOLS_VARNAME.head=           HEAD
+_TOOLS_VARNAME.hostname=       HOSTNAME_CMD
+_TOOLS_VARNAME.id=             ID
+_TOOLS_VARNAME.lex=            LEX
+_TOOLS_VARNAME.ln=             LN
+_TOOLS_VARNAME.ls=             LS
+_TOOLS_VARNAME.m4=             M4
+_TOOLS_VARNAME.mkdir=          MKDIR
+_TOOLS_VARNAME.mtree=          MTREE
+_TOOLS_VARNAME.mv=             MV
+_TOOLS_VARNAME.nice=           NICE
+_TOOLS_VARNAME.patch=          PATCH
+_TOOLS_VARNAME.pax=            PAX
+_TOOLS_VARNAME.pwd=            PWD_CMD
+_TOOLS_VARNAME.rm=             RM
+_TOOLS_VARNAME.rmdir=          RMDIR
+_TOOLS_VARNAME.sed=            SED
+_TOOLS_VARNAME.sh=             SH
+_TOOLS_VARNAME.shlock=         SHLOCK
+_TOOLS_VARNAME.sort=           SORT
+_TOOLS_VARNAME.tail=           TAIL
+_TOOLS_VARNAME.tbl=            TBL
+_TOOLS_VARNAME.tee=            TEE
+_TOOLS_VARNAME.test=           TEST
+_TOOLS_VARNAME.touch=          TOUCH
+_TOOLS_VARNAME.tr=             TR
+_TOOLS_VARNAME.true=           TRUE
+_TOOLS_VARNAME.tsort=          TSORT
+_TOOLS_VARNAME.wc=             WC
+_TOOLS_VARNAME.xargs=          XARGS
+_TOOLS_VARNAME.yacc=           YACC
+
+######################################################################
+
+# 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.
+#
+.for _t_ in ${USE_TOOLS}
+.  if defined(_TOOLS_VARNAME.${_t_}) && \
+      defined(TOOLS_PLATFORM.${_t_}) && !empty(TOOLS_PLATFORM.${_t_})
+${_TOOLS_VARNAME.${_t_}}?=     ${TOOLS_PLATFORM.${_t_}}
+.  endif
+.endfor
+.undef _t_
+
+.endif # TOOLS_DEFAULTS_MK
diff -r 4ac1296b4aca -r 5fd046c58f44 mk/tools/replace.mk
--- a/mk/tools/replace.mk       Sat Apr 30 03:38:29 2005 +0000
+++ b/mk/tools/replace.mk       Sat Apr 30 04:35:54 2005 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: replace.mk,v 1.53 2005/04/28 17:40:52 jlam Exp $
+# $NetBSD: replace.mk,v 1.54 2005/04/30 04:35:54 jlam Exp $
 #
 # This Makefile fragment handles "replacements" of system-supplied
 # tools with pkgsrc versions.  The replacements are placed under
@@ -38,84 +38,12 @@
 USE_TOOLS+=    tbl
 .endif
 
-# These are the platform-specific lists of system-supplied tools.
-#
-# XXX These should eventually just migrate over to the appropriate
-# XXX pkgsrc/mk/platform/${OPSYS}.mk file.
-#
-.include "../../mk/tools/bootstrap.mk"
-.if exists(../../mk/tools/tools.${OPSYS}.mk)
-.  include "../../mk/tools/tools.${OPSYS}.mk"
-.endif
-
-# "TOOL" variable names associated with each of the tools
-_TOOLS_VARNAME.awk=            AWK
-_TOOLS_VARNAME.basename=       BASENAME
-_TOOLS_VARNAME.bison=          YACC
-_TOOLS_VARNAME.cat=            CAT
-_TOOLS_VARNAME.chgrp=          CHGRP
-_TOOLS_VARNAME.chmod=          CHMOD
-_TOOLS_VARNAME.chown=          CHOWN
-_TOOLS_VARNAME.cmp=            CMP
-_TOOLS_VARNAME.cp=             CP
-_TOOLS_VARNAME.cut=            CUT
-_TOOLS_VARNAME.date=           DATE
-_TOOLS_VARNAME.dirname=                DIRNAME
-_TOOLS_VARNAME.echo=           ECHO
-_TOOLS_VARNAME.egrep=          EGREP
-_TOOLS_VARNAME.env=            SETENV
-_TOOLS_VARNAME.expr=           EXPR
-_TOOLS_VARNAME.false=          FALSE
-_TOOLS_VARNAME.fgrep=          FGREP
-_TOOLS_VARNAME.file=           FILE_CMD
-_TOOLS_VARNAME.find=           FIND
-_TOOLS_VARNAME.gawk=           AWK
-_TOOLS_VARNAME.gm4=            M4
-_TOOLS_VARNAME.gmake=          GMAKE
-_TOOLS_VARNAME.grep=           GREP
-_TOOLS_VARNAME.gsed=           SED
-_TOOLS_VARNAME.gtar=           GTAR
-_TOOLS_VARNAME.gunzip=         GUNZIP_CMD
-_TOOLS_VARNAME.gzcat=          GZCAT
-_TOOLS_VARNAME.gzip=           GZIP_CMD
-_TOOLS_VARNAME.head=           HEAD
-_TOOLS_VARNAME.hostname=       HOSTNAME
-_TOOLS_VARNAME.id=             ID
-_TOOLS_VARNAME.lex=            LEX
-_TOOLS_VARNAME.ln=             LN
-_TOOLS_VARNAME.ls=             LS
-_TOOLS_VARNAME.m4=             M4
-_TOOLS_VARNAME.mkdir=          MKDIR
-_TOOLS_VARNAME.mtree=          MTREE
-_TOOLS_VARNAME.mv=             MV
-_TOOLS_VARNAME.nice=           NICE
-_TOOLS_VARNAME.patch=          PATCH
-_TOOLS_VARNAME.pax=            PAX
-_TOOLS_VARNAME.pwd=            PWD
-_TOOLS_VARNAME.rm=             RM
-_TOOLS_VARNAME.rmdir=          RMDIR
-_TOOLS_VARNAME.sed=            SED
-_TOOLS_VARNAME.sh=             SH
-_TOOLS_VARNAME.shlock=         SHLOCK
-_TOOLS_VARNAME.sort=           SORT
-_TOOLS_VARNAME.tail=           TAIL
-_TOOLS_VARNAME.tbl=            TBL
-_TOOLS_VARNAME.tee=            TEE
-_TOOLS_VARNAME.test=           TEST
-_TOOLS_VARNAME.touch=          TOUCH
-_TOOLS_VARNAME.tr=             TR
-_TOOLS_VARNAME.true=           TRUE
-_TOOLS_VARNAME.tsort=          TSORT
-_TOOLS_VARNAME.wc=             WC
-_TOOLS_VARNAME.xargs=          XARGS
-_TOOLS_VARNAME.yacc=           YACC
-
 ######################################################################
 
 # Create _USE_TOOLS, a sanitized version of USE_TOOLS that removes the
 # tools that are overridden by superseding ones.
 
-_USE_TOOLS:=   ${USE_TOOLS}
+_USE_TOOLS:=   ${USE_TOOLS:O:u}
 .if !empty(USE_TOOLS:Mbison)           # bison > yacc
 _USE_TOOLS:=   ${_USE_TOOLS:Nyacc}
 .endif
@@ -983,11 +911,10 @@
 
 # Set TOOLS_REAL_CMD.<tool> appropriately in the case where we are
 # using the system-supplied tool.  Here, we first check to see if
-# TOOLS_PLATFORM.<tool> is defined.  If it is, then use that as the path
-# to the real command and extract any arguments into TOOLS_ARGS.<tool>.
-# We also create either a wrapper or a symlink depending on whether
-# there are any arguments or not.  If TOOLS_PLATFORM.<tool> is undefined
-# or empty, then we fall back to checking if TOOL is defined.  Lastly,
+# TOOLS_PLATFORM.<tool> is defined.  If it is, then use that as the
+# path to the real command and extract any arguments into
+# TOOLS_ARGS.<tool>.  We also create either a wrapper or a symlink
+# depending on whether # there are any arguments or not.  Lastly,
 # always set the TOOL name for each tool to point to the real command,
 # e.g., TBL, YACC, etc., provided that "TOOL" has been associated with
 # <tool>.
@@ -1008,16 +935,6 @@
 .      else
 TOOLS_SYMLINK+=                        ${_t_}
 .      endif
-.    elif defined(${_TOOLS_VARNAME.${_t_}})
-TOOLS_REAL_CMD.${_t_}?=                \
-       ${${_TOOLS_VARNAME.${_t_}}:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//}
-TOOLS_ARGS.${_t_}?=            \
-       ${${_TOOLS_VARNAME.${_t_}}:C/^/_asdf_/1:N_asdf_*}
-.      if !empty(TOOLS_ARGS.${_t_})
-TOOLS_WRAP+=                   ${_t_}
-.      else
-TOOLS_SYMLINK+=                        ${_t_}
-.      endif
 .    elif defined(_TOOLS_VARNAME.${_t_})
 .      if defined(TOOLS_REAL_CMD.${_t_})
 ${_TOOLS_VARNAME.${_t_}}=      ${TOOLS_REAL_CMD.${_t_}} ${TOOLS_ARGS.${_t_}}



Home | Main Index | Thread Index | Old Index