Package: cmor / 2.9.1-5

shlib-link.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
Author: Alastair McKinstry <mckinstry@debian.org>
Description: Bugfix to link libcmor.so.2 against -lossp-uuid
Last-Updated: 2013-06-13
Forwarded: no

Index: cmor-2.9.1/Makefile.in
===================================================================
--- cmor-2.9.1.orig/Makefile.in
+++ cmor-2.9.1/Makefile.in
@@ -34,6 +34,8 @@ MACROS=@MACROS@
 
 # Library name
 LIBNAME=libcmor.a
+SONAME := libcmor.so.2
+SHLIBFLAGS:= -Wl,-O1 -Wl,-soname,$(SONAME) -Wl,--version-script,cmor.ver -lgfortran
 
 # Library sources
 #LIBSOURCES=Src/cmor.c Src/cmor_variables.c Src/cmor_axes.c Src/cmor_tables.c Src/cmor_grids.c Src/cdTime/cdTimeConv.c Src/cdTime/cdUtil.c Src/cdTime/timeConv.c Src/cdTime/timeArith.c
@@ -48,39 +50,58 @@ INCFILES=@INCFILES@
 # Temporary Files
 TMPFILES=*~ $(LIBFILES) *.mod a.out *.stb Test/*.nc Test/IPCC_Fourth_Assessment *.LOG* *.dSYM Test/IPCC Test/CMIP5 CMIP5
 DISTFILES=libcmor.a
-DEPEND= makedepend -c ${DEBUG} ${CFLAGS} ${USERCFLAGS}  ${NCCFLAGS} ${UDUNITS2FLAGS} ${UUIDFLAGS} ${ZFLAGS}
+DEPEND= makedepend -c ${DEBUG} ${CFLAGS} ${USERCFLAGS}  ${NCCFLAGS} ${UDUNITS2FLAGS} ${UUIDLDFLAGS} ${ZFLAGS}
 
 all:    cmor
 	@echo
+
+
+PIC_OBJS = $(patsubst %.c, %.pic_o, $(LIBSOURCES)) $(patsubst %.f90,%.pic_o, $(LIBFSOURCES))
+
+%.pic_o: %.c
+	@CC@ @CPPFLAGS@  -I/usr/include/ossp -fstack-protector --param=ssp-buffer-size=4 \
+		-Wformat -Wformat-security -Werror=format-security  -D_FORTIFY_SOURCE=2 \
+		-fPIC -c -o $@  @DEBUG@ @MACROS@ @CFLAGS@  @NCCFLAGS@ @UDUNITS2FLAGS@ @UUIDLDFLAGS@ @ZFLAGS@  $<
+
+%.pic_o: %.f90
+	@FC@ -c -o $@ -fPIC @FCFLAGS@ @DEBUG@ @MACROS@  $<
+
+shlib $(SONAME):   $(PIC_OBJS)
+	$(CC) -shared  -o $(SONAME) $(LDFLAGS) $(SHLIBFLAGS)  $(PIC_OBJS)  @NCCFLAGS@ @UDUNITS2FLAGS@ @UUIDLDFLAGS@ @ZFLAGS@ 
+install_shlib: $(SONAME)
+	mkdir -p $(DESTDIR)@prefix@/lib
+	cp -p $(SONAME) $(DESTDIR)@prefix@/lib
+
 depend:  $(LIBSOURCES)
 	${DEPEND}  $(LIBSOURCES)
 cmor.o: Src/cmor.c include/cmor.h include/cmor_func_def.h
-	${CC} -c ${DEBUG} ${MACROS} ${CFLAGS} ${USERCFLAGS}  ${NCCFLAGS} ${UDUNITS2FLAGS} ${UUIDFLAGS} ${ZFLAGS} Src/cmor.c
+	${CC} -c ${DEBUG} ${MACROS} ${CFLAGS} ${USERCFLAGS}  ${NCCFLAGS} ${UDUNITS2FLAGS} ${UUIDLDFLAGS} ${ZFLAGS} Src/cmor.c
 cmor_variables.o: Src/cmor_variables.c include/cmor.h include/cmor_func_def.h
-	${CC} -c ${DEBUG} ${MACROS} ${CFLAGS} ${USERCFLAGS}  ${NCCFLAGS} ${UDUNITS2FLAGS} ${UUIDFLAGS} ${ZFLAGS} Src/cmor_variables.c
+	${CC} -c ${DEBUG} ${MACROS} ${CFLAGS} ${USERCFLAGS}  ${NCCFLAGS} ${UDUNITS2FLAGS} ${UUIDLDFLAGS} ${ZFLAGS} Src/cmor_variables.c
 cmor_axes.o: Src/cmor_axes.c include/cmor.h include/cmor_func_def.h
-	${CC} -c ${DEBUG} ${MACROS} ${CFLAGS} ${USERCFLAGS}  ${NCCFLAGS} ${UDUNITS2FLAGS} ${UUIDFLAGS} ${ZFLAGS} Src/cmor_axes.c
+	${CC} -c ${DEBUG} ${MACROS} ${CFLAGS} ${USERCFLAGS}  ${NCCFLAGS} ${UDUNITS2FLAGS} ${UUIDLDFLAGS} ${ZFLAGS} Src/cmor_axes.c
 cmor_tables.o: Src/cmor_tables.c include/cmor.h include/cmor_func_def.h
-	${CC} -c ${DEBUG} ${MACROS} ${CFLAGS} ${USERCFLAGS}  ${NCCFLAGS} ${UDUNITS2FLAGS} ${UUIDFLAGS} ${ZFLAGS} Src/cmor_tables.c
+	${CC} -c ${DEBUG} ${MACROS} ${CFLAGS} ${USERCFLAGS}  ${NCCFLAGS} ${UDUNITS2FLAGS} ${UUIDLDFLAGS} ${ZFLAGS} Src/cmor_tables.c
 cmor_grids.o: Src/cmor_grids.c include/cmor.h include/cmor_func_def.h
-	${CC} -c ${DEBUG} ${MACROS} ${CFLAGS} ${USERCFLAGS}  ${NCCFLAGS} ${UDUNITS2FLAGS} ${UUIDFLAGS} ${ZFLAGS} Src/cmor_grids.c
+	${CC} -c ${DEBUG} ${MACROS} ${CFLAGS} ${USERCFLAGS}  ${NCCFLAGS} ${UDUNITS2FLAGS} ${UUIDLDFLAGS} ${ZFLAGS} Src/cmor_grids.c
 cmor_md5.o: Src/cmor_md5.c include/cmor.h include/cmor_func_def.h include/cmor_md5.h
-	${CC} -c ${DEBUG} ${MACROS} ${CFLAGS} ${USERCFLAGS}  ${NCCFLAGS} ${UDUNITS2FLAGS} ${UUIDFLAGS} ${ZFLAGS} Src/cmor_md5.c
+	${CC} -c ${DEBUG} ${MACROS} ${CFLAGS} ${USERCFLAGS}  ${NCCFLAGS} ${UDUNITS2FLAGS} ${UUIDLDFLAGS} ${ZFLAGS} Src/cmor_md5.c
 cmor_cfortran_interface.o: Src/cmor_cfortran_interface.c include/cmor.h include/cmor_func_def.h
-	${CC} -c ${DEBUG} ${MACROS} ${CFLAGS} ${USERCFLAGS}  ${NCCFLAGS} ${UDUNITS2FLAGS} ${UUIDFLAGS} ${ZFLAGS} Src/cmor_cfortran_interface.c
+	${CC} -c ${DEBUG} ${MACROS} ${CFLAGS} ${USERCFLAGS}  ${NCCFLAGS} ${UDUNITS2FLAGS} ${UUIDLDFLAGS} ${ZFLAGS} Src/cmor_cfortran_interface.c
 cdTimeConv.o: Src/cdTime/cdTimeConv.c include/cmor.h include/cmor_func_def.h
-	${CC} -c ${DEBUG} ${MACROS} ${CFLAGS} ${USERCFLAGS}  ${NCCFLAGS} ${UDUNITS2FLAGS} ${UUIDFLAGS} ${ZFLAGS} Src/cdTime/cdTimeConv.c
+	${CC} -c ${DEBUG} ${MACROS} ${CFLAGS} ${USERCFLAGS}  ${NCCFLAGS} ${UDUNITS2FLAGS} ${UUIDLDFLAGS} ${ZFLAGS} Src/cdTime/cdTimeConv.c
 cdUtil.o: Src/cdTime/cdUtil.c include/cmor.h include/cmor_func_def.h
-	${CC} -c ${DEBUG} ${MACROS} ${CFLAGS} ${USERCFLAGS}  ${NCCFLAGS} ${UDUNITS2FLAGS} ${UUIDFLAGS} ${ZFLAGS} Src/cdTime/cdUtil.c
+	${CC} -c ${DEBUG} ${MACROS} ${CFLAGS} ${USERCFLAGS}  ${NCCFLAGS} ${UDUNITS2FLAGS} ${UUIDLDFLAGS} ${ZFLAGS} Src/cdTime/cdUtil.c
 timeConv.o: Src/cdTime/timeConv.c include/cmor.h include/cmor_func_def.h
-	${CC} -c ${DEBUG} ${MACROS} ${CFLAGS} ${USERCFLAGS}  ${NCCFLAGS} ${UDUNITS2FLAGS} ${UUIDFLAGS} ${ZFLAGS} Src/cdTime/timeConv.c
+	${CC} -c ${DEBUG} ${MACROS} ${CFLAGS} ${USERCFLAGS}  ${NCCFLAGS} ${UDUNITS2FLAGS} ${UUIDLDFLAGS} ${ZFLAGS} Src/cdTime/timeConv.c
 timeArith.o:Src/cdTime/timeArith.c include/cmor.h include/cmor_func_def.h
-	${CC} -c ${DEBUG} ${MACROS} ${CFLAGS} ${USERCFLAGS}  ${NCCFLAGS} ${UDUNITS2FLAGS} ${UUIDFLAGS} ${ZFLAGS} Src/cdTime/timeArith.c
+	${CC} -c ${DEBUG} ${MACROS} ${CFLAGS} ${USERCFLAGS}  ${NCCFLAGS} ${UDUNITS2FLAGS} ${UUIDLDFLAGS} ${ZFLAGS} Src/cdTime/timeArith.c
 cmor_fortran_interface.o: Src/cmor_fortran_interface.f90
 	${FC} -c ${FCFLAGS} ${USERFFLAGS} ${DEBUG} ${MACROS} Src/cmor_fortran_interface.f90
 cmor:  $(LIBFILES) @MAKEDEPPYTHON@
 	@ar crv $(LIBNAME) $(LIBFILES) 
 	@ranlib $(LIBNAME)
+
 clean:
 	@echo "Cleaning [$(WHEREAMI)] ..."
 	@rm -rf $(TMPFILES)