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 /mk/plist | |
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.
Diffstat (limited to 'mk/plist')
-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 |
3 files changed, 57 insertions, 2 deletions
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; } \ |