2019-04-29 13:17:34 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Capstone disassembler engine (www.capstone-engine.org)
|
|
|
|
# Build Capstone libs for specified architecture, or all if none is specified (libcapstone.so & libcapstone.a) on *nix with CMake & make
|
|
|
|
# By Nguyen Anh Quynh, Jorn Vernee, 2019
|
|
|
|
|
2022-01-26 03:28:04 +00:00
|
|
|
CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=Release"
|
2019-04-29 13:17:34 +00:00
|
|
|
# Uncomment below line to compile in Diet mode
|
2022-01-26 03:28:04 +00:00
|
|
|
# CMAKE_FLAGS+=" -DCAPSTONE_BUILD_DIET=ON"
|
2019-04-29 13:17:34 +00:00
|
|
|
|
|
|
|
case $1 in
|
|
|
|
ARM)
|
|
|
|
ARCH=ARM
|
|
|
|
;;
|
|
|
|
ARM64)
|
|
|
|
ARCH=ARM64
|
|
|
|
;;
|
|
|
|
M68K)
|
|
|
|
ARCH=M68K
|
|
|
|
;;
|
|
|
|
MIPS)
|
|
|
|
ARCH=MIPS
|
|
|
|
;;
|
|
|
|
PowerPC)
|
|
|
|
ARCH=PPC
|
|
|
|
;;
|
|
|
|
Sparc)
|
|
|
|
ARCH=SPARC
|
|
|
|
;;
|
|
|
|
SystemZ)
|
|
|
|
ARCH=SYSZ
|
|
|
|
;;
|
|
|
|
XCore)
|
|
|
|
ARCH=XCORE
|
|
|
|
;;
|
|
|
|
x86)
|
|
|
|
ARCH=X86
|
|
|
|
;;
|
|
|
|
TMS320C64x)
|
|
|
|
ARCH=TMS320C64X
|
|
|
|
;;
|
|
|
|
M680x)
|
|
|
|
ARCH=M680X
|
|
|
|
;;
|
|
|
|
EVM)
|
|
|
|
ARCH=EVM
|
|
|
|
;;
|
|
|
|
MOS65XX)
|
|
|
|
ARCH=MOS65XX
|
|
|
|
;;
|
|
|
|
WASM)
|
|
|
|
ARCH=WASM
|
|
|
|
;;
|
|
|
|
BPF)
|
|
|
|
ARCH=BPF
|
|
|
|
;;
|
|
|
|
RISCV)
|
|
|
|
ARCH=RISCV
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2022-01-26 03:28:04 +00:00
|
|
|
if [ -z "${ARCH}" ]; then
|
|
|
|
CMAKE_FLAGS="${CMAKE_FLAGS} -DCAPSTONE_ARCHITECTURE_DEFAULT=ON"
|
2019-04-29 13:17:34 +00:00
|
|
|
else
|
2022-01-26 03:28:04 +00:00
|
|
|
CMAKE_FLAGS="${CMAKE_FLAGS} -DCAPSTONE_ARCHITECTURE_DEFAULT=OFF -DCAPSTONE_${ARCH}_SUPPORT=ON"
|
2019-04-29 13:17:34 +00:00
|
|
|
fi
|
|
|
|
|
2022-01-26 03:28:04 +00:00
|
|
|
cmake ${CMAKE_FLAGS} ..
|
2019-04-29 13:17:34 +00:00
|
|
|
|
|
|
|
make -j8
|