Add support for cs5 and csnext ##build

* The next branch has changed a lot of enums and broke a lot of things
* Let's default to v5, but keep supporting next branch builds
This commit is contained in:
pancake 2023-07-22 10:41:54 +02:00 committed by pancake
parent ab8f425c04
commit 039b8e6fbe
15 changed files with 71 additions and 53 deletions

View File

@ -102,15 +102,16 @@ jobs:
with: with:
name: r2r.json name: r2r.json
path: /tmp/r2r.json path: /tmp/r2r.json
# TODO: Add job to build with capstone-next, for now v5 is stable
build-syscapstone: build-syscapstone:
name: linux-sys-capstone name: linux-sys-capstone
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Installing capstone - name: Installing capstone v5
run: | run: |
git clone --branch next --single-branch --depth=1 https://github.com/capstone-engine/capstone git clone --branch v5 --single-branch --depth=1 https://github.com/capstone-engine/capstone
cd capstone && ( git log | head ) && sh make.sh && sudo make install cd capstone && ( git log | head ) && sh make.sh && sudo make install
- name: Installing r2 with sys-capstone - name: Installing r2 with sys-capstone
run: | run: |

View File

@ -3,6 +3,7 @@ CC=@CC@
WITH_GPL=@WITH_GPL@ WITH_GPL=@WITH_GPL@
USE_CS4=@USE_CS4@ USE_CS4=@USE_CS4@
USE_CSNEXT=@USE_CSNEXT@
DESTDIR= DESTDIR=
PREFIX=@PREFIX@ PREFIX=@PREFIX@
BINDIR=@BINDIR@ BINDIR=@BINDIR@

24
configure vendored
View File

