diff --git a/capstone-5.0.1.tar.gz b/capstone-5.0.5.tar.gz similarity index 50% rename from capstone-5.0.1.tar.gz rename to capstone-5.0.5.tar.gz index 03be1187d0338948b59ad8b4c89c8d56b8b34045..9721b860dec1362f61d110309ba6c61928299e20 100644 Binary files a/capstone-5.0.1.tar.gz and b/capstone-5.0.5.tar.gz differ diff --git a/capstone.spec b/capstone.spec index 932311e4859ced77e9013efd23ff4c1ee89f5422..d96afae64efcc357ef0be57830a1dda7da6e9f98 100644 --- a/capstone.spec +++ b/capstone.spec @@ -1,26 +1,46 @@ %bcond_with java -Name: capstone -Version: 5.0.1 -Release: 2 -Summary: A lightweight multi-platform, multi-architecture disassembly framework -License: BSD -URL: http://www.capstone-engine.org/ -Source0: https://github.com/capstone-engine/capstone/archive/refs/tags/capstone-5.0.1.tar.gz +Name: capstone +Version: 5.0.5 +Release: 1 +Summary: A lightweight multi-platform, multi-architecture disassembly framework +License: BSD +URL: http://www.capstone-engine.org/ +VCS: git:https://github.com/capstone-engine/capstone/ + +%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 gituser capstone-engine +%global gitname capstone +# 5.0.5 release +%global gitdate 20250117 +%global commit 55261253c3f14d957c58382df82e61123dad45b9 +%global shortcommit %(c=%{commit}; echo ${c:0:7}) + +# 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 Patch1: backport-Fix-broken-disassembly-of-floating-point-immediates-on-big-endian-hosts.patch Patch2: backport-Fix-compilation-with-DIET-X86_REDUCE.patch Patch3: backport-Avoid-random-access-values-for-operands-in-not-yet-specified-instructions.patch Patch4: backport-Make-helper-functions-static-to-prevent-multiple-defintions.patch +# Build with python3 package by default %global with_python3 1 -BuildRequires: gcc capstone +BuildRequires: gcc make git -%if 0%{with java} -Buildrequires: jna java-devel +%if %{with java} +%ifarch %{java_arches} +BuildRequires: jna +BuildRequires: java-devel +%endif %endif -%if 0%{?with_python3} +%if %{with python3} BuildRequires: python%{python3_pkgversion} python%{python3_pkgversion}-devel python%{python3_pkgversion}-setuptools %endif @@ -28,84 +48,119 @@ BuildRequires: python%{python3_pkgversion} python%{python3_pkgversion}-devel py Capstone is a lightweight multi-platform, multi-architecture disassembly framework.It supports multi-architectures, Multiple platforms. Clean & intuitive is the key principle in designing the API for Capstone. Capstone is thread-safe. -%package -n %{name}-devel -Summary: Development headers and libraries to build upon %{name} -Requires:%{name} = %{version}-%{release} +%package devel +Summary: Development files for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} -%description -n %{name}-devel -Development headers and libraries to build upon %{name} +%description devel +%{common_desc} +The %{name}-devel package contains libraries and header files for +developing applications that use %{name}. -%if 0%{?with_python3} -%package -n python%{python3_pkgversion}-capstone -Requires: %{name} = %{version}-%{release} -Summary: Python3 bindings for %{name} -Provides: %{name}-python%{python3_pkgversion} = %{version}-%{release} -Provides: %{name}-python%{python3_pkgversion}%{?_isa} = %{version}-%{release} -Obsoletes: %{name}-python%{python3_pkgversion} < %{version}-%{release} -%{?python_provide:%python_provide python%{python3_pkgversion}-capstone} +%package static +Summary: Static linking of %{name} library + +%description static +%{common_desc} +The %{name}-static package contains files needed for static linking +of %{name} library into static binaries. -%description -n python%{python3_pkgversion}-capstone -Python3 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} +Obsoletes: %{name}-python%{python3_pkgversion} < %{version}-%{release} +Requires: %{name} = %{version}-%{release} +Summary: Python3 bindings for %{name} + +%description -n python%{python3_pkgversion}-capstone +%{common_desc} +The python%{python3_pkgversion}-capstone package contains python3 bindings for %{name}. %endif -%if 0%{with java} -%package java -Summary: Java bindings for %{name} -Requires: %{name} = %{version}-%{release} -BuildArch: noarch +%if %{with java} +%ifarch %{java_arches} +%package java +Summary: Java bindings for %{name} +Requires: %{name} = %{version}-%{release} +BuildArch: noarch -%description java -This package contains java bindings for %{name}. +%description java +%{common_desc} +The %{name}-java package contains java bindings for %{name}. +%endif %endif %prep -%autosetup -n %{name}-%{version} -p1 +%autosetup -n %{gitname}-%{version} -p1 %build -DESTDIR="%{buildroot}" V=1 CFLAGS="%{optflags}" \ -LIBDIRARCH="%{_lib}" INCDIR="%{_includedir}" \ -make PYTHON2=%{__python2} PYTHON3=%{__python3} %{?_smp_mflags} +V=1 CFLAGS="%{optflags}" \ +PREFIX="%{_prefix}" LIBDIRARCH="%{_lib}" INCDIR="%{_includedir}" \ +%make_build PYTHON2=%{__python2} PYTHON3=%{__python3} -sed -i 's;%{buildroot};;' capstone.pc +# Fix pkgconfig file grep -v archive capstone.pc > capstone.pc.tmp mv capstone.pc.tmp capstone.pc +# build python bindings pushd bindings/python -%if 0%{?with_python3} + + +%if %{with python3} +# %%pyproject_wheel %py3_build %endif popd -%if 0%{with java} +%if %{with java} +%ifarch %{java_arches} +# build java bindings needs some python runtime pushd bindings/java -%if 0%{?with_python3} -make PYTHON2=%{__python3} PYTHON3=%{__python3} CFLAGS="%{optflags}" +%if %{with python3} +%make_build PYTHON2=%{__python3} PYTHON3=%{__python3} CFLAGS="%{optflags}" # %{?_smp_mflags} parallel seems broken %endif popd %endif +%endif %install -DESTDIR=%{buildroot} LIBDIRARCH=%{_lib} \ +DESTDIR=%{buildroot} PREFIX="%{_prefix}" LIBDIRARCH=%{_lib} \ INCDIR="%{_includedir}" make install -%delete_la_and_a +# 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 python bindings pushd bindings/python -%if 0%{?with_python3} + +%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 0%{with java} +%if %{with java} +%ifarch %{java_arches} +# install java bindings install -D -p -m 0644 bindings/java/%{name}.jar %{buildroot}/%{_javadir}/%{name}.jar %endif +%endif -%pre - -%preun - -%post -p /sbin/ldconfig - -%postun -p /sbin/ldconfig +%ldconfig_scriptlets %files %license LICENSE.TXT LICENSE_LLVM.TXT @@ -118,19 +173,27 @@ install -D -p -m 0644 bindings/java/%{name}.jar %{buildroot}/%{_javadir}/%{name %{_libdir}/*.so %{_libdir}/pkgconfig/* +%files static +%license LICENSE.TXT LICENSE_LLVM.TXT +%{_libdir}/libcapstone.a -%if 0%{?with_python3} +%if %{with python3} +#%%files -n python%%{python3_pkgversion}-capstone -f %%{pyproject_files} %files -n python%{python3_pkgversion}-capstone -%{python3_sitelib}/*egg-info -%{python3_sitelib}/%{name} +%{python3_sitelib}/capstone* %endif -%if 0%{with java} +%if %{with java} +%ifarch %{java_arches} %files java %{_javadir}/ %endif +%endif %changelog +* Mon Jun 16 2025 lvfei - 5.0.5-1 +- DESC:upgrade 5.0.5 + * Mon Aug 5 2024 zhangxingrong - 5.0.1-2 - Fix broken disassembly of floating point immediates on big endian hosts - Fix compilation with DIET + X86_REDUCE @@ -169,3 +232,4 @@ install -D -p -m 0644 bindings/java/%{name}.jar %{buildroot}/%{_javadir}/%{name * Sat Oct 12 2019 openEuler Buildteam - 4.0.1-1 - Package init +