From aa8dd8466606c653e3695b38e32609a2608ff112 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fran=C3=A7ois=20Tigeot?= Date: Mon, 14 Apr 2014 12:20:43 +0200 Subject: [PATCH] buildsystem: Fix libfoo.so links for /lib libraries * When installing to a non-default location by using DESTDIR on the make installworld command line, /usr/lib/libfoo.so links pointed to wrong locations * DESTDIR is used both as an installworld parameter and internally by the build system and these two cases expect different behaviors * Symlinks locations in /usr/obj must be relative to the host (builder) filesystem namespace libc.so -> /usr/obj/usr/src/world_x86_64/lib/libc.so * Symlinks locations in the final destination directory must be relative to the target world filesystem namespace libc.so -> /lib/libc.so * The symlinks themselves must be absolute in order to not break installations where /usr is a symlink Inspired-by: FreeBSD's historical transition to /lib --- Makefile.inc1 | 2 ++ share/mk/bsd.lib.mk | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index e232351050..2eb89bf0b1 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -286,6 +286,7 @@ TMAKE= ${TMAKEENV} make -f Makefile.inc1 -DBOOTSTRAPPING \ XMAKEENV= MAKEOBJDIRPREFIX=${CTOOLSDEST} \ OBJTREE=${OBJTREE} \ DESTDIR=${CTOOLSDEST} \ + _SHLIBDIRPREFIX=${CTOOLSDEST} \ INSTALL="sh ${.CURDIR}/tools/install.sh" \ TOOLS_PREFIX=${CTOOLSDEST} \ USRDATA_PREFIX=${WORLDDEST} \ @@ -315,6 +316,7 @@ CROSSENV= MAKEOBJDIRPREFIX=${WORLDDEST} \ WMAKEENV= ${CROSSENV} \ DESTDIR=${WORLDDEST} \ + _SHLIBDIRPREFIX=${WORLDDEST} \ INSTALL="sh ${.CURDIR}/tools/install.sh" \ M4=${BTOOLSDEST}/usr/bin/m4 \ PATH=${STRICTTMPPATH} diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index 985ec87fc8..6d8a94a2c1 100644 --- a/share/mk/bsd.lib.mk +++ b/share/mk/bsd.lib.mk @@ -226,7 +226,7 @@ _libinstall: .if ${SHLIBDIR} == ${LIBDIR} ${LN} -fs ${SHLIB_NAME} ${DESTDIR}${TARGET_SHLIBDIR}/${SHLIB_LINK} .else - ${LN} -fs ${DESTDIR}${TARGET_SHLIBDIR}/${SHLIB_NAME} \ + ${LN} -fs ${_SHLIBDIRPREFIX}${TARGET_SHLIBDIR}/${SHLIB_NAME} \ ${DESTDIR}${TARGET_LIBDIR}/${SHLIB_LINK} .endif .endif -- 2.41.0