2e48bb3
Name:           capstone
Riccardo Schirone e2d5925
Version:        4.0.2
Riccardo Schirone 08c8b28
Release:        2%{?dist}
2e48bb3
Summary:        A lightweight multi-platform, multi-architecture disassembly framework
2e48bb3
2e48bb3
%global         gituser         aquynh
2e48bb3
%global         gitname         capstone
Michal Ambroz 5418748
# 4.0.1 release
Michal Ambroz 5418748
%global         commit          f9c6a90489be7b3637ff1c7298e45efafe7cf1b9
2e48bb3
%global         shortcommit     %(c=%{commit}; echo ${c:0:7})
2e48bb3
2e48bb3
License:        BSD
2e48bb3
URL:            http://www.capstone-engine.org/
Michal Ambroz 5418748
#               https://github.com/aquynh/capstone/releases
Michal Ambroz 5418748
#Source0:       https://github.com/%{gituser}/%{gitname}/archive/%{commit}/%{name}-%{version}-%{shortcommit}.tar.gz
Michal Ambroz 5418748
Source0:        https://github.com/%{gituser}/%{gitname}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Michal Ambroz 5418748
Michal Ambroz 5418748
# Test suite binary samples to be used for disassembly
rpmbuild 57fca6d
# Source1:
2e48bb3
Michal Ambroz 7e62564
# Fedora 29 makes python executable separate from python2 and python3. This patch makes
Michal Ambroz 7e62564
# it possible to specify PYTHON2 and PYTHON3 binary to be explicit that by "python" we mean "python2"
Michal Ambroz 5418748
# Patch0:         capstone-python.patch
Michal Ambroz 7e62564
3922765
# Upstream patch which fixes libcapstone.pc.
3922765
# See: https://github.com/aquynh/capstone/issues/1339
Riccardo Schirone e2d5925
# Patch1:         0001-Fix-include-path-in-pkg-config-for-Makefile-too-1339.patch
3922765
rpmbuild 57fca6d
%global         common_desc %{expand:
rpmbuild 57fca6d
Capstone is a disassembly framework with the target of becoming the ultimate
rpmbuild 17a9e52
disasm engine for binary analysis and reversing in the security community.}
rpmbuild 57fca6d
rpmbuild 20eece1
# Build with python3 package by default
rpmbuild 20eece1
%bcond_without  python3
rpmbuild 20eece1
rpmbuild 20eece1
# Build without python2 package for newer releases f32+ and rhel8+
rpmbuild 20eece1
%if (0%{?fedora} && 0%{?fedora} >= 32 ) || ( 0%{?rhel} && 0%{?rhel} >= 8 )
rpmbuild 20eece1
%bcond_with     python2
rpmbuild 20eece1
%else
rpmbuild 20eece1
%bcond_without  python2
2e48bb3
%endif
2e48bb3
rpmbuild 57fca6d
2e48bb3
%global srcname distribute
2e48bb3
eff7285
BuildRequires:  gcc
Michal Ambroz 7e62564
BuildRequires:  git
rpmbuild 57fca6d
BuildRequires:  jna
rpmbuild 57fca6d
BuildRequires:  java-devel
rpmbuild 57fca6d
rpmbuild 57fca6d
%if 0%{?with_python2}
Michal Ambroz da2077e
BuildRequires:  python2
2e48bb3
BuildRequires:  python2-devel
Michal Ambroz da2077e
BuildRequires:  python2-setuptools
rpmbuild 57fca6d
%endif # if with_python2
Michal Ambroz 50aad82
2e48bb3
%if 0%{?with_python3}
Michal Ambroz da2077e
BuildRequires:  python%{python3_pkgversion}
Michal Ambroz 50aad82
BuildRequires:  python%{python3_pkgversion}-devel
Michal Ambroz da2077e
BuildRequires:  python%{python3_pkgversion}-setuptools
2e48bb3
%endif # if with_python3
rpmbuild 20eece1
2e48bb3
%global _hardened_build 1
2e48bb3
2e48bb3
2e48bb3
%description
rpmbuild 57fca6d
%{common_desc}
2e48bb3
2e48bb3
%package        devel
2e48bb3
Summary:        Development files for %{name}
2e48bb3
Requires:       %{name}%{?_isa} = %{version}-%{release}
2e48bb3
2e48bb3
%description    devel
rpmbuild 57fca6d
%{common_desc}
2e48bb3
The %{name}-devel package contains libraries and header files for
2e48bb3
developing applications that use %{name}.
2e48bb3
rpmbuild 57fca6d
rpmbuild 57fca6d
rpmbuild 57fca6d
%if 0%{?with_python2}
76e47ad
%package        -n python2-capstone
76e47ad
%{?python_provide:%python_provide python2-capstone}
76e47ad
# Remove before F30
Michal Ambroz 50aad82
Provides:       %{name}-python = %{version}-%{release}
Michal Ambroz 50aad82
Provides:       %{name}-python%{?_isa} = %{version}-%{release}
Michal Ambroz 50aad82
Obsoletes:      %{name}-python < %{version}-%{release}
2e48bb3
Summary:        Python bindings for %{name}
2e48bb3
Requires:       %{name}%{?_isa} = %{version}-%{release}
2e48bb3
76e47ad
%description    -n python2-capstone
rpmbuild 57fca6d
%{common_desc}
rpmbuild 17a9e52
The python2-capstone package contains python bindings for %{name}.
rpmbuild 20eece1
%endif          # with_python2
rpmbuild 57fca6d
rpmbuild 57fca6d
2e48bb3
2e48bb3
%if 0%{?with_python3}
Michal Ambroz 50aad82
%package	-n python%{python3_pkgversion}-capstone
Michal Ambroz 50aad82
%{?python_provide:%python_provide python%{python3_pkgversion}-capstone}
Michal Ambroz 50aad82
Provides:       %{name}-python%{python3_pkgversion} = %{version}-%{release}
Michal Ambroz 50aad82
Provides:       %{name}-python%{python3_pkgversion}%{?_isa} = %{version}-%{release}
Michal Ambroz 50aad82
Obsoletes:      %{name}-python%{python3_pkgversion} < %{version}-%{release}
Michal Ambroz 50aad82
Requires:       %{name}%{?_isa} = %{version}-%{release}
rpmbuild 57fca6d
Summary:        Python3 bindings for %{name}
Michal Ambroz 50aad82
Michal Ambroz 50aad82
rpmbuild 57fca6d
%description    -n python%{python3_pkgversion}-capstone
rpmbuild 57fca6d
%{common_desc}
rpmbuild 17a9e52
The python%{python3_pkgversion}-capstone package contains python3 bindings for %{name}.
2e48bb3
%endif # with_python3
2e48bb3
rpmbuild 57fca6d
rpmbuild 57fca6d
2e48bb3
%package        java
2e48bb3
Summary:        Java bindings for %{name}
2e48bb3
Requires:       %{name} = %{version}-%{release}
2e48bb3
BuildArch:      noarch
2e48bb3
2e48bb3
%description    java
rpmbuild 57fca6d
%{common_desc}
2e48bb3
The %{name}-java package contains java bindings for %{name}.
2e48bb3
rpmbuild 57fca6d
rpmbuild 57fca6d
2e48bb3
%prep
Michal Ambroz 5418748
# autosetup -n %{gitname}-%{commit} -S git
Michal Ambroz 5418748
%autosetup -n %{gitname}-%{version} -S git
2e48bb3
rpmbuild 57fca6d
rpmbuild 57fca6d
2e48bb3
%build
rpmbuild 17a9e52
#DESTDIR="%{buildroot}"
rpmbuild 17a9e52
V=1 CFLAGS="%{optflags}" \
b2655e5
PREFIX="%{_prefix}" LIBDIRARCH="%{_lib}" INCDIR="%{_includedir}" \
Riccardo Schirone 08c8b28
%make_build PYTHON2=%{__python2} PYTHON3=%{__python3}
2e48bb3
2e48bb3
# Fix pkgconfig file
2e48bb3
sed -i 's;%{buildroot};;' capstone.pc
2e48bb3
grep -v archive capstone.pc > capstone.pc.tmp
2e48bb3
mv capstone.pc.tmp capstone.pc
2e48bb3
rpmbuild 57fca6d
2e48bb3
# build python bindings
2e48bb3
pushd bindings/python
rpmbuild 57fca6d
rpmbuild 57fca6d
%if 0%{?with_python2}
2e48bb3
CFLAGS="%{optflags}" %{__python2} setup.py build
rpmbuild 57fca6d
%endif # with_python2
rpmbuild 57fca6d
2e48bb3
%if 0%{?with_python3}
2e48bb3
CFLAGS="%{optflags}" %{__python3} setup.py build
2e48bb3
%endif # with_python3
2e48bb3
popd
2e48bb3
rpmbuild 20eece1
# build java bindings needs some python
2e48bb3
pushd bindings/java
rpmbuild d72f07b
%if 0%{?with_python3}
Riccardo Schirone 08c8b28
%make_build PYTHON2=%{__python3} PYTHON3=%{__python3} CFLAGS="%{optflags}" # %{?_smp_mflags} parallel seems broken
rpmbuild d72f07b
%else
Riccardo Schirone 08c8b28
%make_build PYTHON2=%{__python2} PYTHON3=%{__python2} CFLAGS="%{optflags}" # %{?_smp_mflags} parallel seems broken
rpmbuild d72f07b
%endif
2e48bb3
popd
2e48bb3
rpmbuild 57fca6d
rpmbuild 57fca6d
2e48bb3
%install
b2655e5
DESTDIR=%{buildroot} PREFIX="%{_prefix}" LIBDIRARCH=%{_lib} \
2e48bb3
INCDIR="%{_includedir}" make install
2e48bb3
find %{buildroot} -name '*.la' -exec rm -f {} ';'
2e48bb3
find %{buildroot} -name '*.a' -exec rm -f {} ';'
2e48bb3
2e48bb3
# install python bindings
2e48bb3
pushd bindings/python
rpmbuild 57fca6d
%if 0%{?with_python2}
2e48bb3
%{__python2} setup.py install --skip-build --root %{buildroot}
rpmbuild 57fca6d
%endif # with_python2
rpmbuild 57fca6d
2e48bb3
%if 0%{?with_python3}
2e48bb3
%{__python3} setup.py install --skip-build --root %{buildroot}
2e48bb3
%endif # with_python3
2e48bb3
popd
2e48bb3
2e48bb3
# install java bindings
2e48bb3
install -D -p -m 0644 bindings/java/%{name}.jar  %{buildroot}/%{_javadir}/%{name}.jar
2e48bb3
rpmbuild 57fca6d
rpmbuild 57fca6d
Michal Ambroz 5418748
#%check
Michal Ambroz 5418748
#ln -s libcapstone.so libcapstone.so.4
Michal Ambroz 5418748
#make check LD_LIBRARY_PATH="`pwd`"
2e48bb3
rpmbuild 57fca6d
rpmbuild 57fca6d
d236a7e
%ldconfig_scriptlets
2e48bb3
2e48bb3
rpmbuild 57fca6d
2e48bb3
%files
2e48bb3
# %license does not work for RHEL<7
2e48bb3
%if 0%{?rhel} || 0%{?fedora} < 21
2e48bb3
%doc LICENSE.TXT LICENSE_LLVM.TXT
2e48bb3
%else
2e48bb3
%license LICENSE.TXT LICENSE_LLVM.TXT
2e48bb3
%endif # %license workarond for RHEL<7
Michal Ambroz 5418748
%doc CREDITS.TXT ChangeLog README.md SPONSORS.TXT
2e48bb3
%{_libdir}/*.so.*
Michal Ambroz 4202e43
%{_bindir}/cstool
2e48bb3
rpmbuild 57fca6d
rpmbuild 57fca6d
2e48bb3
%files devel
2e48bb3
%{_includedir}/*
2e48bb3
%{_libdir}/*.so
2e48bb3
%{_libdir}/pkgconfig/*
2e48bb3
rpmbuild 57fca6d
rpmbuild 57fca6d
rpmbuild 57fca6d
%if 0%{?with_python2}
76e47ad
%files -n python2-capstone
2e48bb3
%{python2_sitelib}/*egg-info
2e48bb3
%{python2_sitelib}/%{name}
rpmbuild 57fca6d
%endif # _with_python2
rpmbuild 57fca6d
rpmbuild 57fca6d
2e48bb3
2e48bb3
%if 0%{?with_python3}
Michal Ambroz 50aad82
%files -n python%{python3_pkgversion}-capstone
2e48bb3
%{python3_sitelib}/*egg-info
2e48bb3
%{python3_sitelib}/%{name}
2e48bb3
%endif # _with_python3
2e48bb3
rpmbuild 57fca6d
rpmbuild 57fca6d
2e48bb3
%files java
2e48bb3
%{_javadir}/
2e48bb3
2e48bb3
%changelog
Riccardo Schirone 08c8b28
* Wed Jul 22 2020 Riccardo Schirone <rschirone91@gmail.com> - 4.0.2-2
Riccardo Schirone 08c8b28
- Use make_build macro instead of make (thanks to tstellar)
Riccardo Schirone 08c8b28
Riccardo Schirone e2d5925
* Mon Jul 20 2020 Riccardo Schirone <rschirone91@gmail.com> - 4.0.2-1
Riccardo Schirone e2d5925
- Rebase to upstream version 4.0.2
Riccardo Schirone e2d5925
a88e940
* Fri Jul 10 2020 Jiri Vanek <jvanek@redhat.com> - 4.0.1-13
a88e940
- Rebuilt for JDK-11, see https://fedoraproject.org/wiki/Changes/Java11
a88e940
5f249a1
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 4.0.1-12
5f249a1
- Rebuilt for Python 3.9
5f249a1
5e9bc7b
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.1-11
5e9bc7b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
5e9bc7b
b2655e5
* Tue Jan 21 2020 Kalev Lember <klember@redhat.com> - 4.0.1-10
b2655e5
- Avoid hardcoding /usr prefix
b2655e5
rpmbuild 20eece1
* Tue Oct 15 2019 Michal Ambroz <rebus AT_ seznam.cz> - 4.0.1-9
rpmbuild 20eece1
- do not build python2 package for rhel8
rpmbuild 20eece1
rpmbuild 17a9e52
* Thu Oct 10 2019 Michal Ambroz <rebus AT_ seznam.cz> - 4.0.1-8
rpmbuild 17a9e52
- fix descriptions of sub-packages
rpmbuild 17a9e52
- remove buildroot from the build phase
rpmbuild 17a9e52
rpmbuild 57fca6d
* Thu Oct 10 2019 Michal Ambroz <rebus AT_ seznam.cz> - 4.0.1-7
rpmbuild 57fca6d
- remove python2 from rawhide/fc32 package
rpmbuild 57fca6d
82c6672
* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 4.0.1-6
82c6672
- Rebuilt for Python 3.8.0rc1 (#1748018)
82c6672
bbee224
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 4.0.1-5
bbee224
- Rebuilt for Python 3.8
bbee224
06f817e
* Wed Jul 24 2019 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.1-4
06f817e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
06f817e
98a0bae
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 4.0.1-3
98a0bae
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
98a0bae
3922765
* Sat Jan 12 2019 Richard W.M. Jones <rjones@redhat.com> - 4.0.1-2
3922765
- Add upstream patch which fixes libcapstone.pc
3922765
  https://github.com/aquynh/capstone/issues/1339
3922765
Michal Ambroz 5418748
* Fri Jan 11 2019 Michal Ambroz <rebus _AT seznam.cz> - 4.0.1-1
Michal Ambroz 5418748
- bump to 4.0.1 release
Michal Ambroz 5418748
Michal Ambroz 4202e43
* Mon Aug 27 2018 Michal Ambroz <rebus _AT seznam.cz> - 3.0.5-1
Michal Ambroz 4202e43
- bump to 3.0.5
Michal Ambroz 4202e43
2fdde9d
* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.4-18
2fdde9d
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
2fdde9d
b57594c
* Mon Jul 02 2018 Miro Hrončok <mhroncok@redhat.com> - 3.0.4-17
b57594c
- Rebuilt for Python 3.7
b57594c
Michal Ambroz 50aad82
* Tue Jun 26 2018 Michal Ambroz <rebus _AT seznam.cz> - 3.0.4-16
Michal Ambroz 50aad82
- unify the naming convention for the python packages
Michal Ambroz 50aad82
- fix the python3 package naming for EPEL7
Michal Ambroz 50aad82
76c825e
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 3.0.4-15
76c825e
- Rebuilt for Python 3.7
76c825e
29d96b7
* Fri Feb 09 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.0.4-14
29d96b7
- Escape macros in %%changelog
29d96b7
f23ebd6
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.4-13
f23ebd6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
f23ebd6
e589f1b
* Sun Aug 20 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 3.0.4-12
e589f1b
- Add Provides for the old name without %%_isa
e589f1b
76e47ad
* Sat Aug 19 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 3.0.4-11
76e47ad
- Python 2 binary package renamed to python2-capstone
76e47ad
  See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3
76e47ad
014a287
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.4-10
014a287
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
014a287
4234078
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.4-9
4234078
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
4234078
a87213a
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.4-8
a87213a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
a87213a
ba9e4bb
* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 3.0.4-7
ba9e4bb
- Rebuild for Python 3.6
ba9e4bb
f43c6b7
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.4-6
f43c6b7
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
f43c6b7
5468aa0
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.4-5
5468aa0
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
5468aa0
2e48bb3
* Tue Oct 27 2015 Stefan Cornelius <scorneli@redhat.com> - 3.0.4-4
2e48bb3
- Really add dist tag this time
2e48bb3
2e48bb3
* Sun Oct 25 2015 Stefan Cornelius <scorneli@redhat.com> - 3.0.4-3
2e48bb3
- Fix issues found during package review: dist tag, git sources
2e48bb3
2e48bb3
* Thu Jul 16 2015 Stefan Cornelius <scorneli@redhat.com> - 3.0.4-2
2e48bb3
- Fix EPEL6 build problems
2e48bb3
2e48bb3
* Wed Jul 15 2015 Stefan Cornelius <scorneli@redhat.com> - 3.0.4-1
2e48bb3
- new version 3.0.4. Includes security fixes.
2e48bb3
2e48bb3
* Tue May 12 2015 Stefan Cornelius <scorneli@redhat.com> - 3.0.3-2
2e48bb3
- Addressed issues found during package review.
2e48bb3
2e48bb3
* Fri May 08 2015 Stefan Cornelius <scorneli@redhat.com> - 3.0.3-1
2e48bb3
-  Update to version 3.0.3
2e48bb3
2e48bb3
* Fri May 08 2015 Stefan Cornelius <scorneli@redhat.com> - 3.0.2-3
2e48bb3
- Added python3 and hardened build support. Update java building.
2e48bb3
- Various cleanups.
2e48bb3
2e48bb3
* Wed May 06 2015 Stefan Cornelius <scorneli@redhat.com> - 3.0.2-2
29d96b7
- Update to 3.0.2. Fix 64bit issues. add %%check.
2e48bb3
2e48bb3
* Sat Sep 27 2014 Adel Gadllah <adel.gadllah@gmail.com> - 2.1.2-2
2e48bb3
- Addressed issues found during package review.
2e48bb3
2e48bb3
* Mon May 19 2014 Adel Gadllah <adel.gadllah@gmail.com> - 2.1.2-1
2e48bb3
- Initial package