Fix w32 build

This commit is contained in:
pancake 2013-01-23 14:50:50 +01:00
parent 3fcc031083
commit d82c53224f
14 changed files with 33 additions and 36 deletions

View File

@ -44,7 +44,7 @@ w32dist:
mkdir w32dist
for a in `find libr | grep -e dll$$`; do cp $$a w32dist ; done
for a in `find binr | grep -e exe$$`; do cp $$a w32dist ; done
rm w32dist/plugin.dll
rm -f w32dist/plugin.dll
mkdir -p w32dist/radare2/${VERSION}/magic
cp -f libr/magic/d/default/* w32dist/radare2/${VERSION}/magic
mkdir -p w32dist/radare2/${VERSION}/syscall

View File

@ -9,7 +9,7 @@ Crosscompilation
ArchLinux
---------
./configure --without-gmp --with-compiler=i486-mingw32-gcc --with-ostype=windows --host=i486-unknown-windows --without-ssl
./configure --with-compiler=i486-mingw32-gcc --with-ostype=windows --host=i486-unknown-windows --without-ssl
make
make w32dist
@ -26,7 +26,7 @@ Crosscompilation
Ubuntu
------
sudo apt-get install mingw32
./configure --without-gmp --with-compiler=i586-mingw32msvc-gcc --with-ostype=windows --host=i586-unknown-windows
./configure --with-compiler=i586-mingw32msvc-gcc --with-ostype=windows --host=i586-unknown-windows
make
make w32dist
@ -43,7 +43,7 @@ Windows x86-64
Build radare2
--------------
./configure --without-gmp --with-compiler=x86_64-w64-mingw32-gcc --with-ostype=windows --host=x86_64-unknown-windows --without-magic --without-ssl
./configure --with-compiler=x86_64-w64-mingw32-gcc --with-ostype=windows --host=x86_64-unknown-windows --without-magic --without-ssl
Python bindings:

View File

@ -180,8 +180,10 @@ static const char *radare_argv[] = {
"/", "//", "/a", "/c", "/m", "/x", "/v",
"y", "yy", "y?",
"wx", "ww", "wf", "w?",
"p6d", "p6e", "p8", "pb", "pc", "pd", "pD", "px", "pX", "po",
"pm", "pr", "pt", "ps", "pz", "pu", "pU", "p?",
"p6d", "p6e", "p8", "pb", "pc",
"pd", "pda", "pdj", "pdb", "pdr", "pdf", "pdi", "pdl",
"pD", "px", "pX", "po",
"pm", "pr", "pt", "ptd", "ptn", "pt?", "ps", "pz", "pu", "pU", "p?",
NULL
};
@ -580,24 +582,26 @@ R_API int r_core_prompt(RCore *r, int sync) {
*prompt = 0;
// TODO: also in visual prompt and disasm/hexdump ?
if (r_config_get_i (r->config, "asm.segoff")) {
#if __UNIX__
ut32 a, b;
a = ((r->offset >>16)<<12);
b = (r->offset & 0xffff);
#if __UNIX__
if (r_config_get_i (r->config, "scr.color"))
snprintf (prompt, sizeof (prompt),
Color_YELLOW"[%04x:%04x]> "
Color_RESET, a, b);
else
#endif
else sprintf (prompt, "[%04x:%04x]> ", a, b);
sprintf (prompt, "[%04x:%04x]> ", a, b);
} else {
#if __UNIX__
if (r_config_get_i (r->config, "scr.color"))
snprintf (prompt, sizeof (prompt),
Color_YELLOW"[0x%08"PFMT64x"]> "
Color_RESET, r->offset);
else
#endif
else sprintf (prompt, "[0x%08"PFMT64x"]> ", r->offset);
sprintf (prompt, "[0x%08"PFMT64x"]> ", r->offset);
}
r_line_set_prompt (prompt);
ret = r_cons_fgets (line, sizeof (line), 0, NULL);

View File

@ -511,7 +511,7 @@ R_API char *r_core_rtr_cmds_query (RCore *core, const char *host, const char *po
char *rbuf = NULL;
const int timeout = 0;
RSocket *s = r_socket_new (0);
for (;retries>0; usleep (10*1000)) {
for (;retries>0; r_sys_usleep (10*1000)) {
if (r_socket_connect (s, host, port, R_SOCKET_PROTO_TCP, timeout))
break;
retries--;

View File

@ -31,8 +31,9 @@ int sdb_lock(const char *s) {
void sdb_lock_wait(const char *s) {
// TODO use flock() here
while (!sdb_lock (s))
usleep (100); // hack
while (!sdb_lock (s)) {
// Sleep (100); // W32
}
}
void sdb_unlock(const char *s) {

View File

@ -124,7 +124,7 @@ R_API RIODesc *r_io_open(RIO *io, const char *file, int flags, int mode) {
if (fd == -1)
r_sandbox_creat (uri, O_BINARY);
fd = r_sandbox_open (uri, O_BINARY | 1, 0);
} else fd = r_sandbox_open (uri, O_BINARY);
} else fd = r_sandbox_open (uri, O_BINARY, 0);
#else
fd = r_sandbox_open (uri, (flags&R_IO_WRITE)?
O_RDWR: O_RDONLY, mode);

View File

@ -37,6 +37,7 @@
#include <sys/param.h>
#include <assert.h>
#include <ctype.h>
#include <dirent.h>
#if __UNIX__
#define QUICK 1
#include <sys/mman.h>

View File

@ -16,7 +16,7 @@ LDFLAGS+=-lsocket
endif
# windows
ifeq (${OSTYPE},windows)
LDFLAGS=-lwsock32
LDFLAGS+=-lwsock32
#LDFLAGS+=-lws2_32
endif

View File

@ -4,7 +4,6 @@
#include <r_types.h>
#include <r_socket.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <signal.h>
#include <stdio.h>

View File

@ -79,5 +79,9 @@ R_API int r_sandbox_chdir (const char *path) {
R_API int r_sandbox_kill(int pid, int sig) {
if (enabled) // XXX: fine-tune. maybe we want to enable kill for child?
return -1;
#if __UNIX__
return kill (pid, sig);
#else
return -1;
#endif
}

View File

@ -14,6 +14,7 @@
# include <signal.h>
#elif __WINDOWS__
# include <io.h>
# include <winbase.h>
#endif
/* TODO: import stuff fron bininfo/p/bininfo_addr2line */

