diff options
-rw-r--r-- | mk/tools/autoconf.mk | 184 | ||||
-rw-r--r-- | mk/tools/automake.mk | 138 | ||||
-rw-r--r-- | mk/tools/bsd.tools.mk | 182 | ||||
-rw-r--r-- | mk/tools/make.mk | 11 | ||||
-rw-r--r-- | mk/tools/replace.mk | 306 | ||||
-rw-r--r-- | mk/tools/rpcgen.mk | 36 | ||||
-rw-r--r-- | mk/tools/texinfo.mk | 22 |
7 files changed, 879 insertions, 0 deletions
diff --git a/mk/tools/autoconf.mk b/mk/tools/autoconf.mk new file mode 100644 index 00000000000..f26f79f38d1 --- /dev/null +++ b/mk/tools/autoconf.mk @@ -0,0 +1,184 @@ +# $NetBSD: autoconf.mk,v 1.1 2005/04/15 00:00:21 jlam Exp $ +# +# This Makefile fragment handles packages that use GNU autoconf. +# +# By default, all of the autoconf-related scripts are marked as +# "missing" by running the GNU missing script in place of the utility. +# This hides the autoconf-related scripts from makefiles that aggressively +# call them when some of the inputs are modified in ways the makefiles +# don't expect. +# +# If a package needs to use GNU autoconf, then the package Makefile +# should contain one of the following lines: +# +# USE_TOOLS+= autoconf # use recent GNU autoconf (>=2.50) +# USE_TOOLS+= autoconf213 # use GNU autoconf ~2.13 +# +# This will allow the package to invoke "autoconf", "autoreconf", etc. +# by their usual, bare names. +# +# If a particular minimum version of autoconf is required, then the +# package Makefile can additionally set AUTOCONF_REQD to the desired +# version, e.g.: +# +# AUTOCONF_REQD= 2.54 # use at least autoconf>=2.54 +# +# To globally prevent any GNU autoconf handling, set the following +# in the package Makefile: +# +# AUTOMAKE_OVERRIDE= no +# + +# Only allow one of "autoconf" and "autoconf213" in USE_TOOLS. +.if !empty(USE_TOOLS:Mautoconf) && !empty(USE_TOOLS:Mautoconf213) +PKG_FAIL_REASON+= "\`\`autoconf'' and \`\`autoconf213'' conflict in USE_TOOLS." +.endif + +# This is an exhaustive list of all of the scripts supplied by GNU +# autoconf. +# +_TOOLS_AUTOCONF= autoconf autoheader autom4te autoreconf \ + autoscan autoupdate ifnames + +_TOOLS_AUTOCONF.autoconf= autoconf autoconf-2.13 +_TOOLS_AUTOCONF.autoheader= autoheader autoheader-2.13 +_TOOLS_AUTOCONF.autom4te= autom4te +_TOOLS_AUTOCONF.autoreconf= autoreconf autoreconf-2.13 +_TOOLS_AUTOCONF.autoscan= autoscan autoscan-2.13 +_TOOLS_AUTOCONF.autoupdate= autoupdate autoupdate-2.13 +_TOOLS_AUTOCONF.ifnames= ifnames ifnames-2.13 + +_TOOLS_AUTOCONF_LINKS= # empty + +.if !empty(USE_TOOLS:Mautoconf) +AUTOCONF_REQD?= 2.50 +BUILD_DEPENDS+= autoconf>=${AUTOCONF_REQD}:../../devel/autoconf + +_TOOLS_AUTOCONF_LINKS+= autoconf +TOOLS_CMD.autoconf= ${TOOLS_DIR}/bin/autoconf +TOOLS_REAL_CMD.autoconf= ${LOCALBASE}/bin/autoconf + +_TOOLS_AUTOCONF_LINKS+= autoheader +TOOLS_CMD.autoheader= ${TOOLS_DIR}/bin/autoheader +TOOLS_REAL_CMD.autoheader= ${LOCALBASE}/bin/autoheader + +_TOOLS_AUTOCONF_LINKS+= autom4te +TOOLS_CMD.autom4te= ${TOOLS_DIR}/bin/autom4te +TOOLS_REAL_CMD.autom4te= ${LOCALBASE}/bin/autom4te + +_TOOLS_AUTOCONF_LINKS+= autoreconf +TOOLS_CMD.autoreconf= ${TOOLS_DIR}/bin/autoreconf +TOOLS_REAL_CMD.autoreconf= ${LOCALBASE}/bin/autoreconf + +_TOOLS_AUTOCONF_LINKS+= autoscan +TOOLS_CMD.autoscan= ${TOOLS_DIR}/bin/autoscan +TOOLS_REAL_CMD.autoscan= ${LOCALBASE}/bin/autoscan + +_TOOLS_AUTOCONF_LINKS+= autoupdate +TOOLS_CMD.autoupdate= ${TOOLS_DIR}/bin/autoupdate +TOOLS_REAL_CMD.autoupdate= ${LOCALBASE}/bin/autoupdate + +_TOOLS_AUTOCONF_LINKS+= ifnames +TOOLS_CMD.ifnames= ${TOOLS_DIR}/bin/ifnames +TOOLS_REAL_CMD.ifnames= ${LOCALBASE}/bin/ifnames + +# Continue to define the following variables until packages have been +# taught to just use "autoconf", "autoheader", and "autoreconf" instead. +# +AUTOCONF= ${TOOLS_CMD.autoconf} +AUTOHEADER= ${TOOLS_CMD.autoheader} +AUTORECONF= ${TOOLS_CMD.autoreconf} +.endif + +.if !empty(USE_TOOLS:Mautoconf213) +AUTOCONF_REQD?= 2.13 +BUILD_DEPENDS+= autoconf213>=${AUTOCONF_REQD}:../../devel/autoconf213 + +_TOOLS_AUTOCONF_LINKS+= autoconf +TOOLS_CMD.autoconf= ${TOOLS_DIR}/bin/autoconf +TOOLS_REAL_CMD.autoconf= ${LOCALBASE}/bin/autoconf-2.13 + +_TOOLS_AUTOCONF_LINKS+= autoheader +TOOLS_CMD.autoheader= ${TOOLS_DIR}/bin/autoheader +TOOLS_REAL_CMD.autoheader= ${LOCALBASE}/bin/autoheader-2.13 + +_TOOLS_AUTOCONF_LINKS+= autoreconf +TOOLS_CMD.autoreconf= ${TOOLS_DIR}/bin/autoreconf +TOOLS_REAL_CMD.autoreconf= ${LOCALBASE}/bin/autoreconf-2.13 + +_TOOLS_AUTOCONF_LINKS+= autoscan +TOOLS_CMD.autoscan= ${TOOLS_DIR}/bin/autoscan +TOOLS_REAL_CMD.autoscan= ${LOCALBASE}/bin/autoscan-2.13 + +_TOOLS_AUTOCONF_LINKS+= autoupdate +TOOLS_CMD.autoupdate= ${TOOLS_DIR}/bin/autoupdate +TOOLS_REAL_CMD.autoupdate= ${LOCALBASE}/bin/autoupdate-2.13 + +_TOOLS_AUTOCONF_LINKS+= ifnames +TOOLS_CMD.ifnames= ${TOOLS_DIR}/bin/ifnames +TOOLS_REAL_CMD.ifnames= ${LOCALBASE}/bin/ifnames-2.13 + +# Continue to define the following variables until packages have been +# taught to just use "autoconf", "autoheader", and "autoreconf" instead. +# +AUTOCONF= ${TOOLS_CMD.autoconf} +AUTOHEADER= ${TOOLS_CMD.autoheader} +AUTORECONF= ${TOOLS_CMD.autoreconf} + +. if defined(USE_LIBTOOL) +pre-configure: tools-libtool-m4-override +. endif +.endif + +# For every script that hasn't already been symlinked, we mark it as +# "GNU missing". +# +AUTOMAKE_OVERRIDE?= yes +.if !empty(AUTOMAKE_OVERRIDE:M[yY][eE][sS]) +TOOLS_SYMLINK+= ${_TOOLS_AUTOCONF_LINKS} +. for _t_ in ${_TOOLS_AUTOCONF_LINKS} +. for _s_ in ${_TOOLS_AUTOCONF.${_t_}} +. if empty(TOOLS_REAL_CMD.${_t_}:M*/${_s_}) +TOOLS_GNU_MISSING+= ${_s_} +. endif +. endfor +. endfor +. for _t_ in ${_TOOLS_AUTOCONF} +. if empty(_TOOLS_AUTOCONF_LINKS:M${_t_}) +. for _s_ in ${_TOOLS_AUTOCONF.${_t_}} +TOOLS_GNU_MISSING+= ${_s_} +. endfor +. endif +. endfor +. undef _s_ +. undef _t_ +.endif + +# LIBTOOL_M4_OVERRIDE lists the locations where the libtool.m4 symlink +# will be created. The libtool.m4 symlink is only created if a GNU +# configure script exists at that location. +# +LIBTOOL_M4_OVERRIDE?= libtool.m4 */libtool.m4 */*/libtool.m4 + +# Symlink the libtool-1.4.m4 file into any directory in which there's +# a configure script under ${WRKSRC}. The symlink is called "libtool.m4", +# which is the name expected by the autoconf tools. The symlinking +# is only done if we need autoconf-2.13 and libtool. This allows +# autoconf-2.13, autoreconf-2.13 and aclocal-2.13 to use the older +# libtool.m4 file when regenerating files. This is okay, because we +# later override the generated libtool file anyway. +# +.PHONY: tools-libtool-m4-override +tools-libtool-m4-override: +.for _pattern_ in ${LIBTOOL_M4_OVERRIDE} + ${_PKG_SILENT}${_PKG_DEBUG} \ + cd ${WRKSRC}; \ + for cfile in ${_pattern_:S/libtool.m4$/configure/}; do \ + if ${TEST} -f "$$cfile"; then \ + libtool_m4=`${DIRNAME} $$cfile`/libtool.m4; \ + ${LN} -sf ${PKGSRCDIR}/mk/gnu-config/libtool-1.4.m4 \ + $$libtool_m4; \ + fi; \ + done +.endfor +.undef _pattern_ diff --git a/mk/tools/automake.mk b/mk/tools/automake.mk new file mode 100644 index 00000000000..2241806afa3 --- /dev/null +++ b/mk/tools/automake.mk @@ -0,0 +1,138 @@ +# $NetBSD: automake.mk,v 1.1 2005/04/15 00:00:21 jlam Exp $ +# +# This Makefile fragment handles packages that use GNU automake. +# +# By default, all of the automake-related scripts are marked as +# "missing" by running the GNU missing script in place of the utility. +# This hides the automake-related scripts from makefiles that aggressively +# call them when some of the inputs are modified in ways the makefiles +# don't expect. +# +# If a package needs to use GNU automake, then the package Makefile +# should contain one of the following lines: +# +# USE_TOOLS+= automake # use recent GNU automake (>=1.9) +# USE_TOOLS+= automake14 # use GNU automake ~1.4 +# +# This will allow the package to invoke "aclocal" and "automake" by +# their usual, bare names. +# +# If a particular minimum version of automake is required, then the +# package Makefile can additionally set AUTOMAKE_REQD to the desired +# version, e.g.: +# +# AUTOMAKE_REQD= 1.8 # use at least automake>=1.8 +# +# If a package additionally needs to regenerate configure scripts and +# Makefiles that use gettext, then the package Makefile should contain +# the following line: +# +# USE_TOOLS+= gettext-m4 # need gettext.m4 to re-gen files +# +# To globally prevent any GNU automake handling, set the following +# in the package Makefile: +# +# AUTOMAKE_OVERRIDE= no +# + +# This variable is obsoleted, but continue to allow it until packages +# have been taught to use the new syntax. +# +.if defined(BUILD_USES_GETTEXT_M4) +USE_TOOLS+= gettext-m4 +.endif + +# Only allow one of "automake" and "automake14" in USE_TOOLS. +.if !empty(USE_TOOLS:Mautomake) && !empty(USE_TOOLS:Mautomake14) +PKG_FAIL_REASON+= "\`\`automake'' and \`\`automake14'' conflict in USE_TOOLS." +.endif + +# This is an exhaustive list of all of the scripts supplied by GNU +# automake. +# +_TOOLS_AUTOMAKE= aclocal automake + +_TOOLS_AUTOMAKE.aclocal= aclocal aclocal-1.4 \ + aclocal-1.5 \ + aclocal-1.6 \ + aclocal-1.7 \ + aclocal-1.8 \ + aclocal-1.9 +_TOOLS_AUTOMAKE.automake= automake automake-1.4 \ + automake-1.5 \ + automake-1.6 \ + automake-1.7 \ + automake-1.8 \ + automake-1.9 + +_TOOLS_AUTOMAKE_LINKS= # empty + +.if !empty(USE_TOOLS:Mautomake) +AUTOMAKE_REQD?= 1.9 +BUILD_DEPENDS+= automake>=${AUTOMAKE_REQD}:../../devel/automake +USE_TOOLS+= autoconf +AUTOCONF_REQD?= 2.58 + +_TOOLS_AUTOMAKE_LINKS+= aclocal +TOOLS_CMD.aclocal= ${TOOLS_DIR}/bin/aclocal +TOOLS_REAL_CMD.aclocal= ${LOCALBASE}/bin/aclocal + +_TOOLS_AUTOMAKE_LINKS+= automake +TOOLS_CMD.automake= ${TOOLS_DIR}/bin/automake +TOOLS_REAL_CMD.automake= ${LOCALBASE}/bin/automake + +# Continue to define the following variables until packages have been +# taught to just use "aclocal" and "automake" instead. +# +ACLOCAL= ${TOOLS_CMD.aclocal} +AUTOMAKE= ${TOOLS_CMD.automake} +.endif + +.if !empty(USE_TOOLS:Mautomake14) +AUTOMAKE_REQD?= 1.4 +BUILD_DEPENDS+= automake14>=${AUTOMAKE_REQD}:../../devel/automake14 +USE_TOOLS+= autoconf213 +AUTOCONF_REQD?= 2.13 + +_TOOLS_AUTOMAKE_LINKS+= aclocal +TOOLS_CMD.aclocal= ${TOOLS_DIR}/bin/aclocal +TOOLS_REAL_CMD.aclocal= ${LOCALBASE}/bin/aclocal-1.4 + +_TOOLS_AUTOMAKE_LINKS+= automake +TOOLS_CMD.automake= ${TOOLS_DIR}/bin/automake +TOOLS_REAL_CMD.automake= ${LOCALBASE}/bin/automake-1.4 + +# Continue to define the following variables until packages have been +# taught to just use "aclocal" and "automake" instead. +# +ACLOCAL= ${TOOLS_CMD.aclocal} +AUTOMAKE= ${TOOLS_CMD.automake} +.endif + +# For every script that hasn't already been symlinked, we mark it as +# "GNU missing". +# +AUTOMAKE_OVERRIDE?= yes +.if !empty(AUTOMAKE_OVERRIDE:M[yY][eE][sS]) +TOOLS_SYMLINK+= ${_TOOLS_AUTOMAKE_LINKS} +. for _t_ in ${_TOOLS_AUTOMAKE_LINKS} +. for _s_ in ${_TOOLS_AUTOMAKE.${_t_}} +. if empty(TOOLS_REAL_CMD.${_t_}:M*/${_s_}) +TOOLS_GNU_MISSING+= ${_s_} +. endif +. endfor +. endfor +. for _t_ in ${_TOOLS_AUTOMAKE} +. if empty(_TOOLS_AUTOMAKE_LINKS:M${_t_}) +. for _s_ in ${_TOOLS_AUTOMAKE.${_t_}} +TOOLS_GNU_MISSING+= ${_s_} +. endfor +. endif +. endfor +. undef _s_ +. undef _t_ +.endif + +.if !empty(USE_TOOLS:Mgettext-m4) +BUILD_DEPENDS+= {gettext-0.10.35nb1,gettext-m4-[0-9]*}:../../devel/gettext-m4 +.endif diff --git a/mk/tools/bsd.tools.mk b/mk/tools/bsd.tools.mk new file mode 100644 index 00000000000..a3b976d3124 --- /dev/null +++ b/mk/tools/bsd.tools.mk @@ -0,0 +1,182 @@ +# $NetBSD: bsd.tools.mk,v 1.1 2005/04/15 00:00:21 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. +# +# The following variables specify the details of each <tool>: +# +# TOOLS_CMD.<tool> is the path to the tool under ${TOOLS_DIR} +# +# TOOLS_REAL_CMD.<tool> is the path to the actual command that is +# invoked when ${TOOLS_CMD.<tool>} is called. +# +# If TOOLS_REAL_CMD.<tool> isn't provided, then we search for the a tool +# with the name "<tool>" in ${TOOLS_EXECDIRS.<tool>}, which defaults to +# ${TOOLS_EXECDIRS} == "/bin /sbin /usr/bin /usr/sbin". +# +# The following variables specify further details of each <tool> and +# are used only by tools listed in TOOLS_WRAP: +# +# TOOLS_ARGS.<tool> additional arguments that are passed to the real +# command ahead of any command-line arguments. +# +# TOOLS_REAL_CMDLINE.<tool> specifies the full command-line to invoke +# in the wrapper script when <tool> is called. By default, this +# is built up from TOOLS_REAL_CMD.<tool> and TOOLS_ARGS.<tool>. +# +# The following variables provide shortcuts for creating certain classes +# of tools: +# +# TOOLS_NOOP is a list of tools that do nothing and return true. +# +# TOOLS_BROKEN is a list of tools that do nothing and return false. +# +# TOOLS_GNU_MISSING is a list of tools for which the GNU missing +# script is invoked in place of the real tool. This is used +# primarily to hide GNU auto* tools. +# + +.if !defined(BSD_TOOLS_MK) +BSD_TOOLS_MK= defined + +.include "../../mk/bsd.prefs.mk" + +# Prepend ${TOOLS_DIR}/bin to the PATH so that our scripts are found +# first when searching for executables. +# +TOOLS_DIR= ${WRKDIR}/.tools +PREPEND_PATH+= ${TOOLS_DIR}/bin +TOOLS_EXECDIRS= /bin /sbin /usr/bin /usr/sbin + +TOOLS_SHELL?= ${SH} +_TOOLS_WRAP_LOG= ${WRKLOG} + +.PHONY: do-tools override-tools +do-tools: override-tools +override-tools: .OPTIONAL + +USE_TOOLS?= # empty + +.include "../../mk/tools/automake.mk" +.include "../../mk/tools/autoconf.mk" +.include "../../mk/tools/texinfo.mk" +.include "../../mk/tools/rpcgen.mk" +.include "../../mk/tools/replace.mk" +.include "../../mk/tools/make.mk" + +###################################################################### + +.for _t_ in ${TOOLS_NOOP} +TOOLS_WRAP+= ${_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_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_REAL_CMD.${_t_}?= ${PKGSRCDIR}/mk/gnu-config/missing +TOOLS_REAL_CMDLINE.${_t_}?= ${TOOLS_REAL_CMD.${_t_}} ${_t_:T:C/-[0-9].*$//} +.endfor +.undef _t_ + +###################################################################### + +# If TOOLS_REAL_CMD.<tool> isn't defined, then search the directories +# listed in TOOLS_EXECDIRS.<tool> for something called <tool>. The +# default wrapper script will invoke the real command, followed by +# any arguments specified in TOOLS_ARGS.*, followed by any command-line +# arguments passed to the wrapper script. +# +.for _t_ in ${TOOLS_WRAP} +. if !defined(TOOLS_REAL_CMD.${_t_}) +TOOLS_EXECDIRS.${_t_}?= ${TOOLS_EXECDIRS} +. for _d_ in ${TOOLS_EXECDIRS.${_t_}} +. if exists(${_d_}/${_t_}) +TOOLS_REAL_CMD.${_t_}?= ${_d_}/${_t_} +. endif +. endfor +. undef _d_ +TOOLS_REAL_CMD.${_t_}?= ${FALSE} +. endif +TOOLS_ARGS.${_t_}?= # empty +TOOLS_REAL_CMDLINE.${_t_}?= ${TOOLS_REAL_CMD.${_t_}} ${TOOLS_ARGS.${_t_}} "$$@" +TOOLS_CMD.${_t_}?= ${TOOLS_DIR}/bin/${_t_} + +# Small optimization: exec the command if it points to a real command +# (specified by a full path). +# +. if !empty(TOOLS_REAL_CMDLINE.${_t_}:C/^/_asdf_/1:M_asdf_/*) +_TOOLS_EXEC.${_t_}= exec +. else +_TOOLS_EXEC.${_t_}= # empty +. endif + +. if !empty(TOOLS_CMD.${_t_}:M${TOOLS_DIR}/*) && \ + !target(${TOOLS_CMD.${_t_}}) +override-tools: ${TOOLS_CMD.${_t_}} +${TOOLS_CMD.${_t_}}: + ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H} + ${_PKG_SILENT}${_PKG_DEBUG} \ + ( ${ECHO} '#!'${TOOLS_SHELL:Q}; \ + ${ECHO} 'wrapperlog="$${TOOLS_WRAPPER_LOG-'${_TOOLS_WRAP_LOG:Q}'}"'; \ + ${ECHO} '${ECHO} "[*] '${TOOLS_CMD.${_t_}:Q}' $$*" >> $$wrapperlog'; \ + ${ECHO} '${ECHO} "<.> '${TOOLS_REAL_CMDLINE.${_t_}:Q}'" >> $$wrapperlog'; \ + ${ECHO} ${_TOOLS_EXEC.${_t_}:Q} ${TOOLS_REAL_CMDLINE.${_t_}:Q}; \ + ) > ${.TARGET} + ${_PKG_SILENT}${_PKG_DEBUG}${CHMOD} +x ${.TARGET} +. endif +.endfor +.undef _t_ + +###################################################################### + +# If TOOLS_REAL_CMD.<tool> isn't defined, then search the directories +# listed in TOOLS_EXECDIRS.<tool> for something called <tool>. By +# default, the symlinked tool in ${TOOLS_DIR} will have the same name as +# the real command. +# +.for _t_ in ${TOOLS_SYMLINK} +. if !defined(TOOLS_REAL_CMD.${_t_}) +TOOLS_EXECDIRS.${_t_}?= ${TOOLS_EXECDIRS} +. for _d_ in ${TOOLS_EXECDIRS.${_t_}} +. if exists(${_d_}/${_t_}) +TOOLS_REAL_CMD.${_t_}?= ${_d_}/${_t_} +. endif +. endfor +. undef _d_ +TOOLS_REAL_CMD.${_t_}?= ${FALSE} +. endif +TOOLS_CMD.${_t_}?= \ + ${TOOLS_REAL_CMD.${_t_}:C/.*\/${TOOLS_REAL_CMD.${_t_}:H:T}\//${TOOLS_DIR}\/${TOOLS_REAL_CMD.${_t_}:H:T}\//} + +. if !empty(TOOLS_CMD.${_t_}:M${TOOLS_DIR}/*) && \ + !target(${TOOLS_CMD.${_t_}}) && exists(${TOOLS_REAL_CMD.${_t_}}) +override-tools: ${TOOLS_CMD.${_t_}} +${TOOLS_CMD.${_t_}}: ${TOOLS_REAL_CMD.${_t_}} + ${_PKG_SILENT}${_PKG_DEBUG} \ + if ${TEST} -x "${TOOLS_REAL_CMD.${_t_}}"; then \ + ${MKDIR} ${.TARGET:H}; \ + ${LN} -sf ${TOOLS_REAL_CMD.${_t_}} ${.TARGET}; \ + fi +. endif +.endfor +.undef _t_ + +.endif # BSD_TOOLS_MK diff --git a/mk/tools/make.mk b/mk/tools/make.mk new file mode 100644 index 00000000000..1cd3a4a9792 --- /dev/null +++ b/mk/tools/make.mk @@ -0,0 +1,11 @@ +# $NetBSD: make.mk,v 1.1 2005/04/15 00:00:21 jlam Exp $ + +# Always provide a symlink from ${TOOLS_DIR}/bin/make to the "make" +# used to build the package. This lets a bare "make" invoke the +# correct program if called from within a makefile or script. +# +TOOLS_SYMLINK+= make +TOOLS_CMD.make= ${TOOLS_DIR}/bin/make +.if !empty(MAKE_PROGRAM:M/*) +TOOLS_REAL_CMD.make= ${MAKE_PROGRAM} +.endif diff --git a/mk/tools/replace.mk b/mk/tools/replace.mk new file mode 100644 index 00000000000..feafbc5cd3e --- /dev/null +++ b/mk/tools/replace.mk @@ -0,0 +1,306 @@ +# $NetBSD: replace.mk,v 1.1 2005/04/15 00:00:21 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. +# +# The tools that could be replaced with pkgsrc counterparts (usually +# GNU versions of the tools) should be listed in each package Makefile +# as: +# +# USE_TOOLS+= awk gmake lex +# +# If a package requires yacc to generate a parser, then the package +# Makefile should contain one of the following two lines: +# +# USE_TOOLS+= yacc # any yacc will do +# USE_TOOLS+= bison # requires bison-specific features +# +# Adding either "yacc" or "bison" to USE_TOOLS will cause a "yacc" tool +# to be generated that may be used as a yacc-replacement. +# + +# Continue to allow USE_GNU_TOOLS and USE_TBL until packages have been +# taught to use the new syntax. +# +.for _t_ in ${USE_GNU_TOOLS} +. if "${_t_}" == "make" +USE_TOOLS+= gmake +. else +USE_TOOLS+= ${_t_} +. endif +.endfor +.if defined(USE_TBL) && !empty(USE_TBL:M[yY][eE][sS]) +USE_TOOLS+= tbl +.endif + +.if defined(USE_PERL5) +USE_TOOLS+= perl +.endif + +# Only allow one of "bison" and "yacc". +.if !empty(USE_TOOLS:Mbison) && !empty(USE_TOOLS:Myacc) +PKG_FAIL_REASON+= "\`\`bison'' and \`\`yacc'' conflict in USE_TOOLS." +.endif + +# This is an exhaustive list of tools for which we have pkgsrc +# replacements. +# +_TOOLS_REPLACE_LIST= awk bison gmake grep lex m4 patch perl sed tbl yacc + +# TOOL variable names associated with each of the tools +_TOOLS_VARNAME.awk= AWK +_TOOLS_VARNAME.bison= YACC +_TOOLS_VARNAME.gmake= GMAKE +_TOOLS_VARNAME.grep= GREP +_TOOLS_VARNAME.lex= LEX +_TOOLS_VARNAME.m4= M4 +_TOOLS_VARNAME.patch= PATCH +_TOOLS_VARNAME.perl= PERL5 +_TOOLS_VARNAME.sed= SED +_TOOLS_VARNAME.tbl= TBL +_TOOLS_VARNAME.yacc= YACC + +###################################################################### + +# For each tool, _TOOLS_USE_PLATFORM.<tool> is a list of platforms for +# which we will use the system-supplied tool instead of the pkgsrc +# version. +# +# This table should probably be split amongst the various mk/platform +# files as they are ${OPSYS}-specific. +# +_TOOLS_USE_PLATFORM.awk= FreeBSD-*-* Linux-*-* OpenBSD-*-* \ + NetBSD-1.[0-6]*-* DragonFly-*-* \ + SunOS-*-* Interix-*-* +_TOOLS_USE_PLATFORM.bison= Linux-*-* +_TOOLS_USE_PLATFORM.gmake= Darwin-*-* +_TOOLS_USE_PLATFORM.grep= Darwin-*-* FreeBSD-*-* Linux-*-* \ + NetBSD-*-* OpenBSD-*-* DragonFly-*-* \ + SunOS-*-* +_TOOLS_USE_PLATFORM.lex= FreeBSD-*-* Linux-*-* NetBSD-*-* \ + OpenBSD-*-* DragonFly-*-* +_TOOLS_USE_PLATFORM.m4= # empty +_TOOLS_USE_PLATFORM.patch= Darwin-*-* FreeBSD-*-* Linux-*-* \ + NetBSD-*-* OpenBSD-*-* DragonFly-*-* \ + SunOS-*-* +_TOOLS_USE_PLATFORM.perl= # This should always be empty. +_TOOLS_USE_PLATFORM.sed= FreeBSD-*-* Linux-*-* NetBSD-*-* \ + DragonFly-*-* SunOS-*-* Interix-*-* +_TOOLS_USE_PLATFORM.tbl= FreeBSD-*-* NetBSD-*-* OpenBSD-*-* \ + DragonFly-*-* +_TOOLS_USE_PLATFORM.yacc= FreeBSD-*-* NetBSD-*-* OpenBSD-*-* \ + DragonFly-*-* + +###################################################################### + +# _TOOLS_USE_PKGSRC.<prog> is "yes" or "no" depending on whether we're +# using a pkgsrc-supplied tool to replace the system-supplied one. +# +# This currently uses ${OPSYS}-based checking and ignores the scenario +# where your kernel and userland aren't in sync. This should be turned +# into a bunch of feature tests in the future. +# +.for _t_ in ${_TOOLS_REPLACE_LIST} +. for _pattern_ in ${_TOOLS_USE_PLATFORM.${_t_}} +. if !empty(MACHINE_PLATFORM:M${_pattern_}) +_TOOLS_USE_PKGSRC.${_t_}?= no +. endif +. endfor +. undef _pattern_ +_TOOLS_USE_PKGSRC.${_t_}?= yes +.endfor +.undef _t_ + +###################################################################### + +# 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. +# +.if !defined(TOOLS_IGNORE.awk) && !empty(USE_TOOLS:Mawk) +. if !empty(PKGPATH:Mlang/gawk) +MAKEFLAGS+= TOOLS_IGNORE.awk= +. else +. if !empty(_TOOLS_USE_PKGSRC.awk:M[yY][eE][sS]) +BUILD_DEPENDS+= gawk>=3.1.1:../../lang/gawk +TOOLS_REAL_CMD.awk= ${LOCALBASE}/bin/${GNU_PROGRAM_PREFIX}awk +${_TOOLS_VARNAME.awk}= ${TOOLS_REAL_CMD.awk} +. endif +TOOLS_SYMLINK+= awk +TOOLS_CMD.awk= ${TOOLS_DIR}/bin/awk +. endif +.endif + +.if !defined(TOOLS_IGNORE.bison) && !empty(USE_TOOLS:Mbison) +. if !empty(PKGPATH:Mdevel/bison) +MAKEFLAGS+= TOOLS_IGNORE.bison= +. else +. if !empty(_TOOLS_USE_PKGSRC.bison:M[yY][eE][sS]) +BUILD_DEPENDS+= bison>=1.0:../../devel/bison +TOOLS_REAL_CMD.bison= ${LOCALBASE}/bin/bison +. endif +TOOLS_WRAP+= bison +TOOLS_CMD.bison= ${TOOLS_DIR}/bin/yacc +TOOLS_ARGS.bison= -y +${_TOOLS_VARNAME.bison}= ${TOOLS_REAL_CMD.bison} ${TOOLS_ARGS.bison} +. endif +.endif + +.if !defined(TOOLS_IGNORE.gmake) && !empty(USE_TOOLS:Mgmake) +. if !empty(PKGPATH:Mdevel/gmake) +MAKEFLAGS+= TOOLS_IGNORE.gmake= +. else +. if !empty(_TOOLS_USE_PKGSRC.gmake:M[yY][eE][sS]) +BUILD_DEPENDS+= gmake>=3.78:../../devel/gmake +TOOLS_REAL_CMD.gmake= ${LOCALBASE}/bin/gmake +${_TOOLS_VARNAME.gmake}= ${TOOLS_REAL_CMD.gmake} +. endif +TOOLS_SYMLINK+= gmake +TOOLS_CMD.gmake= ${TOOLS_DIR}/bin/gmake +. endif +.endif + +.if !defined(TOOLS_IGNORE.grep) && !empty(USE_TOOLS:Mgrep) +. if !empty(PKGPATH:Mtextproc/grep) +MAKEFLAGS+= TOOLS_IGNORE.grep= +. else +. if !empty(_TOOLS_USE_PKGSRC.grep:M[yY][eE][sS]) +BUILD_DEPENDS+= grep>=2.5.1:../../textproc/grep +TOOLS_REAL_CMD.grep= ${LOCALBASE}/bin/${GNU_PROGRAM_PREFIX}grep +${_TOOLS_VARNAME.grep}= ${TOOLS_REAL_CMD.grep} +. endif +TOOLS_SYMLINK+= grep +TOOLS_CMD.grep= ${TOOLS_DIR}/bin/grep +. endif +.endif + +.if !defined(TOOLS_IGNORE.lex) && !empty(USE_TOOLS:Mlex) +. if !empty(PKGPATH:Mdevel/flex) +MAKEFLAGS+= TOOLS_IGNORE.lex= +. else +. if !empty(_TOOLS_USE_PKGSRC.lex:M[yY][eE][sS]) +. include "../../devel/flex/buildlink3.mk" +TOOLS_REAL_CMD.lex= ${LOCALBASE}/bin/flex +${_TOOLS_VARNAME.lex}= ${TOOLS_REAL_CMD.lex} +. endif +TOOLS_SYMLINK+= lex +TOOLS_CMD.lex= ${TOOLS_DIR}/bin/lex +. endif +.endif + +.if !defined(TOOLS_IGNORE.m4) && !empty(USE_TOOLS:Mm4) +. if !empty(PKGPATH:Mdevel/m4) +MAKEFLAGS+= TOOLS_IGNORE.m4= +. else +. if !empty(_TOOLS_USE_PKGSRC.m4:M[yY][eE][sS]) +BUILD_DEPENDS+= m4>=1.4:../../devel/m4 +TOOLS_REAL_CMD.m4= ${LOCALBASE}/bin/gm4 +${_TOOLS_VARNAME.m4}= ${TOOLS_REAL_CMD.m4} +. endif +TOOLS_SYMLINK+= m4 +TOOLS_CMD.m4= ${TOOLS_DIR}/bin/m4 +. endif +.endif + +.if !defined(TOOLS_IGNORE.patch) && !empty(USE_TOOLS:Mpatch) +. if !empty(PKGPATH:Mdevel/patch) +MAKEFLAGS+= TOOLS_IGNORE.patch= +. else +. if !empty(_TOOLS_USE_PKGSRC.patch:M[yY][eE][sS]) +BUILD_DEPENDS+= patch>=2.2:../../devel/patch +TOOLS_REAL_CMD.patch= ${LOCALBASE}/bin/gpatch +${_TOOLS_VARNAME.patch}= ${TOOLS_REAL_CMD.patch} +. endif +TOOLS_SYMLINK+= patch +TOOLS_CMD.patch= ${TOOLS_DIR}/bin/patch +. endif +.endif + +.if !defined(TOOLS_IGNORE.perl) && !empty(USE_TOOLS:Mperl) +. if !empty(PKGPATH:Mlang/perl5) +MAKEFLAGS+= TOOLS_IGNORE.perl= +. else +. if !empty(_TOOLS_USE_PKGSRC.perl:M[yY][eE][sS]) +. include "../../lang/perl5/buildlink3.mk" +TOOLS_REAL_CMD.perl= ${LOCALBASE}/bin/perl +${_TOOLS_VARNAME.perl}= ${TOOLS_REAL_CMD.perl} +. endif +TOOLS_SYMLINK+= perl +TOOLS_CMD.perl= ${TOOLS_DIR}/bin/perl +. endif +.endif + +.if !defined(TOOLS_IGNORE.sed) && !empty(USE_TOOLS:Msed) +. if !empty(PKGPATH:Mtextproc/sed) +MAKEFLAGS+= TOOLS_IGNORE.sed= +. else +. if !empty(_TOOLS_USE_PKGSRC.sed:M[yY][eE][sS]) +BUILD_DEPENDS+= gsed>=3.0.2:../../textproc/gsed +TOOLS_REAL_CMD.sed= ${LOCALBASE}/bin/${GNU_PROGRAM_PREFIX}sed +${_TOOLS_VARNAME.sed}= ${TOOLS_REAL_CMD.sed} +. endif +TOOLS_SYMLINK+= sed +TOOLS_CMD.sed= ${TOOLS_DIR}/bin/sed +. endif +.endif + +.if !defined(TOOLS_IGNORE.tbl) && !empty(USE_TOOLS:Mtbl) +. if !empty(PKGPATH:Mtextproc/groff) +MAKEFLAGS+= TOOLS_IGNORE.tbl= +. else +. if !empty(_TOOLS_USE_PKGSRC.tbl:M[yY][eE][sS]) +BUILD_DEPENDS+= groff>=1.19nb4:../../textproc/groff +TOOLS_REAL_CMD.tbl= ${LOCALBASE}/bin/tbl +${_TOOLS_VARNAME.tbl}= ${TOOLS_REAL_CMD.tbl} +. endif +TOOLS_SYMLINK+= tbl +TOOLS_CMD.tbl= ${TOOLS_DIR}/bin/tbl +. endif +.endif + +.if !defined(TOOLS_IGNORE.yacc) && !empty(USE_TOOLS:Myacc) +. if !empty(PKGPATH:Mdevel/bison) +MAKEFLAGS+= TOOLS_IGNORE.yacc= +. else +. if !empty(_TOOLS_USE_PKGSRC.yacc:M[yY][eE][sS]) +BUILD_DEPENDS+= bison>=1.0:../../devel/bison +TOOLS_REAL_CMD.yacc= ${LOCALBASE}/bin/bison +TOOLS_ARGS.yacc= -y +${_TOOLS_VARNAME.yacc}= ${TOOLS_REAL_CMD.yacc} ${TOOLS_ARGS.yacc} +TOOLS_WRAP+= yacc +. else +TOOLS_SYMLINK+= yacc +. endif +TOOLS_CMD.yacc= ${TOOLS_DIR}/bin/yacc +. endif +.endif + +###################################################################### + +# Set TOOLS_REAL_CMD.<tool> appropriately in the case where we are +# using the system-supplied tool. Here, we check to see if TOOL is +# defined. If it is, then use that as the path to the real command. +# Otherwise, set TOOL to be TOOLS_REAL_CMD.<tool>, which we defer +# until TOOLS_{WRAP,SYMLINK} is processed within bsd.tools.mk. +# +# Also, set the TOOL name for each tool to point to the real command +# in the event that it's not predefined, e.g. TBL, YACC. +# +.for _t_ in ${_TOOLS_REPLACE_LIST} +. if !defined(TOOLS_IGNORE.${_t_}) && !empty(USE_TOOLS:M${_t_}) && \ + !empty(_TOOLS_USE_PKGSRC.${_t_}:M[nN][oO]) +. if defined(${_TOOLS_VARNAME.${_t_}}) +. if !empty(${_TOOLS_VARNAME.${_t_}}:M/*) +TOOLS_REAL_CMD.${_t_}?= \ + ${${_TOOLS_VARNAME.${_t_}}:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//} +. endif +. else +${_TOOLS_VARNAME.${_t_}}= ${TOOLS_REAL_CMD.${_t_}} +. endif +. endif +.endfor +.undef _t_ diff --git a/mk/tools/rpcgen.mk b/mk/tools/rpcgen.mk new file mode 100644 index 00000000000..37228484d2e --- /dev/null +++ b/mk/tools/rpcgen.mk @@ -0,0 +1,36 @@ +# $NetBSD: rpcgen.mk,v 1.1 2005/04/15 00:00:21 jlam Exp $ + +# Create an rpcgen script that correctly sets the CPP environment +# variable to a stat(2)able path to a C preprocessor, then invokes +# the real rpcgen. +# +.if !defined(TOOLS_REAL_CMD.rpcgen) +TOOLS_EXECDIRS.rpcgen?= ${TOOLS_EXECDIRS} +. for _d_ in ${TOOLS_EXECDIRS.rpcgen} +. if exists(${_d_}/rpcgen) +TOOLS_REAL_CMD.rpcgen?= ${_d_}/rpcgen +. endif +. endfor +. undef _d_ +TOOLS_REAL_CMD.rpcgen?= ${FALSE} +.endif +TOOLS_CMD.rpcgen= ${TOOLS_DIR}/bin/rpcgen +.if ${OPSYS} == "NetBSD" +TOOLS_ARGS.rpcgen?= -b +.endif +RPCGEN?= rpcgen + +.if !target(${TOOLS_CMD.rpcgen}) +override-tools: ${TOOLS_CMD.rpcgen} +${TOOLS_CMD.rpcgen}: + ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H} + ${_PKG_SILENT}${_PKG_DEBUG} \ + ( ${ECHO} '#!'${TOOLS_SHELL:Q}; \ + ${ECHO} 'wrapperlog="$${TOOLS_WRAPPER_LOG-'${_TOOLS_WRAP_LOG:Q}'}"'; \ + ${ECHO} 'CPP='${WRAPPER_BINDIR:Q}'/cpp"; export CPP'; \ + ${ECHO} '${ECHO} "[*] '${TOOLS_CMD.rpcgen:Q}' $$*" >> $$wrapperlog'; \ + ${ECHO} '${ECHO} "<.> '${TOOLS_REAL_CMD.rpcgen:Q} ${TOOLS_ARGS.rpcgen:Q}' $$*" >> $$wrapperlog'; \ + ${ECHO} ${TOOLS_REAL_CMD.rpcgen:Q} ${TOOLS_ARGS.rpcgen:Q} '"$$@"'; \ + ) > ${.TARGET} + ${_PKG_SILENT}${_PKG_DEBUG}${CHMOD} +x ${.TARGET} +.endif diff --git a/mk/tools/texinfo.mk b/mk/tools/texinfo.mk new file mode 100644 index 00000000000..0b7e693c008 --- /dev/null +++ b/mk/tools/texinfo.mk @@ -0,0 +1,22 @@ +# $NetBSD: texinfo.mk,v 1.1 2005/04/15 00:00:21 jlam Exp $ + +# Create an install-info script that is a "no operation" command, as +# registration of info files is handled by the INSTALL script. +# +TOOLS_NOOP+= install-info +CONFIGURE_ENV+= INSTALL_INFO=${TOOLS_CMD.install-info:Q} +MAKE_ENV+= INSTALL_INFO=${TOOLS_CMD.install-info:Q} + +# Create a makeinfo script that will invoke the right makeinfo command +# if USE_MAKEINFO is "yes" or will exit on error if not. MAKEINFO is +# defined by mk/texinfo.mk if USE_MAKEINFO is "yes". +# +USE_MAKEINFO?= no +.if empty(USE_MAKEINFO:M[nN][oO]) +TOOLS_SYMLINK+= makeinfo +TOOLS_REAL_CMD.makeinfo= ${MAKEINFO} +.else +TOOLS_BROKEN+= makeinfo +.endif +CONFIGURE_ENV+= MAKEINFO=${TOOLS_CMD.makeinfo:Q} +MAKE_ENV+= MAKEINFO=${TOOLS_CMD.makeinfo:Q} |