capstone5, bump to stable release, move recipes to dev-libs (#9469)

This commit is contained in:
Schrijvers Luc
2023-09-20 12:01:46 +00:00
committed by GitHub
parent 61c9160dbd
commit cc7f2bbd3a
4 changed files with 8 additions and 6 deletions

View File

@@ -1,100 +0,0 @@
SUMMARY="Lightweight multi-platform, multi-architecture disassembly framework"
DESCRIPTION="* Multi-architectures: Arm, Arm64 (Armv8), Mips, PowerPC, Sparc, \
SystemZ, XCore & X86 (include X86_64) (details).
* Clean/simple/lightweight/intuitive architecture-neutral API.
* Provide details on disassembled instruction (called “decomposer” by some others).
* Provide some semantics of the disassembled instruction, such as list of \
implicit registers read & written.
* Implemented in pure C language, with bindings for Perl, Python, Ruby, C#, \
NodeJS, Java, GO, C++, OCaml, Lua, Rust, Delphi, Free Pascall & Vala available.
* Native support for Windows & *nix (with Mac OSX, iOS, Android, Linux, *BSD & \
Solaris confirmed).
* 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)."
HOMEPAGE="http://www.capstone-engine.org"
COPYRIGHT="2013-2020 COSEINC"
LICENSE="BSD (3-clause)"
REVISION="2"
SOURCE_URI="https://github.com/aquynh/capstone/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="7c81d798022f81e7507f1a60d6817f63aa76e489aa4e7055255f21a22f5e526a"
srcGitRev="27c8950fe865a2326b919444aeb3cf18963d96ba"
SOURCE_URI_2="https://github.com/groundx/capstonefuzz/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256_2="17e96a70754c8467ebe12c6fe8033b53dfc03a2d52d336be876eb7cf256d36e2"
SOURCE_FILENAME="capstone-$portVersion.tar.gz"
PATCHES="capstone-$portVersion.patchset"
ARCHITECTURES="all !x86_gcc2 ?x86"
SECONDARY_ARCHITECTURES="x86"
PROVIDES="
capstone$secondaryArchSuffix = $portVersion
cmd:cstool = $portVersion
lib:libcapstone$secondaryArchSuffix = 0.4 compat >= 0.4
"
REQUIRES="
haiku$secondaryArchSuffix
"
PROVIDES_devel="
capstone${secondaryArchSuffix}_devel = $portVersion
devel:libcapstone$secondaryArchSuffix = 0.4 compat >= 0.4
"
REQUIRES_devel="
capstone$secondaryArchSuffix == $portVersion base
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
"
BUILD_PREREQUIRES="
cmd:awk
cmd:sed
cmd:find
cmd:cmake
cmd:gcc$secondaryArchSuffix
cmd:make
"
TEST_REQUIRES="
cmd:unzip
"
BUILD()
{
rm -rf build
mkdir build; cd build
cmake .. $cmakeDirArgs -DCMAKE_BUILD_TYPE=Release \
-DCAPSTONE_BUILD_STATIC=OFF
make $jobArgs
}
INSTALL()
{
cd build
make install
prepareInstalledDevelLib libcapstone
fixPkgconfig
# Fix broken include path
sed -i -e "s|includedir=.*|includedir=\"$includeDir/capstone\"/|" \
$developLibDir/pkgconfig/capstone.pc
packageEntries devel $developDir
}
TEST()
{
cd build
export filename="corpus-libFuzzer-capstone_fuzz_disasmnext-latest"
if [ -d "./suite/fuzz/$filename" ]; then
true
else
unzip -o -q $sourceDir2/capstonefuzz-$srcGitRev/corpus/$filename.zip -d suite/fuzz
fi
make check
}

View File

