pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk/tools Replace TOOLS_WRAP and TOOLS_SYMLINK with TOO...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/4e504495ed41
branches:  trunk
changeset: 493534:4e504495ed41
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Mon May 09 01:11:58 2005 +0000

description:
Replace TOOLS_WRAP and TOOLS_SYMLINK with TOOLS_CREATE, and let the tools
framework figure out by itself whether a wrapper or a symlink should be
created based on the real command and any arguments that may need to be
invoked.

diffstat:

 mk/tools/bsd.tools.mk |   66 +++++++++--------------
 mk/tools/imake.mk     |   13 +----
 mk/tools/replace.mk   |  136 ++++++++++++++++++++++++-------------------------
 mk/tools/rpcgen.mk    |    4 +-
 mk/tools/texinfo.mk   |    4 +-
 5 files changed, 99 insertions(+), 124 deletions(-)

diffs (truncated from 781 to 300 lines):

diff -r ea706e1ff8f2 -r 4e504495ed41 mk/tools/bsd.tools.mk
--- a/mk/tools/bsd.tools.mk     Mon May 09 00:13:03 2005 +0000
+++ b/mk/tools/bsd.tools.mk     Mon May 09 01:11:58 2005 +0000
@@ -1,16 +1,12 @@
-# $NetBSD: bsd.tools.mk,v 1.14 2005/05/09 00:13:03 jlam Exp $
+# $NetBSD: bsd.tools.mk,v 1.15 2005/05/09 01:11:58 jlam Exp $
 #
 # This Makefile fragment creates tools under ${TOOLS_DIR} that are
 # found before similarly-named tools in the system path.
 #
-# There are two ways to generate the tool: either create a wrapper script
-# or create a symlink:
-#
-#    TOOLS_WRAP is a whitespace-separated list of tools for which a
-#      wrapper script is created.
-#
-#    TOOLS_SYMLINK is a whitespace-separated list of tools for which a
-#      symlink is created.
+#    TOOLS_CREATE is a whitespace-separated list of tools for which a
+#       corresponding tool is created.  Either a wrapper script or a
+#       symlink is created depending on the tool that is being
+#      overridden.
 #
 # The following variables specify the details of each <tool>:
 #
@@ -27,7 +23,7 @@
 #      below).
 #
 # The following variables specify further details of each <tool> and
-# are used only by tools listed in TOOLS_WRAP:
+# if set, cause a wrapper script to be created.
 #
 #    TOOLS_REAL_ARGS.<tool> additional arguments that are passed to the
 #      real command ahead of any command-line arguments.  This variable
@@ -85,21 +81,21 @@
 ######################################################################
 
 .for _t_ in ${TOOLS_NOOP}
-TOOLS_WRAP+=                   ${_t_}
+TOOLS_CREATE+=                 ${_t_}
 TOOLS_CMD.${_t_}?=             ${TOOLS_DIR}/bin/${_t_}
 TOOLS_REAL_CMDLINE.${_t_}?=    exit 0
 .endfor
 .undef _t_
 
 .for _t_ in ${TOOLS_BROKEN}
-TOOLS_WRAP+=                   ${_t_}
+TOOLS_CREATE+=                 ${_t_}
 TOOLS_CMD.${_t_}?=             ${TOOLS_DIR}/bin/${_t_}
 TOOLS_REAL_CMDLINE.${_t_}?=    exit 1
 .endfor
 .undef _t_
 
 .for _t_ in ${TOOLS_GNU_MISSING}
