summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2001-10-05 02:31:18 +0000
committerjlam <jlam@pkgsrc.org>2001-10-05 02:31:18 +0000
commit5ec5047fdaea27b36cd83fbd04b814caf5f58200 (patch)
treed6c61ec0012a2a4f792300d266afcac70e2c8cf6 /mk
parenta1a797f636be6286cc12061f18053a5a8511bef2 (diff)
downloadpkgsrc-5ec5047fdaea27b36cd83fbd04b814caf5f58200.tar.gz
Substitute for rpath references to buildlink directories in Makefiles
after the configure step. There's a growing number of GNU configure scripts that find a library in -L/path and automatically add -R/path to the linker flags. We need to make sure this doesn't happen to buildlink directories.
Diffstat (limited to 'mk')
-rw-r--r--mk/bsd.buildlink.mk48
-rw-r--r--mk/x11.buildlink.mk6
2 files changed, 46 insertions, 8 deletions
diff --git a/mk/bsd.buildlink.mk b/mk/bsd.buildlink.mk
index 3be251479e8..60cf8a07324 100644
--- a/mk/bsd.buildlink.mk
+++ b/mk/bsd.buildlink.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.buildlink.mk,v 1.38 2001/10/05 01:15:07 jlam Exp $
+# $NetBSD: bsd.buildlink.mk,v 1.39 2001/10/05 02:31:18 jlam Exp $
#
# This Makefile fragment is included by package buildlink.mk files. This
# file does the following things:
@@ -282,6 +282,42 @@ replace-libnames-makefiles:
fi
.endif # REPLACE_LIBNAMES
+REPLACE_RPATH_PATTERNS+= ${MAKEFILE_PATTERNS}
+REPLACE_RPATH_PATTERNS_FIND= \
+ ${REPLACE_RPATH_PATTERNS:S/$/!/:S/^/-or -name !/:S/!/"/g:S/-or//1}
+
+REPLACE_RPATH+= \
+ `cd ${WRKSRC}; ${FIND} . ${REPLACE_RPATH_PATTERNS_FIND} | ${SED} -e 's|^\./||' | ${SORT}`
+
+REPLACE_RPATH_SED+= \
+ -e "s|-R${BUILDLINK_DIR}/|-R${LOCALBASE}/|g"
+
+post-configure: replace-rpath
+
+replace-rpath:
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ cookie=${BUILDLINK_DIR}/.replace_rpath_done; \
+ if [ ! -f $${cookie} ]; then \
+ ${MKDIR} ${BUILDLINK_DIR}; \
+ replace_files="${REPLACE_RPATH}"; \
+ if [ -n "$${replace_files}" ]; then \
+ ${ECHO_MSG} "Removing rpath references to buildlink directories:"; \
+ cd ${WRKSRC}; \
+ for file in $${replace_files}; do \
+ if ${_CHECK_IS_TEXT_FILE}; then \
+ ${ECHO_MSG} " $${file}"; \
+ ${SED} ${REPLACE_RPATH_SED} \
+ $${file} > $${file}.fixed; \
+ if [ -x $${file} ]; then \
+ ${CHMOD} +x $${file}.fixed; \
+ fi; \
+ ${MV} -f $${file}.fixed $${file}; \
+ ${ECHO} $${file} >> $${cookie}; \
+ fi; \
+ done; \
+ fi; \
+ fi
+
REPLACE_BUILDLINK_PATTERNS+= *.lai
REPLACE_BUILDLINK_PATTERNS+= *-config
REPLACE_BUILDLINK_PATTERNS+= *Conf.sh
@@ -290,8 +326,7 @@ REPLACE_BUILDLINK_PATTERNS_FIND= \
${REPLACE_BUILDLINK_PATTERNS:S/$/!/:S/^/-or -name !/:S/!/"/g:S/-or//1}
REPLACE_BUILDLINK+= \
- `cd ${WRKSRC}; ${FIND} . ${REPLACE_BUILDLINK_PATTERNS_FIND} | ${SED} -e 's|^\./||' | ${SORT}`
-
+ `cd ${WRKSRC}; ${FIND} . ${REPLACE_BUILDLINK_PATTERNS_FIND} | ${SED} -e 's|^\./||' | ${SORT}`
.if defined(REPLACE_BUILDLINK)
post-build: replace-buildlink
@@ -299,8 +334,9 @@ post-build: replace-buildlink
REPLACE_BUILDLINK_SED?= # empty
REPLACE_BUILDLINK_POST_SED+= \
-e "s|-I${BUILDLINK_DIR}/|-I${LOCALBASE}/|g" \
- -e "s|-L${BUILDLINK_DIR}/|-L${LOCALBASE}/|g" \
- -e "s|-R${BUILDLINK_DIR}/|-R${LOCALBASE}/|g"
+ -e "s|-L${BUILDLINK_DIR}/|-L${LOCALBASE}/|g"
+
+REPLACE_BUILDLINK_POST_SED+= ${REPLACE_RPATH_SED}
# Fix files by removing buildlink directory references and library names.
replace-buildlink:
@@ -312,7 +348,7 @@ replace-buildlink:
if [ -n "$${replace_files}" ]; then \
${ECHO_MSG} "Fixing directory references and library names:"; \
cd ${WRKSRC}; \
- for file in ${replace_files}; do \
+ for file in $${replace_files}; do \
if ${_CHECK_IS_TEXT_FILE}; then \
${ECHO_MSG} " $${file}"; \
${SED} ${REPLACE_BUILDLINK_SED} \
diff --git a/mk/x11.buildlink.mk b/mk/x11.buildlink.mk
index 75921f16960..db0d87232aa 100644
--- a/mk/x11.buildlink.mk
+++ b/mk/x11.buildlink.mk
@@ -1,4 +1,4 @@
-# $NetBSD: x11.buildlink.mk,v 1.5 2001/10/05 00:08:17 jlam Exp $
+# $NetBSD: x11.buildlink.mk,v 1.6 2001/10/05 02:31:19 jlam Exp $
#
# This Makefile fragment is included by packages that use X11.
#
@@ -81,7 +81,9 @@ BUILDLINK_CONFIG_WRAPPER_POST_SED+= \
REPLACE_BUILDLINK_POST_SED+= \
-e "s|-I${BUILDLINK_X11_DIR}/|-I${X11BASE}/|g" \
- -e "s|-L${BUILDLINK_X11_DIR}/|-L${X11BASE}/|g" \
+ -e "s|-L${BUILDLINK_X11_DIR}/|-L${X11BASE}/|g"
+
+REPLACE_RPATH_SED+= \
-e "s|-R${BUILDLINK_X11_DIR}/|-R${X11BASE}/|g"
.endif # X11_BUILDLINK_MK