gnu: mumps: Build and install shared libraries.
[jackhill/guix/guix.git] / gnu / packages / patches / mumps-shared-pord.patch
1 Create static and shared versions of the PORD library.
2
3 Index: mumps/PORD/lib/Makefile
4 ===================================================================
5 --- mumps.orig/PORD/lib/Makefile
6 +++ mumps/PORD/lib/Makefile
7 @@ -9,7 +9,7 @@
8
9 INCLUDES = -I../include
10
11 -COPTIONS = $(INCLUDES) $(CFLAGS) $(OPTFLAGS)
12 +COPTIONS = $(INCLUDES) $(CFLAGS) $(OPTFLAGS) -fPIC
13
14 OBJS = graph.o gbipart.o gbisect.o ddcreate.o ddbisect.o nestdiss.o \
15 multisector.o gelim.o bucket.o tree.o \
16 @@ -24,12 +24,16 @@ OBJS = graph.o gbipart.o gbisect.o ddcre
17 .c.o:
18 $(CC) $(COPTIONS) -c $*.c $(OUTC)$*.o
19
20 -libpord$(LIBEXT):$(OBJS)
21 - $(AR)$@ $(OBJS)
22 +libpord$(PLAT).a:$(OBJS)
23 + $(AR) $@ $(OBJS)
24 $(RANLIB) $@
25
26 +libpord$(PLAT).so: $(OBJS)
27 + $(CC) -shared $(OBJS) -Wl,-soname,libpord$(PLAT)-5.1.2.so -o libpord$(PLAT)-5.1.2.so -Wl,-z,defs
28 + ln -s libpord$(PLAT)-5.1.2.so $@
29 +
30 clean:
31 rm -f *.o
32
33 realclean:
34 - rm -f *.o libpord.a
35 + rm -f *.o libpord*.a *.so
36 Index: mumps/Makefile
37 ===================================================================
38 --- mumps.orig/Makefile
39 +++ mumps/Makefile
40 @@ -54,7 +54,7 @@ dexamples: d
41 multi_example: s d c z
42 (cd examples ; $(MAKE) multi)
43
44 -requiredobj: Makefile.inc $(LIBSEQNEEDED) $(libdir)/libpord$(PLAT)$(LIBEXT)
45 +requiredobj: Makefile.inc $(LIBSEQNEEDED) $(libdir)/libpord$(PLAT).a $(libdir)/libpord$(PLAT).so
46
47 # dummy MPI library (sequential version)
48
49 @@ -62,19 +62,25 @@ libseqneeded:
50 (cd libseq; $(MAKE))
51
52 # Build the libpord.a library and copy it into $(topdir)/lib
53 -$(libdir)/libpord$(PLAT)$(LIBEXT):
54 +$(libdir)/libpord$(PLAT).a:
55 if [ "$(LPORDDIR)" != "" ] ; then \
56 cd $(LPORDDIR); \
57 $(MAKE) CC="$(CC)" CFLAGS="$(OPTC)" AR="$(AR)" RANLIB="$(RANLIB)" OUTC="$(OUTC)" LIBEXT=$(LIBEXT); \
58 fi;
59 if [ "$(LPORDDIR)" != "" ] ; then \
60 - cp $(LPORDDIR)/libpord$(LIBEXT) $@; \
61 + cp $(LPORDDIR)/libpord$(PLAT).a $@; \
62 fi;
63
64 +$(libdir)/libpord$(PLAT).so:
65 + if [ "$(LPORDDIR)" != "" ] ; then \
66 + cd $(LPORDDIR); make CC="$(CC)" CFLAGS="$(OPTC)" AR="$(AR)" ARFUNCT= RANLIB="$(RANLIB)" libpord$(PLAT).so; fi;
67 + if [ "$(LPORDDIR)" != "" ] ; then \
68 + cp -a $(LPORDDIR)/libpord*.so lib/; fi;
69 +
70 clean:
71 (cd src; $(MAKE) clean)
72 (cd examples; $(MAKE) clean)
73 - (cd $(libdir); $(RM) *$(PLAT)$(LIBEXT))
74 + (cd $(libdir); $(RM) *$(PLAT).a *$(PLAT).so)
75 (cd libseq; $(MAKE) clean)
76 if [ "$(LPORDDIR)" != "" ] ; then \
77 cd $(LPORDDIR); $(MAKE) realclean; \