summaryrefslogtreecommitdiff
path: root/pkgtools/createbuildlink
diff options
context:
space:
mode:
authorrh <rh@pkgsrc.org>2004-01-14 08:53:57 +0000
committerrh <rh@pkgsrc.org>2004-01-14 08:53:57 +0000
commit6978c69a8a3d1ea9c582d33f48f24cbabfb0825b (patch)
tree5a016834832122b38d8dd376d8274dd164ec8465 /pkgtools/createbuildlink
parentc82551f14cffe08a860220c1d034a0da99348e49 (diff)
downloadpkgsrc-6978c69a8a3d1ea9c582d33f48f24cbabfb0825b.tar.gz
Update createbuildlink to 3.0. This now adds -2 and -3 options to create
either buildlink2.mk or buildlink3.mk files.
Diffstat (limited to 'pkgtools/createbuildlink')
-rw-r--r--pkgtools/createbuildlink/Makefile4
-rwxr-xr-xpkgtools/createbuildlink/files/createbuildlink90
-rw-r--r--pkgtools/createbuildlink/files/createbuildlink.821
3 files changed, 89 insertions, 26 deletions
diff --git a/pkgtools/createbuildlink/Makefile b/pkgtools/createbuildlink/Makefile
index 342de2a57af..6f34267c968 100644
--- a/pkgtools/createbuildlink/Makefile
+++ b/pkgtools/createbuildlink/Makefile
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.20 2003/12/22 01:15:49 uebayasi Exp $
+# $NetBSD: Makefile,v 1.21 2004/01/14 08:53:57 rh Exp $
#
-DISTNAME= createbuildlink-2.9
+DISTNAME= createbuildlink-3.0
WRKSRC= ${WRKDIR}
CATEGORIES= pkgtools sysutils
MASTER_SITES= # Nothing
diff --git a/pkgtools/createbuildlink/files/createbuildlink b/pkgtools/createbuildlink/files/createbuildlink
index 57d1f0cc146..e9774ba8094 100755
--- a/pkgtools/createbuildlink/files/createbuildlink
+++ b/pkgtools/createbuildlink/files/createbuildlink
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: createbuildlink,v 1.16 2003/12/22 01:15:50 uebayasi Exp $
+# $NetBSD: createbuildlink,v 1.17 2004/01/14 08:53:57 rh Exp $
#
# Copyright (c) 2002 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -36,18 +36,22 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
-# Create an initial buildlink2.mk from a package's Makefile and PLIST
+# Create an initial buildlink2.mk or buildlink3.mk from a package's Makefile
+# and PLIST
#
-REV=`echo '$Revision: 1.16 $' | sed 's/\\$//g'`
+REV=`echo '$Revision: 1.17 $' | sed 's/\\$//g'`
tmpdir=/tmp
makefile=Makefile
sedrules=$tmpdir/sedrules.buildlink.$$
PLIST=PLIST
+blver=2
+otherver=3
-args=`getopt j $*`
+args=`getopt j23 $*`
if [ $? != 0 ]; then
- echo "Usage: $0 [-j] > buildlink2.mk"
+ echo "Usage: $0 -2 [-j] > buildlink2.mk"
+ echo " or: $0 -3 > buildlink3.mk"
exit 2
fi
set -- $args
@@ -56,6 +60,14 @@ while [ $# -gt 0 ]; do
-j)
join=YES
;;
+ -2)
+ blver=2
+ otherver=3
+ ;;
+ -3)
+ blver=3
+ otherver=2
+ ;;
--)
shift; break
;;
@@ -67,14 +79,14 @@ done
## some simple integrity checking
##
if [ ! -f $makefile ]; then
- echo "===> Incomplete package! To create a buildlink2.mk <==="
- echo "===> a working $makefile is required! <==="
+ echo "===> Incomplete package! To create a buildlink file <==="
+ echo "===> a working $makefile is required! <==="
exit 1
fi
if [ ! -f "$PLIST" ]; then
- echo "===> Incomplete package! To create a buildlink2.mk <==="
- echo "===> a working PLIST is required! <==="
+ echo "===> Incomplete package! To create a buildlink file <==="
+ echo "===> a working PLIST is required! <==="
exit 1
fi
@@ -121,22 +133,55 @@ sed -f $sedrules <<EOF
#
# This Makefile fragment is included by packages that use $PKGNOVER.
#
-# This file was created automatically using createbuildlink @PKGVERSION@.
+# This file was created automatically using createbuildlink-@PKGVERSION@.
#
+EOF
+
+##
+## buildlink 2
+##
+if [ $blver = 2 ]; then
+
+sed -f $sedrules <<EOF
.if !defined(${PKGUPPER}_BUILDLINK2_MK)
${PKGUPPER}_BUILDLINK2_MK= # defined
+EOF
+
+else # buildlink 3
+
+sed -f $sedrules <<EOF
+BUILDLINK_DEPTH:= \${BUILDLINK_DEPTH}+
+${PKGUPPER}_BUILDLINK3_MK:= \${${PKGUPPER}_BUILDLINK3_MK}+
+
+.if !empty(BUILDLINK_DEPTH:M+)
+BUILDLINK_DEPENDS+= ${PKGNOVER}
+.endif
+
+.if !empty(${PKGUPPER}_BUILDLINK3_MK:M+)
+EOF
+
+fi # buildlink 2/3
+
+sed -f $sedrules <<EOF
BUILDLINK_PACKAGES+= $PKGNOVER
BUILDLINK_DEPENDS.$PKGNOVER?= $PKGNOVER>=$PKGVER
BUILDLINK_PKGSRCDIR.$PKGNOVER?= ../../$CURDIR
+EOF
+
+##
+## buildlink2-only part
+##
+if [ $blver = 2 ]; then
+sed -f $sedrules <<EOF
EVAL_PREFIX+= BUILDLINK_PREFIX.$PKGNOVER=$PKGNOVER
BUILDLINK_PREFIX.${PKGNOVER}_DEFAULT= \${$PREFIX}
EOF
##
-## buildlinked includes
+## buildlinked includes (buildlink2 only)
##
if [ "$join" = "YES" ]; then
for i in `egrep "^include/|/Headers/.*\.h" $PLIST \
@@ -150,7 +195,7 @@ else
fi
##
-## buildlinked libraries
+## buildlinked libraries (buildlink2 only)
##
for i in \
`egrep '^lib/|/Libraries/.*/lib[^\.]*\.a$|/Libraries/.*/lib[^\.]*\.so' $PLIST \
@@ -161,17 +206,24 @@ done
echo ""
+fi ## end of buildlink2-only part
+
##
## buildlinked dependencies
##
for i in $makefile $commons ; do
- [ ! -f $i ] || grep '^.include.*\.\.\/.*\/.*/buildlink2.mk\"' $i |
+ [ ! -f $i ] || grep '^.include.*\.\.\/.*\/.*/buildlink[23].mk\"' $i |
+ sed "s/buildlink$otherver/buildlink$blver/" |
egrep -v '/devel/pkgconfig/|/textproc/intltool/'
done
-grep -l '^.include.*\.\.\/.*\/.*/buildlink2.mk\"' $makefile $commons \
+grep -l '^.include.*\.\.\/.*\/.*/buildlink[23].mk\"' $makefile $commons \
>/dev/null 2>&1 && echo "" # Be careful not to print duplicate \n
##
+## buildlink2-only part
+##
+if [ $blver = 2 ]; then
+##
## main buildlink target for this package
##
echo "BUILDLINK_TARGETS+= ${PKGNOVER}-buildlink"
@@ -185,4 +237,14 @@ echo ""
echo ".endif # ${PKGUPPER}_BUILDLINK2_MK"
+else # buildlink 3
+
+sed -f $sedrules <<EOF
+.endif # ${PKGUPPER}_BUILDLINK3_MK
+
+BUILDLINK_DEPTH:= \${BUILDLINK_DEPTH:S/+\$//}
+EOF
+
+fi # buildlink 2/3
+
rm -f $sedrules
diff --git a/pkgtools/createbuildlink/files/createbuildlink.8 b/pkgtools/createbuildlink/files/createbuildlink.8
index 3fbd2322e33..2a950f67540 100644
--- a/pkgtools/createbuildlink/files/createbuildlink.8
+++ b/pkgtools/createbuildlink/files/createbuildlink.8
@@ -1,4 +1,4 @@
-.\" $NetBSD: createbuildlink.8,v 1.5 2003/04/29 01:36:08 rh Exp $
+.\" $NetBSD: createbuildlink.8,v 1.6 2004/01/14 08:53:57 rh Exp $
.\"
.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -34,15 +34,15 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd April 29, 2003
+.Dd January 14, 2004
.Dt CREATEBUILDLINK 8
.Os
.Sh NAME
.Nm createbuildlink
-.Nd automatic pkgsrc buildlink2.mk generator
+.Nd automatic pkgsrc buildlink2.mk and buildlink3.mk generator
.Sh SYNOPSIS
.Nm
-.Op Fl j
+.Op Fl j23
.Sh DESCRIPTION
.Nm
reads in the
@@ -61,12 +61,15 @@ Join together all .h files in an include directory and list as *.h.
Be careful with this option and only use it if you are sure that the
package in question is the only one providing header files in the PLISTed
directory.
+.It Fl 2
+Create buildlink2.mk style output (the default).
+.It Fl 3
+Create buildlink3.mk style output.
.El
.Pp
While
.Nm
-is supposed to help starting create a
-.Pa buildlink2.mk
+is supposed to help starting create a buildlink file
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
@@ -79,13 +82,11 @@ package directory without some scrutiny.
.Pp
Using
.Nm
-helps maneuver through the initial process of creating a
-.Pa buildlink2.mk
+helps maneuver through the initial process of creating a buildlink
file for a package to be included by depending packages.
Using
.Nm
-is less error-prone than copying an existing
-.Pa buildlink2.mk
+is less error-prone than copying an existing buildlink file
as a template and renaming the entries in there.
.Sh SEE ALSO
.Xr packages 7 ,