From 7cd1f092dc163a91292aaf3bfd81482384fb69c2 Mon Sep 17 00:00:00 2001 From: Fernando Lopez Jr Date: Mon, 17 Jul 2017 08:53:03 +0100 Subject: system/capstone: Updated for version 4.0_alpha5. Signed-off-by: David Spencer --- system/capstone/CMakeLists.txt.patch | 41 ++++++++++++++++++++++++++++++++++++ system/capstone/capstone.SlackBuild | 23 +++++++++++++++----- system/capstone/capstone.info | 6 +++--- system/capstone/capstone.pc.in | 8 +++++++ system/capstone/slack-desc | 2 +- 5 files changed, 71 insertions(+), 9 deletions(-) create mode 100644 system/capstone/CMakeLists.txt.patch create mode 100644 system/capstone/capstone.pc.in diff --git a/system/capstone/CMakeLists.txt.patch b/system/capstone/CMakeLists.txt.patch new file mode 100644 index 0000000000..123c94bd83 --- /dev/null +++ b/system/capstone/CMakeLists.txt.patch @@ -0,0 +1,41 @@ +--- CMakeLists.txt 2017-04-17 07:31:11.000000000 -0600 ++++ CMakeLists_new.txt 2017-07-16 19:39:43.597509953 -0600 +@@ -460,21 +460,34 @@ + source_group("Include\\M68K" FILES ${HEADERS_M68K}) + source_group("Include\\TMS320C64x" FILES ${HEADERS_TMS320C64X}) + ++### test library 64bit routine: ++get_property(LIB64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) ++ ++if ("${LIB64}" STREQUAL "TRUE") ++ set(LIBSUFFIX 64) ++else() ++ set(LIBSUFFIX "") ++endif() ++ ++set(INSTALL_LIB_DIR lib${LIBSUFFIX} CACHE PATH "Installation directory for libraries") ++mark_as_advanced(INSTALL_LIB_DIR) ++ ++ + ## installation + install(FILES ${HEADERS_COMMON} DESTINATION include/capstone) + + if (CAPSTONE_BUILD_STATIC) + install(TARGETS capstone-static + RUNTIME DESTINATION bin +- LIBRARY DESTINATION lib +- ARCHIVE DESTINATION lib) ++ LIBRARY DESTINATION ${INSTALL_LIB_DIR} ++ ARCHIVE DESTINATION ${INSTALL_LIB_DIR}) + endif () + + if (CAPSTONE_BUILD_SHARED) + install(TARGETS capstone-shared + RUNTIME DESTINATION bin +- LIBRARY DESTINATION lib +- ARCHIVE DESTINATION lib) ++ LIBRARY DESTINATION ${INSTALL_LIB_DIR} ++ ARCHIVE DESTINATION ${INSTALL_LIB_DIR}) + endif () + + if (CAPSTONE_BUILD_SHARED) diff --git a/system/capstone/capstone.SlackBuild b/system/capstone/capstone.SlackBuild index e4fe1bf7db..faf4fa3070 100644 --- a/system/capstone/capstone.SlackBuild +++ b/system/capstone/capstone.SlackBuild @@ -23,7 +23,7 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. PRGNAM=capstone -VERSION=${VERSION:-3.0.5_rc2} +VERSION=${VERSION:-4.0_alpha5} SRCVER=$(echo $VERSION | tr _ -) BUILD=${BUILD:-1} TAG=${TAG:-_SBo} @@ -70,23 +70,28 @@ find -L . \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; -sed -i -e "s/DESTINATION lib/DESTINATION lib$LIBDIRSUFFIX/" CMakeLists.txt +# capstone lacks 64bit library location support for cmake. this patch +# will re-implement it. version 4.0-alpha5 +patch -p0 --verbose < $CWD/CMakeLists.txt.patch mkdir -p build cd build - cmake \ + +cmake \ -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \ -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \ -DCMAKE_INSTALL_PREFIX=/usr \ -DCAPSTONE_ARM_SUPPORT=1 \ -DCAPSTONE_ARM64_SUPPORT=1 \ + -DCAPSTONE_M68K_SUPPORT=1 \ -DCAPSTONE_MIPS_SUPPORT=1 \ -DCAPSTONE_PPC_SUPPORT=1 \ -DCAPSTONE_SPARC_SUPPORT=1 \ -DCAPSTONE_SYSZ_SUPPORT=1 \ - -DCAPSTONE_XCORE_SUPPORT=1 \ + -DCAPSTONE_TMS320C64X_SUPPORT=1 \ -DCAPSTONE_X86_SUPPORT=1 \ -DCAPSTONE_X86_ATT_DISABLE=1 \ + -DCAPSTONE_XCORE_SUPPORT=1 \ -DCAPSTONE_BUILD_STATIC=0 \ -DCMAKE_BUILD_TYPE=Release .. make VERBOSE=1 @@ -96,8 +101,16 @@ cd .. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true +# pkg-config (PKG_CONFIG_PATH environment variable) +# to generate .pc file do: $ python setup.py build +# inside bindings/python +mkdir -p $PKG/usr/share/pkgconfig +sed -e "s|%VERSION%|$VERSION|" -e "s|%LIBDIRSUFFIX%|$LIBDIRSUFFIX|" \ + < $CWD/capstone.pc.in \ + > $PKG/usr/share/pkgconfig/capstone.pc + mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION -cp -a COMPILE* LICENSE* README TODO RELEASE_NOTES HACK.TXT ChangeLog $PKG/usr/doc/$PRGNAM-$VERSION +cp -a COMPILE* LICENSE* README.md TODO RELEASE_NOTES HACK.TXT ChangeLog $PKG/usr/doc/$PRGNAM-$VERSION cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild mkdir -p $PKG/install diff --git a/system/capstone/capstone.info b/system/capstone/capstone.info index 89ad56d894..e92d1c5d97 100644 --- a/system/capstone/capstone.info +++ b/system/capstone/capstone.info @@ -1,8 +1,8 @@ PRGNAM="capstone" -VERSION="3.0.5_rc2" +VERSION="4.0_alpha5" HOMEPAGE="http://www.capstone-engine.org" -DOWNLOAD="https://github.com/aquynh/capstone/archive/3.0.5-rc2/capstone-3.0.5-rc2.tar.gz" -MD5SUM="d8ebb36e9880c270e2fbb2770956917f" +DOWNLOAD="https://github.com/aquynh/capstone/archive/4.0-alpha5/capstone-4.0-alpha5.tar.gz" +MD5SUM="4722b2b5e5c4bbb1c5c777a98e5f8a9e" DOWNLOAD_x86_64="" MD5SUM_x86_64="" REQUIRES="" diff --git a/system/capstone/capstone.pc.in b/system/capstone/capstone.pc.in new file mode 100644 index 0000000000..fa41c847fd --- /dev/null +++ b/system/capstone/capstone.pc.in @@ -0,0 +1,8 @@ +Name: capstone +Description: Capstone disassembly engine +Version: %VERSION% +libdir=/usr/lib%LIBDIRSUFFIX% +includedir=/usr/include +archive=${libdir}/libcapstone.a +Libs: -L${libdir} -lcapstone +Cflags: -I${includedir} diff --git a/system/capstone/slack-desc b/system/capstone/slack-desc index 482b1d1402..da186946cd 100644 --- a/system/capstone/slack-desc +++ b/system/capstone/slack-desc @@ -5,7 +5,7 @@ # You must make exactly 11 lines for the formatting to be correct. It's also # customary to leave one space after the ':' except on otherwise blank lines. - |----handy-ruler-------------------------------------------------------| + |-----handy-ruler------------------------------------------------------| capstone: capstone (disassembly framework) capstone: capstone: Capstone is a lightweight multi-platform, multi-architecture -- cgit v1.2.3-80-g2a13