From e0616e674285bd7f0db787a8952c1be0e0a31e8f Mon Sep 17 00:00:00 2001 From: radare Date: Mon, 28 May 2018 17:14:49 +0200 Subject: [PATCH 4/4] Add --with-libr and deprecate --with-{nonpic,pic,merged} (#10212) --- binr/blob/Makefile | 48 ++++---------------------------------------- binr/rabin2/Makefile | 2 -- binr/rules.mk | 46 ++++++++++++++++++------------------------ config-user.mk.acr | 4 +--- configure | 16 +++++---------- configure.acr | 4 +--- libr/Makefile | 10 +++++---- libr/bin/p/java.mk | 4 ---- libr/parse/Makefile | 8 -------- libr/rules.mk | 17 +++------------- sys/android-build.sh | 6 +----- sys/build-harden.sh | 2 +- sys/emscripten.sh | 2 +- sys/ios-sdk.sh | 15 ++++++-------- sys/ios-simulator.sh | 5 ++--- sys/ios-static.sh | 7 +++---- sys/sdk.sh | 2 +- sys/static.sh | 2 +- sys/wasm.sh | 2 +- 19 files changed, 57 insertions(+), 145 deletions(-) diff --git a/binr/blob/Makefile b/binr/blob/Makefile index c17fbf493..04e8cf57e 100644 --- a/binr/blob/Makefile +++ b/binr/blob/Makefile @@ -3,15 +3,14 @@ DESTDIR?=/ BINS=rabin2 rarun2 rasm2 ragg2 rahash2 rax2 rafind2 radiff2 BINS2=radare2 ${BINS} + +SOURCES= main.c rabin2.c radare2.c radiff2.c rafind2.c +SOURCES+=rahash2.c rarun2.c rasm2.c rax2.c ragg2.c + include ../../config-user.mk -ifneq ($(OSTYPE),windows) -CFLAGS+=-pie -fPIC -fPIE -LDFLAGS+=-pie -endif SHLR=../../shlr - ifneq (${ANDROID},1) ifneq (${OSTYPE},linux) LDFLAGS+=-lpthread @@ -22,41 +21,6 @@ endif CFLAGS+=-I../../libr/include/ CFLAGS+=-I$(SHLR)/spp -#ifeq ($(STATIC_BUILD),1) -ifeq ($(WITHNONPIC),1) -LDFLAGS+=../../libr/config/libr_config.a -LDFLAGS+=../../libr/io/libr_io.a -LDFLAGS+=../../libr/asm/libr_asm.a -LDFLAGS+=../../libr/egg/libr_egg.a -LDFLAGS+=../../libr/core/libr_core.a -LDFLAGS+=../../libr/crypto/libr_crypto.a -LDFLAGS+=../../libr/parse/libr_parse.a -LDFLAGS+=../../libr/anal/libr_anal.a -LDFLAGS+=../../libr/fs/libr_fs.a -LDFLAGS+=../../libr/magic/libr_magic.a -LDFLAGS+=../../libr/cons/libr_cons.a -LDFLAGS+=../../libr/syscall/libr_syscall.a -LDFLAGS+=../../libr/flag/libr_flag.a -LDFLAGS+=../../libr/reg/libr_reg.a -LDFLAGS+=../../libr/debug/libr_debug.a -LDFLAGS+=../../libr/search/libr_search.a -LDFLAGS+=../../libr/lang/libr_lang.a -LDFLAGS+=../../libr/bp/libr_bp.a -LDFLAGS+=../../libr/hash/libr_hash.a -LDFLAGS+=../../libr/bin/libr_bin.a -LDFLAGS+=../../libr/util/libr_util.a -# extra libs # -ifeq (1,$(WITH_GPL)) -LDFLAGS+=../../shlr/grub/libgrubfs.a -endif -LDFLAGS+=../../shlr/capstone/libcapstone.a -LDFLAGS+=../../shlr/sdb/src/libsdb.a -LDFLAGS+=../../shlr/gdb/lib/libgdbr.a -LDFLAGS+=../../shlr/windbg/libr_windbg.a -LDFLAGS+=../../shlr/java/libr_java.a -LDFLAGS+=-lm -LDFLAGS+=../../libr/socket/libr_socket.a -else LDFLAGS+=-L../../libr/io -lr_io LDFLAGS+=-L../../libr/bp -lr_bp LDFLAGS+=-L../../libr/socket -lr_socket @@ -78,7 +42,6 @@ LDFLAGS+=-L../../libr/hash -lr_hash LDFLAGS+=-L../../libr/debug -lr_debug LDFLAGS+=-L../../libr/search -lr_search LDFLAGS+=-L../../libr/config -lr_config -endif LDFLAGS+=${LINK} include ../../libr/config.mk @@ -102,9 +65,6 @@ clean: mv version.k version.c rm -f ${BINS2} r2 -SOURCES= main.c rabin2.c radare2.c radiff2.c rafind2.c -SOURCES+=rahash2.c rarun2.c rasm2.c rax2.c ragg2.c - build: mv main.c main.k mv version.c version.k diff --git a/binr/rabin2/Makefile b/binr/rabin2/Makefile index 71ea0565c..779d2a906 100644 --- a/binr/rabin2/Makefile +++ b/binr/rabin2/Makefile @@ -6,7 +6,6 @@ BINDEPS+=r_search r_syscall r_socket r_fs r_magic r_crypto r_util include ../rules.mk -ifeq ($(WITHNONPIC),1) include ../../libr/socket/deps.mk include ../../shlr/zip/deps.mk include ../../shlr/gdb/deps.mk @@ -14,4 +13,3 @@ include ../../shlr/java/deps.mk include ../../shlr/bochs/deps.mk include ../../shlr/qnx/deps.mk include ../../shlr/ar/deps.mk -endif diff --git a/binr/rules.mk b/binr/rules.mk index 9fad60f49..30590fedc 100644 --- a/binr/rules.mk +++ b/binr/rules.mk @@ -2,12 +2,9 @@ BINR_PROGRAM=1 include ../../libr/config.mk include ../../shlr/zip/deps.mk -ifneq ($(OSTYPE),windows) -# tcc doesn't recognize the -pie option ifeq (,$(findstring tcc,${CC})) CFLAGS+=-pie endif -endif CFLAGS+=-I$(LTOP)/include ifeq (${COMPILER},emscripten) @@ -21,25 +18,26 @@ endif OBJ+=${BIN}.o BEXE=${BIN}${EXT_EXE} -ifeq ($(WITHNONPIC),1) -## LDFLAGS+=$(addsuffix /lib${BINDEPS}.a,$(addprefix ../../libr/,$(subst r_,,$(BINDEPS)))) -LDFLAGS+=$(shell for a in ${BINDEPS} ; do b=`echo $$a |sed -e s,r_,,g`; echo ../../libr/$$b/lib$$a.${EXT_AR} ; done ) -LDFLAGS+=../../shlr/sdb/src/libsdb.a -ifeq (1,$(WITH_GPL)) -LDFLAGS+=../../shlr/grub/libgrubfs.a -endif -LDFLAGS+=../../shlr/gdb/lib/libgdbr.a -LDFLAGS+=../../shlr/windbg/libr_windbg.a -LDFLAGS+=../../shlr/capstone/libcapstone.a -LDFLAGS+=../../shlr/java/libr_java.a -LDFLAGS+=../../libr/socket/libr_socket.a -LDFLAGS+=../../libr/util/libr_util.a -ifneq (${OSTYPE},haiku) -ifneq ($(CC),cccl) -LDFLAGS+=-lm -endif -endif -endif +# ifeq ($(WITHNONPIC),1) +# ## LDFLAGS+=$(addsuffix /lib${BINDEPS}.a,$(addprefix ../../libr/,$(subst r_,,$(BINDEPS)))) +# LDFLAGS+=$(shell for a in ${BINDEPS} ; do b=`echo $$a |sed -e s,r_,,g`; echo ../../libr/$$b/lib$$a.${EXT_AR} ; done ) +# LDFLAGS+=../../shlr/sdb/src/libsdb.a +# ifeq (1,$(WITH_GPL)) +# LDFLAGS+=../../shlr/grub/libgrubfs.a +# endif +# LDFLAGS+=../../shlr/gdb/lib/libgdbr.a +# LDFLAGS+=../../shlr/windbg/libr_windbg.a +# LDFLAGS+=../../shlr/capstone/libcapstone.a +# LDFLAGS+=../../shlr/java/libr_java.a +# LDFLAGS+=../../libr/socket/libr_socket.a +# LDFLAGS+=../../libr/util/libr_util.a +# ifneq (${OSTYPE},haiku) +# ifneq ($(CC),cccl) +# LDFLAGS+=-lm +# endif +# endif +# endif + LDFLAGS+=${DL_LIBS} LDFLAGS+=${LINK} ifneq (${ANDROID},1) @@ -76,15 +74,11 @@ endif # -static fails because -ldl -lpthread static-gcc ... ${BEXE}: ${OBJ} ${SHARED_OBJ} -ifeq ($(WITHNONPIC),1) - ${CC} -pie ${CFLAGS} $+ -L.. -o $@ $(REAL_LDFLAGS) -else ifneq ($(SILENT),) @echo LD $@ endif ${CC} ${CFLAGS} $+ -L.. -o $@ $(REAL_LDFLAGS) endif -endif # Dummy myclean rule that can be overriden by the t/ Makefile # TODO: move to config.mk ? it must be a precondition diff --git a/config-user.mk.acr b/config-user.mk.acr index 09965004f..fc0b5305d 100644 --- a/config-user.mk.acr +++ b/config-user.mk.acr @@ -16,7 +16,7 @@ HAVE_LIB_GMP=@HAVE_LIB_GMP@ USE_RPATH=@USE_RPATH@ HAVE_JEMALLOC=@HAVE_JEMALLOC@ HAVE_FORK=@HAVE_FORK@ -BUILD_MERGED=@BUILD_MERGED@ +WITH_LIBR=@WITH_LIBR@ MKPLUGINS=mk/stat.mk mk/sloc.mk @@ -46,8 +46,6 @@ endif ifeq ($(OSTYPE),qnx) DL_LIBS= endif -WITHPIC=@WITHPIC@ -WITHNONPIC=@WITHNONPIC@ # capstone USE_CAPSTONE=@USE_CAPSTONE@ diff --git a/configure b/configure index 79810181f..3b9760d9c 100755 --- a/configure +++ b/configure @@ -22,7 +22,7 @@ DEBUGGER=1 USE_MAGIC=0 LOADLIBS=1 HAVE_FORK=1 -BUILD_MERGED=0 +WITH_LIBR=0 WITH_CAPSTONE=0 USE_ZIP=0 WITH_GPL=1 @@ -30,8 +30,6 @@ WANT_OPENSSL=0 USE_RPATH=0 [ -z "${USERCC}" ] && USERCC="gcc" [ -z "${USEROSTYPE}" ] && USEROSTYPE="auto" -WITHPIC=1 -WITHNONPIC=0 [ -z "${LIBVERSION}" ] && LIBVERSION="xxx" HAVE_JEMALLOC=1 split_host() { @@ -169,7 +167,7 @@ Optional Features: --with-sysmagic force to use system's magic --disable-loadlibs disable loading plugins --without-fork disable fork - --enable-merged build merged r library + --with-libr build libr.a and libr.dylib --with-syscapstone force to use system-wide capstone --with-syszip force to use system's libzip and zlib --without-gpl do not build GPL code (grub, cxx, ... ) @@ -177,8 +175,6 @@ Optional Features: --with-rpath use rpath to build --with-compiler Define compiler to use (see mk/) (USERCC=gcc) --with-ostype Choose OS type ( gnulinux windows darwin haiku ) (USEROSTYPE=auto) - --without-pic do not build libr as a program independent location - --with-nonpic build the library archives .a --with-libversion specify different libversion (LIBVERSION=xxx) --without-jemalloc build without jemalloc " @@ -236,7 +232,7 @@ echo "LANGS: c" echo "REQUIRED: libdl" echo "OPTIONAL: libmagic libz libzip libssl" echo "PKG-CONFIG: capstone openssl" -echo "FLAGS: --disable-debugger --with-sysmagic --disable-loadlibs --without-fork --enable-merged --with-syscapstone --with-syszip --without-gpl --with-openssl --with-rpath --with-compiler=gcc --with-ostype=auto --without-pic --with-nonpic --with-libversion=xxx --without-jemalloc" +echo "FLAGS: --disable-debugger --with-sysmagic --disable-loadlibs --without-fork --with-libr --with-syscapstone --with-syszip --without-gpl --with-openssl --with-rpath --with-compiler=gcc --with-ostype=auto --with-libversion=xxx --without-jemalloc" exit 0 ;; --cache-file) @@ -286,7 +282,7 @@ echo "FLAGS: --disable-debugger --with-sysmagic --disable-loadlibs --without "--with-sysmagic") USE_MAGIC="1"; ;; "--disable-loadlibs") LOADLIBS="0"; ;; "--without-fork") HAVE_FORK="0"; ;; -"--enable-merged") BUILD_MERGED="1"; ;; +"--with-libr") WITH_LIBR="1"; ;; "--with-syscapstone") WITH_CAPSTONE="1"; ;; "--with-syszip") USE_ZIP="1"; ;; "--without-gpl") WITH_GPL="0"; ;; @@ -294,8 +290,6 @@ echo "FLAGS: --disable-debugger --with-sysmagic --disable-loadlibs --without "--with-rpath") USE_RPATH="1"; ;; --with-compiler) if [ -z "${value}" ]; then USERCC="gcc"; else USERCC="${value}" ; fi ;; --with-ostype) if [ -z "${value}" ]; then USEROSTYPE="auto"; else USEROSTYPE="${value}" ; fi ;; -"--without-pic") WITHPIC="0"; ;; -"--with-nonpic") WITHNONPIC="1"; ;; --with-libversion) if [ -z "${value}" ]; then LIBVERSION="xxx"; else LIBVERSION="${value}" ; fi ;; "--without-jemalloc") HAVE_JEMALLOC="0"; ;; *) if [ "$value" ]; then eval "`echo $flag2=$value`" ; @@ -315,7 +309,7 @@ parse_options "$1" shift done -ENVWORDS="MANDIR INFODIR LIBDIR INCLUDEDIR LOCALSTATEDIR 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 PKGNAME VPATH VERSION CONTACT CONTACT_NAME CONTACT_MAIL CC CFLAGS CPPFLAGS LDFLAGS HAVE_LANG_C DEBUGGER HAVE_LIB_DL DL_LIBS HAVE_PATCH PATCH HAVE_GIT GIT HAVE_LIB_MAGIC USE_MAGIC USE_LIB_MAGIC LIBMAGIC LOADLIBS HAVE_FORK BUILD_MERGED WITH_CAPSTONE CAPSTONE_CFLAGS CAPSTONE_LDFLAGS HAVE_PKGCFG_CAPSTONE USE_CAPSTONE HAVE_LIB_Z HAVE_LIB_ZIP USE_ZIP USE_LIB_ZIP LIBZIP WITH_GPL HAVE_DECL_ADDR_NO_RANDOMIZE HAVE_LIB_GMP HAVE_LIB_SSL SSL_CFLAGS SSL_LDFLAGS HAVE_PKGCFG_OPENSSL HAVE_OPENSSL WANT_OPENSSL USE_RPATH USERCC USEROSTYPE WITHPIC WITHNONPIC LIBVERSION HAVE_JEMALLOC" +ENVWORDS="MANDIR INFODIR LIBDIR INCLUDEDIR LOCALSTATEDIR 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 PKGNAME VPATH VERSION CONTACT CONTACT_NAME CONTACT_MAIL CC CFLAGS CPPFLAGS LDFLAGS HAVE_LANG_C DEBUGGER HAVE_LIB_DL DL_LIBS HAVE_PATCH PATCH HAVE_GIT GIT HAVE_LIB_MAGIC USE_MAGIC USE_LIB_MAGIC LIBMAGIC LOADLIBS HAVE_FORK WITH_LIBR WITH_CAPSTONE CAPSTONE_CFLAGS CAPSTONE_LDFLAGS HAVE_PKGCFG_CAPSTONE USE_CAPSTONE HAVE_LIB_Z HAVE_LIB_ZIP USE_ZIP USE_LIB_ZIP LIBZIP WITH_GPL HAVE_DECL_ADDR_NO_RANDOMIZE HAVE_LIB_GMP HAVE_LIB_SSL SSL_CFLAGS SSL_LDFLAGS HAVE_PKGCFG_OPENSSL HAVE_OPENSSL WANT_OPENSSL USE_RPATH USERCC USEROSTYPE LIBVERSION HAVE_JEMALLOC" create_environ diff --git a/configure.acr b/configure.acr index 7e1f365f8..8ad8645db 100644 --- a/configure.acr +++ b/configure.acr @@ -26,7 +26,7 @@ ARG_DISABLE LOADLIBS loadlibs disable loading plugins ; ARG_WITHOUT HAVE_FORK fork disable fork ; -ARG_ENABLE BUILD_MERGED merged build merged r library ; +ARG_WITH WITH_LIBR libr build libr.a and libr.dylib ; ARG_WITH WITH_CAPSTONE syscapstone force to use system-wide capstone ; PKGCFG CAPSTONE_CFLAGS CAPSTONE_LDFLAGS capstone @@ -128,8 +128,6 @@ IFEQ USEROSTYPE auto ; { } } } } } } } } } } } -ARG_WITHOUT WITHPIC pic do not build libr as a program independent location ; -ARG_WITH WITHNONPIC nonpic build the library archives .a ; (( this hack is required for openbsd ports )) ARG_WITH LIBVERSION=xxx libversion specify different libversion ; ARG_WITHOUT HAVE_JEMALLOC jemalloc build without jemalloc ; diff --git a/libr/Makefile b/libr/Makefile index 7e75a3a1e..706c0800b 100644 --- a/libr/Makefile +++ b/libr/Makefile @@ -34,10 +34,12 @@ all: $(MAKE) $(LIBS5) $(MAKE) $(LIBS6) $(MAKE) $(LIBS7) +ifeq ($(WITH_LIBR),1) $(MAKE) libr.${EXT_AR} $(MAKE) libr.${EXT_SO} +endif -ifeq ($(BUILD_MERGED),1) +ifeq ($(WITH_LIBR),1) ifeq ($(OSTYPE),darwin) MLFLAGS+=-install_name @rpath/libr2.dylib @@ -99,13 +101,13 @@ libr.${EXT_SO}: .libr else -# BUILD_MERGED=0 +# WITH_LIBR=0 libr.${EXT_SO}: - $(MAKE) libr.${EXT_SO} BUILD_MERGED=1 + $(MAKE) libr.${EXT_SO} WITH_LIBR=1 libr.${EXT_AR}: - $(MAKE) libr.${EXT_AR} BUILD_MERGED=1 + $(MAKE) libr.${EXT_AR} WITH_LIBR=1 endif ../shlr/libr_shlr.${EXT_AR}: diff --git a/libr/bin/p/java.mk b/libr/bin/p/java.mk index dad5a0e41..e5ebb1db9 100644 --- a/libr/bin/p/java.mk +++ b/libr/bin/p/java.mk @@ -3,14 +3,11 @@ OBJ_JAVA=bin_java.o SHARED2_JAVA=$(addprefix ../,${SHARED_JAVA}) STATIC_OBJ+=${OBJ_JAVA} -ifeq ($(WITHNONPIC),1) STATIC_OBJ+=${SHARED2_JAVA} -endif SHARED_OBJ+=${SHARED_JAVA} TARGET_JAVA=bin_java.${EXT_SO} -ifeq ($(WITHPIC),1) ALL_TARGETS+=${TARGET_JAVA} ${TARGET_JAVA}: ${OBJ_JAVA} @@ -18,4 +15,3 @@ ${TARGET_JAVA}: ${OBJ_JAVA} $(LINK) $(LDFLAGS) ${SHARED2_JAVA} \ ${SHLR}/java/libr_java.${EXT_AR} \ ${SHLR}/sdb/src/libsdb.${EXT_AR} -endif diff --git a/libr/parse/Makefile b/libr/parse/Makefile index b613eb86c..a62a1b828 100644 --- a/libr/parse/Makefile +++ b/libr/parse/Makefile @@ -23,14 +23,6 @@ OBJS=parse.o code.o ${STATIC_OBJS} bins: # @cd t && ${MAKE} all -pre: -ifeq ($(WITHNONPIC),1) - @if [ ! -e libr_parse.${EXT_AR} ]; then rm -f ${STATIC_OBJS} ; fi -endif -ifeq ($(WITHPIC),1) - @if [ ! -e libr_parse.${EXT_SO} ]; then rm -f ${STATIC_OBJS} ; fi -endif - plugins: @cd p && ${MAKE} all diff --git a/libr/rules.mk b/libr/rules.mk index 25aaf39fe..042ad8112 100644 --- a/libr/rules.mk +++ b/libr/rules.mk @@ -25,11 +25,6 @@ LINK+=-fvisibility=hidden LINK+=$(addprefix -L../,$(subst r_,,$(BINDEPS))) LINK+=$(addprefix -l,$(BINDEPS)) -# for libraries (DUP) -# implemented in libr/config.mk.tail -#LDFLAGS+=$(addprefix -L../,$(subst r_,,$(DEPS))) -#LDFLAGS+=$(addprefix -l,$(DEPS)) - SRC=$(subst .o,.c,$(OBJ)) BEXE=$(BIN)$(EXT_EXE) @@ -74,8 +69,6 @@ else @-if [ -f p/Makefile ] ; then (echo "DIR ${NAME}/p"; cd p && ${MAKE}) ; fi endif -ifeq (1,1) -#$(WITHPIC),1) $(LIBSO): $(EXTRA_TARGETS) ${WFD} ${OBJS} ${SHARED_OBJ} @for a in ${OBJS} ${SHARED_OBJ} ${SRC}; do \ do=0 ; [ ! -e ${LIBSO} ] && do=1 ; \ @@ -88,19 +81,15 @@ $(LIBSO): $(EXTRA_TARGETS) ${WFD} ${OBJS} ${SHARED_OBJ} [ -f "$(LIBR)/stripsyms.sh" ] && sh $(LIBR)/stripsyms.sh ${LIBSO} ${NAME} ; \ break ; \ fi ; done -else -${LIBSO}: ; -endif -ifeq (1,1) #$(WITHNONPIC),1) +ifeq ($(WITH_LIBR),1) $(LIBAR): ${OBJS} -ifneq ($(SILENT),) - echo "CC_AR $(LIBAR)" -endif + [ "${SILENT}" = 1 ] && @echo "CC_AR $(LIBAR)" || true rm -f $(LIBAR) ${CC_AR} ${OBJS} ${SHARED_OBJ} ${RANLIB} $(LIBAR) else +# ${LIBSO} $(LIBAR): ; $(LIBAR): ; endif diff --git a/sys/android-build.sh b/sys/android-build.sh index df71e0de3..84e774257 100755 --- a/sys/android-build.sh +++ b/sys/android-build.sh @@ -73,11 +73,7 @@ local) ;; esac -[ -z "${NDK_ARCH}" ] && NDK_ARCH=arm [ -z "${STATIC_BUILD}" ] && STATIC_BUILD=0 - -# ow yeah -STATIC_BUILD=1 export NDK_ARCH export STATIC_BUILD PKG=`./configure --version|head -n1 |cut -d ' ' -f 1` @@ -100,7 +96,7 @@ if [ "${BUILD}" = 1 ]; then if [ 1 = 1 ]; then make mrproper if [ $STATIC_BUILD = 1 ]; then - CFGFLAGS="--without-pic --with-nonpic" + CFGFLAGS="--with-libr" fi # dup echo ./configure --with-compiler=android \ diff --git a/sys/build-harden.sh b/sys/build-harden.sh index 7f0042fb1..1f28be647 100755 --- a/sys/build-harden.sh +++ b/sys/build-harden.sh @@ -39,7 +39,7 @@ ${MAKE} mrproper > /dev/null 2>&1 rm -f plugins.cfg # STATIC BUILD CFLAGS="${CFLAGS} -fPIE -fstack-protector-all -D_FORTIFY_SOURCE=2" -CFGFLAGS="--without-pic --with-nonpic" +CFGFLAGS="--with-libr" export CFLAGS # TODO: add this? diff --git a/sys/emscripten.sh b/sys/emscripten.sh index f3d659ec5..c1aeed5a3 100755 --- a/sys/emscripten.sh +++ b/sys/emscripten.sh @@ -13,7 +13,7 @@ export CC="emcc --ignore-dynamic-linking -Oz" export AR="emar" CFGFLAGS="./configure --prefix=/usr --with-compiler=emscripten" -CFGFLAGS="${CFGFLAGS} --disable-debugger --without-pic --with-nonpic" +CFGFLAGS="${CFGFLAGS} --disable-debugger --with-libr" make mrproper cp -f plugins.emscripten.cfg plugins.cfg diff --git a/sys/ios-sdk.sh b/sys/ios-sdk.sh index 217715f82..83dd025ac 100755 --- a/sys/ios-sdk.sh +++ b/sys/ios-sdk.sh @@ -20,23 +20,20 @@ export CC=`pwd`/sys/ios-sdk-gcc export LD="xcrun --sdk iphoneos ld" export IOSVER=9.0 export IOSINC=`pwd`/sys/ios-include -export USE_IOS_STORE=1 export USE_IOS_STATIC=0 +PLUGINS_CFG=plugins.ios-store.cfg +#PLUGINS_CFG=plugins.ios.cfg + if [ "${EMBED_BITCODE}" = 1 ]; then export CFLAGS="$CFLAGS -fembed-bitcode" export LDFLAGS="$LDFLAGS -fembed-bitcode" fi iosConfigure() { - if [ "${USE_IOS_STORE}" = 1 ]; then - cp -f plugins.ios-store.cfg plugins.cfg - else - cp -f plugins.ios.cfg plugins.cfg - fi - ./configure --enable-merged --prefix=${PREFIX} --with-ostype=darwin \ - --without-pic --with-nonpic --without-fork \ - --with-compiler=ios-sdk --target=arm-unknown-darwin + cp -f ${PLUGINS_CFG} plugins.cfg + ./configure --with-libr --prefix=${PREFIX} --with-ostype=darwin \ + --without-fork --with-compiler=ios-sdk --target=arm-unknown-darwin return $? } diff --git a/sys/ios-simulator.sh b/sys/ios-simulator.sh index 4007bb4d3..4385f9459 100755 --- a/sys/ios-simulator.sh +++ b/sys/ios-simulator.sh @@ -71,9 +71,8 @@ fi if true; then make mrproper cp -f ${PLGCFG} plugins.cfg -./configure --prefix=${PREFIX} --with-ostype=darwin \ - --without-fork --without-pic --with-nonpic \ - --disable-debugger --with-compiler=ios-sdk \ +./configure --prefix=${PREFIX} --with-ostype=darwin --with-libr \ + --without-fork --disable-debugger --with-compiler=ios-sdk \ --target=arm-unknown-darwin fi diff --git a/sys/ios-static.sh b/sys/ios-static.sh index 060bc2ea7..53270c997 100755 --- a/sys/ios-static.sh +++ b/sys/ios-static.sh @@ -14,6 +14,7 @@ if [ -z "${CPU}" ]; then # export CPU=armv7 fi +R2BINS="radare2 rabin2 rasm2 r2pm r2agent radiff2 rafind2 ragg2 rahash2 rarun2 rasm2 rax2" CAPSTONE_ARCHS="arm aarch64" #export CAPSTONE_MAKEFLAGS="CAPSTONE_ARCHS=\"arm aarch64\"" # Build all archs for capstone, not just ARM/ARM64 @@ -63,15 +64,13 @@ cp -f plugins.tiny.cfg plugins.cfg cp -f plugins.ios.cfg plugins.cfg ./configure --prefix="${PREFIX}" \ ${CFGFLAGS} \ - --with-ostype=darwin \ - --without-pic --with-nonpic \ + --with-ostype=darwin --with-libr \ --with-compiler=ios-sdk \ --target=arm-unknown-darwin fi if [ $? = 0 ]; then time ${MAKE} -j${MAKE_JOBS} CAPSTONE_ARCHS="${CAPSTONE_ARCHS}" - #time ${MAKE} -j${MAKE_JOBS} if [ $? = 0 ]; then ( cd binr/radare2 ; ${MAKE} ios_sdk_sign ) rm -rf /tmp/r2ios @@ -87,7 +86,7 @@ if [ $? = 0 ]; then export D=radare2-ios-${CPU} rm -rf $D mkdir -p $D/bin - for a in radare2 rabin2 rasm2 r2pm r2agent radiff2 rafind2 ragg2 rahash2 rarun2 rasm2 rax2 ; do + for a in ${R2BINS} ; do cp -f binr/$a/$a "$D/bin" done mkdir -p "$D/include" diff --git a/sys/sdk.sh b/sys/sdk.sh index a7d5f284d..24cb6a1c5 100755 --- a/sys/sdk.sh +++ b/sys/sdk.sh @@ -18,7 +18,7 @@ if [ -z "${R2_PLUGINS_CFG}" ]; then fi cp -f "${R2_PLUGINS_CFG}" plugins.cfg #./configure-plugins -./configure --prefix="$PREFIX" --with-nonpic --without-pic --without-gpl || exit 1 +./configure --prefix="$PREFIX" --with-libr --without-gpl || exit 1 #--disable-loadlibs || exit 1 make -j8 || exit 1 rm -rf "${SDKDIR}" diff --git a/sys/static.sh b/sys/static.sh index c78dfcd5c..16a6bce9a 100755 --- a/sys/static.sh +++ b/sys/static.sh @@ -37,7 +37,7 @@ if [ 1 = "${DOCFG}" ]; then cp -f plugins.static.cfg plugins.cfg #-D__ANDROID__=1" ./configure-plugins || exit 1 - ./configure --prefix="$PREFIX" --with-nonpic --without-pic --disable-loadlibs || exit 1 + ./configure --prefix="$PREFIX" --with-libr --disable-loadlibs || exit 1 fi ${MAKE} -j 8 || exit 1 BINS="rarun2 rasm2 radare2 ragg2 rabin2 rax2 rahash2 rafind2 rasign2 r2agent radiff2" diff --git a/sys/wasm.sh b/sys/wasm.sh index 289dc7704..eceaf1213 100755 --- a/sys/wasm.sh +++ b/sys/wasm.sh @@ -12,7 +12,7 @@ unset LDFLAGS export CC="emcc -Os -s WASM=1 -s SIDE_MODULE=1" export AR="emar" -CFGFLAGS="./configure --prefix=/usr --disable-debugger --with-compiler=wasm --without-pic --with-nonpic" +CFGFLAGS="./configure --prefix=/usr --disable-debugger --with-compiler=wasm --with-libr" make mrproper cp -f plugins.emscripten.cfg plugins.cfg -- 2.17.1