Skip to content

Commit

Permalink
More emscripten/android build fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed Sep 7, 2013
1 parent cc5122e commit 18cc767
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 19 deletions.
2 changes: 1 addition & 1 deletion binr/r2agent/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
BIN=r2agent
BINDEPS=r_socket r_util r_cons
BINDEPS=r_socket r_cons r_util

include ../rules.mk
2 changes: 1 addition & 1 deletion binr/ragg2/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
BIN=ragg2
BINDEPS=r_egg r_bin r_syscall r_asm r_db r_util r_parse r_lib r_flags r_anal r_reg r_diff r_cons
BINDEPS=r_egg r_bin r_syscall r_asm r_db r_parse r_lib r_flags r_anal r_reg r_diff r_cons r_util

include ../rules.mk
5 changes: 3 additions & 2 deletions binr/rahash2/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
BIN=rahash2
BINDEPS=r_io r_hash r_util r_socket r_asm r_cons
BINDEPS+=r_anal r_lib r_syscall r_reg r_diff r_db r_parse
BINDEPS=r_hash
#BINDEPS=r_io r_hash r_util r_socket r_asm r_cons
#BINDEPS+=r_anal r_lib r_syscall r_reg r_diff r_db r_parse
BINDEPS+=r_flags

include ../rules.mk
Expand Down
2 changes: 1 addition & 1 deletion binr/rasm2/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
BIN=rasm2
BINDEPS=r_cons r_flags r_parse r_asm r_lib r_syscall r_anal r_reg r_diff r_db r_util
BINDEPS=r_asm r_parse r_lib r_syscall r_anal r_reg r_diff r_db r_flags r_cons r_util

include ../rules.mk
10 changes: 8 additions & 2 deletions binr/rax2/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,18 @@
canvas.emscripten { border: 0px none; }
</style>
</head>
<body>
<body onload="FocusOnInput()">

<center>
<script>
var _(x) { return document.getElementById(x); }

function FocusOnInput() {
_('input').focus();
}

function doin () {
var input=document.getElementById('input');
var input=_('input');
if (false) {
window.location.href = "#"+input.value;
location.reload();
Expand Down
10 changes: 4 additions & 6 deletions doc/emscripten
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,19 @@ make clean

# Build radare

export CC="emcc --ignore-dynamic-linking"
./configure --prefix=/usr --disable-shared --enable-static --disable-debugger --with-compiler=emscripten --without-ewf --without-pic --with-nonpic --without-gmp
make -j4
sys/emscripten.sh



--- random notes ---

$ ./configure --without-ewf --without-gmp --with-nonpic --without-pic
$ emmake make
export CC="emcc --ignore-dynamic-linking"
./configure --prefix=/usr --disable-shared --enable-static --disable-debugger --with-compiler=emscripten --without-ewf --without-pic --with-nonpic --without-gmp
emmake make -j4

cd binr/radare2
emcc ../../libr/*/*.o radare2.c -I ../../libr/include/ -DR2_BIRTH=\"pop\" -DR2_GITTIP=\"123\" ../../libr/db/sdb/src/*.o


binr/rax2/rax2.js:

emcc -O2 rax2.o ../../libr/util/libr_util.a -o rax2.js
Expand Down
13 changes: 12 additions & 1 deletion libr/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,18 @@ endif

# looks hacky :D
#AR=arm-linux-androideabi-ar
libr.a: $(shell ls */libr_*.a 2>/dev/null)
libr.a:
rm -rf .libr
mkdir .libr
for a in */libr_*.a ; do \
mkdir -p .libr/$$a ; \
cp -f $$a .libr/$$a ; \
(cd .libr/$$a ; ${AR} x *.a ; rm -f *.a ) ; \
done
${AR} qvf libr.a `find .libr/ | grep '\\.o$$'`
rm -rf .libr

gnu_libr.a: $(shell ls */libr_*.a 2>/dev/null)
rm -f libr.a
echo CREATE libr.a > libr.m
for a in */libr_*.a ; do echo ADDLIB $$a >> libr.m ; done
Expand Down
3 changes: 2 additions & 1 deletion shlr/java/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
include ../../config-user.mk
include ../../mk/${COMPILER}.mk

CFLAGS+=-g -ggdb -fPIC
#CFLAGS+=-g -ggdb -fPIC
CFLAGS+=-fPIC
CFLAGS+=-I../../libr/include
LDFLAGS+=-L../../libr/util
OBJS=code.o class.o ops.o
Expand Down
8 changes: 4 additions & 4 deletions shlr/tcc/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
include ../../config-user.mk
include ../../mk/gcc.mk
include ../../mk/${COMPILER}.mk
OFILES=i386-gen.o libtcc.o tccelf.o tccgen.o tccpp.o

CFLAGS+=-fPIC -g -ggdb
LDFLAGS=-shared -g -ggdb
CFLAGS+=-fPIC
LDFLAGS=-shared
SOEXT?=dylib
LIBNAME=libr_tcc.${SOEXT}

Expand All @@ -13,7 +13,7 @@ ${LIBNAME}: ${OFILES}
${CC} -o ${LIBNAME} ${LDFLAGS} ${OFILES}

libr_tcc.a: ${OFILES}
${AR} -r libr_tcc.a ${OFILES}
${AR} q libr_tcc.a ${OFILES}
${RANLIB} libr_tcc.a

clean:
Expand Down
20 changes: 20 additions & 0 deletions sys/emscripten.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh
# find root
cd `dirname $PWD/$0` ; cd ..
#TODO: add support for ccache

# XXX. fails with >1
[ -z "${MAKE_JOBS}" ] && MAKE_JOBS=8

OLD_LDFLAGS="${LDFLAGS}"
unset LDFLAGS

export CC="emcc --ignore-dynamic-linking"
export AR="emar"

CFGFLAGS="./configure --prefix=/usr --disable-shared --enable-static --disable-debugger --with-compiler=emscripten --without-ewf --without-pic --with-nonpic --without-gmp"

make mrproper

./configure ${CFGFLAGS} --host=emscripten && \
make -s -j ${MAKE_JOBS} DEBUG=0

0 comments on commit 18cc767

Please sign in to comment.