9000aab04716114c91dc7c8f8a471ac244afe34d
[openafs.git] / src / packaging / Debian / patches / pam-build
1 Apply an incredibly ugly hack to build the PAM modules against the shared
2 objects generated for the shared libraries.  Not suitable upstream in its
3 current form.  The right upstream solution is to standardize the shared
4 library ABI and install it with a real SONAME, and then link the PAM
5 modules against it.
6
7 --- openafs.orig/Makefile.in
8 +++ openafs/Makefile.in
9 @@ -515,8 +515,6 @@
10  # pthread based user space RX library
11  shlibafsrpc: rx rxkad des
12         case ${SYS_NAME} in \
13 -       amd64_linux24) \
14 -               echo Skipping shlibafsrpc for amd64_linux24 ;; \
15         alpha_dux*|sgi_*|sun4x_*|sunx86_*|rs_aix*|*linux*|hp_ux11*|ia64_hpux*) \
16         ${COMPILE_PART1} shlibafsrpc ${COMPILE_PART2} ;; \
17         *) \
18 @@ -525,8 +523,6 @@
19  
20  shlibafsauthent: ubik auth kauth shlibafsrpc
21         case ${SYS_NAME} in \
22 -       amd64_linux24) \
23 -               echo Skipping shlibafsauthent for amd64_linux24 ;; \
24         alpha_dux*|sgi_*|sun4x_*|sunx86_*|rs_aix*|*linux*|hp_ux11*|ia64_hpux*) \
25         ${COMPILE_PART1} shlibafsauthent ${COMPILE_PART2} ;; \
26         *) \
27 --- openafs.orig/src/pam/Makefile.in
28 +++ openafs/src/pam/Makefile.in
29 @@ -25,7 +25,17 @@
30           afs_pam_msg.o afs_message.o AFS_component_version_number.o
31     OBJS = $(SHOBJS) test_pam.o
32  INCLUDES=-I${TOP_OBJDIR}/src/config -I${TOP_INCDIR} 
33 -CFLAGS =  ${DEBUG} ${INCLUDES} ${PAM_CFLAGS}
34 +CFLAGS =  ${DEBUG} ${INCLUDES} ${PAM_CFLAGS} ${MT_CFLAGS}
35 +
36 +# For Debian, we link directly with the object files that would have gone
37 +# into the libafsrpc and libafsauthent shared libraries.  The shared libraries
38 +# themselves cannot be used because the interface isn't stable and they have
39 +# no SONAME, but this is the easiest way of getting PIC objects built with the
40 +# pthread API.
41 +SHLIB_OBJS     := `ls ../shlibafsauthent/*.o | grep -v version_num` \
42 +                  `ls ../shlibafsrpc/*.o | grep -v version_num`
43 +KRB_SHLIB_OBJS := `ls ../shlibafsauthent/*.o | egrep -v 'version_num|ktc.o'` \
44 +                  `ls ../shlibafsrpc/*.o | grep -v version_num`
45  
46  all: test_pam ${TOP_LIBDIR}/pam_afs.so.1 ${TOP_LIBDIR}/pam_afs.krb.so.1
47  
48 @@ -47,6 +57,9 @@
49  afs_util_krb.o: afs_util.c afs_pam_msg.h afs_message.h afs_util.h
50         ${CC} ${CFLAGS} -DAFS_KERBEROS_ENV -c ${srcdir}/afs_util.c -o afs_util_krb.o
51  
52 +ktc.o: ${srcdir}/../auth/ktc.c
53 +       ${CC} ${CFLAGS} -DAFS_KERBEROS_ENV -c ${srcdir}/../auth/ktc.c
54 +
55  pam_afs.so.1: $(SHOBJS) afs_setcred.o afs_auth.o afs_util.o
56         set -x; \
57         case "$(SYS_NAME)" in \
58 @@ -59,8 +72,9 @@
59                         afs_setcred.o afs_auth.o afs_util.o \
60                         $(SHOBJS) $(LIBS) ;; \
61         *linux*) \
62 -               $(CC) $(LDFLAGS) -o $@ afs_setcred.o \
63 -                       afs_auth.o afs_util.o $(SHOBJS) $(LIBS) ;;\
64 +               $(CC) $(LDFLAGS) $(PAM_CFLAGS) -o $@ afs_setcred.o \
65 +                       afs_auth.o afs_util.o $(SHOBJS) $(SHLIB_OBJS) \
66 +                       $(MT_LIBS) -lpam -lresolv;;\
67         *fbsd*| *nbsd*) \
68                 $(CC) $(LDFLAGS) -o $@ afs_setcred.o \
69                         afs_auth.o afs_util.o $(SHOBJS) $(LIBS) ;;\
70 @@ -68,7 +82,7 @@
71                 echo No link line for system $(SYS_NAME). ;; \
72         esac
73  
74 -pam_afs.krb.so.1: $(SHOBJS) afs_setcred_krb.o afs_auth_krb.o afs_util_krb.o
75 +pam_afs.krb.so.1: $(SHOBJS) afs_setcred_krb.o afs_auth_krb.o afs_util_krb.o ktc.o
76         set -x; \
77         case "$(SYS_NAME)" in \
78         hp_ux* | ia64_hpux*) \
79 @@ -81,7 +95,8 @@
80                         $(SHOBJS) $(LDFLAGS) $(KLIBS) ;; \
81         *linux*) \
82                 $(CC) $(LDFLAGS) -o $@ afs_setcred_krb.o \
83 -                       afs_auth_krb.o afs_util_krb.o $(SHOBJS) $(KLIBS) ;;\
84 +                       afs_auth_krb.o afs_util_krb.o ktc.o $(SHOBJS) \
85 +                       $(KRB_SHLIB_OBJS) $(MT_LIBS) -lpam -lresolv;;\
86         *fbsd*| *nbsd*) \
87                 $(CC) $(LDFLAGS) -o $@ afs_setcred_krb.o \
88                         afs_auth_krb.o afs_util_krb.o $(SHOBJS) $(KLIBS) ;;\