From 2e97cde9dc3dbab9992efa47a023e7e5d6095ddf Mon Sep 17 00:00:00 2001 From: pancake Date: Thu, 7 Jul 2011 18:40:18 +0200 Subject: [PATCH] * Fix r2-bindings valabind build (python, guile, ..) --- r2-bindings/Makefile | 16 ++++++++-------- r2-bindings/README | 16 ++++++++++++++-- r2-bindings/configure-langs | 2 ++ r2-bindings/vapi/r_asm.vapi | 2 +- r2-bindings/vapi/r_core.vapi | 4 ++-- r2-bindings/vapi/r_flags.vapi | 8 ++++---- 6 files changed, 31 insertions(+), 17 deletions(-) diff --git a/r2-bindings/Makefile b/r2-bindings/Makefile index 58eb258c35..c853dc9de9 100644 --- a/r2-bindings/Makefile +++ b/r2-bindings/Makefile @@ -64,29 +64,29 @@ gear: # TODO: unspaguetti this targets perl: - @-[ "`grep perl supported.langs`" ] && cd perl && ${MAKE} ; true + @-[ "`grep perl supported.langs`" ] && ( cd perl && ${MAKE} ) || true python: - @-[ "`grep python supported.langs`" ] && cd python && ${MAKE} ; true + @-[ "`grep python supported.langs`" ] && ( cd python && ${MAKE} ) || true guile: - @-[ "`grep guile supported.langs`" ] && cd guile && ${MAKE} ; true + @-[ "`grep guile supported.langs`" ] && ( cd guile && ${MAKE} ) || true ruby: - @-[ "`grep ruby supported.langs`" ] && cd ruby && ${MAKE} ; true + @-[ "`grep ruby supported.langs`" ] && ( cd ruby && ${MAKE} ) || true lua: - @-[ "`grep lua supported.langs`" ] && cd lua && ${MAKE} ; true + @-[ "`grep lua supported.langs`" ] && ( cd lua && ${MAKE} ) || true go: @-[ -x "${GOBIN}/5g" -o -x "${GOBIN}/6g" -o -x "${GOBIN}/8g" ] && \ - [ "`grep go supported.langs`" ] && cd go && ${MAKE} ; true + [ "`grep go supported.langs`" ] && ( cd go && ${MAKE} ) || true java: - @-[ "`grep java supported.langs`" ] && cd java && ${MAKE} + @-[ "`grep java supported.langs`" ] && ( cd java && ${MAKE} ) || true gir: - @-[ "`grep gir supported.langs`" ] && cd gir && ${MAKE} + @-[ "`grep gir supported.langs`" ] && ( cd gir && ${MAKE} ) || true test: cd perl && ${MAKE} test diff --git a/r2-bindings/README b/r2-bindings/README index 2bbfdabfe0..db8b7e792a 100644 --- a/r2-bindings/README +++ b/r2-bindings/README @@ -1,5 +1,17 @@ -r2-swig notes -============= +r2-bindings +=========== + +If you compile from the repo you need valabind and pass the --enable-devel + + ./configure --prefix=/usr --enable-devel + +You can select the languages you want to compile with --enable={list-of-langs} + + ../configure --prefix=/usr --enable-devel --enable=python + + +NOTES +===== The valabind integration forces us to do some changes in the r2 API. diff --git a/r2-bindings/configure-langs b/r2-bindings/configure-langs index 389e86da3a..b263b1aedc 100755 --- a/r2-bindings/configure-langs +++ b/r2-bindings/configure-langs @@ -70,4 +70,6 @@ cat supported.langs | sed -e 's,^, - ,' # check for perl :> langs.cfg +echo "Supported langs: $(cat supported.langs)" + exit 0 diff --git a/r2-bindings/vapi/r_asm.vapi b/r2-bindings/vapi/r_asm.vapi index d871571333..7db330c9f2 100644 --- a/r2-bindings/vapi/r_asm.vapi +++ b/r2-bindings/vapi/r_asm.vapi @@ -48,7 +48,7 @@ public class RAsm { } [CCode (cname="RAsmOp", destroy_function="")] - public struct Op { + public class Op { public int inst_len; public uint8 *buf; public string buf_asm; diff --git a/r2-bindings/vapi/r_core.vapi b/r2-bindings/vapi/r_core.vapi index 2b3144f280..20a52bc517 100644 --- a/r2-bindings/vapi/r_core.vapi +++ b/r2-bindings/vapi/r_core.vapi @@ -50,8 +50,8 @@ public class RCore { public unowned string disassemble_instr(uint64 addr, int l); public unowned string disassemble_bytes(uint64 addr, int b); - public int anal_search_preludes(); - public int anal_search_prelude(uint64 from, uint64 to, uint8 *k, int ksz, uint8 *m, int msz); + public int search_preludes(); + public int search_prelude(uint64 from, uint64 to, uint8 *k, int ksz, uint8 *m, int msz); public bool anal_all(); public int anal_search (uint64 from, uint64 to, uint64 ref); diff --git a/r2-bindings/vapi/r_flags.vapi b/r2-bindings/vapi/r_flags.vapi index ee8012f2da..187fcdf1bf 100644 --- a/r2-bindings/vapi/r_flags.vapi +++ b/r2-bindings/vapi/r_flags.vapi @@ -3,7 +3,7 @@ [CCode (cheader_filename="r_flags.h,r_list.h,r_types_base.h", cprefix="r_flag_", lower_case_cprefix="r_flag_")] namespace Radare { [Compact] - [CCode (cname="struct r_flag_item_t", free_function="free")] + [CCode (cprefix="r_flag_item_", cname="struct r_flag_item_t", free_function="free")] public class RFlagItem { public string name; public uint64 namehash; @@ -23,11 +23,11 @@ namespace Radare { public void list(bool rad); public RFlagItem get(string name); public RFlagItem get_i(uint64 addr); - public bool unset(string name); + public bool unset(string name, RFlagItem? item); + public bool unset_i(uint64 addr, RFlagItem? item); public bool sort(int namesort); - public static bool name_check(string name); + //public static bool name_check(string name); //public static bool name_filter(string name); - public bool unset_i(uint64 addr); public void set(string name, uint64 addr, int size=1, bool dup=false); public void space_list();