diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index e6a7de1381..1bc6e2643b 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -15,20 +15,21 @@ jobs: with: submodules: true - - name: Make setup.sh and check_capstone.sh are executable + - name: Configure CMake and build the project run: | - chmod +x ./packages/deb/setup.sh - chmod +x ./packages/deb/check_capstone.sh - - - name: Build Debian Package - working-directory: ./packages/deb - run: ./setup.sh ${{ github.event.release.tag_name }} - - - name: Run sanity checks on the Debian package - working-directory: ./packages/deb + cmake -B build \ + -DPROJECT_VERSION=${{ github.event.release.tag_name }} \ + -DCMAKE_BUILD_TYPE=Release \ + -DCAPSTONE_BUILD_SHARED_LIBS=1 \ + -DCMAKE_INSTALL_PREFIX=/usr + cmake --build build + + - name: Package DEB and RPM package run: | - ./check_capstone.sh ./libcapstone-dev_${{ github.event.release.tag_name }}_amd64.deb - + cd build + cpack -G DEB + cpack -G RPM + - name: Upload debian package to release uses: softprops/action-gh-release@v2 env: @@ -36,8 +37,9 @@ jobs: with: tag_name: ${{ github.event.release.tag_name }} files: | - ./packages/deb/*.deb - + ./build/*.deb + ./build/*.rpm + - name: Create archive id: archive run: | diff --git a/BUILDING.md b/BUILDING.md index a6c51c7cfb..67858ee2cd 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -12,6 +12,16 @@ cmake --build build cmake --install build --prefix "" ``` +To create rpm, debian and OSX packages, run the following +```bash +cmake -B build -DCMAKE_BUILD_TYPE=Release -DCAPSTONE_BUILD_SHARED_LIBS=1 -DCMAKE_INSTALL_PREFIX=/usr +cmake --build build +cd build +cpack -G DEB +cpack -G RPM +cpack -G DragNDrop +``` + **Windows** ```bash diff --git a/CMakeLists.txt b/CMakeLists.txt index b4c77a7996..689b618c17 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,9 @@ endif() # Extract the major, minor, and patch versions string(REGEX MATCH "^[0-9]+\\.[0-9]+\\.[0-9]+" PROJECT_VERSION_BASE ${PROJECT_VERSION}) +# Use PROJECT_VERSION directly for CPack +set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) + # Set the project version without the pre-release identifier project(capstone VERSION ${PROJECT_VERSION_BASE}) @@ -959,3 +962,7 @@ if(CAPSTONE_BUILD_CSTEST) set(TESTS_UNIT_DIR ${PROJECT_SOURCE_DIR}/tests/unit) add_subdirectory(${TESTS_UNIT_DIR}) endif() + +# Include CPack +set(CPACK_PROJECT_CONFIG_FILE "${CMAKE_SOURCE_DIR}/CPackConfig.cmake") +include(CPackConfig.txt) \ No newline at end of file diff --git a/CPackConfig.cmake b/CPackConfig.cmake new file mode 100644 index 0000000000..9272f37bc6 --- /dev/null +++ b/CPackConfig.cmake @@ -0,0 +1,13 @@ +# Used to dynamically set the package file name based on the generator +foreach(generator ${CPACK_GENERATOR}) + if("${generator}" STREQUAL "DEB") + set(CPACK_PACKAGE_FILE_NAME ${CPACK_DEBIAN_PACKAGE_FILE_NAME}) + elseif("${generator}" STREQUAL "RPM") + set(CPACK_PACKAGE_FILE_NAME ${CPACK_RPM_PACKAGE_FILE_NAME}) + elseif("${generator}" STREQUAL "DragNDrop") + set(CPACK_PACKAGE_FILE_NAME ${CPACK_DMG_PACKAGE_FILE_NAME}) + else() + set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-unknown") + endif() + message(STATUS "Generating package for ${generator} with file name ${CPACK_PACKAGE_FILE_NAME}") +endforeach() diff --git a/CPackConfig.txt b/CPackConfig.txt new file mode 100644 index 0000000000..4015f45e4d --- /dev/null +++ b/CPackConfig.txt @@ -0,0 +1,59 @@ +# Copyright © 2024 Andrew Quijano +# SPDX-License-Identifier: MIT + +# Set general CPack values +set(CPACK_PACKAGE_NAME "capstone") +set(CPACK_PACKAGE_VENDOR "Rot127") +set(CPACK_PACKAGE_CONTACT "Rot127 ") +set(CPACK_PACKAGE_DESCRIPTION "Capstone is a lightweight multi-platform, multi-architecture disassembly framework. These are the development headers and libraries.\n Features:\n - Support hardware architectures: AArch64, ARM, Alpha, BPF, EVM, HPPA, LongArch, M680X, M68K, MOS65XX, Mips, PowerPC, RISCV, SH, Sparc, SystemZ, TMS320C64x, TriCore, WASM, x86, XCore, Xtensa.\n - Clean/simple/lightweight/intuitive architecture-neutral API.\n - Provide details on disassembled instructions (called \\\"decomposer\\\" by some others).\n - Provide some semantics of the disassembled instruction, such as list of implicit registers read & written.\n - Thread-safe by design.\n - Special support for embedding into firmware or OS kernel.\n - Distributed under the open source BSD license.") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Lightweight multi-architecture disassembly framework - devel files") +set(CPACK_PACKAGE_HOMEPAGE_URL "https://www.capstone-engine.org/") +set(CPACK_STRIP_FILES false) +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSES/LICENSE.TXT") + +# Set Debian-specific package variables +set(CPACK_DEBIAN_PACKAGE_NAME "libcapstone-dev") +set(CPACK_DEBIAN_PACKAGE_SOURCE "capstone") +set(CPACK_DEBIAN_PACKAGE_VERSION "${PROJECT_VERSION}") +set(CPACK_DEBIAN_PACKAGE_ORIGINAL_MAINTAINER "Debian Security Tools ") +set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.2.5)") +set(CPACK_DEBIAN_PACKAGE_SECTION "libdevel") +set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional") +set(CPACK_DEBIAN_PACKAGE_MULTIARCH "same") + +# Determine architecture for Debian package +if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64") + set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64") +elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i386" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i686") + set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "i386") +elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm") + if(CMAKE_SIZE_OF_VOID_P EQUAL 4) + set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "armhf") + else() + set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "arm64") + endif() +else() + set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR}) +endif() + +# Include additional file to run 'ldconfig' after install +set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/packages/deb/triggers") + +# RPM package settings +set(CPACK_RPM_PACKAGE_NAME "capstone-devel") +set(CPACK_RPM_PACKAGE_VERSION "${PROJECT_VERSION}") +set(CPACK_RPM_PACKAGE_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR}) +set(CPACK_RPM_PACKAGE_GROUP "Development/Libraries") +set(CPACK_RPM_PACKAGE_REQUIRES "libc6 >= 2.2.5") +set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${CMAKE_SOURCE_DIR}/packages/rpm/postinstall.sh") +set(CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE "${CMAKE_SOURCE_DIR}/packages/rpm/postinstall.sh") +set(CPACK_RPM_CHANGELOG_FILE "${CMAKE_SOURCE_DIR}/ChangeLog") +set(CPACK_RPM_PACKAGE_LICENSE "BSD3, LLVM") +set(CPACK_RPM_PACKAGE_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION}") + +# Set package file name based on the generator +set(CPACK_DEBIAN_PACKAGE_FILE_NAME "${CPACK_DEBIAN_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}") +set(CPACK_RPM_PACKAGE_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}.${CMAKE_SYSTEM_PROCESSOR}") +set(CPACK_DMG_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}") + +include(CPack) \ No newline at end of file diff --git a/LICENSES/LICENSE_DEB_PACKAGE.txt b/LICENSES/LICENSE_DEB_PACKAGE.txt deleted file mode 100644 index 68c1034680..0000000000 --- a/LICENSES/LICENSE_DEB_PACKAGE.txt +++ /dev/null @@ -1,11 +0,0 @@ -MIT License - -The scope of this license is the `packages/deb` directory - -Copyright (c) 2024 Andrew Quijano - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/packages/deb/.gitignore b/packages/deb/.gitignore deleted file mode 100644 index c636824af1..0000000000 --- a/packages/deb/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*.deb -*.txt \ No newline at end of file diff --git a/packages/deb/Dockerfile b/packages/deb/Dockerfile deleted file mode 100644 index 83ac46f654..0000000000 --- a/packages/deb/Dockerfile +++ /dev/null @@ -1,68 +0,0 @@ -# SPDX-License-Identifier: MIT -# Copyright (C) 2024 Andrew Quijano -# Contact: andrewquijano92@gmail.com -ARG VERSION="" - -# Run in the root of the repo -# docker build -f ./packages/deb/Dockerfile -t packager . -FROM debian:bookworm-slim - -# Install necessary tools for packaging -RUN apt-get -qq update && \ - DEBIAN_FRONTEND=noninteractive apt-get -qq install -y \ - fakeroot dpkg-dev dos2unix cmake - -# Copy project files into the container -RUN mkdir /capstone -COPY . /capstone -WORKDIR /capstone/ - -# Using cmake, see BUILDING.md file -# For debug build change "Release" to "Debug" -ARG VERSION -RUN cmake -B build -DCMAKE_BUILD_TYPE=Release -DCAPSTONE_BUILD_SHARED_LIBS=1 -DPROJECT_VERSION=${VERSION} -DCMAKE_INSTALL_PREFIX=/usr -RUN cmake --build build - -# List files before cmake install -# RUN find / -type f > /before-install.txt - -# Make directories as needed -RUN mkdir -p /package-root/usr/include/capstone/ -RUN mkdir -p /package-root/usr/lib/pkgconfig/ -RUN mkdir -p /package-root/usr/bin/ -RUN mkdir -p /package-root/usr/share/doc/libcapstone-dev - -# Run cmake install -RUN cmake --install build --prefix /package-root/usr/ - -# List files after cmake install -# RUN find / -type f > /after-install.txt - -# Create DEBIAN directory and control file -COPY ./packages/deb/control /package-root/DEBIAN/control - -# Copy documentation over -COPY ./LICENSES/ /package-root/usr/share/doc/libcapstone-dev/LICENSES/ -COPY ./ChangeLog /package-root/usr/share/doc/libcapstone-dev -COPY ./CREDITS.TXT /package-root/usr/share/doc/libcapstone-dev -COPY ./README.md /package-root/usr/share/doc/libcapstone-dev -COPY ./SPONSORS.TXT /package-root/usr/share/doc/libcapstone-dev - -# Generate MD5 checksums for all files and save to DEBIAN/md5sums -RUN cd /package-root && \ - find . -type f ! -path './DEBIAN/*' -exec md5sum {} + | sed 's| \./| |' > /package-root/DEBIAN/md5sums - -# Update control file with the correct information -ARG VERSION -RUN INSTALLED_SIZE=$(du -sk /package-root | cut -f1) && \ - sed -i "s/^Installed-Size:.*/Installed-Size: ${INSTALLED_SIZE}/" /package-root/DEBIAN/control -RUN sed -i "s/^Version:.*/Version: ${VERSION}/" /package-root/DEBIAN/control - -# Add triggers script to run ldconfig after installation -COPY ./packages/deb/triggers /package-root/DEBIAN/triggers - -# Build the package -RUN fakeroot dpkg-deb --build /package-root /libcapstone-dev_${VERSION}_amd64.deb - -# The user can now extract the .deb file from the container with something like -# docker run --rm -v $(pwd):/out packager bash -c "cp /libcapstone-dev.deb /out" diff --git a/packages/deb/README.md b/packages/deb/README.md deleted file mode 100644 index 359f75bd5c..0000000000 --- a/packages/deb/README.md +++ /dev/null @@ -1,26 +0,0 @@ -# Capstone Docker packaging - -This assumes your working directory is in the `packages/deb/` directory. -To build a Debian package for Capstone, run the script, where `` is going to be the version -attached to both the `capstone.pc` file and the Debian package itself. The version is expected to be compliant with Debian versioning (a major/minor/patch), e. g. `5.0.4`. Debian versions can also support values to indicate pre-release, e. g. `6.0.0-Alpha1`. - -**Note**: if a value such as `6.0.0-Alpha1` is provided, the major/minor/patch number is extracted for `capstone.pc`, which would have version `6.0.0`, but the Debian package would have the full version name on the control file. - -**Note**: Currently the package is hard coded to the `amd64` architecture. Independently on what machine you built it. Also see [issue #2537](https://github.com/capstone-engine/capstone/issues/2537). - -```bash -./setup.sh -``` - -The output Debian file would be in the form `libcapstone-dev__amd64.deb`, as to match what would be expected in a standard Debian library package. - -To confirm the necessary libraries and `capstone.pc` is filled correctly, there exists a `check_capstone.sh` script to confirm `libcapstone-dev` was built correctly. - -If you want to check the contents of the Debian package, use the following: -```bash -# Check the DEBIAN/ folder -dpkg-deb -e libcapstone-dev__amd64.deb ./unpacked - -# Check the content of the package, EXCEPT the DEBIAN/ folder -dpkg-deb -x libcapstone-dev__amd64.deb ./unpacked -``` diff --git a/packages/deb/check_capstone.sh b/packages/deb/check_capstone.sh deleted file mode 100755 index deb791b4d4..0000000000 --- a/packages/deb/check_capstone.sh +++ /dev/null @@ -1,50 +0,0 @@ -# SPDX-License-Identifier: MIT -# Copyright (C) 2024 Andrew Quijano -# Contact: andrewquijano92@gmail.com - -#!/bin/bash -set -eu - -# Usage: ./check_capstone_pc.sh - -DEB_FILE=$1 - -# Check if the deb file exists -if [[ ! -f "$DEB_FILE" ]]; then - echo "Debian package file not found!" - exit 1 -fi - -# Create a temporary directory to extract the deb file -TEMP_DIR=$(mktemp -d) - -# Extract the deb file -dpkg-deb -x "$DEB_FILE" "$TEMP_DIR" - -# Check if the capstone.pc file exists -CAPSTONE_PC="$TEMP_DIR/usr/lib/x86_64-linux-gnu/pkgconfig/capstone.pc" -if [[ ! -f "$CAPSTONE_PC" ]]; then - echo "capstone.pc file not found in the package!" - rm -rf "$TEMP_DIR" - exit 1 -fi - -# Check if libcapstone.a is included in the package -LIBCAPSTONE_A="$TEMP_DIR/usr/lib/x86_64-linux-gnu/libcapstone.a" -if [[ ! -f "$LIBCAPSTONE_A" ]]; then - echo "libcapstone.a not found in the package!" - rm -rf "$TEMP_DIR" - exit 1 -fi - -# Check if libcapstone.so is included in the package -LIBCAPSTONE_SO="$TEMP_DIR/usr/lib/x86_64-linux-gnu/libcapstone.so" -if [[ ! -f "$LIBCAPSTONE_SO" ]]; then - echo "libcapstone.so not found in the package!" - rm -rf "$TEMP_DIR" - exit 1 -fi - -echo "libcapstone-dev.deb file is correct." -rm -rf "$TEMP_DIR" -exit 0 diff --git a/packages/deb/control b/packages/deb/control deleted file mode 100644 index 440f21547c..0000000000 --- a/packages/deb/control +++ /dev/null @@ -1,25 +0,0 @@ -Package: libcapstone-dev -Source: capstone -Version: -Architecture: amd64 -Maintainer: Rot127 -Original-Maintainer: Debian Security Tools -Installed-Size: -Depends: libc6 (>= 2.2.5) -Section: libdevel -Priority: optional -Multi-Arch: same -Homepage: https://www.capstone-engine.org/ -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. - Features: - - Support hardware architectures: AArch64, ARM, Alpha, BPF, EVM, HPPA, LongArch, M680X, M68K, MOS65XX, Mips, PowerPC, RISCV, SH, Sparc, SystemZ, TMS320C64x, TriCore, WASM, x86, XCore, Xtensa. - - Clean/simple/lightweight/intuitive architecture-neutral API. - - Provide details on disassembled instructions (called "decomposer" by some - others). - - Provide some semantics of the disassembled instruction, such as list of - implicit registers read & written. - - Thread-safe by design. - - Special support for embedding into firmware or OS kernel. - - Distributed under the open source BSD license. diff --git a/packages/deb/setup.sh b/packages/deb/setup.sh deleted file mode 100755 index 6c7f71bb45..0000000000 --- a/packages/deb/setup.sh +++ /dev/null @@ -1,57 +0,0 @@ -# SPDX-License-Identifier: MIT -# Copyright (C) 2024 Andrew Quijano -# Contact: andrewquijano92@gmail.com - -# !/bin/bash -set -eu - -# Function to get the current Ubuntu version -get_os_version() { - lsb_release -i -s 2>/dev/null -} - -# Check if the script is running in the ./packages/deb folder -if [[ $(basename "$PWD") != "deb" ]]; then - echo "ERROR: Script must be run from the ./deb directory" - exit 1 -fi - -OS_VERSION=$(get_os_version) -if [[ "$OS_VERSION" != "Ubuntu" && "$OS_VERSION" != "Debian" ]]; then - echo "ERROR: OS is not Ubuntu or Debian and unsupported" - exit 1 -fi - -# Get the version number as an input -# Check if version argument is provided -if [[ $# -ne 1 ]]; then - echo "ERROR: Version argument is required" - exit 1 -fi - -# Get the version number as an input -version=$1 - -# Remove leading 'v' if present, e. g. v1.5.1 -> 1.5.1 -if [[ "$version" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - version=${version:1} -fi - -# Check if the version follows the format for Debian Packages -if [[ ! "$version" =~ ^[0-9]+(.[0-9]+)*(-[A-Za-z0-9]+)?$ ]]; then - echo "ERROR: Version must be in a valid Debian package format" - exit 1 -fi - -# Now build the packager container from that -pushd ../../ -docker build -f ./packages/deb/Dockerfile -t packager --build-arg VERSION="${version}" . -popd - -# Copy deb file out of container to host -docker run --rm -v $(pwd):/out packager bash -c "cp /*.deb /out" - -# Check which files existed before and after 'make install' was executed. -# docker run --rm -v $(pwd):/out packager bash -c "cp /before-install.txt /out" -# docker run --rm -v $(pwd):/out packager bash -c "cp /after-install.txt /out" -# diff before-install.txt after-install.txt diff --git a/packages/rpm/capstone.spec b/packages/rpm/capstone.spec deleted file mode 100644 index 738187445c..0000000000 --- a/packages/rpm/capstone.spec +++ /dev/null @@ -1,167 +0,0 @@ -Name: capstone -Version: 3.0.4 -Release: 2 -Summary: A lightweight multi-platform, multi-architecture disassembly framework - -License: BSD -URL: http://www.capstone-engine.org/ -Source0: http://www.capstone-engine.org/download/%{version}/%{name}-%{version}.tar.gz - -%if 0%{?fedora} > 12 -%global with_python3 1 -%else -%{!?__python2: %global __python2 /usr/bin/python2} -%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")} -%endif - -%global srcname distribute - -BuildRequires: python2-devel -BuildRequires: jna -BuildRequires: java-devel -%if 0%{?with_python3} -BuildRequires: python3-devel -%endif # if with_python3 -%global _hardened_build 1 - - -%description -Capstone is a disassembly framework with the target of becoming the ultimate -disasm engine for binary analysis and reversing in the security community. - -%package devel -Summary: Development files for %{name} -Requires: %{name}%{?_isa} = %{version}-%{release} - -%description devel -The %{name}-devel package contains libraries and header files for -developing applications that use %{name}. - -%package python -Summary: Python bindings for %{name} -Requires: %{name}%{?_isa} = %{version}-%{release} - -%description python -The %{name}-python package contains python bindings for %{name}. - -%if 0%{?with_python3} -%package python3 -Summary: Python3 bindings for %{name} -Requires: %{name}%{?_isa} = %{version}-%{release} - -%description python3 -The %{name}-python3 package contains python3 bindings for %{name}. -%endif # with_python3 - -%package java -Summary: Java bindings for %{name} -Requires: %{name} = %{version}-%{release} -BuildArch: noarch - -%description java -The %{name}-java package contains java bindings for %{name}. - -%prep -%setup -q - -%build -DESTDIR="%{buildroot}" V=1 CFLAGS="%{optflags}" \ -LIBDIRARCH="%{_lib}" INCDIR="%{_includedir}" make %{?_smp_mflags} - -# Fix pkgconfig file -sed -i 's;%{buildroot};;' capstone.pc -grep -v archive capstone.pc > capstone.pc.tmp -mv capstone.pc.tmp capstone.pc - -# build python bindings -pushd bindings/python -CFLAGS="%{optflags}" %{__python2} setup.py build -%if 0%{?with_python3} -CFLAGS="%{optflags}" %{__python3} setup.py build -%endif # with_python3 -popd - -# build java bindings -pushd bindings/java -make CFLAGS="%{optflags}" # %{?_smp_mflags} parallel seems broken -popd - -%install -DESTDIR=%{buildroot} LIBDIRARCH=%{_lib} \ -INCDIR="%{_includedir}" make install -find %{buildroot} -name '*.la' -exec rm -f {} ';' -find %{buildroot} -name '*.a' -exec rm -f {} ';' - -# install python bindings -pushd bindings/python -%{__python2} setup.py install --skip-build --root %{buildroot} -%if 0%{?with_python3} -%{__python3} setup.py install --skip-build --root %{buildroot} -%endif # with_python3 -popd - -# install java bindings -install -D -p -m 0644 bindings/java/%{name}.jar %{buildroot}/%{_javadir}/%{name}.jar - -%check -ln -s libcapstone.so libcapstone.so.3 -make check LD_LIBRARY_PATH="`pwd`" - -%post -p /sbin/ldconfig - -%postun -p /sbin/ldconfig - - -%files -# %license does not work for RHEL<7 -%if 0%{?rhel} || 0%{?fedora} < 21 -%doc LICENSE.TXT LICENSE_LLVM.TXT -%else -%license LICENSE.TXT LICENSE_LLVM.TXT -%endif # %license workaround for RHEL<7 -%doc README ChangeLog -%{_libdir}/*.so.* - -%files devel -%{_includedir}/* -%{_libdir}/*.so -%{_libdir}/pkgconfig/* - -%files python -%{python2_sitelib}/*egg-info -%{python2_sitelib}/%{name} - -%if 0%{?with_python3} -%files python3 -%{python3_sitelib}/*egg-info -%{python3_sitelib}/%{name} -%endif # _with_python3 - -%files java -%{_javadir}/ - -%changelog -* Thu Jul 16 2015 Stefan Cornelius - 3.0.4-2 -- Fix EPEL6 build problems - -* Wed Jul 15 2015 Stefan Cornelius - 3.0.4-1 -- new version 3.0.4. Includes security fixes. - -* Tue May 12 2015 Stefan Cornelius - 3.0.3-2 -- Addressed issues found during package review. - -* Fri May 08 2015 Stefan Cornelius - 3.0.3-1 -- Update to version 3.0.3 - -* Fri May 08 2015 Stefan Cornelius - 3.0.2-3 -- Added python3 and hardened build support. Update java building. -- Various cleanups. - -* Wed May 06 2015 Stefan Cornelius - 3.0.2-2 -- Update to 3.0.2. Fix 64bit issues. add %check. - -* Sat Sep 27 2014 Adel Gadllah - 2.1.2-2 -- Addressed issues found during package review. - -* Mon May 19 2014 Adel Gadllah - 2.1.2-1 -- Initial package diff --git a/packages/rpm/postinstall.sh b/packages/rpm/postinstall.sh new file mode 100644 index 0000000000..aea30415f7 --- /dev/null +++ b/packages/rpm/postinstall.sh @@ -0,0 +1 @@ +ldconfig \ No newline at end of file