diff options
author | agc <agc@pkgsrc.org> | 2001-01-04 15:10:17 +0000 |
---|---|---|
committer | agc <agc@pkgsrc.org> | 2001-01-04 15:10:17 +0000 |
commit | 9c2d582fc9678b1f1e5902ac348cb99812ed5f52 (patch) | |
tree | db20fcdd2f38bf4d7f9ea8eafac9c6c9643e05a9 /mk/bsd.pkg.mk | |
parent | e136261bc281b5bdc620fbdaa42234a1545d11ab (diff) | |
download | pkgsrc-9c2d582fc9678b1f1e5902ac348cb99812ed5f52.tar.gz |
The way that shared objects were handled in the PLISTs and bsd.pkg.mk was
out of date - it was based on a.out OBJECT_FMT, and added entries in the
generated PLISTs to reflect the symlinks that ELF packages uses. It also
tried to be clever, and removed and recreated any symbolic links that were
created, which has resulted in some fun, especially with packages which
use dlopen(3) to load modules. Some recent changes to our ld.so to bring
it more into line with other Operating Systems also exposed some cracks.
+ Modify bsd.pkg.mk and its shared object handling, so that PLISTs now contain
the ELF symlinks.
+ Don't mess about with file system entries when handling shared objects in
bsd.pkg.mk, since it's likely that libtool and the BSD *.mk processing will
have got it right, and have a much better idea than we do.
+ Modify PLISTs to contain "ELF symlinks"
+ On a.out platforms, delete any "ELF symlinks" from the generated PLISTs
+ On ELF platforms, no extra processing needs to be done in bsd.pkg.mk
+ Modify print-PLIST target in bsd.pkg.mk to add dummy symlink entries on
a.out platforms
+ Update the documentation in Packages.txt
With many thanks to Thomas Klausner for keeping me honest with this.
Diffstat (limited to 'mk/bsd.pkg.mk')
-rw-r--r-- | mk/bsd.pkg.mk | 124 |
1 files changed, 60 insertions, 64 deletions
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk index 1cc36dace62..72210e42db5 100644 --- a/mk/bsd.pkg.mk +++ b/mk/bsd.pkg.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.pkg.mk,v 1.633 2001/01/04 14:17:54 wiz Exp $ +# $NetBSD: bsd.pkg.mk,v 1.634 2001/01/04 15:10:50 agc Exp $ # # This file is in the public domain. # @@ -1766,69 +1766,48 @@ do-shlib-handling: sos=`${EGREP} -h -x '.*/lib[^/]+\.so\.[0-9]+(\.[0-9]+)+' ${PLIST} || ${TRUE}`; \ if [ "$$sos" != "" ]; then \ shlib_type=`${MAKE} ${MAKEFLAGS} show-shlib-type`; \ + if [ "${SHLIB_PLIST_MODE}" = "0" ]; then \ + ${ECHO_MSG} "${_PKGSRC_IN}> [Automatic $$shlib_type shared object handling]"; \ + fi; \ case "$$shlib_type" in \ - "ELF") \ - if [ "${SHLIB_PLIST_MODE}" = "0" ]; then \ - ${ECHO_MSG} "${_PKGSRC_IN}> [Automatic ELF shared object handling]"; \ - fi ; \ - ${AWK} 'function makelinks(target, lib, v1, v2, v3) { \ - if (${SHLIB_PLIST_MODE}) { \ - print target; \ - } \ - slashc = split(target, slashes, "/"); \ - if (v3 >= 0) { \ - if (${SHLIB_PLIST_MODE}) { \ - printf("%s.%s.%s.%s\n", lib, v1, v2, v3); \ - } else { \ - system(sprintf("${RM} -f ${PREFIX}/%s.%s.%s.%s; ${LN} -s %s ${PREFIX}/%s.%s.%s.%s", lib, v1, v2, v3, slashes[slashc], lib, v1, v2, v3)); \ - } \ - } \ - if (${SHLIB_PLIST_MODE}) { \ - printf("%s.%s.%s\n%s.%s\n", lib, v1, v2, lib, v1); \ - } else { \ - system(sprintf("${RM} -f ${PREFIX}/%s.%s.%s; ${LN} -s %s ${PREFIX}/%s.%s.%s", lib, v1, v2, slashes[slashc], lib, v1, v2)); \ - system(sprintf("${RM} -f ${PREFIX}/%s.%s; ${LN} -s %s ${PREFIX}/%s.%s", lib, v1, slashes[slashc], lib, v1)); \ - } \ - } \ - /^@/ { \ - if (${SHLIB_PLIST_MODE}) { \ - print; \ - } \ - next; \ - } \ + ELF) ;; \ + "a.out") \ + ${AWK} ' \ + BEGIN { linkc = 1 } \ + /^@/ { lines[NR] = $$0; next } \ /.*\/lib[^\/]+\.so\.[0-9]+\.[0-9]+\.[0-9]+$$/ { \ - dotc = split($$0, dots, "\."); \ - lib = dots[1]; \ - for (i = 2 ; i <= dotc - 4 ; i++) \ - lib = lib "." dots[i]; \ - makelinks($$0, lib, dots[dotc - 3], dots[dotc - 2], dots[dotc - 1]); \ - next; \ + lines[NR] = $$0; \ + sub("\.[0-9]+$$", ""); \ + links[linkc++] = $$0; \ + sub("\.[0-9]+$$", ""); \ + links[linkc++] = $$0; \ + sub("\.[0-9]+$$", ""); \ + links[linkc++] = $$0; \ + next \ } \ /.*\/lib[^\/]+\.so\.[0-9]+\.[0-9]+$$/ { \ - dotc = split($$0, dots, "\."); \ - lib = dots[1]; \ - for (i = 2 ; i <= dotc - 3 ; i++) \ - lib = lib "." dots[i]; \ - makelinks($$0, lib, dots[dotc - 2], dots[dotc - 1], -1); \ - next; \ + lines[NR] = $$0; \ + sub("\.[0-9]+$$", ""); \ + links[linkc++] = $$0; \ + sub("\.[0-9]+$$", ""); \ + links[linkc++] = $$0; \ + next \ } \ - /.*\/lib[^\/]+\.so\.[0-9]+$$/ { \ - next; \ + { lines[NR] = $$0 } \ + END { \ + for (i = 1 ; i <= linkc ; i++) \ + for (j = 1 ; j < NR ; j++) \ + if (lines[j] == links[i]) \ + lines[j] = "@comment " lines[j]; \ + if (${SHLIB_PLIST_MODE}) \ + for (i = 1 ; i <= NR ; i++) \ + print lines[i]; \ } \ - { \ - if (${SHLIB_PLIST_MODE}) { \ - print; \ - } \ - }' <${PLIST} >${PLIST}.tmp ; \ - if [ "${SHLIB_PLIST_MODE}" = "1" ]; then \ - ${MV} ${PLIST}.tmp ${PLIST}; \ - else \ - ${RM} ${PLIST}.tmp ; \ - fi ; \ - ;; \ - "a.out") \ - if [ "${SHLIB_PLIST_MODE}" = "0" ]; then \ - ${ECHO_MSG} "${_PKGSRC_IN}> [Automatic a.out shared object handling]"; \ + ' <${PLIST} >${PLIST}.tmp ; \ + if [ "${SHLIB_PLIST_MODE}" = "1" ]; then \ + ${MV} ${PLIST}.tmp ${PLIST}; \ + else \ + ${RM} ${PLIST}.tmp ; \ fi ; \ cnt=`${EGREP} -c -x '@exec[ ]*${LDCONFIG}' ${PLIST} || ${TRUE}`; \ if [ "${SHLIB_PLIST_MODE}" = "1" ]; then \ @@ -3049,11 +3028,10 @@ COMMON_DIRS!= ${AWK} 'BEGIN { \ print-PLIST: @${ECHO} '@comment $$'NetBSD'$$' @shlib_type=`${MAKE} ${MAKEFLAGS} show-shlib-type`; \ - RM_ELFLIBS=''; \ - case "$$shlib_type" in \ - "ELF") \ - RMELFLIBS='-e /.*\/lib[^\/]*\.so\.[0-9]*$$/d'; \ - esac ; \ + case $$shlib_type in \ + "a.out") genlinks=1 ;; \ + *) genlinks=0 ;; \ + esac; \ ${FIND} ${PREFIX}/. -newer ${EXTRACT_COOKIE} \! -type d \ | ${SED} \ -e 's@${PREFIX}/./@@' \ @@ -3065,9 +3043,27 @@ print-PLIST: -e 's@${LOWER_VENDOR}@\$${LOWER_VENDOR}@' \ -e 's@${LOWER_OPSYS}@\$${LOWER_OPSYS}@' \ -e 's@${PKGNAME}@\$${PKGNAME}@' \ - $$RMELFLIBS \ | sort \ | ${AWK} ' \ + /^@/ { print $$0; next } \ + /.*\/lib[^\/]+\.so\.[0-9]+\.[0-9]+\.[0-9]+$$/ { \ + print $$0; \ + sub("\.[0-9]+$$", ""); \ + if ('$$genlinks') print $$0; \ + sub("\.[0-9]+$$", ""); \ + if ('$$genlinks') print $$0; \ + sub("\.[0-9]+$$", ""); \ + if ('$$genlinks') print $$0; \ + next; \ + } \ + /.*\/lib[^\/]+\.so\.[0-9]+\.[0-9]+$$/ { \ + print $$0; \ + sub("\.[0-9]+$$", ""); \ + if ('$$genlinks') print $$0; \ + sub("\.[0-9]+$$", ""); \ + if ('$$genlinks') print $$0; \ + next; \ + } \ { \ if (/\.info$$/) { \ print "\@unexec install-info --delete --info-dir=%D/info %D/" $$1; \ |