From da837ad4ce950eeb41a44cf255e41107605f4fa6 Mon Sep 17 00:00:00 2001 From: pancake Date: Fri, 4 Jan 2013 14:34:58 +0100 Subject: [PATCH] Fix static build. Generate single libr.a --- binr/rules.mk | 1 + libr/Makefile | 13 +++++++++++++ libr/asm/arch/i8080/Makefile | 3 --- libr/asm/arch/i8080/i8080dis.c | 2 +- libr/bin/p/java.mk | 3 +++ sys/android-build.sh | 7 ++++--- sys/android-shell.sh | 6 +++--- 7 files changed, 25 insertions(+), 10 deletions(-) delete mode 100644 libr/asm/arch/i8080/Makefile diff --git a/binr/rules.mk b/binr/rules.mk index 8a9290b3c0..29be64849a 100644 --- a/binr/rules.mk +++ b/binr/rules.mk @@ -11,6 +11,7 @@ OBJ+=${BIN}.o BEXE=${BIN}${EXT_EXE} ifeq ($(WITHNONPIC),1) +LDFLAGS+=../../libr/libr.a LDFLAGS+=../../libr/db/sdb/src/libsdb.a LDFLAGS+=../../libr/fs/p/grub/libgrubfs.a LDFLAGS+=-lm diff --git a/libr/Makefile b/libr/Makefile index f14864708b..b95d6ac7e9 100644 --- a/libr/Makefile +++ b/libr/Makefile @@ -28,6 +28,19 @@ all: ${MAKE} $(LIBS5) ${MAKE} $(LIBS6) ${MAKE} $(LIBS7) +ifeq (${WITHNONPIC},1) + ${MAKE} libr.a +endif + +# looks hacky :D +libr.a: $(shell ls */libr_*.a) + rm -f libr.a + echo CREATE libr.a > libr.m + for a in */libr_*.a ; do echo ADDLIB $$a >> libr.m ; done + echo SAVE >> libr.m + # ar -M is a gnu-ism .. try to find a proper portable way to do that + ar -M < libr.m + rm -f libr.m $(LIBS): @echo "DIR $@" diff --git a/libr/asm/arch/i8080/Makefile b/libr/asm/arch/i8080/Makefile deleted file mode 100644 index 7ff0d61dd6..0000000000 --- a/libr/asm/arch/i8080/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -all: - ${CC} -o d -DVERSION=\"0.19.1\" test.c - ${CC} -Wall -g -ggdb -o a -DMAIN_DIS -DVERSION=\"0.1\" i8080dis.c diff --git a/libr/asm/arch/i8080/i8080dis.c b/libr/asm/arch/i8080/i8080dis.c index be56d653e3..490e7937f2 100644 --- a/libr/asm/arch/i8080/i8080dis.c +++ b/libr/asm/arch/i8080/i8080dis.c @@ -120,7 +120,7 @@ static void arg(char* s, int const cmd, struct arg_t const* arg, int val) { } } -int i8080_disasm(unsigned char const* const code, char* text, int text_sz) { +static int i8080_disasm(unsigned char const* const code, char* text, int text_sz) { int const cmd = code[0]; int const p = code[1] | (code[2] << 8); diff --git a/libr/bin/p/java.mk b/libr/bin/p/java.mk index e2e12490ec..b8ca2610cc 100644 --- a/libr/bin/p/java.mk +++ b/libr/bin/p/java.mk @@ -6,6 +6,9 @@ SHARED_JAVA+=../../shlr/java/ops.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} diff --git a/sys/android-build.sh b/sys/android-build.sh index 023d21064c..307926b4ed 100755 --- a/sys/android-build.sh +++ b/sys/android-build.sh @@ -72,11 +72,12 @@ if [ $STATIC_BUILD = 1 ]; then CFGFLAGS="--without-pic --with-nonpic" fi # dup -echo ./configure --with-compiler=android --with-ostype=android \ - --without-ewf --without-ssl --prefix=${PREFIX} ${CFGFLAGS} +echo ./configure --with-compiler=android \ + --with-ostype=android --without-ewf \ + --prefix=${PREFIX} ${CFGFLAGS} ./configure --with-compiler=android --with-ostype=android \ - --without-ewf --without-ssl --prefix=${PREFIX} ${CFGFLAGS} || exit 1 + --without-ewf --prefix=${PREFIX} ${CFGFLAGS} || exit 1 make -s -j 4 || exit 1 fi rm -rf $D diff --git a/sys/android-shell.sh b/sys/android-shell.sh index 4cb9cdac14..0ed24c28f7 100755 --- a/sys/android-shell.sh +++ b/sys/android-shell.sh @@ -44,9 +44,9 @@ if [ ! -d "${NDK}" ]; then exit 1 fi -TOOLCHAIN_MIPS=`ls ${NDK}/toolchains/ |grep "^mips" |sort |tail -n 1` -TOOLCHAIN_ARM=`ls ${NDK}/toolchains/ |grep "^arm" |sort |tail -n 1` -TOOLCHAIN_X86=`ls ${NDK}/toolchains/ |grep "^x86" |sort |tail -n 1` +TOOLCHAIN_MIPS=`ls ${NDK}/toolchains/ |grep "^mips" |sort |head -n 1` +TOOLCHAIN_ARM=`ls ${NDK}/toolchains/ |grep "^arm" |sort |head -n 1` +TOOLCHAIN_X86=`ls ${NDK}/toolchains/ |grep "^x86" |sort |head -n 1` NDKPATH_MIPS=${NDK}/toolchains/${TOOLCHAIN_MIPS}/prebuilt/${OS}-x86/bin/ NDKPATH_ARM=${NDK}/toolchains/${TOOLCHAIN_ARM}/prebuilt/${OS}-x86/bin/