Files
haikuports/dev-util/capstone/capstone-4.0.1.recipe
2020-03-16 13:25:24 -05:00

106 lines
2.9 KiB
Bash

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-2019, COSEINC"
LICENSE="BSD (3-clause)"
REVISION="4"
SOURCE_URI="https://github.com/aquynh/capstone/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="79bbea8dbe466bd7d051e037db5961fdb34f67c9fac5c3471dd105cfb1e05dc7"
srcGitRev="b01a30bf595c23081d0acfbcbe36fc8c6d829a71"
SOURCE_URI_2="https://github.com/groundx/capstonefuzz/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256_2="837be0138cb44384bf1266e76d67947a5be30a1dbd8d8ea532491677c1609b78"
SOURCE_FILENAME="capstone-$portVersion.tar.gz"
PATCHES="capstone-$portVersion.patchset"
ARCHITECTURES="!x86_gcc2 ?x86 x86_64"
SECONDARY_ARCHITECTURES="x86"
PROVIDES="
capstone$secondaryArchSuffix = $portVersion
cmd:cstool$secondaryArchSuffix = $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 .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$prefix
make $jobArgs
}
INSTALL()
{
cd build
make install
# Fix headers
mkdir -p $includeDir
mv $prefix/include/capstone $includeDir/
prepareInstalledDevelLib libcapstone
fixPkgconfig
# Fix broken include path from capstone 4.0.1
sed -i 's/includedir=\${prefix}\/develop\/headers$/includedir=\${prefix}\/develop\/headers\/capstone/' \
$developDir/lib/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
}