From bbab48b047000db0d1821e2f65917c2e8c2c7768 Mon Sep 17 00:00:00 2001 From: Russ Allbery Date: Mon, 6 Jul 2009 18:41:39 -0700 Subject: [PATCH] Build and install PIC versions of libafsrpc and libafsauthent To include AFS code in loadable modules such as PAM modules, NSS modules, or Perl/Python/PHP/Ruby extensions, it needs to be built PIC or one must link with the AFS shared libraries. Since we haven't historically been that great about maintaining the shared library ABI, it's nice to have static libraries built with PIC code that can be linked into such modules. Based on a patch by Garrett Wollman updated with the build system changes that happened after 1.4. Make shlib makefiles have clean rules for PIC libraries. Make RedHat specfile know how to deal with PIC libraries. Reviewed-on: http://gerrit.openafs.org/8 Verified-by: Derrick Brashear Reviewed-by: Derrick Brashear Backported-by: Evan Broder --- src/packaging/RedHat/openafs.spec.in | 2 ++ src/shlibafsauthent/Makefile.in | 20 ++++++++++++++++---- src/shlibafsrpc/Makefile.in | 18 ++++++++++++++---- 3 files changed, 32 insertions(+), 8 deletions(-) Index: openafs-1.4.6.dfsg1/src/packaging/RedHat/openafs.spec.in =================================================================== --- openafs-1.4.6.dfsg1.orig/src/packaging/RedHat/openafs.spec.in 2007-10-18 00:14:18.000000000 -0400 +++ openafs-1.4.6.dfsg1/src/packaging/RedHat/openafs.spec.in 2009-07-27 01:23:51.000000000 -0400 @@ -1443,6 +1443,8 @@ %defattr(-,root,root) %{_libdir}/libafsauthent.a %{_libdir}/libafsrpc.a +%{_libdir}/libafsauthent_pic.a +%{_libdir}/libafsrpc_pic.a %if %{build_authlibs} %{_libdir}/libafsauthent.so %{_libdir}/libafsrpc.so Index: openafs-1.4.6.dfsg1/src/shlibafsauthent/Makefile.in =================================================================== --- openafs-1.4.6.dfsg1.orig/src/shlibafsauthent/Makefile.in 2006-08-20 16:17:25.000000000 -0400 +++ openafs-1.4.6.dfsg1/src/shlibafsauthent/Makefile.in 2009-07-27 01:35:11.000000000 -0400 @@ -104,9 +104,9 @@ -ln -f -s ${LIBAFSAUTHENT} ${DEST}/lib/libafsauthent.${SHLIB_SUFFIX} -ln -f -s ${LIBAFSAUTHENT} ${DEST}/lib/libafsauthent.${SHLIB_SUFFIX}.${LIBAFSAUTHENTMAJOR} -all: ${TOP_LIBDIR}/${LIBAFSAUTHENT} +all: ${TOP_LIBDIR}/${LIBAFSAUTHENT} ${TOP_LIBDIR}/libafsauthent_pic.a -install: ${DESTDIR}${libdir}/${LIBAFSAUTHENT} +install: ${DESTDIR}${libdir}/${LIBAFSAUTHENT} ${DESTDIR}${libdir}/libafsauthent_pic.a ${LIBAFSAUTHENT}: ${LIBOBJS} case ${SYS_NAME} in \ @@ -120,6 +120,11 @@ ${SHLIB_LINKER} -o ${LIBAFSAUTHENT} ${LIBOBJS} -L${TOP_LIBDIR} -lafsrpc ${MT_LIBS};; \ esac +libafsauthent_pic.a: ${LIBOBJS} + $(RM) -f $@ + $(AR) crv $@ ${LIBOBJS} + $(RANLIB) $@ + audit.o: ${AUDIT}/audit.c ${CCRULE} @@ -276,9 +281,15 @@ -ln -f -s ${LIBAFSAUTHENT} ${DESTDIR}${libdir}/libafsauthent.${SHLIB_SUFFIX} -ln -f -s ${LIBAFSAUTHENT} ${DESTDIR}${libdir}/libafsauthent.${SHLIB_SUFFIX}.${LIBAFSAUTHENTMAJOR} +${DESTDIR}${libdir}/libafsauthent_pic.a: libafsauthent_pic.a + ${INSTALL} libafsauthent_pic.a $@ + ${TOP_LIBDIR}/${LIBAFSAUTHENT}: ${LIBAFSAUTHENT} ${INSTALL} ${LIBAFSAUTHENT} ${TOP_LIBDIR}/${LIBAFSAUTHENT} -ln -f -s ${LIBAFSAUTHENT} ${TOP_LIBDIR}/libafsauthent.${SHLIB_SUFFIX} -ln -f -s ${LIBAFSAUTHENT} ${TOP_LIBDIR}/libafsauthent.${SHLIB_SUFFIX}.${LIBAFSAUTHENTMAJOR} -dest: ${DEST}/lib/${LIBAFSAUTHENT} +${TOP_LIBDIR}/libafsauthent_pic.a: libafsauthent_pic.a + ${INSTALL} libafsauthent_pic.a $@ + +dest: ${DEST}/lib/${LIBAFSAUTHENT} ${DEST}/lib/libafsauthent_pic.a Index: openafs-1.4.6.dfsg1/src/shlibafsrpc/Makefile.in =================================================================== --- openafs-1.4.6.dfsg1.orig/src/shlibafsrpc/Makefile.in 2006-08-20 18:24:10.000000000 -0400 +++ openafs-1.4.6.dfsg1/src/shlibafsrpc/Makefile.in 2009-07-27 01:34:39.000000000 -0400 @@ -134,15 +134,17 @@ LIBAFSRPC = libafsrpc.${SHLIB_SUFFIX}.${LIBAFSRPCMAJOR}.${LIBAFSRPCMINOR} -all: ${TOP_LIBDIR}/${LIBAFSRPC} +all: ${TOP_LIBDIR}/${LIBAFSRPC} ${TOP_LIBDIR}/libafsrpc_pic.a -install: ${DESTDIR}${libdir}/${LIBAFSRPC} +install: ${DESTDIR}${libdir}/${LIBAFSRPC} ${DESTDIR}${libdir}/libafsrpc_pic.a ${DEST}/lib/${LIBAFSRPC}: ${LIBAFSRPC} ${INSTALL} ${LIBAFSRPC} ${DEST}/lib/${LIBAFSRPC} -ln -f -s ${LIBAFSRPC} ${DEST}/lib/libafsrpc.${SHLIB_SUFFIX} -ln -f -s ${LIBAFSRPC} ${DEST}/lib/libafsrpc.${SHLIB_SUFFIX}.${LIBAFSRPCMAJOR} +${DEST}/lib/libafsrpc_pic.a: libafsrpc_pic.a + ${LIBAFSRPC}: ${LIBOBJS} case ${SYS_NAME} in \ rs_aix4* | rs_aix5*) \ @@ -157,6 +159,11 @@ ${SHLIB_LINKER} -o ${LIBAFSRPC} ${LIBOBJS} ${MT_LIBS};; \ esac +libafsrpc_pic.a: ${LIBOBJS} + $(RM) -f $@ + $(AR) crv $@ ${LIBOBJS} + $(RANLIB) $@ + rx_event.o: ${RX}/rx_event.c ${CCRULE} @@ -418,10 +425,16 @@ -ln -f -s ${LIBAFSRPC} ${DESTDIR}${libdir}/libafsrpc.${SHLIB_SUFFIX} -ln -f -s ${LIBAFSRPC} ${DESTDIR}${libdir}/libafsrpc.${SHLIB_SUFFIX}.${LIBAFSRPCMAJOR} +${DESTDIR}${libdir}/libafsrpc_pic.a: libafsrpc_pic.a + ${INSTALL} libafsrpc_pic.a $@ + ${TOP_LIBDIR}/${LIBAFSRPC}: ${LIBAFSRPC} ${INSTALL} ${LIBAFSRPC} ${TOP_LIBDIR}/${LIBAFSRPC} -ln -f -s ${LIBAFSRPC} ${TOP_LIBDIR}/libafsrpc.${SHLIB_SUFFIX} -ln -f -s ${LIBAFSRPC} ${TOP_LIBDIR}/libafsrpc.${SHLIB_SUFFIX}.${LIBAFSRPCMAJOR} -dest: ${DEST}/lib/${LIBAFSRPC} +${TOP_LIBDIR}/libafsrpc_pic.a: libafsrpc_pic.a + ${INSTALL} libafsrpc_pic.a $@ + +dest: ${DEST}/lib/${LIBAFSRPC} ${DEST}/lib/libafsrpc_pic.a