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
|
Author: Laszlo Kajan <lkajan@rostlab.org>
Description: python build system
Forwarded: http://lists.alioth.debian.org/pipermail/debian-med-packaging/2012-August/016975.html
--- /dev/null
+++ librcsb-core-wrapper/wrapper/python/setup.py.in
@@ -0,0 +1,49 @@
+#!/usr/bin/python3
+
+from distutils import sysconfig
+from distutils.core import setup, Extension
+import os
+import platform
+import sys
+
+# lkajan: we follow the example of libtorrent-rasterbar here - thank you very much for that!
+def parse_cmd(cmdline, prefix, keep_prefix = False):
+ ret = []
+ for token in cmdline.split():
+ if token[:len(prefix)] == prefix:
+ if keep_prefix:
+ ret.append(token)
+ else:
+ ret.append(token[len(prefix):])
+ return ret
+
+config_vars = sysconfig.get_config_vars()
+if "CFLAGS" in config_vars and "-Wstrict-prototypes" in config_vars["CFLAGS"]:
+ config_vars["CFLAGS"] = config_vars["CFLAGS"].replace("-Wstrict-prototypes", " ")
+if "OPT" in config_vars and "-Wstrict-prototypes" in config_vars["OPT"]:
+ config_vars["OPT"] = config_vars["OPT"].replace("-Wstrict-prototypes", " ")
+
+source_list = os.listdir(os.path.join(os.path.dirname(__file__), "src"))
+source_list = [os.path.join("src", s) for s in source_list if s.endswith(".C")]
+
+# g++ -O -fPIC -ansi -Werror -Wall -Wno-deprecated -DHAVE_STRCASECMP -DINCL_TEMPLATE_SRC -DHAVE_PLACEMENT_NEW -I./include -I../include -I/usr/include/python3.7 -I/apps/boost/include/boost-1_41 -ftemplate-depth-128 -fno-inline -Wall -c src/TypeCodePyWrap.C -o ./obj/TypeCodePyWrap.o
+# g++ -shared -L/apps/boost/lib -L/apps/xerces-3.0.1/lib TypeCodePyWrap.o StlPyWrap.o CharPyWrap.o RcsbFilePyWrap.o ISTablePyWrap.o TableFilePyWrap.o CifFilePyWrap.o DicFilePyWrap.o DictObjFilePyWrap.o DataInfoPyWrap.o CifDataInfoPyWrap.o DictDataInfoPyWrap.o PdbMlFilePyWrap.o CorePyWrap.o -L../../lib/.libs -lrcsb-core-wrapper -lboost_python-mt-py27 -lxerces-c -lutil -lpthread -ldl -o ../lib/CorePyWrap.so
+extra_cmd = '@DEFINES@'
+
+setup( name='python-corepywrap',
+ version='1.000',
+ author = 'RCSB PDB Software Team',
+ author_email='sw-help@rcsb.rutgers.edu',
+ description = 'Python bindings for librcsb-core-wrapper',
+ long_description = 'Python bindings for librcsb-core-wrapper',
+ url = 'http://sw-tools.rcsb.org/apps/CORE-WRAPPER/index.html',
+ platforms = 'any',
+ license = 'RCSB PDB SOFTWARE LICENSE AGREEMENT',
+ ext_modules = [Extension('CorePyWrap',
+ sources = source_list,
+ language='c++',
+ include_dirs = ['../../include'] + parse_cmd(extra_cmd, '-I'),
+ library_dirs = ['../../lib/.libs'] + parse_cmd(extra_cmd, '-L'),
+ extra_compile_args = parse_cmd(extra_cmd, '-D', True),
+ libraries = ['rcsb-core-wrapper', 'boost_python%1d%1d' % ( sys.version_info[0], sys.version_info[1] )] + parse_cmd(extra_cmd, '-l'))],
+)
--- librcsb-core-wrapper.orig/wrapper/Makefile
+++ librcsb-core-wrapper/wrapper/Makefile
@@ -103,11 +103,16 @@
.PHONY: ../etc/Makefile.platform all install export clean clean_build
-all: install
+all: build
+.PHONY: build
+build: python/setup.py
install: $(M_MOD_LIB)
+python/setup.py: python/setup.py.in
+ sed -e 's!@C++FLAGS@!$(C++FLAGS)!g; s!@DEFINES@!$(DEFINES)!g; s!@EXT_COMP_OPT@!$(EXT_COMP_OPT)!; s!@EXT_LIBS_DIRS@!$(EXT_LIBS_DIRS)!g; s!@EXT_LIBS@!$(EXT_LIBS)!g;' < "$<" > "$@"
+ ln -sf ../src python/src
export:
mkdir -p $(EXPORT_DIR)
@@ -137,6 +142,7 @@
@rm -f $(M_MOD_LIB)
@rm -f $(M_AGR_LIB)
@rm -f *.pyc
+ @rm -f python/setup.py
$(L_MOD_LIB): $(OBJ_FILES) $(ALL_DEP_LIBS)
--- librcsb-core-wrapper.orig/Makefile
+++ librcsb-core-wrapper/Makefile
@@ -12,7 +12,11 @@
CLEAN_DOC_SCRIPT = clean_doc.sh
EXPORT_SCRIPT = export.sh
-all: lib/librcsb-core-wrapper.la
+all: wrapper
+
+.PHONY: wrapper
+wrapper: lib/librcsb-core-wrapper.la
+ cd wrapper && $(MAKE) OPT=-O
compile:
@echo
|