mirror of
https://github.com/radareorg/radare2.git
synced 2024-10-07 10:33:30 +00:00
Lot of build fixes for --as-needed and mingw32
Fix z80 assembler Add r_sys_truncate() for portability Fail build if tests compilation is wrong
This commit is contained in:
parent
60bef170d2
commit
28428438f6
4
Makefile
4
Makefile
@ -26,6 +26,9 @@ gitpush:
|
||||
todo:
|
||||
grep -re TODO:0.9.2 libr binr
|
||||
|
||||
farm:
|
||||
./sys/farm/run.sh
|
||||
|
||||
libr:
|
||||
cd libr && ${MAKE} all
|
||||
|
||||
@ -87,6 +90,7 @@ clean:
|
||||
mrproper:
|
||||
cd libr && ${MAKE} mrproper
|
||||
cd binr && ${MAKE} mrproper
|
||||
cd shlr && ${MAKE} mrproper
|
||||
rm -f config-user.mk plugins.cfg libr/config.h libr/include/r_userconf.h libr/config.mk
|
||||
rm -f pkgcfg/*.pc
|
||||
|
||||
|
@ -17,7 +17,7 @@ all: libs
|
||||
|
||||
libs:
|
||||
@for lib in ${LIBLIST}; do \
|
||||
cd $${lib} && ${MAKE} all || exit 1 ; cd .. ; done
|
||||
cd $${lib} && ${MAKE} || exit 1 ; cd .. ; done
|
||||
@echo Build done for: ${LIBLIST}
|
||||
|
||||
pkgcfg:
|
||||
|
@ -8,13 +8,16 @@ all: tree.o
|
||||
|
||||
tree.o: lex.yy.o
|
||||
|
||||
cparse.o: lemon
|
||||
./lemon cparse.y
|
||||
${CC} ${CFLAGS} -c cparse.c
|
||||
|
||||
lex.yy.o: cparse.o
|
||||
flex cparse.l
|
||||
${CC} ${CFLAGS} -c lex.yy.c
|
||||
|
||||
cparse.o: lemon
|
||||
./lemon cparse.y
|
||||
${CC} ${CFLAGS} -c cparse.c
|
||||
lemon.o:
|
||||
${HOST_CC} ${CFLAGS} -c lemon.c
|
||||
|
||||
lemon: lemon.o
|
||||
${HOST_CC} lemon.o -o lemon
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* radare - LGPL - Copyright 2012 pancake<nopcode.org> */
|
||||
/* radare - LGPL - Copyright 2012 - pancake */
|
||||
|
||||
#include <r_types.h>
|
||||
#include <r_util.h>
|
||||
@ -8,14 +8,12 @@
|
||||
#include "../arch/z80/z80.c"
|
||||
|
||||
static int do_assemble(RAsm *a, RAsmOp *op, const char *buf) {
|
||||
return op->inst_len = z80asm (obuf, op->buf);
|
||||
return op->inst_len = z80asm (op->buf, buf);
|
||||
}
|
||||
|
||||
static int do_disassemble(struct r_asm_t *a, struct r_asm_op_t *op, const ut8 *buf, ut64 len) {
|
||||
int dlen = z80dis (0, buf, op->buf_asm, len);
|
||||
if (dlen>0) {
|
||||
// printf ("LEN IS OK\n");
|
||||
} else dlen = 0;
|
||||
if (dlen<0) dlen = 0;
|
||||
op->inst_len = dlen;
|
||||
return op->inst_len;
|
||||
}
|
||||
|
@ -8,6 +8,8 @@ SHARED_X86+=../../shlr/udis86/syn-intel.o
|
||||
SHARED_X86+=../../shlr/udis86/syn.o
|
||||
SHARED_X86+=../../shlr/udis86/udis86.o
|
||||
|
||||
SHARED2_X86=$(addprefix ../,${SHARED_X86})
|
||||
|
||||
STATIC_OBJ+=${OBJ_X86}
|
||||
SHARED_OBJ+=${SHARED_X86}
|
||||
TARGET_X86=asm_x86.${EXT_SO}
|
||||
@ -15,4 +17,4 @@ TARGET_X86=asm_x86.${EXT_SO}
|
||||
ALL_TARGETS+=${TARGET_X86}
|
||||
|
||||
${TARGET_X86}: ${OBJ_X86}
|
||||
${CC} $(call libname,asm_x86) ${LDFLAGS} ${CFLAGS} -o ${TARGET_X86} ${OBJ_X86}
|
||||
${CC} $(call libname,asm_x86) ${LDFLAGS} ${CFLAGS} -o ${TARGET_X86} ${OBJ_X86} ${SHARED2_X86}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* radare - LGPL - Copyright 2009-2012 // pancake<nopcode.org> */
|
||||
static int magicdepth = 99; //XXX: do not use global var here
|
||||
|
||||
static int magicdepth = 99; //XXX: do not use global var here
|
||||
|
||||
static void r_core_magic_at(RCore *core, const char *file, ut64 addr, int depth, int v) {
|
||||
const char *fmt;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* radare - LGPL - Copyright 2009-2012 pancake<nopcode.org> */
|
||||
/* radare - LGPL - Copyright 2009-2012 - pancake */
|
||||
|
||||
#include "r_core.h"
|
||||
|
||||
@ -7,7 +7,7 @@ R_API int r_core_dump(RCore *core, const char *file, ut64 addr, ut64 size) {
|
||||
ut8 *buf;
|
||||
int bs = core->blocksize;
|
||||
FILE *fd;
|
||||
truncate (file, 0);
|
||||
r_sys_truncate (file, 0);
|
||||
fd = fopen (file, "wb");
|
||||
if (!fd) {
|
||||
eprintf ("Cannot open '%s' for writing\n", file);
|
||||
|
@ -460,6 +460,7 @@ R_API int r_sys_cmd_str_full(const char *cmd, const char *input, char **output,
|
||||
#if __WINDOWS__
|
||||
R_API char *r_sys_cmd_str_w32(const char *cmd);
|
||||
#endif
|
||||
R_API int r_sys_truncate(const char *file, int sz);
|
||||
R_API int r_sys_cmd(const char *cmd);
|
||||
R_API int r_sys_cmdf (const char *fmt, ...);
|
||||
R_API char *r_sys_cmd_str(const char *cmd, const char *input, int *len);
|
||||
|
@ -447,6 +447,6 @@ R_API int r_io_create (RIO *io, const char *file, int mode, int type) {
|
||||
if (io->plugin && io->plugin->create)
|
||||
return io->plugin->create (io, file, mode, type);
|
||||
if (type == 'd'|| type == 1)
|
||||
return mkdir (file, mode);
|
||||
return r_sys_mkdir (file);
|
||||
return creat (file, mode)? R_FALSE: R_TRUE;
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
BINDEPS=r_lib r_util
|
||||
LDFLAGS=-L..
|
||||
|
||||
include ../../config.mk
|
||||
|
||||
|
@ -2,12 +2,11 @@ include ../../config.mk
|
||||
|
||||
all: hex fmt
|
||||
|
||||
BINS=fmt${EXT_EXE}
|
||||
BIN=hex
|
||||
OBJ=hex.o
|
||||
BINDEPS=r_cons r_print r_util
|
||||
|
||||
fmt${EXT_EXE}: fmt.o
|
||||
|
||||
myclean:
|
||||
rm -f fmt fmt.o
|
||||
|
||||
|
@ -12,7 +12,11 @@ all: $(PRE) $(ALL)
|
||||
@$(MAKE) real_all
|
||||
|
||||
real_all: ${EXTRA_TARGETS} ${LIBSO} ${LIBAR}
|
||||
ifeq (${OSTYPE},windows)
|
||||
@-if [ -e t/Makefile ]; then (cd t && ${MAKE} all) ; fi
|
||||
else
|
||||
@if [ -e t/Makefile ]; then (cd t && ${MAKE} all) ; fi
|
||||
endif
|
||||
@-if [ -e p/Makefile ]; then (cd p && ${MAKE} all) ; fi
|
||||
@true
|
||||
|
||||
@ -103,10 +107,12 @@ all: ${BIN}${EXT_EXE} ${BINS}
|
||||
|
||||
${BINS}:
|
||||
echo ${LIBR}
|
||||
${CC} ${CFLAGS} $@.c -L.. ${LDFLAGS} ${LDLIBS} -o $@${EXT_EXE}
|
||||
${CC} ${CFLAGS} $@.c -L.. ${LDFLAGS} -o $@${EXT_EXE}
|
||||
# ${CC} ${CFLAGS} $@.c -L.. ${LDFLAGS} ${LDLIBS} -o $@${EXT_EXE}
|
||||
|
||||
${BIN}${EXT_EXE}: ${OBJ} ${SHARED_OBJ}
|
||||
${CC} $+ -L.. ${LDFLAGS} ${LDLIBS} -o ${BIN}${EXT_EXE}
|
||||
${CC} $+ -L.. -o ${BIN}${EXT_EXE} ${LDFLAGS}
|
||||
# ${CC} $+ -L.. -o ${BIN}${EXT_EXE} ${LDLIBS} ${LDFLAGS}
|
||||
endif
|
||||
|
||||
# Dummy myclean rule that can be overriden by the t/ Makefile
|
||||
|
@ -1,6 +1,6 @@
|
||||
BINDEPS=r_search r_util
|
||||
|
||||
all: test${EXT_EXE} test-str${EXT_EXE} test-regexp${EXT_EXE}
|
||||
BINS=test${EXT_EXE} test-str${EXT_EXE} test-regexp${EXT_EXE}
|
||||
|
||||
include ../../rules.mk
|
||||
|
||||
|
@ -29,6 +29,18 @@ R_API ut64 r_sys_now(void) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
R_API int r_sys_truncate(const char *file, int sz) {
|
||||
#if __WINDOWS__
|
||||
int fd = open (file, O_RDWR);
|
||||
if (!fd) return R_FALSE;
|
||||
ftruncate (fd, sz);
|
||||
close (fd);
|
||||
return R_TRUE;
|
||||
#else
|
||||
return truncate (file, sz)? R_FALSE: R_TRUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
R_API RList *r_sys_dir(const char *path) {
|
||||
struct dirent *entry;
|
||||
DIR *dir;
|
||||
|
@ -1,3 +1,5 @@
|
||||
include ../../config.mk
|
||||
|
||||
BINDEPS=r_util
|
||||
|
||||
BINS=test${EXT_EXE}
|
||||
|
@ -1,3 +1,5 @@
|
||||
ifeq (${_INCLUDE_MK_GCC_},)
|
||||
_INCLUDE_MK_GCC_=1
|
||||
# osx port install mingw32-gcc
|
||||
CC=i386-mingw32-gcc
|
||||
RANLIB=i386-mingw32-ranlib
|
||||
@ -16,3 +18,4 @@ CFLAGS_OPT1=-O1
|
||||
CFLAGS_OPT2=-O2
|
||||
CFLAGS_OPT3=-O3
|
||||
CFLAGS_DEBUG=-g
|
||||
endif
|
||||
|
@ -1,3 +1,5 @@
|
||||
ifeq (${_INCLUDE_MK_GCC_},)
|
||||
_INCLUDE_MK_GCC_=1
|
||||
CC=i486-mingw32-gcc
|
||||
RANLIB=i486-mingw32-ranlib
|
||||
OSTYPE=windows
|
||||
@ -15,3 +17,4 @@ CFLAGS_OPT1=-O1
|
||||
CFLAGS_OPT2=-O2
|
||||
CFLAGS_OPT3=-O3
|
||||
CFLAGS_DEBUG=-g
|
||||
endif
|
||||
|
@ -1,3 +1,5 @@
|
||||
ifeq (${_INCLUDE_MK_GCC_},)
|
||||
_INCLUDE_MK_GCC_=1
|
||||
CC=i586-mingw32msvc-gcc
|
||||
RANLIB=i586-mingw32msvc-ranlib
|
||||
ONELIB=0
|
||||
@ -15,3 +17,4 @@ CFLAGS_OPT1=-O1
|
||||
CFLAGS_OPT2=-O2
|
||||
CFLAGS_OPT3=-O3
|
||||
CFLAGS_DEBUG=-g
|
||||
endif
|
||||
|
@ -13,6 +13,9 @@ LIBS=r_core.so r_asm.so
|
||||
#LIBS=r_util.so
|
||||
|
||||
mkcxx:
|
||||
@echo c++ bindings has been disabled
|
||||
|
||||
mkcxx_real:
|
||||
for a in ${LIBS} ; do \
|
||||
mod=`echo $$a|cut -d . -f 1` ; \
|
||||
valabind --cxx -N Radare -m $$mod --vapidir=../vapi $$mod && \
|
||||
|
@ -1,2 +1,2 @@
|
||||
clean:
|
||||
clean mrproper:
|
||||
rm -f udis86/*.o udis86/*.d
|
||||
|
11
sys/build.sh
11
sys/build.sh
@ -1,5 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
MAKE_JOBS=1
|
||||
|
||||
MAKE=make
|
||||
gmake --help >/dev/null 2>&1
|
||||
[ $? = 0 ] && MAKE=gmake
|
||||
@ -15,8 +17,7 @@ if [ $? = 0 ]; then
|
||||
fi
|
||||
|
||||
# build
|
||||
if [ -f config-user.mk ]; then
|
||||
${MAKE} mrproper > /dev/null 2>&1
|
||||
fi
|
||||
./configure --prefix=/usr && \
|
||||
${MAKE} -j 4
|
||||
${MAKE} mrproper > /dev/null 2>&1
|
||||
[ "`uname`" = Linux ] && export LDFLAGS="-Wl,--as-needed"
|
||||
./configure --prefix=/usr || exit 1
|
||||
exec ${MAKE} -j ${MAKE_JOBS}
|
||||
|
@ -4,7 +4,9 @@ cd `dirname $PWD/$0` ; cd ..
|
||||
. ./farm/CONFIG
|
||||
|
||||
revision() {
|
||||
echo `hg tip|head -n 1|cut -d : -f 2`
|
||||
R=`hg tip 2>/dev/null|head -n 1|cut -d : -f 2`
|
||||
[ -z "$R" ] && R=`git log|head -n1 |cut -d ' ' -f 2`
|
||||
[ -n "$R" ] && echo $R
|
||||
}
|
||||
|
||||
tstamp() {
|
||||
|
@ -3,20 +3,26 @@
|
||||
cd `dirname $PWD/$0` ; cd ..
|
||||
#TODO: add support for ccache
|
||||
|
||||
# XXX. fails with >1
|
||||
MAKE_JOBS=1
|
||||
|
||||
OLD_LDFLAGS="${LDFLAGS}"
|
||||
unset LDFLAGS
|
||||
|
||||
if [ -x /usr/bin/pacman ]; then
|
||||
make clean
|
||||
./configure --without-gmp --with-compiler=i486-mingw32-gcc --with-ostype=windows --host=i486-unknown-windows --without-ssl && \
|
||||
make -j 4 && \
|
||||
make -j ${MAKE_JOBS} && \
|
||||
make w32dist
|
||||
elif [ `uname` = Darwin ]; then
|
||||
make clean
|
||||
./configure --without-gmp --with-compiler=i386-mingw32-gcc --with-ostype=windows --host=i386-unknown-windows --without-ssl && \
|
||||
make -j 4 && \
|
||||
make -j ${MAKE_JOBS} && \
|
||||
make w32dist
|
||||
elif [ -x /usr/bin/apt-get ]; then
|
||||
make clean
|
||||
./configure --without-gmp --with-compiler=i586-mingw32msvc-gcc --with-ostype=windows --host=i586-unknown-windows && \
|
||||
make -j 4 && \
|
||||
make -j ${MAKE_JOBS} && \
|
||||
make w32dist
|
||||
else
|
||||
echo "ubuntu/debian or archlinux required."
|
||||
|
Loading…
Reference in New Issue
Block a user