tech-toolchain archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Simplify handling of shared libraries outside /usr/lib



Hi all,
the attached patch drops SHLIBINSTALLDIR and SHLINKINSTALLDIR.
They seem to be mostly redundant nowadays and produce problems when
using -m32 without including src/compat/*.mk. MKDYNAMICROOT still
produces the references to /lib and /libexec/ld.elf_so.

I think most of the complications are unnecessary since the advent of
--sysroot usage.

Joerg
Index: compat/Makefile.compat
===================================================================
RCS file: /home/joerg/repo/netbsd/src/compat/Makefile.compat,v
retrieving revision 1.7
diff -u -p -r1.7 Makefile.compat
--- compat/Makefile.compat      13 Dec 2009 09:27:34 -0000      1.7
+++ compat/Makefile.compat      17 Aug 2012 18:24:05 -0000
@@ -11,7 +11,6 @@ _COMPAT_OPTIONS_MK_=1
 
 LIBDIR=                        /usr/lib/${MLIBDIR}
 SHLIBDIR=              /usr/lib/${MLIBDIR}
-SHLIBINSTALLDIR=       /usr/lib/${MLIBDIR}
 
 _GCC_CRTBEGIN=         ${DESTDIR}/usr/lib/${MLIBDIR}/crtbegin.o
 _GCC_CRTBEGINS=                ${DESTDIR}/usr/lib/${MLIBDIR}/crtbeginS.o
@@ -27,7 +26,4 @@ NOMAN=                # defined
 NOINFO=                # defined
 NOCHECKVER=    # defined
 
-# ld.elf_so
-SHLINKINSTALLDIR=      /libexec
-
 .endif # _COMPAT_OPTIONS_MK_ }
Index: lib/i18n_module/Makefile.inc
===================================================================
RCS file: /home/joerg/repo/netbsd/src/lib/i18n_module/Makefile.inc,v
retrieving revision 1.12
diff -u -p -r1.12 Makefile.inc
--- lib/i18n_module/Makefile.inc        30 May 2011 14:41:26 -0000      1.12
+++ lib/i18n_module/Makefile.inc        17 Aug 2012 18:15:27 -0000
@@ -12,11 +12,9 @@ SHLIB_VERSION_FILE=  ${NETBSDSRCDIR}/lib/
 .if defined(MLIBDIR)
 LIBDIR=                /usr/lib/${MLIBDIR}/i18n
 SHLIBDIR=      /usr/lib/${MLIBDIR}/i18n
-SHLIBINSTALLDIR=/usr/lib/${MLIBDIR}/i18n
 .else
 LIBDIR=                /usr/lib/i18n
 SHLIBDIR=      /usr/lib/i18n
-SHLIBINSTALLDIR=/usr/lib/i18n
 .endif
 CPPFLAGS+=     -I${NETBSDSRCDIR}/lib/libc/citrus
 CPPFLAGS+=     -DLOCALEMOD_MAJOR=${SHLIB_MAJOR}
Index: libexec/ld.elf_so/Makefile
===================================================================
RCS file: /home/joerg/repo/netbsd/src/libexec/ld.elf_so/Makefile,v
retrieving revision 1.112
diff -u -p -r1.112 Makefile
--- libexec/ld.elf_so/Makefile  4 Aug 2012 15:17:16 -0000       1.112
+++ libexec/ld.elf_so/Makefile  17 Aug 2012 18:40:02 -0000
@@ -14,7 +14,6 @@ WARNS?=4
 PIE_CFLAGS=
 PIE_LDFLAGS=
 .include <bsd.init.mk>                 # for MKPIC definition
-.include <bsd.shlib.mk>                        # for SHLINKINSTALLDIR 
definition
 
 .if defined(LDELFSO_MACHINE_CPU) && !empty(LDELFSO_MACHINE_CPU) && \
     exists(${.CURDIR}/arch/${LDELFSO_MACHINE_CPU})
@@ -81,8 +80,6 @@ xprintf.c: errlist_concat.h
 
 CLEANFILES+=   errlist_concat.h
 
-BINDIR=                ${SHLINKINSTALLDIR}
-
 CPPFLAGS+=     -DLIBDIR=\"${LIBDIR}\" -D_PATH_RTLD=\"${BINDIR}/${PROG}\"
 CPPFLAGS+=     -I${.CURDIR} -I.
 CPPFLAGS+=     -DRTLD_LOADER
@@ -98,11 +95,6 @@ COPTS=               -O3 -fomit-frame-pointer
 COPTS+=                -mno-3dnow -mno-mmx -mno-sse -mno-sse2 -mno-sse3
 .endif
 
-
-.if ${SHLIBDIR} != ${LIBDIR}
-CPPFLAGS+=     -DRTLD_DEFAULT_LIBRARY_PATH=\"${SHLIBDIR}:${LIBDIR}\"
-.endif
-
 # rtld.c and symbol.c use alloca, so disable SSP warnings.
 COPTS.rtld.c+= -Wno-stack-protector
 COPTS.symbol.c+=-Wno-stack-protector
@@ -133,8 +125,15 @@ ${PROG}: ${OBJS} ${DPADD}
        ${_MKMSG_LINK} ${PROG}
        ${CC} ${LDFLAGS} -o ${PROG} ${OBJS} ${LDADD}
 
-.if ${SHLINKINSTALLDIR} != "/usr/libexec"
-SYMLINKS+=     ${SHLINKINSTALLDIR}/${PROG} /usr/libexec/${PROG}
+.if ${MKDYNAMICROOT} == "no"
+BINDIR=                /usr/libexec
+.else
+BINDIR=                /libexec
+.endif
+SHLINKDIR=     ${BINDIR}
+
+.if ${SHLINKDIR} != "/usr/libexec"
+SYMLINKS+=     ${SHLINKDIR}/${PROG} /usr/libexec/${PROG}
 .endif
 
 .include <bsd.prog.mk>
Index: sbin/ldconfig/Makefile
===================================================================
RCS file: /home/joerg/repo/netbsd/src/sbin/ldconfig/Makefile,v
retrieving revision 1.23
diff -u -p -r1.23 Makefile
--- sbin/ldconfig/Makefile      6 Jul 2010 05:59:56 -0000       1.23
+++ sbin/ldconfig/Makefile      17 Aug 2012 18:15:37 -0000
@@ -13,10 +13,6 @@
 PROG=  ldconfig
 SRCS=  ldconfig.c shlib.c
 
-.if ${SHLIBINSTALLDIR} != ${LIBDIR}
-CPPFLAGS+=-DSTANDARD_SEARCH_DIRS=\"${SHLIBINSTALLDIR}\",\"${LIBDIR}\"
-.endif
-
 .endif
 
 MAN=   ldconfig.8
Index: share/mk/bsd.README
===================================================================
RCS file: /home/joerg/repo/netbsd/src/share/mk/bsd.README,v
retrieving revision 1.298
diff -u -p -r1.298 bsd.README
--- share/mk/bsd.README 8 Aug 2012 13:56:13 -0000       1.298
+++ share/mk/bsd.README 17 Aug 2012 18:23:22 -0000
@@ -1068,14 +1068,11 @@ MKARZERO        Normally, ar(1) sets the timest
                permissions to be set to 644. This allows .a files
                from different builds to be bit identical.
 
-SHLIBINSTALLDIR        Target directory for shared libraries if ${USE_SHLIBDIR}
-               is not "no".
-
 SHLIB_MAJOR
 SHLIB_MINOR
 SHLIB_TEENY    Major, minor, and teeny version numbers of shared library
 
-USE_SHLIBDIR   If not "no", use ${SHLIBINSTALLDIR} instead of ${LIBDIR}
+USE_SHLIBDIR   If not "no", use ${SHLIBDIR} instead of ${LIBDIR}
                as the path to install shared libraries to.
                USE_SHLIBDIR must be defined before <bsd.own.mk> is included.
                Default: no
@@ -1613,19 +1610,13 @@ included before <bsd.shlib.mk>.
 <bsd.own.mk> sets the following variables, if they are not already defined
 (defaults are in brackets):
 
-SHLIBINSTALLDIR        If ${USE_SHLIBDIR} is not "no", use ${SHLIBINSTALLDIR}
-               instead of ${LIBDIR} as the base path for shared library
-               installation.  [/lib]
-
 SHLIBDIR       The path to USE_SHLIBDIR shared libraries to use when building
                a program.  [/lib for programs in /bin and /sbin, /usr/lib
                for all others.]
 
-_LIBSODIR      Set to ${SHLIBINSTALLDIR} if ${USE_SHLIBDIR} is not "no",
+_LIBSODIR      Set to ${SHLIBDIR} if ${USE_SHLIBDIR} is not "no",
                otherwise set to ${LIBDIR}
 
-SHLINKINSTALLDIR Base path for shared linker.  [/libexec]
-
 SHLINKDIR      Path to use for shared linker when building a program.
                [/libexec for programs in /bin and /sbin, /usr/libexec for
                all others.]
Index: share/mk/bsd.lib.mk
===================================================================
RCS file: /home/joerg/repo/netbsd/src/share/mk/bsd.lib.mk,v
retrieving revision 1.322
diff -u -p -r1.322 bsd.lib.mk
--- share/mk/bsd.lib.mk 19 Jul 2012 19:42:45 -0000      1.322
+++ share/mk/bsd.lib.mk 17 Aug 2012 18:17:18 -0000
@@ -540,11 +540,7 @@ lib${LIB}_g.a:: ${GOBJS} __archivebuild
 
 _LIBLDOPTS=
 .if ${SHLIBDIR} != "/usr/lib"
-_LIBLDOPTS+=   -Wl,-rpath,${SHLIBDIR} \
-               -L=${SHLIBDIR}
-.elif ${SHLIBINSTALLDIR} != "/usr/lib"
-_LIBLDOPTS+=   -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR} \
-               -L=${SHLIBINSTALLDIR}
+_LIBLDOPTS+=   -Wl,-rpath,${SHLIBDIR} -L=${SHLIBDIR}
 .endif
 
 # gcc -shared now adds -lc automatically. For libraries other than libc and
Index: share/mk/bsd.prog.mk
===================================================================
RCS file: /home/joerg/repo/netbsd/src/share/mk/bsd.prog.mk,v
retrieving revision 1.275
diff -u -p -r1.275 bsd.prog.mk
--- share/mk/bsd.prog.mk        8 Aug 2012 13:56:14 -0000       1.275
+++ share/mk/bsd.prog.mk        17 Aug 2012 18:19:17 -0000
@@ -271,9 +271,6 @@ _PROGLDOPTS+=       -Wl,-dynamic-linker=${_SHL
 .if ${SHLIBDIR} != "/usr/lib"
 _PROGLDOPTS+=  -Wl,-rpath,${SHLIBDIR} \
                -L=${SHLIBDIR}
-.elif ${SHLIBINSTALLDIR} != "/usr/lib"
-_PROGLDOPTS+=  -Wl,-rpath-link,${DESTDIR}${SHLIBINSTALLDIR} \
-               -L=${SHLIBINSTALLDIR}
 .endif
 
 __proginstall: .USE
Index: share/mk/bsd.shlib.mk
===================================================================
RCS file: /home/joerg/repo/netbsd/src/share/mk/bsd.shlib.mk,v
retrieving revision 1.6
diff -u -p -r1.6 bsd.shlib.mk
--- share/mk/bsd.shlib.mk       29 Aug 2007 21:34:17 -0000      1.6
+++ share/mk/bsd.shlib.mk       17 Aug 2012 18:23:29 -0000
@@ -3,12 +3,6 @@
 .if !defined(_BSD_SHLIB_MK_)
 _BSD_SHLIB_MK_=1
 
-.if ${MKDYNAMICROOT} == "no"
-SHLIBINSTALLDIR?= /usr/lib
-.else
-SHLIBINSTALLDIR?= /lib
-.endif
-
 .if ${MKDYNAMICROOT} == "no" || \
     (${BINDIR:Ux} != "/bin" && ${BINDIR:Ux} != "/sbin" && \
      ${BINDIR:Ux} != "/libexec" && ${USE_SHLIBDIR:Uno} == "no")
@@ -17,17 +11,7 @@ SHLIBDIR?=   /usr/lib
 SHLIBDIR?=     /lib
 .endif
 
-.if ${USE_SHLIBDIR:Uno} != "no"
-_LIBSODIR?=    ${SHLIBINSTALLDIR}
-.else
-_LIBSODIR?=    ${LIBDIR}
-.endif
-
-.if ${MKDYNAMICROOT} == "no"
-SHLINKINSTALLDIR?= /usr/libexec
-.else
-SHLINKINSTALLDIR?= /libexec
-.endif
+_LIBSODIR?=    ${SHLIBDIR}
 
 .if ${MKDYNAMICROOT} == "no" || \
     (${BINDIR:Ux} != "/bin" && ${BINDIR:Ux} != "/sbin" && \


Home | Main Index | Thread Index | Old Index