summaryrefslogtreecommitdiff
path: root/pkgtools
diff options
context:
space:
mode:
authorrh <rh@pkgsrc.org>2002-09-06 00:36:14 +0000
committerrh <rh@pkgsrc.org>2002-09-06 00:36:14 +0000
commitb056d10cd77035a02de6dad07ee0bbb8b572c17f (patch)
treebc3170c2281587763030cecaa8ff8555842b38c8 /pkgtools
parentff7d893b42017620fe6a39a11e6fedb7dded4820 (diff)
downloadpkgsrc-b056d10cd77035a02de6dad07ee0bbb8b572c17f.tar.gz
Update createbuildlink to 2.0. Now creates buildlink2.mk files. You can
use createbuildlink1 to still create old buildlink.mk files.
Diffstat (limited to 'pkgtools')
-rw-r--r--pkgtools/createbuildlink/DESCR6
-rw-r--r--pkgtools/createbuildlink/Makefile19
-rw-r--r--pkgtools/createbuildlink/PLIST3
-rwxr-xr-xpkgtools/createbuildlink/files/createbuildlink127
-rw-r--r--pkgtools/createbuildlink/files/createbuildlink.817
-rwxr-xr-xpkgtools/createbuildlink/files/createbuildlink1256
6 files changed, 293 insertions, 135 deletions
diff --git a/pkgtools/createbuildlink/DESCR b/pkgtools/createbuildlink/DESCR
index b439912a303..76a7afc8ad8 100644
--- a/pkgtools/createbuildlink/DESCR
+++ b/pkgtools/createbuildlink/DESCR
@@ -1,7 +1,5 @@
This package installs a shell script that will take a Makefile
and a PLIST file of an existing package and create an initial
-buildlink.mk file from it. The script tries to interpret the
+buildlink2.mk file from it. The script tries to interpret the
contents of the include and lib subdirectories (if any) of the
-package and add the corresponding BUILDLINK files. In addition
-it tries to identify possible config scripts and create the
-corresponding wrapper entries for them.
+package and add the corresponding BUILDLINK files.
diff --git a/pkgtools/createbuildlink/Makefile b/pkgtools/createbuildlink/Makefile
index c03b6d759df..b0114a0f9a8 100644
--- a/pkgtools/createbuildlink/Makefile
+++ b/pkgtools/createbuildlink/Makefile
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.6 2002/05/11 11:52:05 rh Exp $
+# $NetBSD: Makefile,v 1.7 2002/09/06 00:36:14 rh Exp $
#
-DISTNAME= createbuildlink-1.5
+DISTNAME= createbuildlink-2.0
CATEGORIES= pkgtools sysutils
MASTER_SITES= # Nothing
DISTFILES= # Nothing
@@ -16,15 +16,18 @@ NO_BUILD= yes
NO_PATCH= yes
EXTRACT_CMD= ${ECHO}
+SCRIPT= ${DISTNAME:C/-.*$//}
+
do-configure:
+.for scr in ${SCRIPT} ${SCRIPT}1
${SED} -e 's/@PKGVERSION@/${PKGVERSION}/' \
- < ${FILESDIR}/${DISTNAME:C/-.*$//} \
- > ${WRKSRC}/${DISTNAME:C/-.*$//}
+ < ${FILESDIR}/${scr} > ${WRKSRC}/${scr}
+.endfor
do-install:
- ${INSTALL_SCRIPT} ${WRKSRC}/${DISTNAME:C/-.*$//} \
- ${PREFIX}/bin/${DISTNAME:C/-.*$//}
- ${INSTALL_MAN} ${FILESDIR}/${DISTNAME:C/-.*$//}.8 \
- ${PREFIX}/man/man8
+.for scr in ${SCRIPT} ${SCRIPT}1
+ ${INSTALL_SCRIPT} ${WRKSRC}/${scr} ${PREFIX}/bin/${scr}
+.endfor
+ ${INSTALL_MAN} ${FILESDIR}/${SCRIPT}.8 ${PREFIX}/man/man8
.include "../../mk/bsd.pkg.mk"
diff --git a/pkgtools/createbuildlink/PLIST b/pkgtools/createbuildlink/PLIST
index 44a0c7e9163..c7eb64f87f4 100644
--- a/pkgtools/createbuildlink/PLIST
+++ b/pkgtools/createbuildlink/PLIST
@@ -1,3 +1,4 @@
-@comment $NetBSD: PLIST,v 1.1.1.1 2002/04/29 11:03:54 rh Exp $
+@comment $NetBSD: PLIST,v 1.2 2002/09/06 00:36:14 rh Exp $
bin/createbuildlink
+bin/createbuildlink1
man/man8/createbuildlink.8
diff --git a/pkgtools/createbuildlink/files/createbuildlink b/pkgtools/createbuildlink/files/createbuildlink
index 2bd2e27e277..cddf9bc24a5 100755
--- a/pkgtools/createbuildlink/files/createbuildlink
+++ b/pkgtools/createbuildlink/files/createbuildlink
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: createbuildlink,v 1.6 2002/05/11 11:52:06 rh Exp $
+# $NetBSD: createbuildlink,v 1.7 2002/09/06 00:36:14 rh Exp $
#
# Copyright (c) 2002 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -36,10 +36,10 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
-# Create an initial buildlink.mk from a package's Makefile and PLIST
+# Create an initial buildlink2.mk from a package's Makefile and PLIST
#
-REV=`echo '$Revision: 1.6 $' | sed 's/\\$//g'`
+REV=`echo '$Revision: 1.7 $' | sed 's/\\$//g'`
tmpdir=/tmp
makefile=Makefile
sedrules=$tmpdir/sedrules.buildlink.$$
@@ -49,14 +49,14 @@ PLIST=PLIST
## some simple integrity checking
##
if [ ! -f $makefile ]; then
- echo "===> Incomplete package! To create a buildlink.mk <==="
- echo "===> a working $makefile is required! <==="
+ echo "===> Incomplete package! To create a buildlink2.mk <==="
+ echo "===> a working $makefile is required! <==="
exit 1
fi
if [ ! -f "$PLIST" ]; then
- echo "===> Incomplete package! To create a buildlink.mk <==="
- echo "===> a working PLIST is required! <==="
+ echo "===> Incomplete package! To create a buildlink2.mk <==="
+ echo "===> a working PLIST is required! <==="
exit 1
fi
@@ -105,23 +105,13 @@ sed -f $sedrules <<EOF
#
# This file was created automatically using createbuildlink @PKGVERSION@.
#
-# To use this Makefile fragment, simply:
-#
-# (1) Optionally define BUILDLINK_DEPENDS.$PKGNOVER to the dependency pattern
-# for the version of $PKGNOVER desired.
-# (2) Include this Makefile fragment in the package Makefile,
-# (3) Add \${BUILDLINK_DIR}/include to the front of the C preprocessor's header
-# search path, and
-# (4) Add \${BUILDLINK_DIR}/lib to the front of the linker's library search
-# path.
-
-.if !defined(${PKGUPPER}_BUILDLINK_MK)
-${PKGUPPER}_BUILDLINK_MK= # defined
-.include "../../mk/bsd.buildlink.mk"
+.if !defined(${PKGUPPER}_BUILDLINK2_MK)
+${PKGUPPER}_BUILDLINK2_MK= # defined
+BUILDLINK_PACKAGES+= $PKGNOVER
BUILDLINK_DEPENDS.$PKGNOVER?= $PKGNOVER>=$PKGVER
-DEPENDS+= \${BUILDLINK_DEPENDS.$PKGNOVER}:../../$CURDIR
+BUILDLINK_PKGSRCDIR.$PKGNOVER?= ../../$CURDIR
EVAL_PREFIX+= BUILDLINK_PREFIX.$PKGNOVER=$PKGNOVER
BUILDLINK_PREFIX.${PKGNOVER}_DEFAULT= \${$PREFIX}
@@ -148,109 +138,22 @@ echo ""
## buildlinked dependencies
##
for i in $makefile $commons ; do
- [ ! -f $i ] || grep '^.include.*\.\.\/.*\/.*/buildlink.mk\"' $i
+ [ ! -f $i ] || grep '^.include.*\.\.\/.*\/.*/buildlink2.mk\"' $i
done
##
-## check for pkgconfig style config files
-##
-pkgconfigs=`grep "^lib/pkgconfig/.*.pc" $PLIST`
-inplist=`grep "^.include.*devel/pkgconfig/buildlink.mk" $makefile $commons`
-[ -z "$pkgconfigs" -o -n "$inplist" ] || echo ".include \"../../devel/pkgconfig/buildlink.mk\""
-
-##
## main buildlink target for this package
##
echo ""
-echo "BUILDLINK_TARGETS.$PKGNOVER= ${PKGNOVER}-buildlink"
-
-##
-## config wrappers for the buildlink directories
-##
-configs=`grep 'bin/.*-config$' $PLIST`
-
-for i in $configs ; do
- cfg=`echo $i | sed 's|.*/||'`
- blc=`echo $cfg | sed 's|\(.*\)-config|\1-buildlink-config|'`
- echo "BUILDLINK_TARGETS.$PKGNOVER+= $PKGNOVER-$blc-wrapper"
-done
-
-echo "BUILDLINK_TARGETS+= \${BUILDLINK_TARGETS.$PKGNOVER}"
-[ -z "$pkgconfigs" ] || \
-echo "BUILDLINK_TARGETS+= \${BUILDLINK_PKG_CONFIG}"
-echo ""
-
-for i in $configs ; do
- cfg=`echo $i | sed 's|.*/||'`
- ctg=`echo $cfg | sed 's|\(.*\)-config|\1|'`
- echo "BUILDLINK_CONFIG.$PKGNOVER-$ctg= \\"
- echo " \${BUILDLINK_PREFIX.$PKGNOVER}/$i"
- echo "BUILDLINK_CONFIG_WRAPPER.$PKGNOVER-$ctg= \\"
- echo " \${BUILDLINK_DIR}/$i"
- echo "REPLACE_BUILDLINK_SED+= \\"
- echo " -e \"s|\${BUILDLINK_CONFIG_WRAPPER.$PKGNOVER-$ctg}|\${BUILDLINK_CONFIG.$PKGNOVER-$ctg}|g\""
- echo ""
-done
-
-##
-## config wrappers for include and library directories
-##
-if [ -n "$configs" ]; then
- for i in `grep "^include/[^/]*/.*\.h" $PLIST | \
- sed -e 's|/[^/]*\.h$||' | sort | uniq`; do
- dir=$i
- while [ "$dir" != "include" ] ; do
- echo "BUILDLINK_CONFIG_WRAPPER_SED+= \\"
- echo " -e \"s|-I[ ]*\${BUILDLINK_PREFIX.$PKGNOVER}/$dir|-I\${BUILDLINK_DIR}/$dir|g\""
- echo "REPLACE_BUILDLINK_SED+= \\"
- echo " -e \"s|-I\${BUILDLINK_DIR}/$dir|-I\${BUILDLINK_PREFIX.$PKGNOVER}/$dir|g\""
- dir=`echo $dir | sed 's|/[^/]*$||'`
- done
- done
-
- for i in `grep "^lib/.*\.a$" $PLIST | \
- sed -e 's|/[^/]*\.a$||' | sort | uniq`; do
- dir=$i
- while [ "$dir" != "lib" ] ; do
- echo "BUILDLINK_CONFIG_WRAPPER_SED+= \\"
- echo " -e \"s|-L[ ]*\${BUILDLINK_PREFIX.$PKGNOVER}/$dir|-L\${BUILDLINK_DIR}/$dir|g\""
- echo "REPLACE_BUILDLINK_SED+= \\"
- echo " -e \"s|-L\${BUILDLINK_DIR}/$dir|-L\${BUILDLINK_PREFIX.$PKGNOVER}/$dir|g\""
- dir=`echo $dir | sed 's|/[^/]*$||'`
- done
- done
- echo ""
-fi
-
-##
-## environment variables to help dependent packages find config scripts
-##
-if [ -n "$configs" ]; then
- echo '.if defined(USE_CONFIG_WRAPPER)'
- for i in $configs ; do
- cfg=`echo $i | sed 's|.*/||'`
- CFG=`echo $cfg | tr '[:lower:]' '[:upper:]' | tr - _`
- ctg=`echo $cfg | sed 's|\(.*\)-config|\1|'`
- echo "${PKGUPPER}_${CFG}?= \${BUILDLINK_CONFIG_WRAPPER.$PKGNOVER-$ctg}"
- echo "CONFIGURE_ENV+= ${PKGUPPER}_${CFG}=\"\${${PKGUPPER}_${CFG}}\""
- echo "MAKE_ENV+= ${PKGUPPER}_${CFG}=\"\${${PKGUPPER}_${CFG}}\""
- done
- echo ".endif"
- echo ""
-fi
+echo "BUILDLINK_TARGETS+= ${PKGNOVER}-buildlink"
##
## buildlink targets for this package
##
-echo "pre-configure: \${BUILDLINK_TARGETS}"
+echo ""
echo "${PKGNOVER}-buildlink: _BUILDLINK_USE"
-for i in $configs ; do
- cfg=`echo $i | sed 's|.*/||'`
- blc=`echo $cfg | sed 's|\(.*\)-config|\1-buildlink-config|'`
- echo "$PKGNOVER-$blc-wrapper: _BUILDLINK_CONFIG_WRAPPER_USE"
-done
echo ""
-echo ".endif # ${PKGUPPER}_BUILDLINK_MK"
+echo ".endif # ${PKGUPPER}_BUILDLINK2_MK"
rm -f $sedrules
diff --git a/pkgtools/createbuildlink/files/createbuildlink.8 b/pkgtools/createbuildlink/files/createbuildlink.8
index e5e72f559ea..a4e6d2440c6 100644
--- a/pkgtools/createbuildlink/files/createbuildlink.8
+++ b/pkgtools/createbuildlink/files/createbuildlink.8
@@ -1,4 +1,4 @@
-.\" $NetBSD: createbuildlink.8,v 1.2 2002/04/29 11:12:35 wiz Exp $
+.\" $NetBSD: createbuildlink.8,v 1.3 2002/09/06 00:36:14 rh Exp $
.\"
.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -34,12 +34,12 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd April 29, 2002
+.Dd September 6, 2002
.Dt CREATEBUILDLINK 8
.Os
.Sh NAME
.Nm createbuildlink
-.Nd automatic NetBSD buildlink.mk generator
+.Nd automatic NetBSD buildlink2.mk generator
.Sh SYNOPSIS
.Nm
.Sh DESCRIPTION
@@ -50,13 +50,13 @@ and
.Pa PLIST
of a package and creates
an initial
-.Pa buildlink.mk
+.Pa buildlink2.mk
file on stdout.
.Pp
While
.Nm
is supposed to help starting create a
-.Pa buildlink.mk
+.Pa buildlink2.mk
for a package, it is not intended to fly on autopilot.
That means that while the script makes some simplistic attempts
to interpret some elements of the
@@ -70,12 +70,12 @@ package directory without some scrutiny.
Using
.Nm
helps maneuver through the initial process of creating a
-.Pa buildlink.mk
+.Pa buildlink2.mk
file for a package to be included by depending packages.
Using
.Nm
is less error-prone than copying an existing
-.Pa buildlink.mk
+.Pa buildlink2.mk
as a template and renaming the entries in there.
.Sh SEE ALSO
.Xr packages 7 ,
@@ -84,6 +84,3 @@ as a template and renaming the entries in there.
.Nm
was written by
.An Rene Hexel Aq rh@netbsd.org .
-.Sh BUGS
-.Nm
-is in its very early stages. Use with caution!
diff --git a/pkgtools/createbuildlink/files/createbuildlink1 b/pkgtools/createbuildlink/files/createbuildlink1
new file mode 100755
index 00000000000..7b41cb1c5cd
--- /dev/null
+++ b/pkgtools/createbuildlink/files/createbuildlink1
@@ -0,0 +1,256 @@
+#!/bin/sh
+#
+# $NetBSD: createbuildlink1,v 1.1 2002/09/06 00:36:15 rh Exp $
+#
+# Copyright (c) 2002 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Rene Hexel.
+#
+# 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.
+# 3. All advertising materials mentioning features or use of this software
+# must display the following acknowledgement:
+# This product includes software developed by the NetBSD
+# Foundation, Inc. and its contributors.
+# 4. Neither the name of The NetBSD Foundation nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# 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.
+#
+# Create an initial buildlink.mk from a package's Makefile and PLIST
+#
+
+REV=`echo '$Revision: 1.1 $' | sed 's/\\$//g'`
+tmpdir=/tmp
+makefile=Makefile
+sedrules=$tmpdir/sedrules.buildlink.$$
+PLIST=PLIST
+
+##
+## some simple integrity checking
+##
+if [ ! -f $makefile ]; then
+ echo "===> Incomplete package! To create a buildlink.mk <==="
+ echo "===> a working $makefile is required! <==="
+ exit 1
+fi
+
+if [ ! -f "$PLIST" ]; then
+ echo "===> Incomplete package! To create a buildlink.mk <==="
+ echo "===> a working PLIST is required! <==="
+ exit 1
+fi
+
+##
+## try to find any included Makefile.common's
+##
+commons=`grep '^.include.*Makefile.common\"' $makefile | \
+ sed 's/^.*"\(.*\)".*/\1/'`
+
+##
+## package specific variables
+##
+CURDIR=`pwd | sed 's|^.*/\([^/]*/[^/]*\)$|\1|'`
+PKGNAME=`make show-var VARNAME=PKGNAME`
+PKGVER=`echo $PKGNAME | sed -e 's/^.*-//'`
+PKGNOVER=`echo $PKGNAME | sed -e 's/-[^-]*$//'`
+PKGUPPER=`echo $PKGNOVER | tr '[:lower:]' '[:upper:]' | tr - _`
+PREFIX=X11PREFIX
+USE_X11BASE=`make show-var VARNAME=USE_X11BASE`
+if [ -z "$USE_X11BASE" ]; then
+ if ! grep -q "^USE_X11BASE" $makefile $commons ; then
+ PREFIX=LOCALBASE
+ fi
+fi
+
+##
+## create sed rules
+##
+echo >$sedrules "s|@@CURDIR@@|$CURDIR|g"
+echo >>$sedrules "s|@@ID@@|\$NetBSD\$|g"
+echo >>$sedrules "s|@@PKGNAME@@|$PKGNAME|g"
+echo >>$sedrules "s|@@PKGNOVER@@|$PKGNOVER|g"
+echo >>$sedrules "s|@@PKGUPPER@@|$PKGUPPER|g"
+echo >>$sedrules "s|@@PKGVER@@|$PKGVER|g"
+echo >>$sedrules "s|@@PREFIX@@|$PREFIX|g"
+echo >>$sedrules "s|@@REV@@|$REV|g"
+echo >>$sedrules "s|@@PKGVERSION@@|@PKGVERSION@|g"
+
+#
+# buildlink header
+#
+sed -f $sedrules <<EOF
+# @@ID@@
+#
+# This Makefile fragment is included by packages that use $PKGNOVER.
+#
+# This file was created automatically using createbuildlink @PKGVERSION@.
+#
+# To use this Makefile fragment, simply:
+#
+# (1) Optionally define BUILDLINK_DEPENDS.$PKGNOVER to the dependency pattern
+# for the version of $PKGNOVER desired.
+# (2) Include this Makefile fragment in the package Makefile,
+# (3) Add \${BUILDLINK_DIR}/include to the front of the C preprocessor's header
+# search path, and
+# (4) Add \${BUILDLINK_DIR}/lib to the front of the linker's library search
+# path.
+
+.if !defined(${PKGUPPER}_BUILDLINK_MK)
+${PKGUPPER}_BUILDLINK_MK= # defined
+
+.include "../../mk/bsd.buildlink.mk"
+
+BUILDLINK_DEPENDS.$PKGNOVER?= $PKGNOVER>=$PKGVER
+DEPENDS+= \${BUILDLINK_DEPENDS.$PKGNOVER}:../../$CURDIR
+
+EVAL_PREFIX+= BUILDLINK_PREFIX.$PKGNOVER=$PKGNOVER
+BUILDLINK_PREFIX.${PKGNOVER}_DEFAULT= \${$PREFIX}
+EOF
+
+##
+## buildlinked includes
+##
+for i in `grep "^include/" $PLIST`; do
+ echo "BUILDLINK_FILES.$PKGNOVER+= $i"
+done
+
+##
+## buildlinked libraries
+##
+for i in `grep "^lib/" $PLIST | \
+sed -e 's/\.a$/.*/' -e 's/\.la$/.*/' -e 's/\.so.*$/.*/' | sort | uniq`; do
+ echo "BUILDLINK_FILES.$PKGNOVER+= $i"
+done
+
+echo ""
+
+##
+## buildlinked dependencies
+##
+for i in $makefile $commons ; do
+ [ ! -f $i ] || grep '^.include.*\.\.\/.*\/.*/buildlink.mk\"' $i
+done
+
+##
+## check for pkgconfig style config files
+##
+pkgconfigs=`grep "^lib/pkgconfig/.*.pc" $PLIST`
+inplist=`grep "^.include.*devel/pkgconfig/buildlink.mk" $makefile $commons`
+[ -z "$pkgconfigs" -o -n "$inplist" ] || echo ".include \"../../devel/pkgconfig/buildlink.mk\""
+
+##
+## main buildlink target for this package
+##
+echo ""
+echo "BUILDLINK_TARGETS.$PKGNOVER= ${PKGNOVER}-buildlink"
+
+##
+## config wrappers for the buildlink directories
+##
+configs=`grep 'bin/.*-config$' $PLIST`
+
+for i in $configs ; do
+ cfg=`echo $i | sed 's|.*/||'`
+ blc=`echo $cfg | sed 's|\(.*\)-config|\1-buildlink-config|'`
+ echo "BUILDLINK_TARGETS.$PKGNOVER+= $PKGNOVER-$blc-wrapper"
+done
+
+echo "BUILDLINK_TARGETS+= \${BUILDLINK_TARGETS.$PKGNOVER}"
+[ -z "$pkgconfigs" ] || \
+echo "BUILDLINK_TARGETS+= \${BUILDLINK_PKG_CONFIG}"
+echo ""
+
+for i in $configs ; do
+ cfg=`echo $i | sed 's|.*/||'`
+ ctg=`echo $cfg | sed 's|\(.*\)-config|\1|'`
+ echo "BUILDLINK_CONFIG.$PKGNOVER-$ctg= \\"
+ echo " \${BUILDLINK_PREFIX.$PKGNOVER}/$i"
+ echo "BUILDLINK_CONFIG_WRAPPER.$PKGNOVER-$ctg= \\"
+ echo " \${BUILDLINK_DIR}/$i"
+ echo "REPLACE_BUILDLINK_SED+= \\"
+ echo " -e \"s|\${BUILDLINK_CONFIG_WRAPPER.$PKGNOVER-$ctg}|\${BUILDLINK_CONFIG.$PKGNOVER-$ctg}|g\""
+ echo ""
+done
+
+##
+## config wrappers for include and library directories
+##
+if [ -n "$configs" ]; then
+ for i in `grep "^include/[^/]*/.*\.h" $PLIST | \
+ sed -e 's|/[^/]*\.h$||' | sort | uniq`; do
+ dir=$i
+ while [ "$dir" != "include" ] ; do
+ echo "BUILDLINK_CONFIG_WRAPPER_SED+= \\"
+ echo " -e \"s|-I[ ]*\${BUILDLINK_PREFIX.$PKGNOVER}/$dir|-I\${BUILDLINK_DIR}/$dir|g\""
+ echo "REPLACE_BUILDLINK_SED+= \\"
+ echo " -e \"s|-I\${BUILDLINK_DIR}/$dir|-I\${BUILDLINK_PREFIX.$PKGNOVER}/$dir|g\""
+ dir=`echo $dir | sed 's|/[^/]*$||'`
+ done
+ done
+
+ for i in `grep "^lib/.*\.a$" $PLIST | \
+ sed -e 's|/[^/]*\.a$||' | sort | uniq`; do
+ dir=$i
+ while [ "$dir" != "lib" ] ; do
+ echo "BUILDLINK_CONFIG_WRAPPER_SED+= \\"
+ echo " -e \"s|-L[ ]*\${BUILDLINK_PREFIX.$PKGNOVER}/$dir|-L\${BUILDLINK_DIR}/$dir|g\""
+ echo "REPLACE_BUILDLINK_SED+= \\"
+ echo " -e \"s|-L\${BUILDLINK_DIR}/$dir|-L\${BUILDLINK_PREFIX.$PKGNOVER}/$dir|g\""
+ dir=`echo $dir | sed 's|/[^/]*$||'`
+ done
+ done
+ echo ""
+fi
+
+##
+## environment variables to help dependent packages find config scripts
+##
+if [ -n "$configs" ]; then
+ echo '.if defined(USE_CONFIG_WRAPPER)'
+ for i in $configs ; do
+ cfg=`echo $i | sed 's|.*/||'`
+ CFG=`echo $cfg | tr '[:lower:]' '[:upper:]' | tr - _`
+ ctg=`echo $cfg | sed 's|\(.*\)-config|\1|'`
+ echo "${PKGUPPER}_${CFG}?= \${BUILDLINK_CONFIG_WRAPPER.$PKGNOVER-$ctg}"
+ echo "CONFIGURE_ENV+= ${PKGUPPER}_${CFG}=\"\${${PKGUPPER}_${CFG}}\""
+ echo "MAKE_ENV+= ${PKGUPPER}_${CFG}=\"\${${PKGUPPER}_${CFG}}\""
+ done
+ echo ".endif"
+ echo ""
+fi
+
+##
+## buildlink targets for this package
+##
+echo "pre-configure: \${BUILDLINK_TARGETS}"
+echo "${PKGNOVER}-buildlink: _BUILDLINK_USE"
+for i in $configs ; do
+ cfg=`echo $i | sed 's|.*/||'`
+ blc=`echo $cfg | sed 's|\(.*\)-config|\1-buildlink-config|'`
+ echo "$PKGNOVER-$blc-wrapper: _BUILDLINK_CONFIG_WRAPPER_USE"
+done
+
+echo ""
+echo ".endif # ${PKGUPPER}_BUILDLINK_MK"
+
+rm -f $sedrules