File: shared_lib.patch

package info (click to toggle)
libvcflib 1.0.0~rc1%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 46,836 kB
  • ctags: 1,488
  • sloc: cpp: 27,298; makefile: 177; ansic: 139; python: 46; perl: 26; sh: 19
file content (105 lines) | stat: -rw-r--r-- 3,983 bytes parent folder | download | duplicates (2)
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
Author: Andreas Tille <tille@debian.org>
Last-Update: Thu, 15 Sep 2016 22:26:26 +0200
Description: Create shared lib instead of static

--- a/Makefile
+++ b/Makefile
@@ -115,11 +115,11 @@ BINS = $(addprefix bin/,$(notdir $(BIN_S
 SHORTBINS = $(notdir $(BIN_SOURCES:.cpp=))
 
 # TABIX = tabixpp/tabix.o
-SMITHWATERMAN = smithwaterman/SmithWatermanGotoh.o
-REPEATS = smithwaterman/Repeats.o
-INDELALLELE = smithwaterman/IndelAllele.o
-DISORDER = smithwaterman/disorder.o
-LEFTALIGN = smithwaterman/LeftAlign.o
+# SMITHWATERMAN = smithwaterman/SmithWatermanGotoh.o
+# REPEATS = smithwaterman/Repeats.o
+# INDELALLELE = smithwaterman/IndelAllele.o
+# DISORDER = smithwaterman/disorder.o
+# LEFTALIGN = smithwaterman/LeftAlign.o
 FSOM = fsom/fsom.o
 FILEVERCMP = filevercmp/filevercmp.o
 
@@ -138,8 +138,11 @@ CXXFLAGS = -O3 -D_FILE_OFFSET_BITS=64 -s
 
 SSW = src/ssw.o src/ssw_cpp.o
 
-ssw.o: src/ssw.h
-ssw_cpp.o:src/ssw_cpp.h
+src/ssw.o: src/ssw.h src/ssw.c
+	$(CXX) -c $(CFLAGS) -fPIC -o $@ src/$(*F).c
+
+src/ssw_cpp.o: src/ssw_cpp.cpp src/ssw_cpp.h
+	$(CXX) -c $(CFLAGS) -fPIC -o $@ src/$(*F).cpp
 
 openmp:
 	$(MAKE) CXXFLAGS="$(CXXFLAGS) -fopenmp -D HAS_OPENMP"
@@ -151,7 +154,7 @@ gprof:
 	$(MAKE) CXXFLAGS="$(CXXFLAGS) -pg" all
 
 $(OBJECTS): $(SOURCES) $(HEADERS) multichoose pre $(SMITHWATERMAN) $(FILEVERCMP)
-	$(CXX) -c -o $@ src/$(*F).cpp $(INCLUDES) $(LDFLAGS) $(CXXFLAGS) && cp src/*.h* $(VCF_LIB_LOCAL)/$(INC_DIR)/
+	$(CXX) -c $(CFLAGS) -fPIC -o $@ src/$(*F).cpp $(INCLUDES) $(LDFLAGS) $(CXXFLAGS) && cp src/*.h* $(VCF_LIB_LOCAL)/$(INC_DIR)/
 
 multichoose: pre
 	echo "Source does not contain dir multichoose"
@@ -162,22 +165,6 @@ intervaltree: pre
 	# cd intervaltree && $(MAKE) && cp *.h* $(VCF_LIB_LOCAL)/$(INC_DIR)/
 	mkdir -p $(VCF_LIB_LOCAL)/$(INC_DIR)/ && cp -a debian/include/* $(VCF_LIB_LOCAL)/$(INC_DIR)/
 
-$(TABIX): pre
-	echo "No need to create separately packaged tabixpp"
-	# cd tabixpp && $(MAKE) && cp *.h* $(VCF_LIB_LOCAL)/$(INC_DIR)/
-
-$(SMITHWATERMAN): pre
-	echo "Source does not contain dir smithwaterman"
-	# cd smithwaterman && $(MAKE) && cp *.h* $(VCF_LIB_LOCAL)/$(INC_DIR)/ && cp *.o $(VCF_LIB_LOCAL)/$(OBJ_DIR)/
-
-$(DISORDER): $(SMITHWATERMAN)
-
-$(REPEATS): $(SMITHWATERMAN)
-
-$(LEFTALIGN): $(SMITHWATERMAN)
-
-$(INDELALLELE): $(SMITHWATERMAN)
-
 #$(FSOM):
 #	cd fsom && $(CXX) $(CXXFLAGS) -c fsom.c -lm
 
@@ -186,19 +173,20 @@ $(FILEVERCMP): pre
 	#cp /usr/share/gnulib/lib/filevercmp.* filevercmp
 	#echo 'Proper use of filevercmp would be: `gnulib-tool --import filevercmp` - but it needs ./configure.ac'
 	#We here go with quilt patches from upstream files
-	cd filevercmp && $(CXX) $(CXXFLAGS) -c filevercmp.c
+	cd filevercmp && $(CXX) $(CXXFLAGS) -fPIC -c filevercmp.c
 	ln -sf ../filevercmp/filevercmp.h $(VCF_LIB_LOCAL)/$(INC_DIR)/filevercmp.h
 
 $(SHORTBINS): pre
 	$(MAKE) bin/$@
 
-$(BINS): $(BIN_SOURCES) libvcflib.a $(OBJECTS) $(SMITHWATERMAN) $(DISORDER) $(LEFTALIGN) $(INDELALLELE) $(SSW) $(FILEVERCMP) pre intervaltree
+$(BINS): $(BIN_SOURCES) libvcflib.so $(OBJECTS) $(SMITHWATERMAN) $(DISORDER) $(LEFTALIGN) $(INDELALLELE) $(SSW) $(FILEVERCMP) pre intervaltree
 	$(CXX) src/$(notdir $@).cpp -o $@ $(INCLUDES) $(LDFLAGS) $(CXXFLAGS)
 
-libvcflib.a: $(OBJECTS) $(SMITHWATERMAN) $(REPEATS) $(DISORDER) $(LEFTALIGN) $(INDELALLELE) $(SSW) $(FILEVERCMP) pre
-	ar rs libvcflib.a $(OBJECTS) $(SSW) $(FILEVERCMP)
-	cp libvcflib.a $(LIB_DIR)
-
+libvcflib.so: $(OBJECTS) $(SMITHWATERMAN) $(REPEATS) $(DISORDER) $(LEFTALIGN) $(INDELALLELE) $(SSW) $(FILEVERCMP) pre
+	# ar rs libvcflib.a $(OBJECTS) $(SSW) $(FILEVERCMP)
+	gcc -shared  -Wl,-soname -Wl,libvcflib.so.1 -o libvcflib.so.1 $(OBJECTS) $(SSW) $(FILEVERCMP)
+	ln -s libvcflib.so.1 libvcflib.so
+	cp -a libvcflib.so* $(LIB_DIR)
 
 test: $(BINS)
 	@prove -Itests/lib -w tests/*.t
@@ -218,7 +206,7 @@ update: pull all
 clean:
 	rm -f $(BINS) $(OBJECTS)
 	rm -f ssw_cpp.o ssw.o
-	rm -f libvcflib.a
+	rm -f libvcflib.so
 	rm -rf $(BIN_DIR)
 	rm -rf $(LIB_DIR)
 	rm -rf $(INC_DIR)