From 57fca6d4ffd36deb6b38b2848ebe6a9a15018402 Mon Sep 17 00:00:00 2001 From: rpmbuild Date: Thu, 10 Oct 2019 23:21:58 +0200 Subject: [PATCH] remove python2 package from fc32 --- capstone.spec | 82 ++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 65 insertions(+), 17 deletions(-) diff --git a/capstone.spec b/capstone.spec index f07f630..2a3129d 100644 --- a/capstone.spec +++ b/capstone.spec @@ -1,6 +1,6 @@ Name: capstone Version: 4.0.1 -Release: 6%{?dist} +Release: 7%{?dist} Summary: A lightweight multi-platform, multi-architecture disassembly framework %global gituser aquynh @@ -18,7 +18,7 @@ URL: http://www.capstone-engine.org/ Source0: https://github.com/%{gituser}/%{gitname}/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz # Test suite binary samples to be used for disassembly -# Source1: +# 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" @@ -28,22 +28,31 @@ Source0: https://github.com/%{gituser}/%{gitname}/archive/%{version}.tar. # See: https://github.com/aquynh/capstone/issues/1339 Patch1: 0001-Fix-include-path-in-pkg-config-for-Makefile-too-1339.patch -%if 0%{?fedora} > 12 +%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. +} + %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())")} +%bcond_with python2 +# Build also the python2 package +%if %{with python2} || (0%{?fedora} && 0%{?fedora} <= 31 ) || ( 0%{?rhel} && 0%{?rhel} <= 8 ) +%global with_python2 1 %endif + %global srcname distribute BuildRequires: gcc BuildRequires: git +BuildRequires: jna +BuildRequires: java-devel + +%if 0%{?with_python2} BuildRequires: python2 BuildRequires: python2-devel BuildRequires: python2-setuptools -BuildRequires: jna -BuildRequires: java-devel +%endif # if with_python2 %if 0%{?with_python3} BuildRequires: python%{python3_pkgversion} @@ -54,17 +63,20 @@ BuildRequires: python%{python3_pkgversion}-setuptools %description -Capstone is a disassembly framework with the target of becoming the ultimate -disasm engine for binary analysis and reversing in the security community. +%{common_desc} %package devel Summary: Development files for %{name} Requires: %{name}%{?_isa} = %{version}-%{release} %description devel +%{common_desc} The %{name}-devel package contains libraries and header files for developing applications that use %{name}. + + +%if 0%{?with_python2} %package -n python2-capstone %{?python_provide:%python_provide python2-capstone} # Remove before F30 @@ -75,40 +87,48 @@ Summary: Python bindings for %{name} Requires: %{name}%{?_isa} = %{version}-%{release} %description -n python2-capstone +%{common_desc} The %{name}-python package contains python bindings for %{name}. +%endif # _with_python3 + + %if 0%{?with_python3} %package -n python%{python3_pkgversion}-capstone %{?python_provide:%python_provide python%{python3_pkgversion}-capstone} -# Remove before F30 Provides: %{name}-python%{python3_pkgversion} = %{version}-%{release} Provides: %{name}-python%{python3_pkgversion}%{?_isa} = %{version}-%{release} Obsoletes: %{name}-python%{python3_pkgversion} < %{version}-%{release} -Summary: Python bindings for %{name} Requires: %{name}%{?_isa} = %{version}-%{release} +Summary: Python3 bindings for %{name} -Summary: Python3 bindings for %{name} -Requires: %{name}%{?_isa} = %{version}-%{release} - -%description -n python%{python3_pkgversion}-capstone +%description -n python%{python3_pkgversion}-capstone +%{common_desc} 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 +%{common_desc} The %{name}-java package contains java bindings for %{name}. + + %prep # autosetup -n %{gitname}-%{commit} -S git %autosetup -n %{gitname}-%{version} -S git + + %build -DESTDIR="%{buildroot}" V=1 CFLAGS="%{optflags}" \ +DESTDIR="%{buildroot}" V=1 CFLAGS="%{optflags}" \ LIBDIRARCH="%{_lib}" INCDIR="%{_includedir}" \ make PYTHON2=%{__python2} PYTHON3=%{__python3} %{?_smp_mflags} @@ -117,9 +137,14 @@ 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 0%{?with_python2} CFLAGS="%{optflags}" %{__python2} setup.py build +%endif # with_python2 + %if 0%{?with_python3} CFLAGS="%{optflags}" %{__python3} setup.py build %endif # with_python3 @@ -130,6 +155,8 @@ pushd bindings/java make PYTHON2=%{__python2} PYTHON3=%{__python3} CFLAGS="%{optflags}" # %{?_smp_mflags} parallel seems broken popd + + %install DESTDIR=%{buildroot} LIBDIRARCH=%{_lib} \ INCDIR="%{_includedir}" make install @@ -138,7 +165,10 @@ find %{buildroot} -name '*.a' -exec rm -f {} ';' # install python bindings pushd bindings/python +%if 0%{?with_python2} %{__python2} setup.py install --skip-build --root %{buildroot} +%endif # with_python2 + %if 0%{?with_python3} %{__python3} setup.py install --skip-build --root %{buildroot} %endif # with_python3 @@ -147,13 +177,18 @@ popd # install java bindings install -D -p -m 0644 bindings/java/%{name}.jar %{buildroot}/%{_javadir}/%{name}.jar + + #%check #ln -s libcapstone.so libcapstone.so.4 #make check LD_LIBRARY_PATH="`pwd`" + + %ldconfig_scriptlets + %files # %license does not work for RHEL<7 %if 0%{?rhel} || 0%{?fedora} < 21 @@ -165,14 +200,22 @@ install -D -p -m 0644 bindings/java/%{name}.jar %{buildroot}/%{_javadir}/%{name %{_libdir}/*.so.* %{_bindir}/cstool + + %files devel %{_includedir}/* %{_libdir}/*.so %{_libdir}/pkgconfig/* + + +%if 0%{?with_python2} %files -n python2-capstone %{python2_sitelib}/*egg-info %{python2_sitelib}/%{name} +%endif # _with_python2 + + %if 0%{?with_python3} %files -n python%{python3_pkgversion}-capstone @@ -180,10 +223,15 @@ install -D -p -m 0644 bindings/java/%{name}.jar %{buildroot}/%{_javadir}/%{name %{python3_sitelib}/%{name} %endif # _with_python3 + + %files java %{_javadir}/ %changelog +* Thu Oct 10 2019 Michal Ambroz - 4.0.1-7 +- remove python2 from rawhide/fc32 package + * Thu Oct 03 2019 Miro HronĨok - 4.0.1-6 - Rebuilt for Python 3.8.0rc1 (#1748018)