@ -30,6 +30,7 @@ WANT_GPERF=1
WANT_CAPSTONE=1 WANT_CAPSTONE=1
WITH_LIBR=0 WITH_LIBR=0
WITH_STATIC_THEMES=0 WITH_STATIC_THEMES=0
USE_CSNEXT=0
USE_CS5=0 USE_CS5=0
USE_CS4=0 USE_CS4=0
WITH_CAPSTONE=0 WITH_CAPSTONE=0
@ -187,7 +188,8 @@ System types:
--target=TARGET configure for building compilers for TARGET [HOST] --target=TARGET configure for building compilers for TARGET [HOST]
EOF2 EOF2
printf "\nOptional Features: printf "
Optional Features:
--disable-debugger disable native debugger features --disable-debugger disable native debugger features
--with-sysmagic force to use system's magic --with-sysmagic force to use system's magic
--disable-threads disable use of thread apis --disable-threads disable use of thread apis
@ -200,7 +202,8 @@ printf "\nOptional Features:
--without-capstone dont build the capstone dependency --without-capstone dont build the capstone dependency
--with-libr build libr.a and libr.dylib --with-libr build libr.a and libr.dylib
--with-static-themes default themes are compiled and fallback if not available on disk --with-static-themes default themes are compiled and fallback if not available on disk
--with-capstone5 build next branch of capstone5 (default) --with-capstone-next build next branch of the capstone disassembler
--with-capstone5 build v5 branch of capstone5 (default)
--with-capstone4 build v4 branch of capstone --with-capstone4 build v4 branch of capstone
--with-syscapstone force to use system-wide capstone --with-syscapstone force to use system-wide capstone
--with-syslz4 force to use system's liblz4 --with-syslz4 force to use system's liblz4
@ -215,16 +218,20 @@ printf "\nOptional Features:
--with-ostype Choose OS ( android windows wsl mingw32 bsd solaris gnulinux darwin haiku ) (USEROSTYPE=auto) --with-ostype Choose OS ( android windows wsl mingw32 bsd solaris gnulinux darwin haiku ) (USEROSTYPE=auto)
--with-libversion specify different libversion (LIBVERSION=xxx) --with-libversion specify different libversion (LIBVERSION=xxx)
--without-jemalloc build without jemalloc --without-jemalloc build without jemalloc
--with-checks-level value between 0 and 3 to enable different level of assert (see R_CHECKS_LEVEL) (R_CHECKS_LEVEL=2)\n" --with-checks-level value between 0 and 3 to enable different level of assert (see R_CHECKS_LEVEL) (R_CHECKS_LEVEL=2)
printf "\nSome influential environment variables: "
printf "
Some influential environment variables:
CC C compiler command CC C compiler command
CFLAGS C compiler flags CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir> nonstandard directory <lib dir>
CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
headers in a nonstandard directory <include dir> headers in a nonstandard directory <include dir>
CPP C preprocessor\n" CPP C preprocessor
printf "\nReport bugs to: pancake <pancake@nopcode.org>" "
printf "
Report bugs to: pancake <pancake@nopcode.org>"
echo "" echo ""
exit 0 exit 0
} }
@ -288,7 +295,7 @@ echo "LANGS: c"
echo "REQUIRED: libdl" echo "REQUIRED: libdl"
echo "OPTIONAL: libmagic libz libzip libxxhash libssl liblibuv>=1.0.0" echo "OPTIONAL: libmagic libz libzip libxxhash libssl liblibuv>=1.0.0"
echo "PKGCONFIG: capstone liblz4 openssl libuv" echo "PKGCONFIG: capstone liblz4 openssl libuv"
echo "FLAGS: --disable-debugger --with-sysmagic --disable-threads --disable-loadlibs --enable-threadsafety --without-dylink --without-fork --without-ptrace-wrap --without-gperf --without-capstone --with-libr --with-static-themes --with-capstone5 --with-capstone4 --with-syscapstone --with-syslz4 --with-syszip --with-sysxxhash --without-gpl --with-ssl --with-ssl-crypto --with-libuv --with-rpath --with-compiler=gcc --with-ostype=auto --with-libversion=xxx --without-jemalloc --with-checks-level=2" echo "FLAGS: --disable-debugger --with-sysmagic --disable-threads --disable-loadlibs --enable-threadsafety --without-dylink --without-fork --without-ptrace-wrap --without-gperf --without-capstone --with-libr --with-static-themes --with-capstone-next --with-capstone5 --with-capstone4 --with-syscapstone --with-syslz4 --with-syszip --with-sysxxhash --without-gpl --with-ssl --with-ssl-crypto --with-libuv --with-rpath --with-compiler=gcc --with-ostype=auto --with-libversion=xxx --without-jemalloc --with-checks-level=2"
exit 0 exit 0
;; ;;
--cache-file) --cache-file)
@ -352,6 +359,7 @@ echo "FLAGS: --disable-debugger --with-sysmagic --disable-threads --disabl
"--without-capstone") WANT_CAPSTONE="0"; ;; "--without-capstone") WANT_CAPSTONE="0"; ;;
"--with-libr") WITH_LIBR="1"; ;; "--with-libr") WITH_LIBR="1"; ;;
"--with-static-themes") WITH_STATIC_THEMES="1"; ;; "--with-static-themes") WITH_STATIC_THEMES="1"; ;;
"--with-capstone-next") USE_CSNEXT="1"; ;;
"--with-capstone5") USE_CS5="1"; ;; "--with-capstone5") USE_CS5="1"; ;;
"--with-capstone4") USE_CS4="1"; ;; "--with-capstone4") USE_CS4="1"; ;;
"--with-syscapstone") WITH_CAPSTONE="1"; ;; "--with-syscapstone") WITH_CAPSTONE="1"; ;;
@ -385,7 +393,7 @@ parse_options "$1"
shift shift
done done
ENVWORDS="MANDIR DESCRIPTION INFODIR LIBDIR INCLUDEDIR LOCALSTATEDIR ETCDIR SYSCONFDIR DATADIR DOCDIR LIBEXECDIR SBINDIR BINDIR EPREFIX PREFIX SPREFIX TARGET HOST BUILD INSTALL INSTALL_LIB INSTALL_MAN INSTALL_PROGRAM INSTALL_PROGRAM_STRIP INSTALL_DIR INSTALL_SCRIPT INSTALL_DATA HOST_OS HOST_CPU BUILD_OS BUILD_CPU TARGET_OS TARGET_CPU VERSION VERSION_MAJOR VERSION_MINOR VERSION_PATCH VERSION_NUMBER PKGCFG_LIBDIR PKGCFG_INCDIR PKGNAME VPATH CONTACT CONTACT_NAME CONTACT_MAIL CC CFLAGS CPPFLAGS LDFLAGS HAVE_LANG_C DEBUGGER HAVE_LIB_DL DL_LIBS PKGCONFIG R2_BUILDSYSTEM HAVE_PATCH PATCH HAVE_AR AR HAVE_GIT GIT HAVE_GPERF GPERF HAVE_LIB_MAGIC HAVE_LINUX_CAN_H USE_MAGIC USE_LIB_MAGIC LIBMAGIC WANT_THREADS LOADLIBS R_CRITICAL_ENABLED WANT_DYLINK HAVE_FORK WANT_PTRACE_WRAP WANT_GPERF WANT_CAPSTONE WITH_LIBR WITH_STATIC_THEMES USE_CS5 USE_CS4 WITH_CAPSTONE CAPSTONE_CFLAGS CAPSTONE_LDFLAGS HAVE_PKGCFG_CAPSTONE USE_CAPSTONE LZ4_CFLAGS LZ4_LDFLAGS HAVE_PKGCFG_LIBLZ4 WITH_SYSLZ4 USE_SYSLZ4 HAVE_LIB_Z HAVE_LIB_ZIP USE_ZIP USE_LIB_ZIP LIBZIP HAVE_LIB_XXHASH USE_XXHASH USE_LIB_XXHASH LIBXXHASH WITH_GPL HAVE_DECL_ADDR_NO_RANDOMIZE HAVE_DECL___GLIBC__ HAVE_ARC4RANDOM_UNIFORM HAVE_EXPLICIT_BZERO HAVE_EXPLICIT_MEMSET HAVE_CLOCK_NANOSLEEP HAVE_SIGACTION HAVE_CLOCK_GETTIME CLOCK_LDFLAGS SUPPORT_GNU99 HAVE_LIB_GMP HAVE_LIB_SSL SSL_CFLAGS SSL_LDFLAGS HAVE_PKGCFG_OPENSSL HAVE_OPENSSL WANT_SSL WANT_SSL_CRYPTO WANT_LIBUV HAVE_LIBUV_VERSION_1_0_0 LIBUV_CFLAGS LIBUV_LDFLAGS HAVE_PKGCFG_LIBUV HAVE_LIBUV USE_RPATH USERCC USEROSTYPE LIBVERSION HAVE_JEMALLOC HAVE_PTRACE USE_PTRACE_WRAP R_CHECKS_LEVEL" ENVWORDS="MANDIR DESCRIPTION INFODIR LIBDIR INCLUDEDIR LOCALSTATEDIR ETCDIR SYSCONFDIR DATADIR DOCDIR LIBEXECDIR SBINDIR BINDIR EPREFIX PREFIX SPREFIX TARGET HOST BUILD INSTALL INSTALL_LIB INSTALL_MAN INSTALL_PROGRAM INSTALL_PROGRAM_STRIP INSTALL_DIR INSTALL_SCRIPT INSTALL_DATA HOST_OS HOST_CPU BUILD_OS BUILD_CPU TARGET_OS TARGET_CPU VERSION VERSION_MAJOR VERSION_MINOR VERSION_PATCH VERSION_NUMBER PKGCFG_LIBDIR PKGCFG_INCDIR PKGNAME VPATH CONTACT CONTACT_NAME CONTACT_MAIL CC CFLAGS CPPFLAGS LDFLAGS HAVE_LANG_C DEBUGGER HAVE_LIB_DL DL_LIBS PKGCONFIG R2_BUILDSYSTEM HAVE_PATCH PATCH HAVE_AR AR HAVE_GIT GIT HAVE_GPERF GPERF HAVE_LIB_MAGIC HAVE_LINUX_CAN_H USE_MAGIC USE_LIB_MAGIC LIBMAGIC WANT_THREADS LOADLIBS R_CRITICAL_ENABLED WANT_DYLINK HAVE_FORK WANT_PTRACE_WRAP WANT_GPERF WANT_CAPSTONE WITH_LIBR WITH_STATIC_THEMES USE_CSNEXT USE_CS5 USE_CS4 WITH_CAPSTONE CAPSTONE_CFLAGS CAPSTONE_LDFLAGS HAVE_PKGCFG_CAPSTONE USE_CAPSTONE LZ4_CFLAGS LZ4_LDFLAGS HAVE_PKGCFG_LIBLZ4 WITH_SYSLZ4 USE_SYSLZ4 HAVE_LIB_Z HAVE_LIB_ZIP USE_ZIP USE_LIB_ZIP LIBZIP HAVE_LIB_XXHASH USE_XXHASH USE_LIB_XXHASH LIBXXHASH WITH_GPL HAVE_DECL_ADDR_NO_RANDOMIZE HAVE_DECL___GLIBC__ HAVE_ARC4RANDOM_UNIFORM HAVE_EXPLICIT_BZERO HAVE_EXPLICIT_MEMSET HAVE_CLOCK_NANOSLEEP HAVE_SIGACTION HAVE_CLOCK_GETTIME CLOCK_LDFLAGS SUPPORT_GNU99 HAVE_LIB_GMP HAVE_LIB_SSL SSL_CFLAGS SSL_LDFLAGS HAVE_PKGCFG_OPENSSL HAVE_OPENSSL WANT_SSL WANT_SSL_CRYPTO WANT_LIBUV HAVE_LIBUV_VERSION_1_0_0 LIBUV_CFLAGS LIBUV_LDFLAGS HAVE_PKGCFG_LIBUV HAVE_LIBUV USE_RPATH USERCC USEROSTYPE LIBVERSION HAVE_JEMALLOC HAVE_PTRACE USE_PTRACE_WRAP R_CHECKS_LEVEL"
create_environ create_environ

