Fix Cydia/iOS packaging and compilation issues ##build (#17342)
This commit is contained in:
parent
2b882ce7ca
commit
8efd721dba
12 changed files with 75 additions and 42 deletions
1
Makefile
1
Makefile
|
|
@ -53,6 +53,7 @@ endif
|
|||
endif
|
||||
|
||||
all: plugins.cfg libr/include/r_version.h
|
||||
${MAKE} -C shlr targets
|
||||
${MAKE} -C shlr/zip
|
||||
${MAKE} -C libr/util
|
||||
${MAKE} -C libr/socket
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ include ../../libr/config.mk
|
|||
include ../../libr/socket/deps.mk
|
||||
include ../../libr/magic/deps.mk
|
||||
include ../../libr/main/deps.mk
|
||||
include ../../shlr/sdb.mk
|
||||
include ../../shlr/zip/deps.mk
|
||||
include ../../shlr/gdb/deps.mk
|
||||
include ../../shlr/java/deps.mk
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ static bool r2r_chdir(const char *argv0) {
|
|||
}
|
||||
|
||||
static bool r2r_test_run_unit(void) {
|
||||
return system ("make -C unit all run") == 0;
|
||||
return r_sandbox_system ("make -C unit all run", 1) == 0;
|
||||
}
|
||||
|
||||
static bool r2r_chdir_fromtest(const char *test_path) {
|
||||
|
|
|
|||
|
|
@ -15,6 +15,9 @@ ENTITL=radare2.xcent
|
|||
#CFLAGS+=-flto
|
||||
#LDFLAGS+=-flto
|
||||
|
||||
CFLAGS_INCLUDES+=-I$(SHLR)/sdb/src
|
||||
CFLAGS_INCLUDES+=-I$(LIBR)/include
|
||||
|
||||
ifeq (${COMPILER},emscripten)
|
||||
# https://kripken.github.io/emscripten-site/docs/optimizing/Optimizing-Code.html
|
||||
# -s INLINING_LIMIT=1
|
||||
|
|
@ -57,7 +60,7 @@ ios_sdk_sign:
|
|||
|
||||
macos-sign macossign:
|
||||
rm -f radare2
|
||||
${CC} radare2.c ${CFLAGS} ${LDFLAGS} ${LINK} -o radare2 \
|
||||
${CC} radare2.c ${CFLAGS_INCLUDES} ${CFLAGS} ${LDFLAGS} ${LINK} -o radare2 \
|
||||
-sectcreate __TEXT __info_plist Info.plist \
|
||||
-framework Security -framework CoreFoundation
|
||||
#xcrun --sdk $(MACSDK) codesign -f -s ${CERTID} --entitlements radare2_macos.xml radare2
|
||||
|
|
@ -94,4 +97,5 @@ include ../../shlr/grub/deps.mk
|
|||
include ../../shlr/qnx/deps.mk
|
||||
include ../../shlr/ar/deps.mk
|
||||
include ../../shlr/yxml/deps.mk
|
||||
include ../../shlr/sdb.mk
|
||||
LDFLAGS+=$(LINK)
|
||||
|
|
|
|||
|
|
@ -1,14 +1,13 @@
|
|||
BINR_PROGRAM=1
|
||||
include ../../libr/config.mk
|
||||
include ../../shlr/zip/deps.mk
|
||||
include ../../shlr/sdb.mk
|
||||
|
||||
ifeq (,$(findstring tcc,${CC}))
|
||||
CFLAGS+=-pie
|
||||
endif
|
||||
CFLAGS+=-I$(LTOP)/include
|
||||
|
||||
include ../../shlr/sdb.mk
|
||||
|
||||
ifeq (${COMPILER},emscripten)
|
||||
LINK+=$(SHLR)/libr_shlr.a
|
||||
LINK+=$(SHLR)/sdb/src/libsdb.a
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
include $(SHLR)/sdb.mk
|
||||
include $(SHLR)/zip/deps.mk
|
||||
|
|
|
|||
|
|
@ -214,13 +214,18 @@ R_API int r_sandbox_system(const char *x, int n) {
|
|||
#if LIBC_HAVE_SYSTEM
|
||||
if (n) {
|
||||
#if APPLE_SDK_IPHONEOS
|
||||
#include <dlfcn.h>
|
||||
int (*__system)(const char *cmd)
|
||||
= dlsym (NULL, "system");
|
||||
if (__system) {
|
||||
return __system (x);
|
||||
#include <spawn.h>
|
||||
int argc;
|
||||
char *cmd = strdup (x);
|
||||
char **argv = r_str_argv (cmd, &argc);
|
||||
if (argv) {
|
||||
char *argv0 = r_file_path (argv[0]);
|
||||
pid_t pid = 0;
|
||||
int r = posix_spawn (&pid, argv0, NULL, NULL, argv, NULL);
|
||||
int status;
|
||||
int s = waitpid (pid, &status, 0);
|
||||
return WEXITSTATUS (s);
|
||||
}
|
||||
return -1;
|
||||
#else
|
||||
return system (x);
|
||||
#endif
|
||||
|
|
|
|||
16
mk/darwin.mk
16
mk/darwin.mk
|
|
@ -1,12 +1,22 @@
|
|||
ifeq ($(OSTYPE),darwin)
|
||||
ARCH=$(shell uname -m)
|
||||
|
||||
MACOS_VERSION="10.5"
|
||||
MACOS_SDK_VERSION="10.5"
|
||||
|
||||
XCODE_VERSION=$(shell xcodebuild -version|grep Xcode|grep -o "[\.0-9]\+")
|
||||
XCODE_VERSION_MAJOR=$(word 1, $(subst ., ,$(XCODE_VERSION)))
|
||||
|
||||
ifeq ($(COMPILER),ios-sdk)
|
||||
|
||||
IOS_VERSION="9.0"
|
||||
IOS_SDK_VERSION="9.0"
|
||||
|
||||
else
|
||||
|
||||
ifeq ($(XCODE_VERSION_MAJOR),11)
|
||||
MACOS_VERSION="10.5"
|
||||
MACOS_SDK_VERSION="10.5"
|
||||
PARTIALLD+=-arch ${ARCH} -platform_version macos $(MACOS_VERSION) $(MACOS_SDK_VERSION)
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
CROSS=ios-sdk-
|
||||
HOST_CC=gcc
|
||||
CC=${CROSS}gcc
|
||||
USERCC=${CROSS}gcc
|
||||
RANLIB=xcrun --sdk iphonesimulator ranlib
|
||||
RANLIB=xcrun --sdk iphoneos ranlib
|
||||
ONELIB=0
|
||||
OSTYPE=darwin
|
||||
AR=xcrun --sdk iphonesimulator ar
|
||||
AR=xcrun --sdk iphoneos ar
|
||||
CC_AR=${AR} -r ${LIBAR}
|
||||
PARTIALLD=${CROSS}ld -r -all_load
|
||||
PICFLAGS=
|
||||
|
|
|
|||
|
|
@ -62,7 +62,9 @@ endif
|
|||
|
||||
.PHONY: capstone-sync capstone-build all clean mrproper libgdbr libwindbg bochs tree-sitter-sync
|
||||
|
||||
ifeq ($(shell gcc -v > /dev/null 2>&1 && echo works),works)
|
||||
HOST_CC?=gcc
|
||||
endif
|
||||
SHLR?=$(shell pwd)
|
||||
AR?=ar
|
||||
RANLIB?=ranlib
|
||||
|
|
@ -92,7 +94,7 @@ all:
|
|||
exit 1
|
||||
endif
|
||||
|
||||
preall: targets libwindbg capstone-build tree-sitter-build radare2-shell-parser-build bochs
|
||||
preall: libwindbg capstone-build tree-sitter-build radare2-shell-parser-build bochs
|
||||
@for MOD in ${MODS} ; do \
|
||||
echo $(MAKE) -C $$MOD ; \
|
||||
$(MAKE) -C $$MOD HAVE_VALA= ROOT="${PWD}/../" CC="${CC}" ; \
|
||||
|
|
@ -127,7 +129,9 @@ endif
|
|||
endif
|
||||
|
||||
targets:
|
||||
for TARGET in ${SDB_TARGETS} ; do ${MAKE} $$TARGET ; done
|
||||
#for TARGET in ${SDB_TARGETS} ; do ${MAKE} $$TARGET ; done
|
||||
$(MAKE) sdb-native-build HOST_CC=$(HOST_CC) CC=$(HOST_CC)
|
||||
$(MAKE) sdb-target-build
|
||||
|
||||
sdb/src/sdb_version.h:
|
||||
@echo
|
||||
|
|
@ -148,8 +152,11 @@ sdb-native-build: sdb/src/sdb_version.h
|
|||
@echo "NATIVE BUILD SDB"
|
||||
@echo ">>>>>>>>>>>>>>>>"
|
||||
@echo
|
||||
$(MAKE) -C sdb/src CC=${HOST_CC} LDFLAGS='${HOST_LDFLAGS}' CPPFLAGS='' CFLAGS='${HOST_CFLAGS} ${PIC}' bin
|
||||
$(MAKE) -C sdb clean ; rm -f sdb/src/*.o sdb/src/sdb_version.h
|
||||
$(MAKE) -C sdb/src "CC=${HOST_CC}" LDFLAGS='${HOST_LDFLAGS}' CPPFLAGS='' CFLAGS='${HOST_CFLAGS} ${PIC}' bin
|
||||
cp -f sdb/src/sdb${BUILD_EXT_EXE} sdb/src/.sdb${BUILD_EXT_EXE}
|
||||
cp -f sdb/src/sdb${BUILD_EXT_EXE} sdb/sdb$(BUILD_EXT_EXE)
|
||||
-file sdb/sdb$(BUILD_EXT_EXE)
|
||||
|
||||
sdb-target-build: sdb/src/sdb_version.h
|
||||
@echo
|
||||
|
|
@ -157,16 +164,19 @@ sdb-target-build: sdb/src/sdb_version.h
|
|||
@echo "TARGET BUILD SDB"
|
||||
@echo ">>>>>>>>>>>>>>>>"
|
||||
@echo
|
||||
cd sdb/src ; $(MAKE) ARCH=xxx RANLIB="${RANLIB}" CFLAGS_SHARED="${CFLAGS_SHARED}" \
|
||||
CC="${CC}" AR="${AR}" CFLAGS='${CFLAGS}' LDFLAGS='${LDFLAGS}' libsdb.a
|
||||
$(MAKE) -C sdb clean ; rm -f sdb/src/*.o sdb/src/sdb_version.h
|
||||
$(MAKE) -C sdb/src sdb_version.h
|
||||
$(MAKE) -C sdb/src ARCH=xxx RANLIB="${RANLIB}" CFLAGS_SHARED="${CFLAGS_SHARED}" \
|
||||
CC="${CC}" AR="${AR}" ARCH=undefined CFLAGS='${CFLAGS}' LDFLAGS='${LDFLAGS}' libsdb.a
|
||||
${RANLIB} sdb/src/libsdb.a
|
||||
|
||||
${SDB_TARGETS}: sdb-native-build sdb-target-build
|
||||
${SDB_TARGETS}:
|
||||
ifneq (${EXT_AR},a)
|
||||
-cp -f sdb/src/libsdb.a sdb/src/libsdb.${EXT_AR}
|
||||
endif
|
||||
rm -f $@
|
||||
cp -f sdb/src/.sdb${BUILD_EXT_EXE} $@
|
||||
$(MAKE) targets
|
||||
|
||||
.PHONY: sdb-sync sync-sdb sdbclean sdb-native-build sdb-target-build
|
||||
SDB_F=README.md config.mk src Makefile meson.build
|
||||
|
|
|
|||
|
|
@ -55,7 +55,8 @@ ifneq (${CONTROL_EXTRAS},)
|
|||
cp ${CONTROL_EXTRAS} $@
|
||||
endif
|
||||
# Make control file.
|
||||
echo "Package: ${PACKAGE}" > $@/control
|
||||
echo "Name: ${PACKAGE}" > $@/control
|
||||
echo "Package: ${PACKAGE}" >> $@/control
|
||||
echo "Version: ${VERSION}" >> $@/control
|
||||
echo "Section: ${SECTION}" >> $@/control
|
||||
echo "Priority: ${PRIORITY}" >> $@/control
|
||||
|
|
|
|||
|
|
@ -1,11 +1,17 @@
|
|||
#!/bin/sh
|
||||
|
||||
|
||||
set -x
|
||||
STOW=0
|
||||
fromscratch=1 # 1
|
||||
onlydebug=0
|
||||
onlymakedeb=0
|
||||
static=1
|
||||
|
||||
|
||||
gcc -v 2> /dev/null
|
||||
if [ $? = 0 ]; then
|
||||
export HOST_CC=gcc
|
||||
fi
|
||||
if [ -z "${CPU}" ]; then
|
||||
export CPU=arm64
|
||||
#export CPU=armv7
|
||||
|
|
@ -40,9 +46,7 @@ makeDeb() {
|
|||
rm -rf sys/cydia/radare2/root
|
||||
mkdir -p sys/cydia/radare2/root
|
||||
sudo tar xpzvf /tmp/r2ios-${CPU}.tar.gz -C sys/cydia/radare2/root
|
||||
rm -f sys/cydia/radare2/root/${PREFIX}/lib/*.dSYM
|
||||
rm -f sys/cydia/radare2/root/${PREFIX}/lib/*.a
|
||||
rm -f sys/cydia/radare2/root/${PREFIX}/lib/*.dylib
|
||||
rm -f sys/cydia/radare2/root/${PREFIX}/lib/*.{a,dylib,dSYM}
|
||||
if [ "$static" = 1 ]; then
|
||||
(
|
||||
rm -f sys/cydia/radare2/root/${PREFIX}/bin/*
|
||||
|
|
@ -87,28 +91,24 @@ fi
|
|||
if [ $onlymakedeb = 1 ]; then
|
||||
makeDeb
|
||||
else
|
||||
RV=0
|
||||
if [ $fromscratch = 1 ]; then
|
||||
if [ $onlydebug = 1 ]; then
|
||||
(cd libr/debug ; make clean)
|
||||
RV=0
|
||||
make clean
|
||||
cp -f plugins.ios.cfg plugins.cfg
|
||||
if [ "$static" = 1 ]; then
|
||||
./configure --prefix="${PREFIX}" --with-ostype=darwin --without-libuv \
|
||||
--with-compiler=ios-sdk --target=arm-unknown-darwin --with-libr
|
||||
else
|
||||
make clean
|
||||
cp plugins.ios.cfg plugins.cfg
|
||||
if [ "$static" = 1 ]; then
|
||||
./configure --prefix="${PREFIX}" --with-ostype=darwin --without-libuv \
|
||||
--with-compiler=ios-sdk --target=arm-unknown-darwin --with-libr
|
||||
else
|
||||
./configure --prefix="${PREFIX}" --with-ostype=darwin --without-libuv \
|
||||
--with-compiler=ios-sdk --target=arm-unknown-darwin
|
||||
fi
|
||||
RV=$?
|
||||
./configure --prefix="${PREFIX}" --with-ostype=darwin --without-libuv \
|
||||
--with-compiler=ios-sdk --target=arm-unknown-darwin
|
||||
fi
|
||||
else
|
||||
RV=0
|
||||
RV=$?
|
||||
fi
|
||||
if [ $RV = 0 ]; then
|
||||
time make -j4
|
||||
time make -j4 || exit 1
|
||||
if [ "$static" = 1 ]; then
|
||||
ls -l libr/util/libr_util.a || exit 1
|
||||
ls -l libr/flag/libr_flag.a || exit 1
|
||||
rm -f libr/*/*.dylib
|
||||
(
|
||||
cd binr ; make clean ;
|
||||
|
|
|
|||
Loading…
Reference in a new issue