diff options
author | jperkin <jperkin@pkgsrc.org> | 2012-12-06 11:36:30 +0000 |
---|---|---|
committer | jperkin <jperkin@pkgsrc.org> | 2012-12-06 11:36:30 +0000 |
commit | fd61cb92740bc60c6a0ab08b35c0aa84934f97c1 (patch) | |
tree | 84f766bb8b9cbffe0b57fcfa317b3e88d3d29f7f | |
parent | 16bda8a30b466dc3d329ef7392347b7f254aef47 (diff) | |
download | pkgsrc-fd61cb92740bc60c6a0ab08b35c0aa84934f97c1.tar.gz |
Introduce PKGGNUDIR as a way to control gnu prefix.
By default pkgsrc uses LOCABASE/gnu as a prefix for packages to install
native versions of GNU tools, which are them symbolically linked back to
the 'g' versions of the files in LOCALBASE, and users can then add
LOCALBASE/gnu/bin to PATH to pick up those tools.
On systems where the GNU environment is desired, PKGGNUDIR now allows
users to install the non-'g' files directly into LOCALBASE, making them
the default without having to alter PATH, whilst retaining the 'g' files
in order to ensure dependencies and tool paths remain the same.
-rw-r--r-- | mk/bsd.pkg.mk | 3 | ||||
-rw-r--r-- | mk/build/bsd.build-vars.mk | 3 | ||||
-rw-r--r-- | mk/defaults/mk.conf | 10 | ||||
-rw-r--r-- | mk/install/install.mk | 10 | ||||
-rw-r--r-- | mk/plist/plist-gnu.awk | 50 | ||||
-rw-r--r-- | mk/plist/plist.mk | 5 | ||||
-rw-r--r-- | mk/plist/print-plist.mk | 4 |
7 files changed, 76 insertions, 9 deletions
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk index 15944e01deb..c0a5e6d2d62 100644 --- a/mk/bsd.pkg.mk +++ b/mk/bsd.pkg.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.pkg.mk,v 1.1982 2012/07/18 12:29:12 obache Exp $ +# $NetBSD: bsd.pkg.mk,v 1.1983 2012/12/06 11:36:30 jperkin Exp $ # # This file is in the public domain. # @@ -194,6 +194,7 @@ BSD_MAKE_ENV+= MKHTML=no _BUILD_DEFS= ${BUILD_DEFS} _BUILD_DEFS+= LOCALBASE +_BUILD_DEFS+= PKGGNUDIR _BUILD_DEFS+= PKGINFODIR _BUILD_DEFS+= PKGMANDIR _BUILD_DEFS+= _USE_DESTDIR diff --git a/mk/build/bsd.build-vars.mk b/mk/build/bsd.build-vars.mk index fe63c62a338..c86c9a9a052 100644 --- a/mk/build/bsd.build-vars.mk +++ b/mk/build/bsd.build-vars.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.build-vars.mk,v 1.7 2011/09/08 20:17:15 abs Exp $ +# $NetBSD: bsd.build-vars.mk,v 1.8 2012/12/06 11:36:31 jperkin Exp $ # # Package-settable variables: # @@ -40,6 +40,7 @@ MAKE_ENV+= X11BASE=${X11BASE:Q} MAKE_ENV+= X11PREFIX=${X11PREFIX:Q} MAKE_ENV+= PKGMANDIR=${PKGMANDIR:Q} MAKE_ENV+= PKGINFODIR=${PKGINFODIR:Q} +MAKE_ENV+= PKGGNUDIR=${PKGGNUDIR:Q} # Provide a consistent environment for packages using (Net)BSD-style # Makefiles. diff --git a/mk/defaults/mk.conf b/mk/defaults/mk.conf index 50d4b3bc8fe..227d413108b 100644 --- a/mk/defaults/mk.conf +++ b/mk/defaults/mk.conf @@ -1,4 +1,4 @@ -# $NetBSD: mk.conf,v 1.217 2012/11/10 17:13:37 ryoon Exp $ +# $NetBSD: mk.conf,v 1.218 2012/12/06 11:36:31 jperkin Exp $ # # This file provides default values for variables that may be overridden @@ -307,6 +307,14 @@ PKGMANDIR?= man # # See also: PKGINFODIR +PKGGNUDIR?= gnu/ +# The subdirectory of PREFIX that holds gnu programs and manual pages. +# Making this value empty can be useful when trying to build a fully +# GNU environment. +# +# Possible: Any sane pathname including a trailing slash, or empty to +# install into LOCALBASE + BSDSRCDIR?= /usr/src # Where the NetBSD src module source tree is located # used in the emulators/plex86, emulators/vmware-module{,3}, net/arla, diff --git a/mk/install/install.mk b/mk/install/install.mk index f41cff58d0b..1894657dc5a 100644 --- a/mk/install/install.mk +++ b/mk/install/install.mk @@ -1,4 +1,4 @@ -# $NetBSD: install.mk,v 1.64 2012/07/28 21:33:48 reed Exp $ +# $NetBSD: install.mk,v 1.65 2012/12/06 11:36:31 jperkin Exp $ # # This file provides the code for the "install" phase. # @@ -39,8 +39,9 @@ # INSTALLATION_DIRS # A list of directories that should be created at the very # beginning of the install phase. These directories are relative -# to ${PREFIX}. As a convenience, a leading man/ is transformed -# to ${PKGMANDIR}, to save package authors from typing too much. +# to ${PREFIX}. As a convenience, a leading gnu/ is transformed +# to ${PKGGNUDIR} and a leading man/ is transformed to +# ${PKGMANDIR}, to save package authors from typing too much. # # AUTO_MKDIRS # INSTALLATION_DIRS_FROM_PLIST @@ -268,7 +269,7 @@ install-makedirs: .if defined(INSTALLATION_DIRS) && !empty(INSTALLATION_DIRS) @${STEP_MSG} "Creating installation directories" ${RUN} \ - for dir in ${INSTALLATION_DIRS:C,^man/,${PKGMANDIR}/,}; do \ + for dir in ${INSTALLATION_DIRS:C,^gnu/,${PKGGNUDIR},:C,^man/,${PKGMANDIR}/,}; do \ case "$$dir" in \ ${PREFIX}/*) \ dir=`${ECHO} "$$dir" | ${SED} "s|^${PREFIX}/||"` ;; \ @@ -292,6 +293,7 @@ install-dirs-from-PLIST: ${CAT} ${PLIST_SRC} \ | sed -n \ -e 's,\\,\\\\,' \ + -e 's,^gnu/,${PKGGNUDIR},' \ -e 's,^man/,${PKGMANDIR}/,' \ -e 's,^info/,${PKGINFODIR}/,' \ -e 's,^share/locale/,${PKGLOCALEDIR}/locale/,' \ diff --git a/mk/plist/plist-gnu.awk b/mk/plist/plist-gnu.awk new file mode 100644 index 00000000000..4613ec0f6e1 --- /dev/null +++ b/mk/plist/plist-gnu.awk @@ -0,0 +1,50 @@ +# $NetBSD: plist-gnu.awk,v 1.1 2012/12/06 11:36:31 jperkin Exp $ +# +# Copyright (c) 2012 The NetBSD Foundation, Inc. +# All rights reserved. +# +# This code is derived from software contributed to The NetBSD Foundation +# by Jonathan Perkin +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +### This awk script handles gnu entries in PLISTs. This script +### requires the following scripts to be included: +### +### plist-functions.awk (print_entry) +### +### Certain environment variables must be set prior to running this script: +### +### PKGGNUDIR is the ${PREFIX}-relative path to the installed GNU files. +### +BEGIN { + # PKGGNUDIR is allowed to be empty so we do not provide a default. + PKGGNUDIR = ENVIRON["PKGGNUDIR"] +} + +### +### Convert gnu/ to ${PKGGNUDIR} for all GNU file entries. +### +/^[^@]/ && \ +/^gnu\// { + sub("^gnu/", PKGGNUDIR) +} diff --git a/mk/plist/plist.mk b/mk/plist/plist.mk index ff0417fa580..ad2a9c2c5f6 100644 --- a/mk/plist/plist.mk +++ b/mk/plist/plist.mk @@ -1,4 +1,4 @@ -# $NetBSD: plist.mk,v 1.43 2012/05/27 14:32:28 cheusov Exp $ +# $NetBSD: plist.mk,v 1.44 2012/12/06 11:36:31 jperkin Exp $ # # This Makefile fragment handles the creation of PLISTs for use by # pkg_create(8). @@ -136,6 +136,7 @@ _PLIST_AWK_ENV+= LIBTOOL_EXPAND=${_LIBTOOL_EXPAND:Q} _PLIST_AWK_ENV+= LS=${TOOLS_LS:Q} _PLIST_AWK_ENV+= MANINSTALL=${_PLIST_MANINSTALL:Q} _PLIST_AWK_ENV+= MANZ=${_MANZ:Q} +_PLIST_AWK_ENV+= PKGGNUDIR=${PKGGNUDIR:Q} _PLIST_AWK_ENV+= PKGMANDIR=${PKGMANDIR:Q} _PLIST_AWK_ENV+= PREFIX=${DESTDIR:Q}${PREFIX:Q} _PLIST_AWK_ENV+= TEST=${TOOLS_TEST:Q} @@ -169,6 +170,7 @@ PLIST_SUBST+= OPSYS=${OPSYS:Q} \ RMDIR=${RMDIR:Q} \ RM=${RM:Q} \ TRUE=${TRUE:Q} \ + PKGGNUDIR=${PKGGNUDIR:Q} \ PKGMANDIR=${PKGMANDIR:Q} .for _var_ in ${PLIST_VARS} @@ -187,6 +189,7 @@ _PLIST_1_AWK+= -f ${PKGSRCDIR}/mk/plist/plist-macros.awk _PLIST_AWK+= -f ${.CURDIR}/../../mk/plist/plist-functions.awk _PLIST_AWK+= -f ${.CURDIR}/../../mk/plist/plist-locale.awk +_PLIST_AWK+= -f ${.CURDIR}/../../mk/plist/plist-gnu.awk _PLIST_AWK+= -f ${.CURDIR}/../../mk/plist/plist-info.awk _PLIST_AWK+= -f ${.CURDIR}/../../mk/plist/plist-man.awk _PLIST_AWK+= -f ${.CURDIR}/../../mk/plist/plist-libtool.awk diff --git a/mk/plist/print-plist.mk b/mk/plist/print-plist.mk index 2caee62d6f8..3874dfad973 100644 --- a/mk/plist/print-plist.mk +++ b/mk/plist/print-plist.mk @@ -1,4 +1,4 @@ -# $NetBSD: print-plist.mk,v 1.20 2012/03/08 23:12:16 wiz Exp $ +# $NetBSD: print-plist.mk,v 1.21 2012/12/06 11:36:31 jperkin Exp $ ### ### Automatic PLIST generation @@ -28,6 +28,7 @@ _PRINT_PLIST_AWK_SUBST+= \ gsub(/${PKGNAME_NOREV}/, "$${PKGNAME}"); \ gsub(/${PKGVERSION:S/./\./g:C/nb[0-9]*$$//}/, "$${PKGVERSION}");\ gsub(/^${PKGLOCALEDIR}\/locale/, "share/locale"); \ + gsub("^${PKGGNUDIR}", "gnu/"); \ gsub("^${PKGINFODIR}/", "info/"); \ gsub("^${PKGMANDIR}/", "man/"); _PRINT_PLIST_AWK_SUBST+=} @@ -176,6 +177,7 @@ print-PLIST: /${DESTDIR:S|/|\\/|g:S/+/\\\\+/g}${PREFIX:S|/|\\/|g}\/\.$$/ { next; } \ /${PKG_DBDIR:S|/|\\/|g}\// { next; } \ { sub("${DESTDIR:S/+/\\\\\\+/g}${PREFIX}/\\\\./", ""); } \ + { sub("^${PKGGNUDIR}", "gnu/"); } \ { sub("^${PKGINFODIR}/", "info/"); } \ { sub("^${PKGMANDIR}/", "man/"); } \ /^${PKG_DBDIR:S|^${PREFIX}/||:S|/|\\/|g}(\/|$$)/ { next; } \ |