View File

@ -50,7 +50,9 @@ ARG_WITH WITH_LIBR libr build libr.a and libr.dylib ;
ARG_WITH WITH_STATIC_THEMES static-themes default themes are compiled and fallback if not available on disk ; ARG_WITH WITH_STATIC_THEMES static-themes default themes are compiled and fallback if not available on disk ;
(( CAPSTONE )) (( CAPSTONE ))
ARG_WITH USE_CS5 capstone5 build next branch of capstone5 (default) ; ARG_WITH USE_CSNEXT capstone-next build next branch of the capstone disassembler ;
(( TODO rename to capstone-v5 and capstone-v4 ))
ARG_WITH USE_CS5 capstone5 build v5 branch of capstone5 (default) ;
ARG_WITH USE_CS4 capstone4 build v4 branch of capstone ; ARG_WITH USE_CS4 capstone4 build v4 branch of capstone ;
ARG_WITH WITH_CAPSTONE syscapstone force to use system-wide capstone ; ARG_WITH WITH_CAPSTONE syscapstone force to use system-wide capstone ;

View File

@ -11,11 +11,10 @@ static bool r_core_hack_riscv(RCore *core, const char *op, const RAnalOp *analop
if (!strcmp (op, "nop")) { if (!strcmp (op, "nop")) {
// TODO honor analop->size // TODO honor analop->size
r_core_cmdf (core, "wx 13000000"); r_core_cmdf (core, "wx 13000000");
} else { return true;
R_LOG_ERROR ("Unsupported operation '%s'", op);
return false;
} }
return true; R_LOG_ERROR ("Unsupported operation '%s'", op);
return false;
} }
static bool r_core_hack_dalvik(RCore *core, const char *op, const RAnalOp *analop) { static bool r_core_hack_dalvik(RCore *core, const char *op, const RAnalOp *analop) {

View File

@ -21,8 +21,10 @@ extern "C" {
#define HAVE_LINUX_CAN_H @HAVE_LINUX_CAN_H@ #define HAVE_LINUX_CAN_H @HAVE_LINUX_CAN_H@
#define R_BUILDSYSTEM "@R2_BUILDSYSTEM@" #define R_BUILDSYSTEM "@R2_BUILDSYSTEM@"
#if @USE_CS4@ > 0 #if @USE_CS4@ == 1
#define R2_CSVERSION 4 #define R2_CSVERSION 4
#elif @USE_CSNEXT@ == 1
#define R2_CSVERSION 6
#else #else
#define R2_CSVERSION 5 #define R2_CSVERSION 5
#endif #endif

View File

@ -378,6 +378,7 @@ userconf.set('BINDINGS', r2_bindings)
userconf.set('R2_BUILDSYSTEM', 'meson') userconf.set('R2_BUILDSYSTEM', 'meson')
capstone_version = get_option('use_capstone_version') capstone_version = get_option('use_capstone_version')
userconf.set10('USE_CS4', capstone_version == 'v4') userconf.set10('USE_CS4', capstone_version == 'v4')
userconf.set10('USE_CSNEXT', capstone_version == 'v6')
userconf.set10('HAVE_OPENSSL', use_sys_openssl) userconf.set10('HAVE_OPENSSL', use_sys_openssl)
userconf.set10('WANT_SSL_CRYPTO', use_ssl_crypto) userconf.set10('WANT_SSL_CRYPTO', use_ssl_crypto)
userconf.set10('HAVE_LIBUV', use_libuv) userconf.set10('HAVE_LIBUV', use_libuv)

View File

@ -28,7 +28,7 @@ option('capstone_in_builddir', type: 'boolean', value: false, description: 'When
option('want_threads', type: 'boolean', value: true) option('want_threads', type: 'boolean', value: true)
option('want_capstone', type: 'boolean', value: true) option('want_capstone', type: 'boolean', value: true)
option('use_sys_capstone', type: 'boolean', value: false) option('use_sys_capstone', type: 'boolean', value: false)
option('use_capstone_version', type: 'combo', choices: ['v3', 'v4', 'v5'], value: 'v5') option('use_capstone_version', type: 'combo', choices: ['v3', 'v4', 'v5', 'next'], value: 'v5')
option('use_sys_magic', type: 'boolean', value: false) option('use_sys_magic', type: 'boolean', value: false)
option('use_sys_zip', type: 'boolean', value: false) option('use_sys_zip', type: 'boolean', value: false)
option('use_sys_zlib', type: 'boolean', value: false) option('use_sys_zlib', type: 'boolean', value: false)

View File

@ -48,12 +48,17 @@ CS_URL=$(GIT_PREFIX)$(CS_URL_BASE).git
CS_ARCHIVE=https://$(CS_URL_BASE)/archive CS_ARCHIVE=https://$(CS_URL_BASE)/archive
CS_UPD=20201203 CS_UPD=20201203
# NOTE: when you update CS_TIP or CS_BRA, also update them in shlr/meson.build # NOTE: when you update CS_TIP or CS_BRA, also update them in shlr/meson.build
ifeq ($(USE_CSNEXT),1)
CS_TIP=a4df92eda647e739432860682be638da1b8b901a
CS_BRA=next
else
ifeq ($(USE_CS4),1) ifeq ($(USE_CS4),1)
CS_TIP=1d230532840a37ac032c6ab80128238fc930c6c1 CS_TIP=0efa3cc530ea188c0e03c945ab884ee19dd16342
CS_BRA=v4 CS_BRA=v4
else else
CS_TIP=8ae8f68ea3abb7a68071908bad02baa39742870c CS_TIP=e1af2e249ab85c70594a8c975f27d072278257fb
CS_BRA=next CS_BRA=v5
endif
endif endif
ifeq ($(CS_COMMIT_ARCHIVE),1) ifeq ($(CS_COMMIT_ARCHIVE),1)
CS_ARCHIVE_URL=$(CS_ARCHIVE)/$(CS_TIP).zip CS_ARCHIVE_URL=$(CS_ARCHIVE)/$(CS_TIP).zip

View File

@ -1,28 +1,28 @@
diff --git a/arch/X86/X86ATTInstPrinter.c b/arch/X86/X86ATTInstPrinter.c diff --git a/arch/X86/X86ATTInstPrinter.c b/arch/X86/X86ATTInstPrinter.c
index 216efb25..37cab473 100644 index 216efb2..37cab47 100644
--- a/arch/X86/X86ATTInstPrinter.c --- a/arch/X86/X86ATTInstPrinter.c
+++ b/arch/X86/X86ATTInstPrinter.c +++ b/arch/X86/X86ATTInstPrinter.c
@@ -536,6 +536,9 @@ static void printPCRelImm(MCInst *MI, unsigned OpNo, SStream *O) @@ -536,6 +536,9 @@ static void printPCRelImm(MCInst *MI, unsigned OpNo, SStream *O)
imm = imm & 0xffffffff; imm = imm & 0xffffffff;
} }
+ if (MI->csh->mode == CS_MODE_16) + if (MI->csh->mode == CS_MODE_16)
+ imm = (imm & 0xf0000) + (imm&0xffff); + imm |= (MI->address >> 16) << 16;
+ +
if (imm < 0) { if (imm < 0) {
SStream_concat(O, "0x%"PRIx64, imm); SStream_concat(O, "0x%"PRIx64, imm);
} else { } else {
diff --git a/arch/X86/X86IntelInstPrinter.c b/arch/X86/X86IntelInstPrinter.c diff --git a/arch/X86/X86IntelInstPrinter.c b/arch/X86/X86IntelInstPrinter.c
index 5361172d..45625ab1 100644 index 6167e85..cff9237 100644
--- a/arch/X86/X86IntelInstPrinter.c --- a/arch/X86/X86IntelInstPrinter.c
+++ b/arch/X86/X86IntelInstPrinter.c +++ b/arch/X86/X86IntelInstPrinter.c
@@ -767,6 +767,9 @@ static void printPCRelImm(MCInst *MI, unsigned OpNo, SStream *O) @@ -767,6 +767,9 @@ static void printPCRelImm(MCInst *MI, unsigned OpNo, SStream *O)
imm = imm & 0xffffffff; imm = imm & 0xffffffff;
} }
+ if (MI->csh->mode == CS_MODE_16) + if (MI->csh->mode == CS_MODE_16)
+ imm = (imm & 0xf0000) + (imm&0xffff); + imm |= (MI->address >> 16) << 16;
+ +
printImm(MI, O, imm, true); printImm(MI, O, imm, true);
if (MI->csh->detail) { if (MI->csh->detail) {

View File

@ -1,12 +0,0 @@
diff --git a/functions.mk b/functions.mk
index d734ce5d..d946cd34 100644
--- a/functions.mk
+++ b/functions.mk
@@ -2,7 +2,6 @@
# Common functions used by Makefile & tests/Makefile
define compile
- @$(CC) -MM -MP -MT $@ -MT $(@:.o=.d) $(CFLAGS) $< > $(@:.o=.d)
${CC} ${CFLAGS} -c $< -o $@
endef

View File

@ -26,14 +26,16 @@ fatal_msg() {
patch_capstone() { patch_capstone() {
echo "[capstone] Applying patches..." echo "[capstone] Applying patches..."
if [ "$CS_BRA" = next ]; then if [ "$CS_BRA" = next ]; then
CV=v5 CV=v6
else else
CV=v4 CV=v5
fi
if [ -n "`ls ../capstone-patches/$CV/ 2> /dev/null`" ]; then
for patchfile in ../capstone-patches/$CV/*.patch ; do
echo "Patch $patchFile"
patch -p 1 < "${patchfile}"
done
fi fi
for patchfile in ../capstone-patches/$CV/*.patch ; do
echo "Patch $patchFile"
patch -p 1 < "${patchfile}"
done
} }
parse_capstone_tip() { parse_capstone_tip() {

View File

@ -18,21 +18,20 @@ if not capstone_dep.found() or not get_option('use_sys_capstone')
patches_files = [] patches_files = []
# NOTE: when you update CS_TIP or CS_BRA, also update them in shlr/Makefile # NOTE: when you update CS_TIP or CS_BRA, also update them in shlr/Makefile
if capstone_version == 'v5' if capstone_version == 'next'
CS_TIP = '8ae8f68ea3abb7a68071908bad02baa39742870c' CS_TIP = 'a4df92eda647e739432860682be638da1b8b901a'
CS_BRA = 'next' CS_BRA = 'next'
patches_files = [ patches_files = [
'fix-x86-16.patch', 'fix-x86-16.patch',
'mmm.patch'
] ]
elif capstone_version == 'v3' elif capstone_version == 'v5'
CS_TIP = '61bf71c771680033651f16cff832446e421847b1' CS_TIP = 'e1af2e249ab85c70594a8c975f27d072278257fb'
CS_BRA = 'v3' CS_BRA = 'v5'
patches_files = [ patches_files = [
'capstone-include.patch' 'fix-x86-16.patch'
] ]
elif capstone_version == 'v4' elif capstone_version == 'v4'
CS_TIP = '1d230532840a37ac032c6ab80128238fc930c6c1' CS_TIP = '0efa3cc530ea188c0e03c945ab884ee19dd16342'
CS_BRA = 'v4' CS_BRA = 'v4'
patches_files = [ patches_files = [
'capstone-calloc.patch', 'capstone-calloc.patch',
@ -40,6 +39,12 @@ if not capstone_dep.found() or not get_option('use_sys_capstone')
'sparc-crash.patch', 'sparc-crash.patch',
'sstream-null.patch' 'sstream-null.patch'
] ]
elif capstone_version == 'v3'
CS_TIP = '61bf71c771680033651f16cff832446e421847b1'
CS_BRA = 'v3'
patches_files = [
'capstone-include.patch'
]
else else
error('Wrong capstone version selected. Please use one of the supported versions.') error('Wrong capstone version selected. Please use one of the supported versions.')
endif endif

View File

@ -53,6 +53,9 @@ ABSPREFIX=`realpath ${PREFIX} 2> /dev/null`
if [ "${USE_CS4}" = 1 ]; then if [ "${USE_CS4}" = 1 ]; then
CFGARG="${CFGARG} --with-capstone4" CFGARG="${CFGARG} --with-capstone4"
fi fi
if [ "${USE_CSNEXT}" = 1 ]; then
CFGARG="${CFGARG} --with-capstone-next"
fi
if [ "${OSNAME}" = Linux -a -n "${PREFIX}" -a "${PREFIX}" != /usr ]; then if [ "${OSNAME}" = Linux -a -n "${PREFIX}" -a "${PREFIX}" != /usr ]; then
CFGARG="${CFGARG} --with-rpath" CFGARG="${CFGARG} --with-rpath"

View File

@ -27,6 +27,7 @@ if [ $? = 0 ]; then
fi fi
export USE_CS4=0 export USE_CS4=0
export USE_CSNEXT=0
# if owner of sys/install.sh != uid && uid == 0 { exec sudo -u id -A $SUDO_UID sys/install.sh $* } # if owner of sys/install.sh != uid && uid == 0 { exec sudo -u id -A $SUDO_UID sys/install.sh $* }
ARGS="" ARGS=""
while : ; do while : ; do