|
|
|
@ -1,42 +1,35 @@
|
|
|
|
|
Name: capstone
|
|
|
|
|
Version: 5.0.1
|
|
|
|
|
Release: 6%{?dist}
|
|
|
|
|
Version: 4.0.2
|
|
|
|
|
Release: 10%{?dist}
|
|
|
|
|
Summary: A lightweight multi-platform, multi-architecture disassembly framework
|
|
|
|
|
License: BSD-3-Clause AND BSD-4-Clause AND APSL-2.0 AND NCSA AND MIT
|
|
|
|
|
URL: http://www.capstone-engine.org/
|
|
|
|
|
VCS: https://github.com/capstone-engine/capstone/
|
|
|
|
|
# https://github.com/capstone-engine/capstone/releases
|
|
|
|
|
|
|
|
|
|
%global common_desc %{expand:
|
|
|
|
|
Capstone is a disassembly framework with the target of becoming the ultimate
|
|
|
|
|
disasm engine for binary analysis and reversing in the security community.}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%define _lto_cflags %{nil}
|
|
|
|
|
#%%global _hardened_build 1
|
|
|
|
|
|
|
|
|
|
%global gituser capstone-engine
|
|
|
|
|
%global gituser aquynh
|
|
|
|
|
%global gitname capstone
|
|
|
|
|
# 5.0.1 release
|
|
|
|
|
%global gitdate 20230823
|
|
|
|
|
%global commit 097c04d9413c59a58b00d4d1c8d5dc0ac158ffaa
|
|
|
|
|
# 4.0.2 release
|
|
|
|
|
%global commit 1d230532840a37ac032c6ab80128238fc930c6c1
|
|
|
|
|
%global shortcommit %(c=%{commit}; echo ${c:0:7})
|
|
|
|
|
|
|
|
|
|
License: BSD
|
|
|
|
|
URL: http://www.capstone-engine.org/
|
|
|
|
|
VCS: https://github.com/aquynh/capstone/
|
|
|
|
|
# https://github.com/aquynh/capstone/releases
|
|
|
|
|
# Source0: https://github.com/%%{gituser}/%%{gitname}/archive/%%{commit}/%%{name}-%%{version}-%%{shortcommit}.tar.gz
|
|
|
|
|
Source0: https://github.com/%{gituser}/%{gitname}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
|
|
|
|
|
|
|
|
|
|
# Manpage for cstool is missing in the package, add one generated by help2man
|
|
|
|
|
Source1: cstool.1
|
|
|
|
|
|
|
|
|
|
# modified to remove the GH CI modifications from this patch
|
|
|
|
|
# Patch: https://patch-diff.githubusercontent.com/raw/capstone-engine/capstone/pull/2099.patch
|
|
|
|
|
# Patch0: https://github.com/capstone-engine/capstone/pull/2099.patch#/capstone-5.0.1-cibuildwheel.patch
|
|
|
|
|
# Test suite binary samples to be used for disassembly
|
|
|
|
|
# Source1:
|
|
|
|
|
|
|
|
|
|
Patch0: capstone-5.0.1-platform.patch
|
|
|
|
|
# Fedora 29 makes python executable separate from python2 and python3. This patch makes
|
|
|
|
|
# it possible to specify PYTHON2 and PYTHON3 binary to be explicit that by "python" we mean "python2"
|
|
|
|
|
# Patch0: capstone-python.patch
|
|
|
|
|
|
|
|
|
|
# Ocaml binding is not using local path for the includes/links
|
|
|
|
|
Patch1: capstone-5.0.1-ocaml.patch
|
|
|
|
|
# Upstream patch which fixes libcapstone.pc.
|
|
|
|
|
# See: https://github.com/aquynh/capstone/issues/1339
|
|
|
|
|
# Patch1: 0001-Fix-include-path-in-pkg-config-for-Makefile-too-1339.patch
|
|
|
|
|
|
|
|
|
|
%global common_desc %{expand:
|
|
|
|
|
Capstone is a disassembly framework with the target of becoming the ultimate
|
|
|
|
|
disasm engine for binary analysis and reversing in the security community.}
|
|
|
|
|
|
|
|
|
|
# Build with python3 package by default
|
|
|
|
|
%bcond_without python3
|
|
|
|
@ -48,47 +41,29 @@ Patch1: capstone-5.0.1-ocaml.patch
|
|
|
|
|
%bcond_without python2
|
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
# Build with java binding
|
|
|
|
|
%bcond_without java
|
|
|
|
|
|
|
|
|
|
# Build without ocaml binding - it is not ready to be distributed as ocaml shared library
|
|
|
|
|
%bcond_with ocaml
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%global srcname distribute
|
|
|
|
|
|
|
|
|
|
BuildRequires: gcc
|
|
|
|
|
BuildRequires: make
|
|
|
|
|
BuildRequires: git
|
|
|
|
|
|
|
|
|
|
%if %{with java}
|
|
|
|
|
%ifarch %{java_arches}
|
|
|
|
|
BuildRequires: jna
|
|
|
|
|
BuildRequires: java-devel
|
|
|
|
|
%endif
|
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
%if %{with python2}
|
|
|
|
|
BuildRequires: python2
|
|
|
|
|
BuildRequires: python2-devel
|
|
|
|
|
BuildRequires: python2-pip
|
|
|
|
|
BuildRequires: python2-setuptools
|
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
%if %{with python3}
|
|
|
|
|
BuildRequires: python%{python3_pkgversion}
|
|
|
|
|
BuildRequires: python%{python3_pkgversion}-devel
|
|
|
|
|
BuildRequires: python%{python3_pkgversion}-pip
|
|
|
|
|
BuildRequires: python%{python3_pkgversion}-setuptools
|
|
|
|
|
BuildRequires: python%{python3_pkgversion}-wheel
|
|
|
|
|
BuildRequires: python%{python3_pkgversion}-pytest
|
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
%if %{with ocaml}
|
|
|
|
|
BuildRequires: ocaml
|
|
|
|
|
BuildRequires: ocaml-ocamlbuild
|
|
|
|
|
%endif
|
|
|
|
|
%global _hardened_build 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%description
|
|
|
|
|
%{common_desc}
|
|
|
|
@ -106,14 +81,13 @@ developing applications that use %{name}.
|
|
|
|
|
|
|
|
|
|
%if %{with python2}
|
|
|
|
|
%package -n python2-capstone
|
|
|
|
|
BuildArch: noarch
|
|
|
|
|
%{?python_provide:%python_provide python2-capstone}
|
|
|
|
|
# Remove before F30
|
|
|
|
|
# loading the libcapstone dynamically using ctypes, not tied to certain architecture
|
|
|
|
|
Provides: %{name}-python = %{version}-%{release}
|
|
|
|
|
Provides: %{name}-python%{?_isa} = %{version}-%{release}
|
|
|
|
|
Obsoletes: %{name}-python < %{version}-%{release}
|
|
|
|
|
Summary: Python bindings for %{name}
|
|
|
|
|
Requires: %{name} = %{version}-%{release}
|
|
|
|
|
Requires: %{name}%{?_isa} = %{version}-%{release}
|
|
|
|
|
|
|
|
|
|
%description -n python2-capstone
|
|
|
|
|
%{common_desc}
|
|
|
|
@ -125,11 +99,11 @@ The python2-capstone package contains python bindings for %{name}.
|
|
|
|
|
|
|
|
|
|
%if %{with python3}
|
|
|
|
|
%package -n python%{python3_pkgversion}-capstone
|
|
|
|
|
BuildArch: noarch
|
|
|
|
|
%{?python_provide:%python_provide python%{python3_pkgversion}-capstone}
|
|
|
|
|
Provides: %{name}-python%{python3_pkgversion} = %{version}-%{release}
|
|
|
|
|
Provides: %{name}-python%{python3_pkgversion}%{?_isa} = %{version}-%{release}
|
|
|
|
|
Obsoletes: %{name}-python%{python3_pkgversion} < %{version}-%{release}
|
|
|
|
|
Requires: %{name} = %{version}-%{release}
|
|
|
|
|
Requires: %{name}%{?_isa} = %{version}-%{release}
|
|
|
|
|
Summary: Python3 bindings for %{name}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -140,8 +114,7 @@ The python%{python3_pkgversion}-capstone package contains python3 bindings for %
|
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%if %{with java}
|
|
|
|
|
%ifarch %{java_arches}
|
|
|
|
|
|
|
|
|
|
%package java
|
|
|
|
|
Summary: Java bindings for %{name}
|
|
|
|
|
Requires: %{name} = %{version}-%{release}
|
|
|
|
@ -150,29 +123,13 @@ BuildArch: noarch
|
|
|
|
|
%description java
|
|
|
|
|
%{common_desc}
|
|
|
|
|
The %{name}-java package contains java bindings for %{name}.
|
|
|
|
|
%endif
|
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
%if %{with ocaml}
|
|
|
|
|
%package -n ocaml-%{name}
|
|
|
|
|
Summary: OCaml bindings for %{name}
|
|
|
|
|
Requires: %{name}%{?_isa} = %{version}-%{release}
|
|
|
|
|
|
|
|
|
|
%description -n ocaml-%{name}
|
|
|
|
|
%{common_desc}
|
|
|
|
|
The ocaml-%{name} package contains OCaml bindings for %{name}.
|
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%prep
|
|
|
|
|
# autosetup -n %%{gitname}-%%{commit} -S git
|
|
|
|
|
%autosetup -n %{gitname}-%{version} -p1
|
|
|
|
|
%autosetup -n %{gitname}-%{version} -S git
|
|
|
|
|
|
|
|
|
|
%if %{with python3}
|
|
|
|
|
pushd bindings/python
|
|
|
|
|
%pyproject_buildrequires
|
|
|
|
|
popd
|
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%build
|
|
|
|
@ -181,9 +138,11 @@ PREFIX="%{_prefix}" LIBDIRARCH="%{_lib}" INCDIR="%{_includedir}" \
|
|
|
|
|
%make_build PYTHON2=%{__python2} PYTHON3=%{__python3}
|
|
|
|
|
|
|
|
|
|
# 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
|
|
|
|
|
|
|
|
|
@ -192,14 +151,11 @@ pushd bindings/python
|
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
%if %{with python3}
|
|
|
|
|
# %%pyproject_wheel
|
|
|
|
|
%py3_build
|
|
|
|
|
%endif
|
|
|
|
|
popd
|
|
|
|
|
|
|
|
|
|
%if %{with java}
|
|
|
|
|
%ifarch %{java_arches}
|
|
|
|
|
# build java bindings needs some python runtime
|
|
|
|
|
# build java bindings needs some python
|
|
|
|
|
pushd bindings/java
|
|
|
|
|
%if %{with python3}
|
|
|
|
|
%make_build PYTHON2=%{__python3} PYTHON3=%{__python3} CFLAGS="%{optflags}" # %{?_smp_mflags} parallel seems broken
|
|
|
|
@ -207,97 +163,46 @@ pushd bindings/java
|
|
|
|
|
%make_build PYTHON2=%{__python2} PYTHON3=%{__python2} CFLAGS="%{optflags}" # %{?_smp_mflags} parallel seems broken
|
|
|
|
|
%endif
|
|
|
|
|
popd
|
|
|
|
|
%endif
|
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
%if %{with ocaml}
|
|
|
|
|
pushd bindings/ocaml
|
|
|
|
|
# build ocaml bindings needs some python runtime
|
|
|
|
|
%if %{with python3}
|
|
|
|
|
%make_build PYTHON2=%{__python3} PYTHON3=%{__python3} CFLAGS="%{optflags}" -j1 # %{?_smp_mflags} parallel seems broken
|
|
|
|
|
%else
|
|
|
|
|
%make_build PYTHON2=%{__python2} PYTHON3=%{__python2} CFLAGS="%{optflags}" -j1 # %{?_smp_mflags} parallel seems broken
|
|
|
|
|
%endif
|
|
|
|
|
popd
|
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%install
|
|
|
|
|
DESTDIR=%{buildroot} PREFIX="%{_prefix}" LIBDIRARCH=%{_lib} \
|
|
|
|
|
INCDIR="%{_includedir}" make install
|
|
|
|
|
|
|
|
|
|
# cleanup static libraries
|
|
|
|
|
find %{buildroot} -name '*.la' -exec rm -f {} ';'
|
|
|
|
|
find %{buildroot} -name '*.a' -exec rm -f {} ';'
|
|
|
|
|
|
|
|
|
|
# add the manpage
|
|
|
|
|
install -d -D %{buildroot}%{_mandir}/man1
|
|
|
|
|
install -p -m 644 -D %{SOURCE1} %{buildroot}%{_mandir}/man1/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# install python bindings
|
|
|
|
|
pushd bindings/python
|
|
|
|
|
%if %{with python2}
|
|
|
|
|
%py2_install
|
|
|
|
|
|
|
|
|
|
# cleanup the install
|
|
|
|
|
rm -rf %{buildroot}%{python2_sitelib}/capstone/lib/libcapstone.a
|
|
|
|
|
rm -rf %{buildroot}%{python2_sitelib}/capstone/lib/libcapstone.so
|
|
|
|
|
rm -rf %{buildroot}%{python2_sitelib}/capstone/include/capstone
|
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
%if %{with python3}
|
|
|
|
|
%py3_install
|
|
|
|
|
# %%pyproject_install
|
|
|
|
|
# %%pyproject_save_files capstone
|
|
|
|
|
|
|
|
|
|
# cleanup the install
|
|
|
|
|
rm -rf %{buildroot}%{python3_sitelib}/capstone/lib/libcapstone.a
|
|
|
|
|
rm -rf %{buildroot}%{python3_sitelib}/capstone/lib/libcapstone.so
|
|
|
|
|
rm -rf %{buildroot}%{python3_sitelib}/capstone/include/capstone
|
|
|
|
|
|
|
|
|
|
%endif
|
|
|
|
|
popd
|
|
|
|
|
|
|
|
|
|
%if %{with java}
|
|
|
|
|
%ifarch %{java_arches}
|
|
|
|
|
# install java bindings
|
|
|
|
|
install -D -p -m 0644 bindings/java/%{name}.jar %{buildroot}/%{_javadir}/%{name}.jar
|
|
|
|
|
%endif
|
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
%if %{with ocaml}
|
|
|
|
|
# install ocaml binding
|
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%check
|
|
|
|
|
# ln -s libcapstone.so.5 libcapstone.so
|
|
|
|
|
ln -s libcapstone.so.4 libcapstone.so
|
|
|
|
|
make check LD_LIBRARY_PATH="`pwd`"
|
|
|
|
|
|
|
|
|
|
%if %{with python3}
|
|
|
|
|
pushd bindings/python
|
|
|
|
|
%pytest -sv -k "not testcb and not test_cs_disasm_quick"
|
|
|
|
|
popd
|
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
%if %{with ocaml}
|
|
|
|
|
pushd bindings/ocaml
|
|
|
|
|
make check LD_LIBRARY_PATH="`pwd`"
|
|
|
|
|
popd
|
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%ldconfig_scriptlets
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%files
|
|
|
|
|
%license LICENSE.TXT LICENSE_LLVM.TXT
|
|
|
|
|
%doc CREDITS.TXT ChangeLog README.md SPONSORS.TXT
|
|
|
|
|
%{_libdir}/*.so.*
|
|
|
|
|
%{_bindir}/cstool
|
|
|
|
|
%{_mandir}/man1/cstool.1*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%files devel
|
|
|
|
@ -306,6 +211,7 @@ popd
|
|
|
|
|
%{_libdir}/pkgconfig/*
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%if %{with python2}
|
|
|
|
|
%files -n python2-capstone
|
|
|
|
|
%{python2_sitelib}/*egg-info
|
|
|
|
@ -313,71 +219,21 @@ popd
|
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%if %{with python3}
|
|
|
|
|
#%%files -n python%%{python3_pkgversion}-capstone -f %%{pyproject_files}
|
|
|
|
|
%files -n python%{python3_pkgversion}-capstone
|
|
|
|
|
%{python3_sitelib}/capstone*
|
|
|
|
|
%{python3_sitelib}/*egg-info
|
|
|
|
|
%{python3_sitelib}/%{name}
|
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%if %{with java}
|
|
|
|
|
%ifarch %{java_arches}
|
|
|
|
|
|
|
|
|
|
%files java
|
|
|
|
|
%{_javadir}/
|
|
|
|
|
%endif
|
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%if %{with ocaml}
|
|
|
|
|
%files -n ocaml-%{name}
|
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%changelog
|
|
|
|
|
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 5.0.1-6
|
|
|
|
|
- Bump release for October 2024 mass rebuild:
|
|
|
|
|
Resolves: RHEL-64018
|
|
|
|
|
|
|
|
|
|
* Fri Oct 25 2024 MSVSphere Packaging Team <packager@msvsphere-os.ru> - 5.0.1-5
|
|
|
|
|
- Rebuilt for MSVSphere 10
|
|
|
|
|
|
|
|
|
|
* Sat Sep 21 2024 Andrew Hughes <gnu.andrew@redhat.com> - 5.0.1-5
|
|
|
|
|
- Rebuilt with java-21-openjdk as default JDK:
|
|
|
|
|
https://issues.redhat.com/browse/RHEL-34597
|
|
|
|
|
|
|
|
|
|
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 5.0.1-4
|
|
|
|
|
- Bump release for June 2024 mass rebuild
|
|
|
|
|
|
|
|
|
|
* Tue Jan 23 2024 Fedora Release Engineering <releng@fedoraproject.org> - 5.0.1-3
|
|
|
|
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
|
|
|
|
|
|
|
|
|
* Fri Jan 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 5.0.1-2
|
|
|
|
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
|
|
|
|
|
|
|
|
|
* Fri Sep 15 2023 Jonathan Wright <jonathan@almalinux.org> - 5.0.1-1
|
|
|
|
|
- Update to 5.0.1
|
|
|
|
|
|
|
|
|
|
* Wed Jul 19 2023 Jonathan Wright <jonathan@almalinux.org> - 5.0-1
|
|
|
|
|
- Modernize spec file using pyproject/wheel build
|
|
|
|
|
|
|
|
|
|
* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.2-15
|
|
|
|
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
|
|
|
|
|
|
|
|
|
|
* Tue Jun 13 2023 Python Maint <python-maint@redhat.com> - 4.0.2-14
|
|
|
|
|
- Rebuilt for Python 3.12
|
|
|
|
|
|
|
|
|
|
* Fri Jan 27 2023 Michal Ambroz <rebus AT_ seznam.cz> - 4.0.2-13
|
|
|
|
|
- update the new github page
|
|
|
|
|
|
|
|
|
|
* Wed Jan 18 2023 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.2-12
|
|
|
|
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
|
|
|
|
|
|
|
|
|
* Wed Jul 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.2-11
|
|
|
|
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
|
|
|
|
|
- drop java binding for platforms not in %%{java_arches}
|
|
|
|
|
|
|
|
|
|
* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 4.0.2-10
|
|
|
|
|
- Rebuilt for Python 3.11
|
|
|
|
|
* Fri Sep 02 2022 Miroslav Rezanina <mrezanin@redhat.com> - 4.0.2-10
|
|
|
|
|
- Import to CentOS 9 Stream / RHEL 9
|
|
|
|
|
|
|
|
|
|
* Sat Feb 05 2022 Jiri Vanek <jvanek@redhat.com> - 4.0.2-9
|
|
|
|
|
- Rebuilt for java-17-openjdk as system jdk
|
|
|
|
|