@@ -1,114 +0,0 @@
SUMMARY="Lightweight multi-platform, multi-architecture disassembly framework"
DESCRIPTION="* Multi-architectures: Arm, Arm64 (Armv8), Mips, PowerPC, Sparc, \
SystemZ, XCore & X86 (include X86_64) (details).
* Clean/simple/lightweight/intuitive architecture-neutral API.
* Provide details on disassembled instruction (called “decomposer” by some others).
* Provide some semantics of the disassembled instruction, such as list of \
implicit registers read & written.
* Implemented in pure C language, with bindings for Perl, Python, Ruby, C#, \
NodeJS, Java, GO, C++, OCaml, Lua, Rust, Delphi, Free Pascall & Vala available.
* Native support for Windows & *nix (with Mac OSX, iOS, Android, Linux, *BSD & \
Solaris confirmed).
* 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)."
HOMEPAGE="http://www.capstone-engine.org"
COPYRIGHT="2013-2020 COSEINC"
LICENSE="BSD (3-clause)"
REVISION="1"
SOURCE_URI="https://github.com/capstone-engine/capstone/archive/refs/tags/${portVersion/\~/-}.tar.gz"
CHECKSUM_SHA256="ec1823481ce8443153485dc6a789f0a2fdc5a4dfce511585c3b045764f53e340"
SOURCE_FILENAME="capstone-${portVersion/\~/-}.tar.gz"
SOURCE_DIR="capstone-${portVersion/\~/-}"
PATCHES="capstone5-$portVersion.patchset"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
commandBinDir=$binDir
commandSuffix=$secondaryArchSuffix
if [ "$targetArchitecture" = x86_gcc2 ]; then
commandSuffix=
commandBinDir=$prefix/bin
fi
libVersion="5.0.0"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"
PROVIDES="
capstone5$secondaryArchSuffix = $portVersion
lib:libcapstone$secondaryArchSuffix = $libVersionCompat
"
REQUIRES="
haiku$secondaryArchSuffix
"
PROVIDES_tools="
capstone5${secondaryArchSuffix}_tools = $portVersion
cmd:cstool$commandSuffix = $portVersion
"
REQUIRES_tools="
capstone5$secondaryArchSuffix == $portVersion base
haiku$secondaryArchSuffix
"
CONFLICTS_tools="
capstone$secondaryArchSuffix
"
PROVIDES_devel="
capstone5${secondaryArchSuffix}_devel = $portVersion
devel:libcapstone$secondaryArchSuffix = $libVersionCompat
"
REQUIRES_devel="
capstone5$secondaryArchSuffix == $portVersion base
"
CONFLICTS_devel="
capstone${secondaryArchSuffix}_devel
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
"
BUILD_PREREQUIRES="
cmd:cmake
cmd:gcc$secondaryArchSuffix
cmd:make
"
BUILD()
{
cmake -Bbuild -S. $cmakeDirArgs -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_BINDIR=$commandBinDir \
-DBUILD_SHARED_LIBS=ON
make -C build $jobArgs
}
INSTALL()
{
make -C build install
prepareInstalledDevelLib libcapstone
fixPkgconfig
# Fix broken include path
if [ -n "$secondaryArchSuffix" ]; then
sed -i 's,\/headers/x86,\/headers/x86/capstone,g' \
$prefix/$relativeDevelopLibDir/pkgconfig/capstone.pc
else
sed -i 's,\/headers,\/headers/capstone,g' \
$prefix/$relativeDevelopLibDir/pkgconfig/capstone.pc
fi
packageEntries tools \
$commandBinDir
packageEntries devel $developDir \
$libDir/cmake
}
TEST()
{
./build/test_basic
./build/test_detail
}

View File

@@ -1,47 +0,0 @@
From 12215d491664fab5e11d359edc70dcda513cc1f2 Mon Sep 17 00:00:00 2001
From: Calvin Hill <calvin@hakobaito.co.uk>
Date: Sun, 13 Jan 2019 00:39:39 +0000
Subject: Fix build of fuzztests.
diff --git a/suite/fuzz/driverbin.c b/suite/fuzz/driverbin.c
index c5676dd..1ac5b72 100644
--- a/suite/fuzz/driverbin.c
+++ b/suite/fuzz/driverbin.c
@@ -3,6 +3,7 @@
#include <stdio.h>
#include <dirent.h>
#include <unistd.h>
+#include <sys/stat.h>
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size);
const char * cs_fuzz_arch(uint8_t arch);
@@ -14,6 +15,7 @@ int main(int argc, char** argv)
size_t Size;
DIR *d;
struct dirent *dir;
+ struct stat s;
int r = 0;
int i;
@@ -34,10 +36,16 @@ int main(int argc, char** argv)
while((dir = readdir(d)) != NULL) {
//opens the file, get its size, and reads it into a buffer
+ #ifndef __HAIKU__
if (dir->d_type != DT_REG) {
continue;
}
-
+ else
+ stat(dir->d_name, &s);
+ if(!S_ISREG(s.st_mode)){
+ continue;
+ }
+ #endif
printf("Running %s\n", dir->d_name);
fflush(stdout);
--
2.26.0

View File

@@ -1,46 +0,0 @@
From 4be90b6bc051b1138356a0d4d95f95794284b10f Mon Sep 17 00:00:00 2001
From: Calvin Hill <calvin@hakobaito.co.uk>
Date: Sun, 13 Jan 2019 00:39:39 +0000
Subject: Fix build of fuzztests.
diff --git a/suite/fuzz/driverbin.c b/suite/fuzz/driverbin.c
index d5e3a0f..d59aae9 100644
--- a/suite/fuzz/driverbin.c
+++ b/suite/fuzz/driverbin.c
@@ -3,6 +3,7 @@
#include <stdio.h>
#include <dirent.h>
#include <unistd.h>
+#include <sys/stat.h>
#include "platform.h"
@@ -15,6 +16,7 @@ int main(int argc, char** argv)
size_t Size;
DIR *d;
struct dirent *dir;
+ struct stat s;
int r = 0;
int i;
@@ -35,9 +37,16 @@ int main(int argc, char** argv)
while((dir = readdir(d)) != NULL) {
//opens the file, get its size, and reads it into a buffer
+ #ifndef __HAIKU__
if (dir->d_type != DT_REG) {
continue;
}
+ else
+ stat(dir->d_name, &s);
+ if(!S_ISREG(s.st_mode)){
+ continue;
+ }
+ #endif
printf("Running file %s ", dir->d_name);
fflush(stdout);
fp = fopen(dir->d_name, "rb");
--
2.37.3