Blame SPECS/capstone.spec

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