summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authoragc <agc@pkgsrc.org>1999-04-13 14:18:11 +0000
committeragc <agc@pkgsrc.org>1999-04-13 14:18:11 +0000
commitf041c79b79e382c00b40ccf5afc7c164a5138065 (patch)
tree4efddb11ca6545e5aa62f48a5a3b56da7ff52fc4 /mk
parent75f67407927c91ca70ea4ef1e8a48628c874a543 (diff)
downloadpkgsrc-f041c79b79e382c00b40ccf5afc7c164a5138065.tar.gz
Work out the type of shared libraries once, at "make install" time, and
do this dynamically. This means that we no longer have to have a separate pkgsrc copy of bsd.own.mk, which was a maintenance nightmare, and usually out of date, and quite costly too (with a calculation of whether NetBSD-current was being run every time the file was read). Also, on a.out, add ldconfig lines to the generated PLIST only if they're not already there, rather than if they were previously there, and ignore the return value from ldconfig, which cannot be trusted. The ldconfig calls have largely been made obsolete by the use of -rpath, but keep it for just now for backwards compatibility.
Diffstat (limited to 'mk')
-rw-r--r--mk/bsd.pkg.mk38
1 files changed, 30 insertions, 8 deletions
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk
index 62d1b7d7b44..7bfdac26ec0 100644
--- a/mk/bsd.pkg.mk
+++ b/mk/bsd.pkg.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.mk,v 1.251 1999/04/09 02:06:53 hubertf Exp $
+# $NetBSD: bsd.pkg.mk,v 1.252 1999/04/13 14:18:11 agc Exp $
#
# This file is in the public domain.
#
@@ -314,13 +314,13 @@ MTREE_ARGS?= -U -f ${MTREE_FILE} -d -e -p
.if (${OPSYS} == "NetBSD")
NEED_OWN_INSTALL_TARGET= no
-.include "../../mk/bsd.own.mk"
+.include <bsd.own.mk>
SHAREOWN = ${DOCOWN}
SHAREGRP = ${DOCGRP}
SHAREMODE = ${DOCMODE}
.elif (${OPSYS} == "SunOS")
NEED_OWN_INSTALL_TARGET= no
-.include "../../mk/bsd.own.mk"
+.include <bsd.own.mk>
SHAREOWN = ${DOCOWN}
SHAREGRP = ${DOCGRP}
SHAREMODE = ${DOCMODE}
@@ -1337,9 +1337,10 @@ root-install:
'.*/lib[^/]+\.so\.[0-9]+\.[0-9]+$$' \
${PLIST} || ${TRUE}`; \
if [ X"$$sos" != X"" ]; then \
- case "${SHLIB_TYPE}" in \
+ shlib_type=`${MAKE} ${.MAKEFLAGS} show-shlib-type`; \
+ case "$$shlib_type" in \
"ELF") \
- ${ECHO_MSG} "===> [Automatic ${SHLIB_TYPE} shared object handling]";\
+ ${ECHO_MSG} "===> [Automatic $$shlib_type shared object handling]";\
for so2 in $$sos; do \
so1=`${ECHO} $$so2 | ${SED} -e 's|\.[0-9]*$$||'`; \
so0=`${ECHO} $$so1 | ${SED} -e 's|\.[0-9]*$$||'`; \
@@ -1363,8 +1364,9 @@ root-install:
done; \
;; \
"a.out") \
- ${ECHO_MSG} "===> [Automatic ${SHLIB_TYPE} shared object handling]";\
- if ${GREP} -q '^@exec ${LDCONFIG}$$' ${PLIST}; then \
+ ${ECHO_MSG} "===> [Automatic $$shlib_type shared object handling]";\
+ cnt=`${EGREP} -c -x '@exec[ ]*${LDCONFIG}' ${PLIST}`; \
+ if [ $$cnt -eq 0 ]; then \
${ECHO} "@exec ${LDCONFIG}" >> ${PLIST}; \
${ECHO} "@unexec ${LDCONFIG}" >> ${PLIST}; \
fi; \
@@ -1372,7 +1374,7 @@ root-install:
${ECHO_MSG} "$$sos"; \
${ECHO_MSG} "Running ${LDCONFIG}"; \
fi; \
- ${LDCONFIG}; \
+ ${LDCONFIG} || ${TRUE}; \
;; \
"*") \
${ECHO_MSG} "No shared libraries for ${MACHINE_ARCH}"; \
@@ -1398,6 +1400,26 @@ root-install:
${_PKG_SILENT}${_PKG_DEBUG}${TOUCH} ${TOUCH_FLAGS} ${WRKDIR}/.install_done
+# Show the shared lib type being built: one of ELF, a.out or none
+show-shlib-type:
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ cd ${WRKDIR} && \
+ sotype=none; \
+ if [ "X${MKPIC}" != "Xno" -a "X${MKPICINSTALL}" != "Xno" -a \
+ "X${NOPIC}" = "X" -a "X${NOPICINSTALL}" = "X" ]; then \
+ ${ECHO} "int main() { exit(0); }" > a.$$$$.c; \
+ ${CC} ${CFLAGS} a.$$$$.c -o a.$$$$.out; \
+ case `${FILE} a.$$$$.out` in \
+ *ELF*dynamically*) \
+ sotype=ELF ;; \
+ *dynamically*) \
+ sotype="a.out" ;; \
+ esac; \
+ fi; \
+ ${ECHO} "$$sotype"; \
+ ${RM} -f a.$$$$.c a.$$$$.out
+
+
################################################################
# Skeleton targets start here
#