-TOOLS_WRAP+=                   ${_t_}
+TOOLS_CREATE+=                 ${_t_}
 TOOLS_REAL_CMD.${_t_}?=                ${PKGSRCDIR}/mk/gnu-config/missing
 TOOLS_REAL_CMDLINE.${_t_}?=    ${TOOLS_REAL_CMD.${_t_}} ${_t_:T:C/-[0-9].*$//}
 .endfor
@@ -120,21 +116,28 @@
 
 ######################################################################
 
+# If the command line was defined, then we create a wrapper.
+# If the real command isn't a full path, then we create a wrapper.
+# If some command arguments were given, then we create a wrapper.
+# Otherwise, we create a symlink.
+#
+# By default, the tool in ${TOOLS_DIR} will be in the "bin" directory
+# and will be called <tool>.
+#
 # The default wrapper script will invoke the real command, followed
 # by any arguments specified in TOOLS_REAL_ARGS.*, followed by any
-# command-line arguments passed to the wrapper script.  By default,
-# the wrapper in ${TOOLS_DIR} will be in the "bin" directory and will
-# be called <tool>.
+# command-line arguments passed to the wrapper script.
 #
-.for _t_ in ${TOOLS_WRAP}
+.for _t_ in ${TOOLS_CREATE}
+TOOLS_CMD.${_t_}?=             ${TOOLS_DIR}/bin/${_t_}
 TOOLS_REAL_CMD.${_t_}?=                ${FALSE}
-TOOLS_REAL_ARGS.${_t_}?=       # empty
-TOOLS_REAL_CMDLINE.${_t_}?=    ${TOOLS_REAL_CMD.${_t_}} ${TOOLS_REAL_ARGS.${_t_}} "$$@"
-TOOLS_CMD.${_t_}?=             ${TOOLS_DIR}/bin/${_t_}
+override-tools: ${TOOLS_CMD.${_t_}}
 
-.  if !empty(TOOLS_CMD.${_t_}:M${TOOLS_DIR}/*) && \
-      !target(${TOOLS_CMD.${_t_}})
-override-tools: ${TOOLS_CMD.${_t_}}
+.  if defined(TOOLS_REAL_CMDLINE.${_t_}) || \
+      (defined(TOOLS_REAL_CMD.${_t_}) && empty(TOOLS_REAL_CMD.${_t_}:M/*)) || \
+      (defined(TOOLS_REAL_ARGS.${_t_}) && !empty(TOOLS_REAL_ARGS.${_t_}))
+TOOLS_REAL_CMDLINE.${_t_}?=    \
+       ${TOOLS_REAL_CMD.${_t_}} ${TOOLS_REAL_ARGS.${_t_}} "$$@"
 ${TOOLS_CMD.${_t_}}:
        ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
@@ -145,22 +148,7 @@
          ${ECHO} ${TOOLS_REAL_CMDLINE.${_t_}:Q};                       \
        ) > ${.TARGET}
        ${_PKG_SILENT}${_PKG_DEBUG}${CHMOD} +x ${.TARGET}
-.  endif
-.endfor
-.undef _t_
-
-######################################################################
-
-# By default, the symlinked tool in ${TOOLS_DIR} will be in the "bin"
-# directory and will be called <tool>.
-#
-.for _t_ in ${TOOLS_SYMLINK}
-TOOLS_REAL_CMD.${_t_}?=        ${FALSE}
-TOOLS_CMD.${_t_}?=     ${TOOLS_DIR}/bin/${_t_}
-
-.  if !empty(TOOLS_CMD.${_t_}:M${TOOLS_DIR}/*) && \
-      !target(${TOOLS_CMD.${_t_}}) && exists(${TOOLS_REAL_CMD.${_t_}})
-override-tools: ${TOOLS_CMD.${_t_}}
+.  else
 ${TOOLS_CMD.${_t_}}: ${TOOLS_REAL_CMD.${_t_}}
        ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
        ${_PKG_SILENT}${_PKG_DEBUG}${LN} -sf ${TOOLS_REAL_CMD.${_t_}} ${.TARGET}
diff -r ea706e1ff8f2 -r 4e504495ed41 mk/tools/imake.mk
--- a/mk/tools/imake.mk Mon May 09 00:13:03 2005 +0000
+++ b/mk/tools/imake.mk Mon May 09 01:11:58 2005 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: imake.mk,v 1.3 2005/05/09 00:13:03 jlam Exp $
+# $NetBSD: imake.mk,v 1.4 2005/05/09 01:11:58 jlam Exp $
 #
 # This Makefile fragment handles packages that need imake and xmkmf
 # to build X11-related packages.  The correct imake and xmkmf tools
@@ -80,16 +80,7 @@
 # Define IMAKE and XMKMF_CMD and create wrappers/symlinks corresponding
 # to imake and xmkmf.
 #
-.    if !empty(TOOLS_REAL_ARGS.imake)
-TOOLS_WRAP+=                   imake
-.    else
-TOOLS_SYMLINK+=                        imake
-.    endif
-.    if !empty(TOOLS_REAL_ARGS.xmkmf)
-TOOLS_WRAP+=                   xmkmf
-.    else
-TOOLS_SYMLINK+=                        xmkmf
-.    endif
+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
diff -r ea706e1ff8f2 -r 4e504495ed41 mk/tools/replace.mk
--- a/mk/tools/replace.mk       Mon May 09 00:13:03 2005 +0000
+++ b/mk/tools/replace.mk       Mon May 09 01:11:58 2005 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: replace.mk,v 1.63 2005/05/09 00:13:03 jlam Exp $
+# $NetBSD: replace.mk,v 1.64 2005/05/09 01:11:58 jlam Exp $
 #
 # This Makefile fragment handles "replacements" of system-supplied
 # tools with pkgsrc versions.  The replacements are placed under
@@ -93,7 +93,7 @@
 MAKEFLAGS+=                    TOOLS_IGNORE.[=
 .  elif !empty(_TOOLS_USE_PKGSRC.[:M[yY][eE][sS])
 TOOLS_DEPENDS.[?=              coreutils>=5.2.1:../../sysutils/coreutils
-TOOLS_SYMLINK+=                        [
+TOOLS_CREATE+=                 [
 TOOLS_REAL_CMD.[=              ${LOCALBASE}/bin/${GNU_PROGRAM_PREFIX}[
 .  endif
 .endif
@@ -103,7 +103,7 @@
 MAKEFLAGS+=                    TOOLS_IGNORE.awk=
 .  elif !empty(_TOOLS_USE_PKGSRC.awk:M[yY][eE][sS])
 TOOLS_DEPENDS.awk?=            gawk>=3.1.1:../../lang/gawk
-TOOLS_SYMLINK+=                        awk
+TOOLS_CREATE+=                 awk
 TOOLS_REAL_CMD.awk=            ${LOCALBASE}/bin/${GNU_PROGRAM_PREFIX}awk
 ${_TOOLS_VARNAME.awk}=         ${TOOLS_REAL_CMD.awk}
 .  endif
@@ -114,7 +114,7 @@
 MAKEFLAGS+=                    TOOLS_IGNORE.basename=
 .  elif !empty(_TOOLS_USE_PKGSRC.basename:M[yY][eE][sS])
 TOOLS_DEPENDS.basename?=       coreutils>=5.2.1:../../sysutils/coreutils
-TOOLS_SYMLINK+=                        basename
+TOOLS_CREATE+=                 basename
 TOOLS_REAL_CMD.basename=       ${LOCALBASE}/bin/${GNU_PROGRAM_PREFIX}basename
 ${_TOOLS_VARNAME.basename}=    ${TOOLS_REAL_CMD.basename}
 .  endif
@@ -125,7 +125,7 @@
 MAKEFLAGS+=                    TOOLS_IGNORE.bison=
 .  elif !empty(_TOOLS_USE_PKGSRC.bison:M[yY][eE][sS])
 TOOLS_DEPENDS.bison?=          bison>=1.0:../../devel/bison
-TOOLS_WRAP+=                   bison
+TOOLS_CREATE+=                 bison
 TOOLS_REAL_CMD.bison=          ${LOCALBASE}/bin/bison
 TOOLS_REAL_ARGS.bison=         -y
 ${_TOOLS_VARNAME.bison}=       ${TOOLS_REAL_CMD.bison} ${TOOLS_REAL_ARGS.bison}
@@ -138,7 +138,7 @@
 MAKEFLAGS+=                    TOOLS_IGNORE.bzcat=
 .  elif !empty(_TOOLS_USE_PKGSRC.bzcat:M[yY][eE][sS])
 TOOLS_DEPENDS.bzcat?=          bzip2>=0.9.0b:../../archivers/bzip2
-TOOLS_SYMLINK+=                        bzcat
+TOOLS_CREATE+=                 bzcat
 TOOLS_REAL_CMD.bzcat=          ${LOCALBASE}/bin/bzcat
 ${_TOOLS_VARNAME.bzcat}=       ${TOOLS_REAL_CMD.bzcat}
 .  endif
@@ -149,7 +149,7 @@
 MAKEFLAGS+=                    TOOLS_IGNORE.cat=
 .  elif !empty(_TOOLS_USE_PKGSRC.cat:M[yY][eE][sS])
 TOOLS_DEPENDS.cat?=            coreutils>=5.2.1:../../sysutils/coreutils
-TOOLS_SYMLINK+=                        cat
+TOOLS_CREATE+=                 cat
 TOOLS_REAL_CMD.cat=            ${LOCALBASE}/bin/${GNU_PROGRAM_PREFIX}cat
 ${_TOOLS_VARNAME.cat}=         ${TOOLS_REAL_CMD.cat}
 .  endif
@@ -160,7 +160,7 @@
 MAKEFLAGS+=                    TOOLS_IGNORE.chgrp=
 .  elif !empty(_TOOLS_USE_PKGSRC.chgrp:M[yY][eE][sS])
 TOOLS_DEPENDS.chgrp?=          coreutils>=5.2.1:../../sysutils/coreutils
-TOOLS_SYMLINK+=                        chgrp
+TOOLS_CREATE+=                 chgrp
 TOOLS_REAL_CMD.chgrp=          ${LOCALBASE}/bin/${GNU_PROGRAM_PREFIX}chgrp
 ${_TOOLS_VARNAME.chgrp}=       ${TOOLS_REAL_CMD.chgrp}
 .  endif
@@ -171,7 +171,7 @@
 MAKEFLAGS+=                    TOOLS_IGNORE.chmod=
 .  elif !empty(_TOOLS_USE_PKGSRC.chmod:M[yY][eE][sS])
 TOOLS_DEPENDS.chmod?=          coreutils>=5.2.1:../../sysutils/coreutils
-TOOLS_SYMLINK+=                        chmod
+TOOLS_CREATE+=                 chmod
 TOOLS_REAL_CMD.chmod=          ${LOCALBASE}/bin/${GNU_PROGRAM_PREFIX}chmod
 ${_TOOLS_VARNAME.chmod}=       ${TOOLS_REAL_CMD.chmod}
 .  endif
@@ -182,7 +182,7 @@
 MAKEFLAGS+=                    TOOLS_IGNORE.chown=
 .  elif !empty(_TOOLS_USE_PKGSRC.chown:M[yY][eE][sS])
 TOOLS_DEPENDS.chown?=          coreutils>=5.2.1:../../sysutils/coreutils
-TOOLS_SYMLINK+=                        chown
+TOOLS_CREATE+=                 chown
 TOOLS_REAL_CMD.chown=          ${LOCALBASE}/bin/${GNU_PROGRAM_PREFIX}chown
 ${_TOOLS_VARNAME.chown}=       ${TOOLS_REAL_CMD.chown}
 .  endif
@@ -193,7 +193,7 @@
 MAKEFLAGS+=                    TOOLS_IGNORE.cmp=
 .  elif !empty(_TOOLS_USE_PKGSRC.cmp:M[yY][eE][sS])
 TOOLS_DEPENDS.cmp?=            diffutils>=2.8.1:../../devel/diffutils
-TOOLS_SYMLINK+=                        cmp
+TOOLS_CREATE+=                 cmp
 TOOLS_REAL_CMD.cmp=            ${LOCALBASE}/bin/cmp
 ${_TOOLS_VARNAME.cmp}=         ${TOOLS_REAL_CMD.cmp}
 .  endif
@@ -204,7 +204,7 @@
 MAKEFLAGS+=                    TOOLS_IGNORE.cp=
 .  elif !empty(_TOOLS_USE_PKGSRC.cp:M[yY][eE][sS])
 TOOLS_DEPENDS.cp?=             coreutils>=5.2.1:../../sysutils/coreutils
-TOOLS_SYMLINK+=                        cp
+TOOLS_CREATE+=                 cp
 TOOLS_REAL_CMD.cp=             ${LOCALBASE}/bin/${GNU_PROGRAM_PREFIX}cp
 ${_TOOLS_VARNAME.cp}=          ${TOOLS_REAL_CMD.cp}
 .  endif
@@ -215,7 +215,7 @@
 MAKEFLAGS+=                    TOOLS_IGNORE.cut=
 .  elif !empty(_TOOLS_USE_PKGSRC.cut:M[yY][eE][sS])
 TOOLS_DEPENDS.cut?=            coreutils>=5.2.1:../../sysutils/coreutils
-TOOLS_SYMLINK+=                        cut
+TOOLS_CREATE+=                 cut
 TOOLS_REAL_CMD.cut=            ${LOCALBASE}/bin/${GNU_PROGRAM_PREFIX}cut
 ${_TOOLS_VARNAME.cut}=         ${TOOLS_REAL_CMD.cut}
 .  endif
@@ -226,7 +226,7 @@
 MAKEFLAGS+=                    TOOLS_IGNORE.date=
 .  elif !empty(_TOOLS_USE_PKGSRC.date:M[yY][eE][sS])
 TOOLS_DEPENDS.date?=           coreutils>=5.2.1:../../sysutils/coreutils
-TOOLS_SYMLINK+=                        date
+TOOLS_CREATE+=                 date
 TOOLS_REAL_CMD.date=           ${LOCALBASE}/bin/${GNU_PROGRAM_PREFIX}date
 ${_TOOLS_VARNAME.date}=                ${TOOLS_REAL_CMD.date}
 .  endif
@@ -237,7 +237,7 @@
 MAKEFLAGS+=                    TOOLS_IGNORE.dirname=
 .  elif !empty(_TOOLS_USE_PKGSRC.dirname:M[yY][eE][sS])
 TOOLS_DEPENDS.dirname?=                coreutils>=5.2.1:../../sysutils/coreutils
-TOOLS_SYMLINK+=                        dirname
+TOOLS_CREATE+=                 dirname
 TOOLS_REAL_CMD.dirname=                ${LOCALBASE}/bin/${GNU_PROGRAM_PREFIX}dirname
 ${_TOOLS_VARNAME.dirname}=     ${TOOLS_REAL_CMD.dirname}
 .  endif
@@ -248,7 +248,7 @@
 MAKEFLAGS+=                    TOOLS_IGNORE.echo=
 .  elif !empty(_TOOLS_USE_PKGSRC.echo:M[yY][eE][sS])
 TOOLS_DEPENDS.echo?=           coreutils>=5.2.1:../../sysutils/coreutils
-TOOLS_SYMLINK+=                        echo
+TOOLS_CREATE+=                 echo
 TOOLS_REAL_CMD.echo=           ${LOCALBASE}/bin/${GNU_PROGRAM_PREFIX}echo
 ${_TOOLS_VARNAME.echo}=                ${TOOLS_REAL_CMD.echo}
 .  endif
@@ -259,7 +259,7 @@
 MAKEFLAGS+=                    TOOLS_IGNORE.egrep=
 .  elif !empty(_TOOLS_USE_PKGSRC.egrep:M[yY][eE][sS])
 TOOLS_DEPENDS.egrep?=          grep>=2.5.1:../../textproc/grep
-TOOLS_SYMLINK+=                        egrep
+TOOLS_CREATE+=                 egrep
 TOOLS_REAL_CMD.egrep=          ${LOCALBASE}/bin/${GNU_PROGRAM_PREFIX}egrep



Home | Main Index | Thread Index | Old Index