View File

@ -1,3 +1,6 @@
include ../../config-user.mk
include ../../mk/${COMPILER}.mk
CFLAGS+=-g -ggdb
CFLAGS+=-I../../libr/include
LDFLAGS+=-L../../libr/util

File diff suppressed because one or more lines are too long

View File

@ -10,16 +10,6 @@ var prev_lastoff = 0;
r2.root = ""; // prefix path
Array.prototype.push = function (x) {
this[this.length] = x;
}
Array.prototype.pop = function () {
var x = this[this.length-1];
delete this[this.length-1];
return x;
}
/* helpers */
function dump(obj) {
var x = "";
@ -82,22 +72,19 @@ r2.set_flag_space = function (ns, fn) {
r2.get_flags = function (fn) {
r2.cmd ("fj", function (x) {
if (x) x = JSON.parse (x);
fn (x);
fn (x? JSON.parse (x): []);
});
}
r2.get_opcodes = function (off, n, cb) {
r2.cmd ("pdj @"+off+"!"+n, function (json) {
var o = JSON.parse (json);
cb (o);
cb (JSON.parse (o));
});
}
r2.get_bytes = function (off, n, cb) {
r2.cmd ("pcj @"+off+"!"+n, function (json) {
var o = JSON.parse (json);
cb (o);
cb (JSON.parse (json));
});
}
@ -120,8 +107,7 @@ r2.bin_symbols = function (cb) {
r2.bin_sections = function (cb) {
r2.cmd ("iSj", function (json) {
var o = JSON.parse (json);
cb (o);
cb (JSON.parse (json));
});
}
@ -151,8 +137,7 @@ r2.get_logger = function (obj) {
});
obj.load = function (cb) {
r2.cmd ("lj "+(obj.last+1), function (ret) {
var json = JSON.parse (ret);
if (cb) cb (json);
if (cb) cb (JSON.parse (ret));
});
}
obj.clear = function (cb) {