summaryrefslogtreecommitdiff
path: root/pkgtools/libnbcompat
diff options
context:
space:
mode:
authortnn <tnn@pkgsrc.org>2008-02-22 04:07:55 +0000
committertnn <tnn@pkgsrc.org>2008-02-22 04:07:55 +0000
commitd3fa34a3c6f2ac8eeb59629384840ef2c6095e92 (patch)
tree721e86dda85e4dab09b98f875505c923f3df7aa3 /pkgtools/libnbcompat
parentccf3d5314b373660acfc0d49dd2987b3679883b0 (diff)
downloadpkgsrc-d3fa34a3c6f2ac8eeb59629384840ef2c6095e92.tar.gz
Introduce a variable, LIBNBCOMPAT_USE_PIC, which if set to yes before
including inplace.mk causes a PIC version of libnbcompat to be built alongside the regular static libnbcompat. This will be used to extend the features framework in two ways: 1) Support linking features into shared modules 2) Ability to cherry-pick individual objects to link from the libnbcompat build directory rather than linking the whole archive.
Diffstat (limited to 'pkgtools/libnbcompat')
-rw-r--r--pkgtools/libnbcompat/inplace.mk32
1 files changed, 26 insertions, 6 deletions
diff --git a/pkgtools/libnbcompat/inplace.mk b/pkgtools/libnbcompat/inplace.mk
index 6dfd24ae108..12c89960c5d 100644
--- a/pkgtools/libnbcompat/inplace.mk
+++ b/pkgtools/libnbcompat/inplace.mk
@@ -1,15 +1,15 @@
-# $NetBSD: inplace.mk,v 1.7 2007/11/20 18:55:25 rillig Exp $
+# $NetBSD: inplace.mk,v 1.8 2008/02/22 04:07:55 tnn Exp $
#
# This file should not be included directly. Use USE_FEATURES instead.
#
# This Makefile fragment builds a working copy of libnbcompat inside
# ${WRKDIR}.
#
-# XXX: Why isn't libnbcompat installed as shared library?
-#
.include "../../mk/bsd.prefs.mk"
+LIBNBCOMPAT_USE_PIC?= no
+
LIBNBCOMPAT_FILESDIR= ${.CURDIR}/../../pkgtools/libnbcompat/files
LIBNBCOMPAT_SRCDIR= ${WRKDIR}/libnbcompat
@@ -17,10 +17,20 @@ CPPFLAGS.nbcompat= -DHAVE_NBCOMPAT_H=1 -I${LIBNBCOMPAT_SRCDIR}
LDFLAGS.nbcompat= -L${LIBNBCOMPAT_SRCDIR}
LDADD.nbcompat= -lnbcompat
+.if !empty(LIBNBCOMPAT_USE_PIC:M[Yy][Ee][Ss])
+LIBNBCOMPAT_PICDIR= ${WRKDIR}/libnbcompat_pic
+CPPFLAGS.nbcompat_pic= -DHAVE_NBCOMPAT_H=1 -I${LIBNBCOMPAT_PICDIR}
+LDFLAGS.nbcompat_pic= -L${LIBNBCOMPAT_PICDIR}
+LDADD.nbcompat_pic= -lnbcompat
+.endif
+
post-extract: libnbcompat-extract
+.PHONY: libnbcompat-extract
libnbcompat-extract:
- ${_PKG_SILENT}${_PKG_DEBUG} \
- ${CP} -R ${LIBNBCOMPAT_FILESDIR} ${LIBNBCOMPAT_SRCDIR}
+ ${RUN} ${CP} -R ${LIBNBCOMPAT_FILESDIR} ${LIBNBCOMPAT_SRCDIR}
+.if !empty(LIBNBCOMPAT_USE_PIC:M[Yy][Ee][Ss])
+ ${RUN} ${CP} -R ${LIBNBCOMPAT_FILESDIR} ${LIBNBCOMPAT_PICDIR}
+.endif
.if !empty(USE_CROSS_COMPILE:M[yY][eE][sS])
NBCOMPAT_CONFIGURE_ARGS+= --build=${NATIVE_MACHINE_GNU_PLATFORM:Q}
@@ -28,12 +38,22 @@ NBCOMPAT_CONFIGURE_ARGS+= --build=${NATIVE_MACHINE_GNU_PLATFORM:Q}
NBCOMPAT_CONFIGURE_ARGS+= --host=${MACHINE_GNU_PLATFORM:Q}
pre-configure: libnbcompat-build
+.PHONY: libnbcompat-build
libnbcompat-build:
@${STEP_MSG} "Configuring and building libnbcompat"
- ${_PKG_SILENT}${_PKG_DEBUG}${_ULIMIT_CMD} \
+ ${RUN} ${_ULIMIT_CMD} \
cd ${LIBNBCOMPAT_SRCDIR} && ${SETENV} \
AWK=${AWK:Q} CC=${CC:Q} CFLAGS=${CFLAGS:M*:Q} \
CPPFLAGS=${CPPFLAGS:M*:Q} \
${CONFIGURE_ENV:NLIBS=*} ${CONFIG_SHELL} \
${CONFIGURE_SCRIPT} ${NBCOMPAT_CONFIGURE_ARGS} && \
${MAKE_PROGRAM}
+.if !empty(LIBNBCOMPAT_USE_PIC:M[Yy][Ee][Ss])
+ @${STEP_MSG} "Configuring and building libnbcompat (PIC version)"
+ ${RUN} ${_ULIMIT_CMD} \
+ cd ${LIBNBCOMPAT_PICDIR} && ${SETENV} \
+ ${CONFIGURE_ENV:NLIBS=*} CFLAGS=${CFLAGS:Q}" -fPIC" \
+ ${CONFIG_SHELL} \
+ ${CONFIGURE_SCRIPT} ${NBCOMPAT_CONFIGURE_ARGS} && \
+ ${MAKE_PROGRAM}
+.endif