Package: capstone Version: 2.1.2-2.1 Severity: wishlist Tags: patch Version 3.0.1 of capstone is available. It is needed for building radare2 0.9.8.
I have attached a set of patches based upon 2.1.2-2.1. - Apparently, the FTBFS-fixing patch for mips is no longer needed -- I was able to build the package on mipsel (eder.debian.org) just fine. - I have added some definitions so that the exported symbols are limited. This makes it possible to add a .symbols file to the library pacakge. Cheers, -Hilko
>From b687fc5173c9a35f657f29ce22aef8625b4d7cdb Mon Sep 17 00:00:00 2001 From: Hilko Bengen <ben...@debian.org> Subject: [PATCH 1/4] Rework patches; add change to limit exported symbols --- debian/patches/fix_python_bindings | 68 +++++++++++++++++++++-------------- debian/patches/limit_exported_symbols | 33 +++++++++++++++++ debian/patches/no_usr_lib64 | 31 ---------------- debian/patches/series | 4 +-- debian/patches/use_cppflags | 19 +++++----- 5 files changed, 87 insertions(+), 68 deletions(-) create mode 100644 debian/patches/limit_exported_symbols delete mode 100644 debian/patches/no_usr_lib64 diff --git a/debian/patches/fix_python_bindings b/debian/patches/fix_python_bindings index 566a2eb..ebc1fc0 100644 --- a/debian/patches/fix_python_bindings +++ b/debian/patches/fix_python_bindings @@ -6,18 +6,18 @@ Description: Fix build system for Python bindings. on libcapstone-dev. Author: David Martínez Moreno <en...@debian.org> Forwarded: no -Last-Update: 2014-05-05 +Last-Update: 2015-02-25 --- a/bindings/python/setup_cython.py +++ b/bindings/python/setup_cython.py -@@ -6,19 +6,21 @@ - VERSION = '2.1' +@@ -6,25 +6,27 @@ from Cython.Distutils import build_ext + VERSION = '3.0' compile_args = ['-O3', '-fomit-frame-pointer'] -+include_dirs = ['../../include'] -+library_dirs = ['../../'] ++include_dirs = ['../../../include'] ++library_dirs = ['../../../'] --ext_modules = [ Extension("capstone.capstone", ["pyx/capstone.pyx"], extra_compile_args=compile_args), + ext_modules = [ - Extension("capstone.ccapstone", ["pyx/ccapstone.pyx"], libraries=["capstone"], extra_compile_args=compile_args), - Extension("capstone.arm", ["pyx/arm.pyx"], extra_compile_args=compile_args), - Extension("capstone.arm_const", ["pyx/arm_const.pyx"], extra_compile_args=compile_args), @@ -28,8 +28,13 @@ Last-Update: 2014-05-05 - Extension("capstone.ppc", ["pyx/ppc.pyx"], extra_compile_args=compile_args), - Extension("capstone.ppc_const", ["pyx/ppc_const.pyx"], extra_compile_args=compile_args), - Extension("capstone.x86", ["pyx/x86.pyx"], extra_compile_args=compile_args), -- Extension("capstone.x86_const", ["pyx/x86_const.pyx"], extra_compile_args=compile_args) -+ext_modules = [ Extension("capstone.capstone", ["pyx/capstone.pyx"], extra_compile_args=compile_args, include_dirs=include_dirs, library_dirs=library_dirs), +- Extension("capstone.x86_const", ["pyx/x86_const.pyx"], extra_compile_args=compile_args), +- Extension("capstone.sparc", ["pyx/sparc.pyx"], extra_compile_args=compile_args), +- Extension("capstone.sparc_const", ["pyx/sparc_const.pyx"], extra_compile_args=compile_args), +- Extension("capstone.systemz", ["pyx/systemz.pyx"], extra_compile_args=compile_args), +- Extension("capstone.sysz_const", ["pyx/sysz_const.pyx"], extra_compile_args=compile_args), +- Extension("capstone.xcore", ["pyx/xcore.pyx"], extra_compile_args=compile_args), +- Extension("capstone.xcore_const", ["pyx/xcore_const.pyx"], extra_compile_args=compile_args) + Extension("capstone.ccapstone", ["pyx/ccapstone.pyx"], libraries=["capstone"], extra_compile_args=compile_args, include_dirs=include_dirs, library_dirs=library_dirs), + Extension("capstone.arm", ["pyx/arm.pyx"], extra_compile_args=compile_args, include_dirs=include_dirs, library_dirs=library_dirs), + Extension("capstone.arm_const", ["pyx/arm_const.pyx"], extra_compile_args=compile_args, include_dirs=include_dirs, library_dirs=library_dirs), @@ -40,7 +45,13 @@ Last-Update: 2014-05-05 + Extension("capstone.ppc", ["pyx/ppc.pyx"], extra_compile_args=compile_args, include_dirs=include_dirs, library_dirs=library_dirs), + Extension("capstone.ppc_const", ["pyx/ppc_const.pyx"], extra_compile_args=compile_args, include_dirs=include_dirs, library_dirs=library_dirs), + Extension("capstone.x86", ["pyx/x86.pyx"], extra_compile_args=compile_args, include_dirs=include_dirs, library_dirs=library_dirs), -+ Extension("capstone.x86_const", ["pyx/x86_const.pyx"], extra_compile_args=compile_args, include_dirs=include_dirs, library_dirs=library_dirs) ++ Extension("capstone.x86_const", ["pyx/x86_const.pyx"], extra_compile_args=compile_args, include_dirs=include_dirs, library_dirs=library_dirs), ++ Extension("capstone.sparc", ["pyx/sparc.pyx"], extra_compile_args=compile_args, include_dirs=include_dirs, library_dirs=library_dirs), ++ Extension("capstone.sparc_const", ["pyx/sparc_const.pyx"], extra_compile_args=compile_args, include_dirs=include_dirs, library_dirs=library_dirs), ++ Extension("capstone.systemz", ["pyx/systemz.pyx"], extra_compile_args=compile_args, include_dirs=include_dirs, library_dirs=library_dirs), ++ Extension("capstone.sysz_const", ["pyx/sysz_const.pyx"], extra_compile_args=compile_args, include_dirs=include_dirs, library_dirs=library_dirs), ++ Extension("capstone.xcore", ["pyx/xcore.pyx"], extra_compile_args=compile_args, include_dirs=include_dirs, library_dirs=library_dirs), ++ Extension("capstone.xcore_const", ["pyx/xcore_const.pyx"], extra_compile_args=compile_args, include_dirs=include_dirs, library_dirs=library_dirs) ] # clean package directory first @@ -57,23 +68,28 @@ Last-Update: 2014-05-05 --- a/bindings/python/Makefile +++ b/bindings/python/Makefile -@@ -27,7 +27,7 @@ - # clean up first - rm -rf build - # then install -- python setup_cython.py install -+ python setup_cython.py install $(OPTS) +@@ -13,13 +13,13 @@ install: + rm -rf $(OBJDIR) src/ + rm -rf prebuilt/win64/capstone.dll + rm -rf prebuilt/win32/capstone.dll +- python setup.py build -b $(OBJDIR) install ++ python setup.py build -b $(OBJDIR) install $(OPTS) - clean: - rm -rf capstone/*.pyc ---- a/bindings/python/capstone/capstone.py -+++ b/bindings/python/capstone/capstone.py -@@ -124,7 +124,7 @@ - __file__ = inspect.getfile(inspect.currentframe()) + install3: + rm -rf $(OBJDIR) src/ + rm -rf prebuilt/win64/capstone.dll + rm -rf prebuilt/win32/capstone.dll +- python3 setup.py build -b $(OBJDIR) install ++ python3 setup.py build -b $(OBJDIR) install $(OPTS) - _lib_path = split(__file__)[0] --_all_libs = ['libcapstone.dll', 'libcapstone.so', 'libcapstone.dylib'] -+_all_libs = ['libcapstone.dll', 'libcapstone.so.2', 'libcapstone.dylib'] - _found = False + # NOTE: Newer cython can be installed by: sudo pip install --upgrade cython + install_cython: +@@ -48,7 +48,7 @@ install_cython: + cp capstone/xcore_const.py $(OBJDIR)/pyx/xcore_const.pyx + cd $(OBJDIR) && python setup_cython.py build -b ./tmp install --home=$(OBJDIR) + mv $(OBJDIR)/build/lib/python/capstone/* capstone +- cd $(OBJDIR) && python setup_cython.py build -b ./tmp install ++ cd $(OBJDIR) && python setup_cython.py build -b ./tmp install $(OPTS) - for _lib in _all_libs: + # build & upload PyPi package with source code of the core + sdist: diff --git a/debian/patches/limit_exported_symbols b/debian/patches/limit_exported_symbols new file mode 100644 index 0000000..aa66c5d --- /dev/null +++ b/debian/patches/limit_exported_symbols @@ -0,0 +1,33 @@ +Description: Limit exported symbols + Make sure that only symbols that are part of the API are exported by + the library -- similar to __declspec(dllexport) for the MSVC + compiler. This makes it possible to use dpkg-gensymbols. +Author: Hilko Bengen <ben...@debian.org> +Forwarded: no +Last-Update: 2015-02-25 + +--- a/Makefile ++++ b/Makefile +@@ -290,6 +290,7 @@ else ifeq ($(IS_CYGWIN),1) + LIBRARY = $(BLDIR)/$(LIBNAME).$(EXT) + else # *nix + LIBRARY = $(BLDIR)/lib$(LIBNAME).$(EXT) ++CFLAGS += -fvisibility=hidden + endif + endif + +--- a/include/capstone.h ++++ b/include/capstone.h +@@ -24,8 +24,12 @@ extern "C" { + #define CAPSTONE_EXPORT + #endif + #else ++#ifdef __GNUC__ ++#define CAPSTONE_EXPORT __attribute__((visibility("default"))) ++#else + #define CAPSTONE_EXPORT + #endif ++#endif + + #ifdef __GNUC__ + #define CAPSTONE_DEPRECATED __attribute__((deprecated)) diff --git a/debian/patches/no_usr_lib64 b/debian/patches/no_usr_lib64 deleted file mode 100644 index 79a647f..0000000 --- a/debian/patches/no_usr_lib64 +++ /dev/null @@ -1,31 +0,0 @@ -Description: Stop installing libcapstone in /usr/lib64. - Upstream seems to make a distinction between x86_64 and the rest of - architectures and install the libraries in /usr/lib64 if we are building - for that architecture. At least Debian doesn't have such difference. -Author: David Martínez Moreno <en...@debian.org> -Forwarded: not-needed -Last-Update: 2014-05-05 - ---- a/Makefile -+++ b/Makefile -@@ -34,13 +34,13 @@ - # on x86_64, we might have /usr/lib64 directory instead of /usr/lib - UNAME_M := $(shell uname -m) - UNAME_S := $(shell uname -s) --ifeq ($(UNAME_M), x86_64) --ifeq (,$(wildcard $(LIBDIR))) --ifneq ($(UNAME_S), Darwin) --LIBDIR = $(DESTDIR)$(PREFIX)/lib64 --endif --endif --endif -+#ifeq ($(UNAME_M), x86_64) -+#ifeq (,$(wildcard $(LIBDIR))) -+#ifneq ($(UNAME_S), Darwin) -+#LIBDIR = $(DESTDIR)$(PREFIX)/lib64 -+#endif -+#endif -+#endif - - ifneq ($(UNAME_S),Darwin) - LDFLAGS += -shared diff --git a/debian/patches/series b/debian/patches/series index 874f6ac..b7e7255 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,5 +1,3 @@ -typos -no_usr_lib64 use_cppflags fix_python_bindings -capstone-mips.patch +limit_exported_symbols diff --git a/debian/patches/use_cppflags b/debian/patches/use_cppflags index 849dd09..1b74f10 100644 --- a/debian/patches/use_cppflags +++ b/debian/patches/use_cppflags @@ -2,13 +2,16 @@ Description: CPPFLAGS is not being used. Without CPPFLAGS we cannot have fortified builds. Author: David Martínez Moreno <en...@debian.org> Forwarded: no -Last-Update: 2014-05-05 +Last-Update: 2015-02-25 ---- a/Makefile -+++ b/Makefile -@@ -286,4 +286,4 @@ - git archive --format=zip --prefix=capstone-$(DIST_VERSION)/ $(TAG) > capstone-$(DIST_VERSION).zip +--- a/functions.mk ++++ b/functions.mk +@@ -2,7 +2,7 @@ + # Common functions used by Makefile & tests/Makefile - .c.o: -- $(CC) $(CFLAGS) -c $< -o $@ -+ $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ + define compile +- ${CC} ${CFLAGS} -c $< -o $@ ++ ${CC} ${CFLAGS} ${CPPFLAGS} -c $< -o $@ + endef + + -- 2.1.4
>From dff66e886815f5cdb380934469ae4828591675cb Mon Sep 17 00:00:00 2001 From: Hilko Bengen <bengen@nomad> Subject: [PATCH 2/4] Enable parallel builds, add dh_install safeguard --- debian/rules | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/debian/rules b/debian/rules index bf040b3..d8bdd72 100755 --- a/debian/rules +++ b/debian/rules @@ -5,8 +5,11 @@ #export DH_VERBOSE=1 %: - dh $@ --with python2 + dh $@ --with python2 --parallel override_dh_auto_install: dh_auto_install cd bindings/python && OPTS="--root=$(CURDIR)/debian/tmp/ --install-layout=deb" make install_cython + +override_dh_install: + dh_install --fail-missing -- 2.1.4
>From 669c1d7a12b2d7ddb73c86155d40c397634551a3 Mon Sep 17 00:00:00 2001 From: Hilko Bengen <bengen@nomad> Subject: [PATCH 3/4] Rename package to reflect SONAME change, add symbols file --- debian/control | 4 ++-- debian/libcapstone2.dirs | 1 - debian/libcapstone2.install | 1 - debian/libcapstone3.dirs | 1 + debian/libcapstone3.install | 1 + debian/libcapstone3.symbols | 21 +++++++++++++++++++++ 6 files changed, 25 insertions(+), 4 deletions(-) delete mode 100644 debian/libcapstone2.dirs delete mode 100644 debian/libcapstone2.install create mode 100644 debian/libcapstone3.dirs create mode 100644 debian/libcapstone3.install create mode 100644 debian/libcapstone3.symbols diff --git a/debian/control b/debian/control index 1ab993f..26410b5 100644 --- a/debian/control +++ b/debian/control @@ -18,14 +18,14 @@ Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/capstone.git;a=sum Package: libcapstone-dev Section: libdevel Architecture: any -Depends: libcapstone2 (= ${binary:Version}), ${misc:Depends} +Depends: libcapstone3 (= ${binary:Version}), ${misc:Depends} Description: lightweight multi-architecture disassembly framework - devel files Capstone is a lightweight multi-platform, multi-architecture disassembly framework. . These are the development headers and libraries. -Package: libcapstone2 +Package: libcapstone3 Section: libs Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} diff --git a/debian/libcapstone2.dirs b/debian/libcapstone2.dirs deleted file mode 100644 index 6845771..0000000 --- a/debian/libcapstone2.dirs +++ /dev/null @@ -1 +0,0 @@ -usr/lib diff --git a/debian/libcapstone2.install b/debian/libcapstone2.install deleted file mode 100644 index d0dbfd1..0000000 --- a/debian/libcapstone2.install +++ /dev/null @@ -1 +0,0 @@ -usr/lib/lib*.so.* diff --git a/debian/libcapstone3.dirs b/debian/libcapstone3.dirs new file mode 100644 index 0000000..6845771 --- /dev/null +++ b/debian/libcapstone3.dirs @@ -0,0 +1 @@ +usr/lib diff --git a/debian/libcapstone3.install b/debian/libcapstone3.install new file mode 100644 index 0000000..d0dbfd1 --- /dev/null +++ b/debian/libcapstone3.install @@ -0,0 +1 @@ +usr/lib/lib*.so.* diff --git a/debian/libcapstone3.symbols b/debian/libcapstone3.symbols new file mode 100644 index 0000000..66c6088 --- /dev/null +++ b/debian/libcapstone3.symbols @@ -0,0 +1,21 @@ +libcapstone.so.3 libcapstone3 #MINVER# + cs_close@Base 3.0.0 + cs_disasm@Base 3.0.0 + cs_disasm_ex@Base 3.0.0 + cs_disasm_iter@Base 3.0.0 + cs_errno@Base 3.0.0 + cs_free@Base 3.0.0 + cs_group_name@Base 3.0.0 + cs_insn_group@Base 3.0.0 + cs_insn_name@Base 3.0.0 + cs_malloc@Base 3.0.0 + cs_op_count@Base 3.0.0 + cs_op_index@Base 3.0.0 + cs_open@Base 3.0.0 + cs_option@Base 3.0.0 + cs_reg_name@Base 3.0.0 + cs_reg_read@Base 3.0.0 + cs_reg_write@Base 3.0.0 + cs_strerror@Base 3.0.0 + cs_support@Base 3.0.0 + cs_version@Base 3.0.0 -- 2.1.4
>From af04fce7f9ca6e3ae5b1a14645d7875ff4d573d5 Mon Sep 17 00:00:00 2001 From: Hilko Bengen <ben...@debian.org> Subject: [PATCH 4/4] 3.0.1 --- debian/changelog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/debian/changelog b/debian/changelog index 2d96b7f..7c5f22c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,10 @@ +capstone (3.0.1-0.1) UNRELEASED; urgency=medium + + * New upstream version + * Non-maintainer upload + + -- + capstone (2.1.2-2.1) unstable; urgency=medium * Non-maintainer upload. -- 2.1.4