File: adding_soname

package info (click to toggle)
genometools 1.6.6%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 50,528 kB
  • sloc: ansic: 271,876; ruby: 29,930; python: 5,106; sh: 3,083; makefile: 1,211; perl: 219; pascal: 159; haskell: 37; sed: 5
file content (53 lines) | stat: -rw-r--r-- 1,797 bytes parent folder | 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
Description: add soname to linker call in Makefile 
 Upstream Makefile does not build a shared object with soname or version 
 number. This patch adds support for sonames, as well a symlink from
 the .so to the .so.X file.
Author: Sascha Steinbiss <steinbiss@zbh.uni-hamburg.de>
--- a/Makefile
+++ b/Makefile
@@ -140,6 +140,7 @@
   SHARED_OBJ_NAME_EXT:=.so
   SHARED:=-shared
 endif
+SONAME_VERSION:=.0
 
 # compiled executables
 GTMAIN_SRC:=src/gt.c src/gtr.c src/gtt.c src/interactive.c
@@ -644,8 +645,9 @@
 	$(V_ECHO) "[link $(@F)]"
 	$(V_DO)test -d $(@D) || mkdir -p $(@D)
 	$(V_DO)$(CC) $(EXP_LDFLAGS) $(VERSION_SCRIPT_PARAM) \
-	  $(GT_LDFLAGS) $(ADDITIONAL_SO_DEPS) $(SHARED) $(LIBGENOMETOOLS_OBJ) \
-	  -o $@ $(GTSHAREDLIB_LIBDEP)
+	  $(GT_LDFLAGS) $(ADDITIONAL_SO_DEPS) $(SHARED) \
+		-Wl,-soname,$(notdir $@)$(SONAME_VERSION) $(LIBGENOMETOOLS_OBJ) \
+		-o $@$(SONAME_VERSION) $(GTSHAREDLIB_LIBDEP)
 
 define PROGRAM_template
 $(1): $(2) $(OVERRIDELIBS)
@@ -1015,7 +1017,8 @@
 	$(RANLIB) $(prefix)/lib/libgenometools.a
 endif
 ifneq ($(sharedlib),no)
-	cp lib/libgenometools$(SHARED_OBJ_NAME_EXT) $(prefix)/lib
+	cp lib/libgenometools$(SHARED_OBJ_NAME_EXT)$(SONAME_VERSION) $(prefix)/lib
+	ln -fs $(prefix)/lib/libgenometools$(SHARED_OBJ_NAME_EXT)$(SONAME_VERSION) $(prefix)/lib/libgenometools$(SHARED_OBJ_NAME_EXT)
 endif
 	$(V_ECHO) '[build config script $(@F)]'
 	sed -e 's!@CC@!$(CC)!' -e 's!@CFLAGS@!$(EXP_CFLAGS)!' \
--- a/gtpython/gt/dlload.py
+++ b/gtpython/gt/dlload.py
@@ -26,8 +26,12 @@
     soext = ".dylib"
 else:
     soext = ".so"
+try:
+	gtlib = CDLL("libgenometools" + soext)
+except OSError:
+	# Debian sets a version suffix
+	gtlib = CDLL("libgenometools" + soext + ".0")
 
-gtlib = CDLL("libgenometools" + soext)
 gtlib.gt_lib_init()
 gtlib.gt_lib_reg_atexit_func()