From owner-svn-src-stable@FreeBSD.ORG Thu May 17 07:59:16 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 63ABC106564A; Thu, 17 May 2012 07:59:16 +0000 (UTC) (envelope-from jlh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 43F6F8FC14; Thu, 17 May 2012 07:59:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q4H7xGXU085475; Thu, 17 May 2012 07:59:16 GMT (envelope-from jlh@svn.freebsd.org) Received: (from jlh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q4H7xGr2085471; Thu, 17 May 2012 07:59:16 GMT (envelope-from jlh@svn.freebsd.org) Message-Id: <201205170759.q4H7xGr2085471@svn.freebsd.org> From: Jeremie Le Hen Date: Thu, 17 May 2012 07:59:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r235534 - in stable/9: . share/mk X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 May 2012 07:59:16 -0000 Author: jlh Date: Thu May 17 07:59:15 2012 New Revision: 235534 URL: http://svn.freebsd.org/changeset/base/235534 Log: MFC r235122: Introduce the ${SHLIB_LDSCRIPT} variable to have an ld(1) script instead of a symlink for .so files. Modified: stable/9/Makefile.inc1 (contents, props changed) stable/9/share/mk/bsd.README stable/9/share/mk/bsd.lib.mk Directory Properties: stable/9/ (props changed) stable/9/share/mk/ (props changed) Modified: stable/9/Makefile.inc1 ============================================================================== --- stable/9/Makefile.inc1 Thu May 17 07:24:13 2012 (r235533) +++ stable/9/Makefile.inc1 Thu May 17 07:59:15 2012 (r235534) @@ -260,6 +260,7 @@ XMAKE= TOOLS_PREFIX=${WORLDTMP} ${BMAKE # world stage WMAKEENV= ${CROSSENV} \ _SHLIBDIRPREFIX=${WORLDTMP} \ + _LDSCRIPTROOT= \ VERSION="${VERSION}" \ INSTALL="sh ${.CURDIR}/tools/install.sh" \ PATH=${TMPPATH} @@ -302,6 +303,7 @@ LIB32FLAGS= -m32 ${LIB32CPUFLAGS} -DCOMP # Yes, the flags are redundant. LIB32WMAKEENV+= MAKEOBJDIRPREFIX=${OBJTREE}/lib32 \ _SHLIBDIRPREFIX=${LIB32TMP} \ + _LDSCRIPTROOT=${LIB32TMP} \ VERSION="${VERSION}" \ INSTALL="sh ${.CURDIR}/tools/install.sh" \ PATH=${TMPPATH} \ @@ -314,11 +316,11 @@ LIB32WMAKE= ${LIB32WMAKEENV} ${MAKE} -DN -DWITHOUT_BIND -DWITHOUT_MAN -DWITHOUT_INFO \ -DWITHOUT_HTML -DNO_CTF -DNO_LINT -ECC -ECXX -EAS -ELD \ DESTDIR=${LIB32TMP} -LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*} -DNO_INCS +LIB32IMAKE= ${LIB32WMAKE:NINSTALL=*:NDESTDIR=*:N_LDSCRIPTROOT=*} -DNO_INCS .endif # install stage -IMAKEENV= ${CROSSENV} +IMAKEENV= ${CROSSENV:N_LDSCRIPTROOT=*} IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 .if empty(.MAKEFLAGS:M-n) IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMP} \ Modified: stable/9/share/mk/bsd.README ============================================================================== --- stable/9/share/mk/bsd.README Thu May 17 07:24:13 2012 (r235533) +++ stable/9/share/mk/bsd.README Thu May 17 07:59:15 2012 (r235534) @@ -352,6 +352,10 @@ SRCS List of source files to build the to .c files of the same name. (This is not the default for versions of make.) +SHLIB_LDSCRIPT Template file to generate shared library linker script. + Unless used, a simple symlink is created to the real + shared object. + The include file includes the file named "../Makefile.inc" if it exists, as well as the include file . Modified: stable/9/share/mk/bsd.lib.mk ============================================================================== --- stable/9/share/mk/bsd.lib.mk Thu May 17 07:24:13 2012 (r235533) +++ stable/9/share/mk/bsd.lib.mk Thu May 17 07:59:15 2012 (r235534) @@ -287,6 +287,25 @@ _libinstall: ${_INSTALLFLAGS} ${_SHLINSTALLFLAGS} \ ${SHLIB_NAME} ${DESTDIR}${SHLIBDIR} .if defined(SHLIB_LINK) +# ${_SHLIBDIRPREFIX} and ${_LDSCRIPTROOT} are both needed when cross-building +# and when building 32 bits library shims. ${_SHLIBDIRPREFIX} is the directory +# prefix where shared objects will be installed. ${_LDSCRIPTROOT} is the +# directory prefix that will be used in generated ld(1) scripts. They cannot +# be coalesced because of the way ld(1) handles the sysroot prefix (used in the +# cross-toolchain): +# - 64 bits libs are located under sysroot, so ${_LDSCRIPTROOT} must be empty. +# - 32 bits shims are not, so ${_LDSCRIPTROOT} is used to specify their full +# path. Note that ld(1) scripts are generated both during buildworld and +# installworld; in the later case ${_LDSCRIPTROOT} must be obviously empty. +# On the other hand, the use of ${_SHLIBDIRPREFIX} is more consistent since it +# does not involve the logic of a tool we do not own. +.if defined(SHLIB_LDSCRIPT) && !empty(SHLIB_LDSCRIPT) && exists(${.CURDIR}/${SHLIB_LDSCRIPT}) + sed -e 's,@@SHLIB@@,${_LDSCRIPTROOT}${SHLIBDIR}/${SHLIB_NAME},g' \ + -e 's,@@LIBDIR@@,${_LDSCRIPTROOT}${LIBDIR},g' \ + ${.CURDIR}/${SHLIB_LDSCRIPT} > lib${LIB}.ld + ${INSTALL} -S -C -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ + ${_INSTALLFLAGS} lib${LIB}.ld ${DESTDIR}${LIBDIR}/${SHLIB_LINK} +.else .if ${SHLIBDIR} == ${LIBDIR} ln -fs ${SHLIB_NAME} ${DESTDIR}${LIBDIR}/${SHLIB_LINK} .else @@ -297,8 +316,9 @@ _libinstall: rm -f ${DESTDIR}${LIBDIR}/${SHLIB_NAME} .endif .endif -.endif -.endif +.endif # SHLIB_LDSCRIPT +.endif # SHLIB_LINK +.endif # SHIB_NAME .if defined(INSTALL_PIC_ARCHIVE) && defined(LIB) && !empty(LIB) && ${MK_TOOLCHAIN} != "no" ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \ ${_INSTALLFLAGS} lib${LIB}_pic.a ${DESTDIR}${LIBDIR} @@ -366,6 +386,9 @@ clean: .endif .if defined(SHLIB_NAME) .if defined(SHLIB_LINK) +.if defined(SHLIB_LDSCRIPT) && exists(${.CURDIR}/${SHLIB_LDSCRIPT}) + rm -f lib${LIB}.ld +.endif rm -f ${SHLIB_LINK} .endif .if defined(LIB) && !empty(LIB)