diff options
author | agc <agc> | 1999-04-13 14:18:11 +0000 |
---|---|---|
committer | agc <agc> | 1999-04-13 14:18:11 +0000 |
commit | 1c433e208a2918886e042c31db57df0c7a8be82d (patch) | |
tree | 4efddb11ca6545e5aa62f48a5a3b56da7ff52fc4 /mk/bsd.pkg.mk | |
parent | e4df167ad85e2cdf45ba34044fa6dbe6ada1a97b (diff) | |
download | pkgsrc-1c433e208a2918886e042c31db57df0c7a8be82d.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/bsd.pkg.mk')
-rw-r--r-- | mk/bsd.pkg.mk | 38 |
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 # |