2 ===================================================================
3 --- tabix.orig/Makefile 2012-12-21 16:59:37.846017464 -0800
4 +++ tabix/Makefile 2012-12-21 16:59:57.586016768 -0800
7 -CFLAGS= -g -Wall -O2 -fPIC #-m64 #-arch ppc
10 DFLAGS= -D_FILE_OFFSET_BITS=64 -D_USE_KNETFILE -DBGZF_CACHE
11 -LOBJS= bgzf.o kstring.o knetfile.o index.o bedidx.o
13 +LOBJS= bgzf.lo kstring.lo knetfile.lo index.lo bedidx.lo
15 +BOBJS= bgzip.lo bgzf.lo
25 +# catch platform settings
26 +UNAME := $(shell uname)
27 +ifeq ($(UNAME), Darwin)
43 + $(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) -c $(CFLAGS) $(DFLAGS) $(INCLUDES) $<
45 +all:$(PROG) $(LIBNAME)
49 + $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) $(CFLAGS) -version-info $(LIBVERSION) -rpath /usr/lib $(LOBJS) -o $@ -lc -lz
52 - $(CC) -c $(CFLAGS) $(DFLAGS) $(INCLUDES) $< -o $@
53 +tabix:$(AOBJS) $(LIBNAME)
54 + $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) $(CFLAGS) -o $@ $(AOBJS) $(LIBNAME) -lm -lz
56 -all-recur lib-recur clean-recur cleanlocal-recur install-recur:
57 - @target=`echo $@ | sed s/-recur//`; \
59 - list='$(SUBDIRS)'; for subdir in $$list; do \
61 - $(MAKE) CC="$(CC)" DFLAGS="$(DFLAGS)" CFLAGS="$(CFLAGS)" \
62 - INCLUDES="$(INCLUDES)" LIBPATH="$(LIBPATH)" $$target || exit 1; \
70 -libtabix.so.1:$(LOBJS)
71 - $(CC) -shared -Wl,-soname,libtabix.so -o $@ $(LOBJS) -lc -lz
73 -libtabix.1.dylib:$(LOBJS)
74 - libtool -dynamic $(LOBJS) -o $@ -lc -lz
77 - $(AR) -csru $@ $(LOBJS)
80 - $(CC) $(CFLAGS) -o $@ $(AOBJS) -L. -ltabix -lm $(LIBPATH) -lz
82 -bgzip:bgzip.o bgzf.o knetfile.o
83 - $(CC) $(CFLAGS) -o $@ bgzip.o bgzf.o knetfile.o -lz
85 + $(LIBTOOL) $(LTFLAGS) --mode=link $(CC) $(CFLAGS) -o $@ $(BOBJS) $(LIBNAME) -lz
87 TabixReader.class:TabixReader.java
88 javac -cp .:sam.jar TabixReader.java
94 - rm -fr gmon.out *.o a.out *.dSYM $(PROG) *~ *.a tabix.aux tabix.log tabix.pdf *.class libtabix.*.dylib libtabix.so*
96 -clean:cleanlocal-recur
98 + $(LIBTOOL) --mode=clean rm -fr gmon.out $(LOBJS) $(AOBJS) $(BOBJS) a.out *.dSYM $(PROG) *~ tabix.aux tabix.log tabix.pdf *.class libtabix.la
100 ===================================================================
101 --- tabix.orig/tabix.py 2012-12-21 16:59:37.846017464 -0800
102 +++ tabix/tabix.py 2012-12-21 17:06:31.342002867 -0800
104 from ctypes.util import find_library
105 import glob, platform
107 -def load_shared_library(lib, _path='.', ver='*'):
108 +def load_shared_library(lib, _path=None, ver='*'):
109 """Search for and load the tabix library. The
110 expectation is that the library is located in
111 the current directory (ie. "./")
113 # find from the system path
114 path = find_library(lib)
115 - if (path == None): # if fail, search in the custom directory
116 + if path is None: # if fail, search in the custom directory
117 + _path = list(_path) if _path is not None else ['.', '.libs']
118 s = platform.system()
119 if (s == 'Darwin'): suf = ver+'.dylib'
120 elif (s == 'Linux'): suf = '.so'+ver
121 - candidates = glob.glob(_path+'/lib'+lib+suf);
122 - if (len(candidates) == 1): path = candidates[0]
125 + candidates = glob.glob(_p+'/lib'+lib+suf);
126 + if (len(candidates) > 0): path = candidates[0]
127 + if path is None: return None
128 cdll.LoadLibrary(path)