From 0dbcf2b0c924642e93b379e31ae42e6944fd8c2b Mon Sep 17 00:00:00 2001 From: Jakub Bogusz Date: Sat, 23 May 2020 21:37:42 +0200 Subject: [PATCH] - new --- capstone-libsuffix.patch | 18 ++++++ capstone-shared.patch | 11 ++++ capstone.spec | 130 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 159 insertions(+) create mode 100644 capstone-libsuffix.patch create mode 100644 capstone-shared.patch create mode 100644 capstone.spec diff --git a/capstone-libsuffix.patch b/capstone-libsuffix.patch new file mode 100644 index 0000000..574b10f --- /dev/null +++ b/capstone-libsuffix.patch @@ -0,0 +1,18 @@ +--- capstone-4.0.1/CMakeLists.txt.orig 2020-05-23 20:26:01.339972482 +0200 ++++ capstone-4.0.1/CMakeLists.txt 2020-05-23 20:31:02.661673415 +0200 +@@ -574,14 +574,7 @@ + source_group("Include\\M680X" FILES ${HEADERS_MC680X}) + source_group("Include\\EVM" FILES ${HEADERS_EVM}) + +-### test library 64bit routine: +-get_property(LIB64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS) +- +-if (NOT APPLE AND "${LIB64}" STREQUAL "TRUE") +- set(LIBSUFFIX 64) +-else() +- set(LIBSUFFIX "") +-endif() ++set(LIBSUFFIX "${LIB_SUFFIX}") + + set(INSTALL_LIB_DIR lib${LIBSUFFIX} CACHE PATH "Installation directory for libraries") + mark_as_advanced(INSTALL_LIB_DIR) diff --git a/capstone-shared.patch b/capstone-shared.patch new file mode 100644 index 0000000..a741dad --- /dev/null +++ b/capstone-shared.patch @@ -0,0 +1,11 @@ +Link cstool with capstone-shared instead of -static +--- capstone-4.0.1/CMakeLists.txt.orig 2019-01-10 14:45:56.000000000 +0100 ++++ capstone-4.0.1/CMakeLists.txt 2020-05-23 20:25:12.603569843 +0200 +@@ -491,7 +491,6 @@ + if (CAPSTONE_BUILD_STATIC) + add_library(capstone-static STATIC ${ALL_SOURCES} ${ALL_HEADERS}) + set_property(TARGET capstone-static PROPERTY OUTPUT_NAME capstone) +- set(default-target capstone-static) + endif () + + # Force static runtime libraries diff --git a/capstone.spec b/capstone.spec new file mode 100644 index 0000000..e8cf112 --- /dev/null +++ b/capstone.spec @@ -0,0 +1,130 @@ +# +# Conditional build: +%bcond_without static_libs # static library + +Summary: Capstone engine - dissassembly framework +Summary(pl.UTF-8): Silnik Capstone - szkielet do disasemblacji +Name: capstone +Version: 4.0.1 +Release: 1 +License: BSD +Group: Libraries +#Source0Download: https://github.com/aquynh/capstone/releases +Source0: https://github.com/aquynh/capstone/archive/%{version}/%{name}-%{version}.tar.gz +# Source0-md5: 1b0a9a0d50d9515dcf7684ce0a2270a4 +Patch0: %{name}-shared.patch +Patch1: %{name}-libsuffix.patch +URL: http://www.capstone-engine.org/ +BuildRequires: cmake >= 2.6 +BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) + +%description +Capstone is a disassembly framework with the target of becoming the +ultimate disasm engine for binary analysis and reversing in the +security community. Capstone offers some unparalleled features: +- Support for multiple hardware architectures: ARM, ARM64 (ARMv8), + Ethereum VM, M68K, MIPS, PPC, SPARC, SystemZ, TMS320C64X, M680X, + XCore and X86 (including X86_64). +- Having clean/simple/lightweight/intuitive architecture-neutral API. +- Provide details on disassembled instruction ("decomposer"). +- Provide semantics of the disassembled instruction, such as list of + implicit registers read & written. +- Implemented in pure C language, with lightweight bindings for many + languages. +- Native support for all popular platforms: Windows, MacOS X, iOS, + Android, Linux, *BSD, Solaris, etc. +- Thread-safe by design. +- Special support for embedding into firmware or OS kernel. +- High performance & suitable for malware analysis (capable of + handling various X86 malware tricks). +- Distributed under the open source BSD license. + +%description -l pl.UTF-8 +Capstone to szkielet do disasemblacji o aspiracjach do stania się +standardowym silnikiem disasemblującym do analizy binariów i +inżynierii wstecznej wśród społeczności związanej z bezpieczeństwem. +Oferuje trochę niespotykanych możliwości: +- obsługę wielu architektur sprzętowych: ARM, ARM64 (ARMv8), Ethereum + VM, M68K, MIPS, PPC, SPARC, SystemZ, TMS320C64X, M680X, XCore oraz + X86 (w tym X86_64) +- czyste/proste/lekkie/intuicyjne API niezależne od architektury +- podaje szczegóły disasemblowanej instrukcji ("dekompozycję") +- podaje semantykę disasemblowanej instrukcji - np. listę niejawnych + odczytywanych i zapisywanych rejestrów +- jest zaimplementowany w czystym C z lekkimi wiązaniami do wielu + innych języków +- natywną obsługę wielu popularnych platform: Windows, MacOS X, iOS, + Android, Linux, *BSD, Solaris itp. +- jest bezpieczny pod kątem wątków +- specjalną obsługę osadzania w firmwarze lub jądrze systemu +- wysoką wydajność, przydatność przy analizie podejrzanego + oprogramowania (obsługę różnych sztuczek architektury X86) +- jest udostępniony z otwartymi źródłami na licencji BSD. + +%package devel +Summary: Header files for Capstone dissassembler library +Summary(pl.UTF-8): Pliki nagłówkowe biblioteki disasemblera Capstone +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} + +%description devel +Header files for Capstone dissassembler library. + +%description devel -l pl.UTF-8 +Pliki nagłówkowe biblioteki disasemblera Capstone. + +%package static +Summary: Static Capstone dissassembler library +Summary(pl.UTF-8): Biblioteka statyczna disasemblera Capstone +Group: Development/Libraries +Requires: %{name}-devel = %{version}-%{release} + +%description static +Static Capstone dissassembler library. + +%description static -l pl.UTF-8 +Biblioteka statyczna disasemblera Capstone. + +%prep +%setup -q +%patch0 -p1 +%patch1 -p1 + +%build +install -d build +cd build +%cmake .. \ + %{!?with_static_libs:-DCAPSTONE_BUILD_STATIC=OFF} + +%{__make} + +%install +rm -rf $RPM_BUILD_ROOT + +%{__make} -C build install \ + DESTDIR=$RPM_BUILD_ROOT + +%clean +rm -rf $RPM_BUILD_ROOT + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%files +%defattr(644,root,root,755) +%doc CREDITS.TXT ChangeLog LICENSE.TXT LICENSE_LLVM.TXT README.md SPONSORS.TXT TODO +%attr(755,root,root) %{_bindir}/cstool +%attr(755,root,root) %{_libdir}/libcapstone.so.*.*.* +%attr(755,root,root) %ghost %{_libdir}/libcapstone.so.4 + +%files devel +%defattr(644,root,root,755) +%attr(755,root,root) %{_libdir}/libcapstone.so +%{_includedir}/capstone +%{_pkgconfigdir}/capstone.pc + +%if %{with static_libs} +%files static +%defattr(644,root,root,755) +%{_libdir}/libcapstone.a +%endif -- 2.44.0