Fix #8653 - Fix spp build for iOS and enhance ios-sdk.sh

This commit is contained in:
pancake 2017-10-09 01:56:44 +02:00
parent 637543c541
commit 5db2e67490
12 changed files with 211 additions and 180 deletions

View File

@ -15,6 +15,7 @@ INCLUDEDIR=@INCLUDEDIR@
HAVE_LIB_GMP=@HAVE_LIB_GMP@
USE_RPATH=@USE_RPATH@
HAVE_JEMALLOC=@HAVE_JEMALLOC@
HAVE_FORK=@HAVE_FORK@
MKPLUGINS=mk/stat.mk mk/sloc.mk

View File

@ -302,6 +302,6 @@ spp-sync sync-spp:
git add spp
spp: spp-sync
CFLAGS=-fPIC $(MAKE) -C spp
CFLAGS="-DHAVE_FORK=${HAVE_FORK} -fPIC" $(MAKE) -C spp
.PHONY: spp

View File

@ -1,19 +1,19 @@
#if !TARGET_OS_IPHONE
#include "p/sh.h"
#endif
#include "p/spp.h"
#include "p/acr.h"
#include "p/pod.h"
#include "p/cpp.h"
#ifdef HAVE_FORK
#define HAVE_FORK 1
#endif
struct Proc *procs[] = {
&spp_proc,
&cpp_proc,
&pod_proc,
&acr_proc,
#if !TARGET_OS_IPHONE
&sh_proc,
#endif
NULL
};

View File

@ -130,7 +130,7 @@ int main(int argc, char **argv) {
}
if (proc->eof)
proc->eof ("", &out);
proc->eof (&proc->state, "", &out);
if (out.fout) {
fclose (out.fout);
}

View File

