source: third_tags/openafs/+invirt3/pic-afs-libs @ 2747

Last change on this file since 2747 was 2374, checked in by broder, 15 years ago

Instead of installing the (somewhat broken) AFS shared libraries,
backport bbab48b047000db0d1821e2f65917c2e8c2c7768 from the AFS tree to
build and install PIC versions of the libraries.

File size: 5.4 KB
Line 
1From bbab48b047000db0d1821e2f65917c2e8c2c7768 Mon Sep 17 00:00:00 2001
2From: Russ Allbery <rra@stanford.edu>
3Date: Mon, 6 Jul 2009 18:41:39 -0700
4Subject: [PATCH] Build and install PIC versions of libafsrpc and libafsauthent
5
6To include AFS code in loadable modules such as PAM modules, NSS modules,
7or Perl/Python/PHP/Ruby extensions, it needs to be built PIC or one must
8link with the AFS shared libraries.  Since we haven't historically been
9that great about maintaining the shared library ABI, it's nice to have
10static libraries built with PIC code that can be linked into such modules.
11
12Based on a patch by Garrett Wollman updated with the build system changes
13that happened after 1.4.
14
15Make shlib makefiles have clean rules for PIC libraries.
16Make RedHat specfile know how to deal with PIC libraries.
17
18Reviewed-on: http://gerrit.openafs.org/8
19Verified-by: Derrick Brashear <shadow@dementia.org>
20Reviewed-by: Derrick Brashear <shadow@dementia.org>
21Backported-by: Evan Broder <broder@mit.edu>
22---
23 src/packaging/RedHat/openafs.spec.in |    2 ++
24 src/shlibafsauthent/Makefile.in      |   20 ++++++++++++++++----
25 src/shlibafsrpc/Makefile.in          |   18 ++++++++++++++----
26 3 files changed, 32 insertions(+), 8 deletions(-)
27
28Index: openafs-1.4.6.dfsg1/src/packaging/RedHat/openafs.spec.in
29===================================================================
30--- openafs-1.4.6.dfsg1.orig/src/packaging/RedHat/openafs.spec.in       2007-10-18 00:14:18.000000000 -0400
31+++ openafs-1.4.6.dfsg1/src/packaging/RedHat/openafs.spec.in    2009-07-27 01:23:51.000000000 -0400
32@@ -1443,6 +1443,8 @@
33 %defattr(-,root,root)
34 %{_libdir}/libafsauthent.a
35 %{_libdir}/libafsrpc.a
36+%{_libdir}/libafsauthent_pic.a
37+%{_libdir}/libafsrpc_pic.a
38 %if %{build_authlibs}
39 %{_libdir}/libafsauthent.so
40 %{_libdir}/libafsrpc.so
41Index: openafs-1.4.6.dfsg1/src/shlibafsauthent/Makefile.in
42===================================================================
43--- openafs-1.4.6.dfsg1.orig/src/shlibafsauthent/Makefile.in    2006-08-20 16:17:25.000000000 -0400
44+++ openafs-1.4.6.dfsg1/src/shlibafsauthent/Makefile.in 2009-07-27 01:35:11.000000000 -0400
45@@ -104,9 +104,9 @@
46        -ln -f -s ${LIBAFSAUTHENT} ${DEST}/lib/libafsauthent.${SHLIB_SUFFIX}
47        -ln -f -s ${LIBAFSAUTHENT} ${DEST}/lib/libafsauthent.${SHLIB_SUFFIX}.${LIBAFSAUTHENTMAJOR}
48 
49-all: ${TOP_LIBDIR}/${LIBAFSAUTHENT}
50+all: ${TOP_LIBDIR}/${LIBAFSAUTHENT} ${TOP_LIBDIR}/libafsauthent_pic.a
51 
52-install: ${DESTDIR}${libdir}/${LIBAFSAUTHENT}
53+install: ${DESTDIR}${libdir}/${LIBAFSAUTHENT} ${DESTDIR}${libdir}/libafsauthent_pic.a
54 
55 ${LIBAFSAUTHENT}: ${LIBOBJS}
56        case ${SYS_NAME} in \
57@@ -120,6 +120,11 @@
58                ${SHLIB_LINKER} -o ${LIBAFSAUTHENT} ${LIBOBJS} -L${TOP_LIBDIR} -lafsrpc ${MT_LIBS};; \
59        esac
60 
61+libafsauthent_pic.a: ${LIBOBJS}
62+       $(RM) -f $@
63+       $(AR) crv $@ ${LIBOBJS}
64+       $(RANLIB) $@
65+
66 audit.o: ${AUDIT}/audit.c
67        ${CCRULE}
68 
69@@ -276,9 +281,15 @@
70        -ln -f -s ${LIBAFSAUTHENT} ${DESTDIR}${libdir}/libafsauthent.${SHLIB_SUFFIX}
71        -ln -f -s ${LIBAFSAUTHENT} ${DESTDIR}${libdir}/libafsauthent.${SHLIB_SUFFIX}.${LIBAFSAUTHENTMAJOR}
72 
73+${DESTDIR}${libdir}/libafsauthent_pic.a: libafsauthent_pic.a
74+       ${INSTALL} libafsauthent_pic.a $@
75+
76 ${TOP_LIBDIR}/${LIBAFSAUTHENT}: ${LIBAFSAUTHENT}
77        ${INSTALL} ${LIBAFSAUTHENT} ${TOP_LIBDIR}/${LIBAFSAUTHENT}
78        -ln -f -s ${LIBAFSAUTHENT} ${TOP_LIBDIR}/libafsauthent.${SHLIB_SUFFIX}
79        -ln -f -s ${LIBAFSAUTHENT} ${TOP_LIBDIR}/libafsauthent.${SHLIB_SUFFIX}.${LIBAFSAUTHENTMAJOR}
80 
81-dest: ${DEST}/lib/${LIBAFSAUTHENT}
82+${TOP_LIBDIR}/libafsauthent_pic.a: libafsauthent_pic.a
83+       ${INSTALL} libafsauthent_pic.a $@
84+
85+dest: ${DEST}/lib/${LIBAFSAUTHENT} ${DEST}/lib/libafsauthent_pic.a
86Index: openafs-1.4.6.dfsg1/src/shlibafsrpc/Makefile.in
87===================================================================
88--- openafs-1.4.6.dfsg1.orig/src/shlibafsrpc/Makefile.in        2006-08-20 18:24:10.000000000 -0400
89+++ openafs-1.4.6.dfsg1/src/shlibafsrpc/Makefile.in     2009-07-27 01:34:39.000000000 -0400
90@@ -134,15 +134,17 @@
91 
92 LIBAFSRPC = libafsrpc.${SHLIB_SUFFIX}.${LIBAFSRPCMAJOR}.${LIBAFSRPCMINOR}
93 
94-all: ${TOP_LIBDIR}/${LIBAFSRPC}
95+all: ${TOP_LIBDIR}/${LIBAFSRPC} ${TOP_LIBDIR}/libafsrpc_pic.a
96 
97-install: ${DESTDIR}${libdir}/${LIBAFSRPC}
98+install: ${DESTDIR}${libdir}/${LIBAFSRPC} ${DESTDIR}${libdir}/libafsrpc_pic.a
99 
100 ${DEST}/lib/${LIBAFSRPC}: ${LIBAFSRPC}
101        ${INSTALL} ${LIBAFSRPC} ${DEST}/lib/${LIBAFSRPC}
102        -ln -f -s ${LIBAFSRPC} ${DEST}/lib/libafsrpc.${SHLIB_SUFFIX}
103        -ln -f -s ${LIBAFSRPC} ${DEST}/lib/libafsrpc.${SHLIB_SUFFIX}.${LIBAFSRPCMAJOR}
104 
105+${DEST}/lib/libafsrpc_pic.a: libafsrpc_pic.a
106+
107 ${LIBAFSRPC}: ${LIBOBJS}
108        case ${SYS_NAME} in \
109        rs_aix4* | rs_aix5*) \
110@@ -157,6 +159,11 @@
111                ${SHLIB_LINKER} -o ${LIBAFSRPC} ${LIBOBJS} ${MT_LIBS};; \
112        esac
113 
114+libafsrpc_pic.a: ${LIBOBJS}
115+       $(RM) -f $@
116+       $(AR) crv $@ ${LIBOBJS}
117+       $(RANLIB) $@
118+
119 rx_event.o: ${RX}/rx_event.c
120        ${CCRULE}
121 
122@@ -418,10 +425,16 @@
123        -ln -f -s ${LIBAFSRPC} ${DESTDIR}${libdir}/libafsrpc.${SHLIB_SUFFIX}
124        -ln -f -s ${LIBAFSRPC} ${DESTDIR}${libdir}/libafsrpc.${SHLIB_SUFFIX}.${LIBAFSRPCMAJOR}
125 
126+${DESTDIR}${libdir}/libafsrpc_pic.a: libafsrpc_pic.a
127+       ${INSTALL} libafsrpc_pic.a $@
128+
129 ${TOP_LIBDIR}/${LIBAFSRPC}: ${LIBAFSRPC}
130        ${INSTALL} ${LIBAFSRPC} ${TOP_LIBDIR}/${LIBAFSRPC}
131        -ln -f -s ${LIBAFSRPC} ${TOP_LIBDIR}/libafsrpc.${SHLIB_SUFFIX}
132        -ln -f -s ${LIBAFSRPC} ${TOP_LIBDIR}/libafsrpc.${SHLIB_SUFFIX}.${LIBAFSRPCMAJOR}
133 
134-dest: ${DEST}/lib/${LIBAFSRPC}
135+${TOP_LIBDIR}/libafsrpc_pic.a: libafsrpc_pic.a
136+       ${INSTALL} libafsrpc_pic.a $@
137+
138+dest: ${DEST}/lib/${LIBAFSRPC} ${DEST}/lib/libafsrpc_pic.a
139 
Note: See TracBrowser for help on using the repository browser.