summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2001-07-27 14:30:16 +0000
committerjlam <jlam@pkgsrc.org>2001-07-27 14:30:16 +0000
commita9fa4a16355b5a85ddf9ac9a493f907c41634212 (patch)
treeb58ffe5f9be78ee9a00ffc5cbde75ca3bce5bc25 /mk
parentce231fc6e0e842e9cc19acb8c30bd29e543eeff8 (diff)
downloadpkgsrc-a9fa4a16355b5a85ddf9ac9a493f907c41634212.tar.gz
On ELF, the linker extracts the soname from the specified libraries to
place in the linked object, so even if the library is a symlink with a different name from the true library, the correct soname is recorded in the object. On a.out, there is no soname, so the linker just records the specified library name + major number into the object, which can cause the incorrect library name to be recorded. Fix this problem on a.out by replacing the specified library names with the true library names in all of the Makefiles in a post-configure step. Additional files may be added to the list of files on which replacement is done by setting REPLACE_LIBNAMES in each package that needs it. This should fix pkg/13402 by John Klos <john@sixgirls.org>.
Diffstat (limited to 'mk')
-rw-r--r--mk/bsd.buildlink.mk40
1 files changed, 38 insertions, 2 deletions
diff --git a/mk/bsd.buildlink.mk b/mk/bsd.buildlink.mk
index 7723ae4537b..e740904d597 100644
--- a/mk/bsd.buildlink.mk
+++ b/mk/bsd.buildlink.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.buildlink.mk,v 1.26 2001/07/24 11:47:28 jlam Exp $
+# $NetBSD: bsd.buildlink.mk,v 1.27 2001/07/27 14:30:16 jlam Exp $
#
# This Makefile fragment is included by package buildlink.mk files. This
# file does the following things:
@@ -165,6 +165,42 @@ _BUILDLINK_CONFIG_WRAPPER_USE: .USE
${ECHO} ${BUILDLINK_CONFIG.${.TARGET:S/-buildlink-config-wrapper//}} >> $${cookie}; \
fi
+.include "../../mk/bsd.prefs.mk"
+
+.if (${OBJECT_FMT} == "a.out")
+REPLACE_LIBNAMES+= \
+ `${FIND} . -name "Makefile" -or -name "Makeconf" -or -name "*.mk" | ${SED} -e 's|\^\./||' | ${SORT}`
+.endif
+
+.if defined(REPLACE_LIBNAMES)
+post-configure: replace-libnames
+
+# Fix linking on a.out platforms by changing library references in Makefiles
+# to the true library names.
+#
+replace-libnames:
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ cookie=${BUILDLINK_DIR}/.replace_libnames_done; \
+ if [ ! -f $${cookie} ]; then \
+ replace_libnames="${REPLACE_LIBNAMES}"; \
+ if [ -n "$${replace_libnames}" -a -n "${REPLACE_LIBNAMES_SED:Q}" ]; then \
+ ${ECHO_MSG} "Fixing library name references:"; \
+ cd ${WRKSRC}; \
+ for file in ${REPLACE_LIBNAMES}; do \
+ ${ECHO_MSG} " $${file}"; \
+ ${MV} -f $${file} $${file}.fixme; \
+ ${SED} ${REPLACE_LIBNAMES_SED} \
+ $${file}.fixme > $${file}; \
+ if [ -x $${file}.fixme ]; then \
+ ${CHMOD} +x $${file}; \
+ fi; \
+ ${RM} -f $${file}.fixme; \
+ ${ECHO} $${file} >> $${cookie}; \
+ done; \
+ fi; \
+ fi
+.endif # REPLACE_LIBNAMES
+
# Note: This hack uses some libtool internals to correctly fix the references
# to ${BUILDLINK_DIR} into ${LOCALBASE}.
#
@@ -203,6 +239,6 @@ replace-buildlink:
done; \
fi; \
fi
-.endif
+.endif # REPLACE_BUILDLINK
.endif # _BSD_BUILDLINK_MK