@ -7,8 +7,8 @@ static TAG_CALLBACK(cpp_default) {
static TAG_CALLBACK(cpp_error) {
do_printf (out,"\n");
if (echo[ifl] && buf != NULL) {
do_printf (out, "ERROR: %s (line=%d)\n", buf, lineno);
if (state->echo[state->ifl] && buf != NULL) {
do_printf (out, "ERROR: %s (line=%d)\n", buf, state->lineno);
return -1;
}
return 0;
@ -16,8 +16,8 @@ static TAG_CALLBACK(cpp_error) {
static TAG_CALLBACK(cpp_warning) {
do_printf (out,"\n");
if (echo[ifl] && buf != NULL) {
do_printf (out, "WARNING: line %d: %s\n", lineno, buf);
if (state->echo[state->ifl] && buf != NULL) {
do_printf (out, "WARNING: line %d: %s\n", state->lineno, buf);
}
return 0;
}
@ -25,26 +25,26 @@ static TAG_CALLBACK(cpp_warning) {
static TAG_CALLBACK(cpp_if) {
char *var = getenv (buf + ((*buf == '!') ? 1 : 0));
if (var && *var=='1')
echo[ifl + 1] = 1;
else echo[ifl + 1] = 0;
if (*buf=='!') echo[ifl+1] = !!!echo[ifl+1];
state->echo[state->ifl + 1] = 1;
else state->echo[state->ifl + 1] = 0;
if (*buf=='!') state->echo[state->ifl + 1] = !!!state->echo[state->ifl + 1];
return 1;
}
static TAG_CALLBACK(cpp_ifdef) {
char *var = getenv (buf);
echo[ifl + 1] = var? 1: 0;
state->echo[state->ifl + 1] = var? 1: 0;
return 1;
}
static TAG_CALLBACK(cpp_else) {
echo[ifl] = echo[ifl]? 0: 1;
state->echo[state->ifl] = state->echo[state->ifl]? 0: 1;
return 0;
}
static TAG_CALLBACK(cpp_ifndef) {
cpp_ifdef (buf, out);
cpp_else (buf, out);
cpp_ifdef (state, buf, out);
cpp_else (state, buf, out);
return 1;
}
@ -111,7 +111,7 @@ static TAG_CALLBACK(cpp_endif) {
}
static TAG_CALLBACK(cpp_include) {
if (echo[ifl]) {
if (state->echo[state->ifl]) {
spp_file (buf, out);
}
return 0;

View File

@ -7,12 +7,12 @@ static TAG_CALLBACK(pod_default) {
static TAG_CALLBACK(pod_cut) {
do_printf (out, "\n");
echo[ifl] = 0;
state->echo[state->ifl] = 0;
return 0;
}
static TAG_CALLBACK(pod_head1) {
echo[ifl] = 1;
state->echo[state->ifl] = 1;
do_printf (out, "\n");
if (!buf) {
return 0;

View File

@ -24,7 +24,9 @@ static TAG_CALLBACK(sh_default) {
// printf("system(%s)\n", buf);
if (eof)
#endif
system(buf);
#if HAVE_FORK
system (buf);
#endif
return 0;
}
@ -49,7 +51,9 @@ static PUT_CALLBACK(sh_fputs) {
if (sh_pipe_enabled) {
char str[1024]; // XXX
sprintf (str, "echo '%s' | %s", buf, sh_pipe_cmd); // XXX
#if HAVE_FORK
system (str);
#endif
} else {
do_printf (out, "%s", buf);
}

View File

@ -33,7 +33,7 @@ static char *cmd_to_str(const char *cmd) {
static TAG_CALLBACK(spp_set) {
char *eq, *val = "";
if (!echo[ifl]) {
if (!state->echo[state->ifl]) {
return 0;
}
for (eq=buf; eq[0]; eq++) {
@ -50,14 +50,14 @@ static TAG_CALLBACK(spp_set) {
val = eq + 1;
}
if (spp_var_set (buf, val) == -1) {
fprintf (stderr, "Invalid variable name '%s' at line %d\n", buf, lineno);
fprintf (stderr, "Invalid variable name '%s' at line %d\n", buf, state->lineno);
}
return 0;
}
static TAG_CALLBACK(spp_get) {
char *var;
if (!echo[ifl]) {
if (!state->echo[state->ifl]) {
return 0;
}
var = spp_var_get (buf);
@ -69,7 +69,7 @@ static TAG_CALLBACK(spp_get) {
static TAG_CALLBACK(spp_getrandom) {
int max;
if (!echo[ifl]) {
if (!state->echo[state->ifl]) {
return 0;
}
// XXX srsly? this is pretty bad random
@ -86,7 +86,7 @@ static TAG_CALLBACK(spp_add) {
char res[32];
char *var, *eq = strchr (buf, ' ');
int ret = 0;
if (!echo[ifl]) {
if (!state->echo[state->ifl]) {
return 0;
}
if (eq) {
@ -108,7 +108,7 @@ static TAG_CALLBACK(spp_sub) {
char *eq = strchr(buf, ' ');
char *var;
int ret = 0;
if (!echo[ifl]) {
if (!state->echo[state->ifl]) {
return 0;
}
if (eq) {
@ -125,39 +125,43 @@ static TAG_CALLBACK(spp_sub) {
// XXX This method needs some love
static TAG_CALLBACK(spp_trace) {
if (echo[ifl]) {
fprintf (stderr, "%s\n", buf);
#if HAVE_FORK
char b[1024];
if (!state->echo[state->ifl]) {
return 0;
}
snprintf(b, 1023, "echo '%s' >&2 ", buf);
system(b);
#endif
return 0;
}
/* TODO: deprecate */
static TAG_CALLBACK(spp_echo) {
if (echo[ifl]) {
do_printf (out, "%s", buf);
}
if (!state->echo[state->ifl]) return 0;
do_printf (out, "%s", buf);
// TODO: add variable replacement here?? not necessary, done by {{get}}
return 0;
}
static TAG_CALLBACK(spp_error) {
if (!echo[ifl]) {
if (!state->echo[state->ifl]) {
return 0;
}
fprintf (stderr, "ERROR: %s (line=%d)\n", buf, lineno);
fprintf (stderr, "ERROR: %s (line=%d)\n", buf, state->lineno);
return -1;
}
static TAG_CALLBACK(spp_warning) {
if (!echo[ifl]) {
if (!state->echo[state->ifl]) {
return 0;
}
fprintf (stderr, "WARNING: %s (line=%d)\n", buf, lineno);
fprintf (stderr, "WARNING: %s (line=%d)\n", buf, state->lineno);
return 0;
}
static TAG_CALLBACK(spp_system) {
if (!echo[ifl]) {
if (!state->echo[state->ifl]) {
return 0;
}
char *str = cmd_to_str (buf);
@ -168,7 +172,7 @@ static TAG_CALLBACK(spp_system) {
static TAG_CALLBACK(spp_include) {
char *incdir;
if (!echo[ifl]) {
if (!state->echo[state->ifl]) {
return 0;
}
incdir = getenv("SPP_INCDIR");
@ -190,7 +194,7 @@ static TAG_CALLBACK(spp_include) {
static TAG_CALLBACK(spp_if) {
char *var = spp_var_get(buf);
echo[ifl + 1] = (var && *var != '0' && *var != '\0') ? 1 : 0;
state->echo[state->ifl + 1] = (var && *var != '0' && *var != '\0') ? 1 : 0;
return 1;
}
@ -202,14 +206,14 @@ static TAG_CALLBACK(spp_ifeq) {
*eq = '\0';
value = spp_var_get(value);
if (value && !strcmp(value, eq+1)) {
echo[ifl+1] = 1;
} else echo[ifl+1] = 0;
state->echo[state->ifl + 1] = 1;
} else state->echo[state->ifl + 1] = 0;
//fprintf(stderr, "IFEQ(%s)(%s)=%d\n", buf, eq+1, echo[ifl]);
} else {
value = spp_var_get(buf);
if (!value || *value=='\0')
echo[ifl+1] = 1;
else echo[ifl+1] = 0;
state->echo[state->ifl + 1] = 1;
else state->echo[state->ifl + 1] = 0;
//fprintf(stderr, "IFEQ(%s)(%s)=%d\n", buf, value, echo[ifl]);
}
return 1;
@ -238,7 +242,7 @@ static TAG_CALLBACK(spp_grepline) {
char *ptr;
int line;
if (!echo[ifl]) return 1;
if (!state->echo[state->ifl]) return 1;
ptr = strchr(buf, ' ');
if (ptr) {
*ptr= '\0';
@ -257,28 +261,28 @@ static TAG_CALLBACK(spp_grepline) {
}
static TAG_CALLBACK(spp_else) {
echo[ifl] = echo[ifl] ? 0 : 1;
state->echo[state->ifl] = state->echo[state->ifl] ? 0 : 1;
return 0;
}
static TAG_CALLBACK(spp_ifnot) {
spp_if (buf, out);
spp_else (buf, out);
spp_if (state, buf, out);
spp_else (state, buf, out);
return 1;
}
static TAG_CALLBACK(spp_ifin) {
char *var, *ptr;
if (!echo[ifl]) {
if (!state->echo[state->ifl]) {
return 1;
}
ptr = strchr (buf, ' ');
echo[ifl + 1] = 0;
state->echo[state->ifl + 1] = 0;
if (ptr) {
*ptr='\0';
var = getenv(buf);
if (strstr (ptr + 1, var)) {
echo[ifl + 1] = 1;
state->echo[state->ifl + 1] = 1;
}
}
return 1;
@ -289,11 +293,11 @@ static TAG_CALLBACK(spp_endif) {
}
static TAG_CALLBACK(spp_default) {
if (!echo[ifl]) {
if (!state->echo[state->ifl]) {
return 0;
}
if (buf[-1] != ';') { /* commented tag */
fprintf (stderr, "WARNING: invalid command: '%s' at line %d\n", buf, lineno);
fprintf (stderr, "WARNING: invalid command: '%s' at line %d\n", buf, state->lineno);
}
return 0;
}
@ -318,7 +322,7 @@ static TAG_CALLBACK(spp_switch) {
}
static TAG_CALLBACK(spp_case) {
echo[ifl] = strcmp (buf, spp_switch_str)?0:1;
state->echo[state->ifl] = strcmp (buf, spp_switch_str)?0:1;
return 0;
}

View File

@ -22,9 +22,7 @@
#include <windows.h>
#endif
#if __WIN32__ || MINGW32 && !__CYGWIN__
#ifndef _MSC_VER
#include <winsock.h>
#endif
typedef int socklen_t;
#undef USE_SOCKETS
#define __WINDOWS__ 1

View File

@ -3,19 +3,6 @@
#include "spp.h"
#include "config.h"
// TODO: avoid globals
static char *lbuf = NULL;
static int lbuf_s = 1024;
static int lbuf_n = 0;
static int incmd = 0;
static int printed = 0;
static char *tag_pre, *tag_post, *token = NULL;
int lineno = 1;
int tag_begin, echo[MAXIFL];
int ifl = 0; /* conditional nest level */
int spp_run(char *buf, Output *out) {
int i, ret = 0;
char *tok;
@ -29,8 +16,8 @@ int spp_run(char *buf, Output *out) {
}
}
if (token) {
tok = strstr (buf, token);
if (proc->token) {
tok = strstr (buf, proc->token);
if (tok) {
*tok = '\0';
tok = tok + 1;
@ -46,14 +33,14 @@ int spp_run(char *buf, Output *out) {
if (out->fout) {
fflush (out->fout);
}
ret = tags[i].callback (tok, out);
ifl += ret;
ret = tags[i].callback (&proc->state, tok, out);
proc->state.ifl += ret;
if (ret == -1) {
break;
}
if (ret) {
if (ifl < 0 || ifl >= MAXIFL) {
if (proc->state.ifl < 0 || proc->state.ifl >= MAXIFL) {
fprintf (stderr, "Nested conditionals parsing error.\n");
break;
}
@ -78,13 +65,13 @@ static char *spp_run_str(char *buf, int *rv) {
return b;
}
void lbuf_strcat(char *dst, char *src) {
void lbuf_strcat(SppBuf *dst, char *src) {
int len = strlen (src);
if (!lbuf || (len + lbuf_n) > lbuf_s) {
lbuf = realloc (lbuf, lbuf_s << 1);
if (!dst->lbuf || (len + dst->lbuf_n) > dst->lbuf_s) {
dst->lbuf = realloc (dst->lbuf, dst->lbuf_s << 1);
}
memcpy (lbuf + lbuf_n, src, len + 1);
lbuf_n += len;
memcpy (dst->lbuf + dst->lbuf_n, src, len + 1);
dst->lbuf_n += len;
}
void do_printf(Output *out, char *str, ...) {
@ -95,16 +82,18 @@ void do_printf(Output *out, char *str, ...) {
} else {
char tmp[4096];
vsnprintf (tmp, sizeof (tmp), str, ap);
tmp[sizeof (tmp) - 1] = 0;
r_strbuf_append (out->cout, tmp);
}
va_end (ap);
}
void do_fputs(Output *out, char *str) {
int do_fputs(Output *out, char *str) {
int i;
for (i = 0; i <= ifl; i++) {
if (!echo[i]) {
return;
int printed = 0;
for (i = 0; i <= proc->state.ifl; i++) {
if (!proc->state.echo[i]) {
return printed;
}
}
if (str[0]) {
@ -117,19 +106,19 @@ void do_fputs(Output *out, char *str) {
fprintf (out->fout, "%s", str);
}
}
return printed;
}
void spp_eval(char *buf, Output *out) {
char *ptr, *ptr2;
char *ptrr = NULL;
int delta;
printed = 0;
int printed = 0;
retry:
/* per word */
if (!tag_pre && token) {
if (!proc->tag_pre && proc->token) {
do {
ptr = strstr (buf, token);
ptr = strstr (buf, proc->token);
if (ptr) {
*ptr = '\0';
}
@ -145,44 +134,47 @@ retry:
return;
}
if (!tag_post) {
if (!proc->tag_post) {
/* handle per line here ? */
return;
}
// TODO: do it in scope!
delta = strlen (tag_post);
delta = strlen (proc->tag_post);
/* (pre) tag */
ptr = tag_pre? strstr (buf, tag_pre): NULL;
ptr = proc->tag_pre? strstr (buf, proc->tag_pre): NULL;
if (ptr) {
D printf ("==> 0.0 (%s)\n", ptr);
incmd = 1;
if (!tag_begin || (tag_begin && ptr == buf)) {
if (!proc->tag_begin || (proc->tag_begin && ptr == buf)) {
*ptr = '\0';
ptr = ptr + strlen (tag_pre);
do_fputs (out, buf);
ptr = ptr + strlen (proc->tag_pre);
if (do_fputs (out, buf)) {
printed = 1;
}
D printf ("==> 0 (%s)\n", ptr);
}
ptrr = strstr (ptr + strlen (tag_pre), tag_pre);
ptrr = strstr (ptr + strlen (proc->tag_pre), proc->tag_pre);
}
/* (post) tag */
if (!ptr) {
do_fputs (out, buf);
if (do_fputs (out, buf)) {
printed = 1;
}
return;
}
ptr2 = strstr (ptr, tag_post);
ptr2 = strstr (ptr, proc->tag_post);
if (ptr2) {
*ptr2 = '\0';
if (ptrr) {
if (ptrr < ptr2) {
char *p = strdup (ptr2 + 2);
char *s = spp_run_str (ptrr + strlen (tag_pre), NULL);
char *s = spp_run_str (ptrr + strlen (proc->tag_pre), NULL);
D fprintf (stderr, "strcpy(%s)(%s)\n", ptrr, s);
strcpy (ptrr, s);
free (s);
ptr[-2] = tag_pre[0]; // XXX -2 check underflow?
ptr[-2] = proc->tag_pre[0]; // XXX -2 check underflow?
D fprintf (stderr, "strcat(%s)(%s)\n", ptrr, p);
strcat (ptrr, p);
@ -193,21 +185,22 @@ retry:
goto retry;
}
}
incmd = 0;
if (lbuf && lbuf[0]) {
D printf("==> 1 (%s)\n", lbuf);
if (proc->buf.lbuf && proc->buf.lbuf[0]) {
D printf("==> 1 (%s)\n", proc->buf.lbuf);
if (ptr) {
lbuf_strcat (lbuf, buf);
do_fputs (out, lbuf);
lbuf_strcat (&proc->buf, buf);
if (do_fputs (out, buf)) {
printed = 1;
}
spp_run (ptr, out);
} else {
lbuf_strcat (lbuf, buf);
D printf ("=(1)=> spp_run(%s)\n", lbuf);
spp_run (lbuf+delta, out);
D printf ("=(1)=> spp_run(%s)\n", lbuf);
lbuf_strcat (&proc->buf, buf);
D printf ("=(1)=> spp_run(%s)\n", proc->buf.lbuf);
spp_run (proc->buf.lbuf + delta, out);
D printf ("=(1)=> spp_run(%s)\n", proc->buf.lbuf);
}
lbuf[0]='\0';
lbuf_n = 0;
proc->buf.lbuf[0]='\0';
proc->buf.lbuf_n = 0;
} else {
D printf ("==> 2 (%s)\n", ptr);
if (ptr) {
@ -220,13 +213,17 @@ retry:
D printf (" ==> 2.1: continue(%s)\n", buf);
goto retry;
} else {
do_fputs (out, "\n");
if (do_fputs (out, buf)) {
printed = 1;
}
}
}
do_fputs (out, ptr2 + delta);
if (do_fputs (out, buf)) {
printed = 1;
}
} else {
D printf ("==> 3\n");
lbuf_strcat (lbuf, ptr);
lbuf_strcat (&proc->buf, ptr);
}
}
@ -234,14 +231,15 @@ retry:
void spp_io(FILE *in, Output *out) {
char buf[4096];
int lines;
if (!lbuf) {
lbuf = calloc (1, 4096);
if (!proc->buf.lbuf) {
proc->buf.lbuf = calloc (1, 4096);
}
if (!lbuf) {
if (!proc->buf.lbuf) {
fprintf (stderr, "Out of memory.\n");
return;
}
lbuf[0] = '\0';
proc->buf.lbuf[0] = '\0';
proc->buf.lbuf_s = 1024;
while (!feof (in)) {
buf[0] = '\0'; // ???
fgets (buf, 1023, in);
@ -268,9 +266,9 @@ void spp_io(FILE *in, Output *out) {
}
}
spp_eval (buf, out);
lineno += lines;
proc->state.lineno += lines;
}
do_fputs (out, lbuf);
do_fputs (out, proc->buf.lbuf);
}
int spp_file(const char *file, Output *out) {
@ -317,15 +315,12 @@ void spp_proc_set(struct Proc *p, char *arg, int fail) {
proc = p;
}
if (proc) {
// TODO: wtf!
tag_pre = proc->tag_pre;
tag_post = proc->tag_post;
proc->state.lineno = 1;
proc->state.ifl = 0;
for (i = 0; i < MAXIFL; i++) {
echo[i] = proc->default_echo;
proc->state.echo[i] = proc->default_echo;
}
token = proc->token;
tag_begin = proc->tag_begin;
args = (struct Arg*)proc->args;
//args = (struct Arg*)proc->args;
tags = (struct Tag*)proc->tags;
}
}

View File

@ -14,7 +14,6 @@ int r_sys_setenv(const char *key, const char *value);
#ifdef __WINDOWS__
#include <io.h>
#include <r_types_base.h>
#define popen _popen
#define pclose _pclose
#define srandom srand
@ -28,13 +27,10 @@ int r_sys_setenv(const char *key, const char *value);
extern int ifl;
extern int echo[MAXIFL];
extern int lineno;
#ifndef DLL_LOCAL
#ifdef _MSC_VER
#define DLL_LOCAL
#else
#define DLL_LOCAL __attribute__ ((visibility ("hidden")))
#endif
#endif
#define GET_ARG(x,y,i) if (y[i][2]) x = y[i] + 2; else x = y[++i]
@ -49,9 +45,22 @@ typedef struct {
int size;
} Output;
typedef struct SppState {
int lineno;
int echo[MAXIFL];
int ifl;
} SppState;
typedef struct SppBuf {
char *lbuf;
int lbuf_s;
int lbuf_n;
} SppBuf;
#define ARG_CALLBACK(x) int x (char *arg)
/* XXX swap arguments ?? */
#define TAG_CALLBACK(x) int x (char *buf, Output *out)
#define TAG_CALLBACK(x) int x (SppState *state, Output *out, char *buf)
#define PUT_CALLBACK(x) int x (Output *out, char *buf)
#define IS_SPACE(x) ((x==' ')||(x=='\t')||(x=='\r')||(x=='\n'))
@ -80,21 +89,18 @@ struct Proc {
int chop;
int tag_begin;
int default_echo;
SppState state;
SppBuf buf;
};
int spp_file(const char *file, Output *out);
int spp_run(char *buf, Output *out);
void spp_eval(char *buf, Output *out);
void spp_io(FILE *in, Output *out);
#ifdef _MSC_VER
void do_printf (Output *out, char *str, ...);
#else
void do_printf(Output *out, char *str, ...) __attribute__ ((format (printf, 2, 3)));
#endif
void spp_proc_list(void);
void spp_proc_list_kw(void);
void spp_proc_list();
void spp_proc_list_kw();
void spp_proc_set(struct Proc *p, char *arg, int fail);
#if DEBUG

View File

@ -5,6 +5,60 @@ BUILD=1
PREFIX="/usr"
# PREFIX=/var/mobile
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 --prefix=${PREFIX} --with-ostype=darwin \
--without-pic --with-nonpic --without-fork \
--with-compiler=ios-sdk --target=arm-unknown-darwin
# --disable-debugger --with-compiler=ios-sdk
return $?
}
iosClean() {
make clean
}
iosBuild() {
time make -j4 || exit 1
# Build and sign
( cd binr/radare2 ; make ios_sdk_sign )
return $?
}
iosPackage() {
rm -rf /tmp/r2ios
make install DESTDIR=/tmp/r2ios
rm -rf /tmp/r2ios/usr/share/radare2/*/www/enyo/node_modules
( cd /tmp/r2ios && tar czvf ../r2ios-${CPU}.tar.gz * )
# Prepare radare2
rm -rf sys/cydia/radare2/root
rm -rf sys/cydia/radare2/root/usr/lib/*.dSYM
rm -rf sys/cydia/radare2/root/usr/lib/*.a
mkdir -p sys/cydia/radare2/root
sudo tar xpzvf /tmp/r2ios-${CPU}.tar.gz -C sys/cydia/radare2/root
rm -rf sys/cydia/radare2-dev/root
# Prepare radare2-dev
mkdir -p sys/cydia/radare2-dev/root
mkdir -p sys/cydia/radare2-dev/root/usr/include
mv sys/cydia/radare2/root/usr/include/* sys/cydia/radare2-dev/root/usr/include
mkdir -p sys/cydia/radare2-dev/root/usr/lib
mv sys/cydia/radare2/root/usr/lib/lib* sys/cydia/radare2-dev/root/usr/lib
mv sys/cydia/radare2/root/usr/lib/pkgconfig sys/cydia/radare2-dev/root/usr/lib
(
cd sys/cydia/radare2/root/usr/bin ;
for a in * ; do strip $a ; done
)
( cd sys/cydia/radare2 ; sudo make clean ; sudo make )
( cd sys/cydia/radare2-dev ; sudo make clean ; sudo make )
return $?
}
######################################################################
#if [ ! -d sys/ios-include ]; then
#(
# cd sys && \
@ -21,8 +75,12 @@ arm64|aarch64)
CPU=arm64
shift
;;
-p)
iosPackage
exit 0
;;
-s)
CPU=armv7
:
;;
'')
CPU=arm64
@ -52,6 +110,7 @@ export USE_IOS_STORE=1
if [ "$1" = -s ]; then
export PS1="\033[33m[ios-sdk-$CPU \w]> \033[0m"
exec $SHELL
exit $?
fi
echo
@ -59,46 +118,10 @@ echo "BUILDING R2 FOR iOS CPU = $CPU"
echo
sleep 1
if true; then
make clean
if [ "${USE_IOS_STORE}" = 1 ]; then
cp -f plugins.ios-store.cfg plugins.cfg
else
cp -f plugins.ios.cfg plugins.cfg
fi
./configure --prefix=${PREFIX} --with-ostype=darwin \
--without-pic --with-nonpic \
--with-compiler=ios-sdk --target=arm-unknown-darwin
# --disable-debugger --with-compiler=ios-sdk
fi
iosClean
iosConfigure
if [ $? = 0 ]; then
time make -j4 || exit 1
# Build and sign
( cd binr/radare2 ; make ios_sdk_sign )
rm -rf /tmp/r2ios
make install DESTDIR=/tmp/r2ios
rm -rf /tmp/r2ios/usr/share/radare2/*/www/enyo/node_modules
( cd /tmp/r2ios && tar czvf ../r2ios-${CPU}.tar.gz * )
# Prepare radare2
rm -rf sys/cydia/radare2/root
rm -rf sys/cydia/radare2/root/usr/lib/*.dSYM
rm -rf sys/cydia/radare2/root/usr/lib/*.a
mkdir -p sys/cydia/radare2/root
sudo tar xpzvf /tmp/r2ios-${CPU}.tar.gz -C sys/cydia/radare2/root
rm -rf sys/cydia/radare2-dev/root
# Prepare radare2-dev
mkdir -p sys/cydia/radare2-dev/root
mkdir -p sys/cydia/radare2-dev/root/usr/include
mv sys/cydia/radare2/root/usr/include/* sys/cydia/radare2-dev/root/usr/include
mkdir -p sys/cydia/radare2-dev/root/usr/lib
mv sys/cydia/radare2/root/usr/lib/lib* sys/cydia/radare2-dev/root/usr/lib
mv sys/cydia/radare2/root/usr/lib/pkgconfig sys/cydia/radare2-dev/root/usr/lib
(
cd sys/cydia/radare2/root/usr/bin ;
for a in * ; do strip $a ; done
)
( cd sys/cydia/radare2 ; sudo make clean ; sudo make )
( cd sys/cydia/radare2-dev ; sudo make clean ; sudo make )
iosBuild
iosPackage
fi