update to 5.0

This commit is contained in:
jonathanspw 2023-07-15 07:09:59 -05:00
commit 746a06ddf2
3 changed files with 37 additions and 99 deletions

1
.gitignore vendored
View file

@ -3,3 +3,4 @@
/capstone-4.0.0-75c0528.tar.gz
/capstone-4.0.1.tar.gz
/capstone-4.0.2.tar.gz
/capstone-5.0.tar.gz

View file

@ -1,32 +1,17 @@
%define _lto_cflags %{nil}
Name: capstone
Version: 4.0.2
Release: 14%{?dist}
Version: 5.0
Release: 1%{?dist}
Summary: A lightweight multi-platform, multi-architecture disassembly framework
%global gituser capstone-engine
%global gitname capstone
# 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/capstone-engine/capstone/
# https://github.com/capstone-engine/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
# Test suite binary samples to be used for disassembly
# Source1:
# 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
# Upstream patch which fixes libcapstone.pc.
# See: https://github.com/capstone-engine/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.}
@ -34,14 +19,6 @@ disasm engine for binary analysis and reversing in the security community.}
# Build with python3 package by default
%bcond_without python3
# Build without python2 package for newer releases f32+ and rhel8+
%if (0%{?fedora} && 0%{?fedora} >= 32 ) || ( 0%{?rhel} && 0%{?rhel} >= 8 )
%bcond_with python2
%else
%bcond_without python2
%endif
%global srcname distribute
BuildRequires: gcc
@ -53,20 +30,14 @@ BuildRequires: jna
BuildRequires: java-devel
%endif
%if %{with python2}
BuildRequires: python2
BuildRequires: python2-devel
BuildRequires: python2-setuptools
%endif
%if %{with python3}
BuildRequires: python%{python3_pkgversion}
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-setuptools
BuildRequires: python3
BuildRequires: python3-devel
BuildRequires: python3-pip
BuildRequires: python3-setuptools
BuildRequires: python3-wheel
%endif
%global _hardened_build 1
%description
%{common_desc}
@ -82,38 +53,18 @@ developing applications that use %{name}.
%if %{with python2}
%package -n python2-capstone
%{?python_provide:%python_provide python2-capstone}
# Remove before F30
Provides: %{name}-python = %{version}-%{release}
Provides: %{name}-python%{?_isa} = %{version}-%{release}
Obsoletes: %{name}-python < %{version}-%{release}
Summary: Python bindings for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}
%description -n python2-capstone
%{common_desc}
The python2-capstone package contains python bindings for %{name}.
# with_python2
%endif
%if %{with python3}
%package -n python%{python3_pkgversion}-capstone
%{?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}
%package -n python3-capstone
Provides: %{name}-python3 = %{version}-%{release}
Provides: %{name}-python3%{?_isa} = %{version}-%{release}
Obsoletes: %{name}-python3 < %{version}-%{release}
Requires: %{name}%{?_isa} = %{version}-%{release}
Summary: Python3 bindings for %{name}
%description -n python%{python3_pkgversion}-capstone
%description -n python3-capstone
%{common_desc}
The python%{python3_pkgversion}-capstone package contains python3 bindings for %{name}.
#with python3
The python3-capstone package contains python3 bindings for %{name}.
%endif
@ -130,42 +81,36 @@ The %{name}-java package contains java bindings for %{name}.
%prep
# autosetup -n %%{gitname}-%%{commit} -S git
%autosetup -n %{gitname}-%{version} -S git
%if %{with python3}
pushd bindings/python
%pyproject_buildrequires
popd
%endif
%build
V=1 CFLAGS="%{optflags}" \
PREFIX="%{_prefix}" LIBDIRARCH="%{_lib}" INCDIR="%{_includedir}" \
%make_build PYTHON2=%{__python2} PYTHON3=%{__python3}
%make_build 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
#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
%if %{with python2}
%py2_build
%endif
%if %{with python3}
%py3_build
%pyproject_wheel
%endif
popd
%ifarch %{java_arches}
# 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
%else
%make_build PYTHON2=%{__python2} PYTHON3=%{__python2} CFLAGS="%{optflags}" # %{?_smp_mflags} parallel seems broken
%endif
%make_build PYTHON2=%{__python3} PYTHON3=%{__python3} CFLAGS="%{optflags}"
popd
%endif
@ -179,12 +124,9 @@ find %{buildroot} -name '*.a' -exec rm -f {} ';'
# install python bindings
pushd bindings/python
%if %{with python2}
%py2_install
%endif
%if %{with python3}
%py3_install
%pyproject_install
%pyproject_save_files capstone
%endif
popd
@ -195,7 +137,7 @@ install -D -p -m 0644 bindings/java/%{name}.jar %{buildroot}/%{_javadir}/%{name
%check
ln -s libcapstone.so.4 libcapstone.so
#ln -s libcapstone.so.5 libcapstone.so
make check LD_LIBRARY_PATH="`pwd`"
@ -218,18 +160,8 @@ make check LD_LIBRARY_PATH="`pwd`"
%if %{with python2}
%files -n python2-capstone
%{python2_sitelib}/*egg-info
%{python2_sitelib}/%{name}
%endif
%if %{with python3}
%files -n python%{python3_pkgversion}-capstone
%{python3_sitelib}/*egg-info
%{python3_sitelib}/%{name}
%files -n python3-capstone -f %{pyproject_files}
%endif
@ -239,6 +171,11 @@ make check LD_LIBRARY_PATH="`pwd`"
%endif
%changelog
* Sat Jul 15 2023 Jonathan Wright <jonathan@almalinux.org> - 5.0-1
- Update to 5.0
- Remove legacy code from spec
- Modernize spec file
* Tue Jun 13 2023 Python Maint <python-maint@redhat.com> - 4.0.2-14
- Rebuilt for Python 3.12

View file

@ -1 +1 @@
SHA512 (capstone-4.0.2.tar.gz) = 7f93534517307b737422a8825b66b2a1f3e1cca2049465d60ab12595940154aaf843ba40ed348fce58de58b990c19a0caef289060eb72898cb008a88c470970e
SHA512 (capstone-5.0.tar.gz) = e6794a9a06ed93edff9ae0b2c085d34010dd415e128ce4018b584fe35fa81182431f8fd6549d6a3c7a8a3bcca0691157c7a1c96971b7f51774960fd9afef9b8f