radare2: update to 2.0.0 (#1654)
authorLeonid Plyushch <leonid.plyushch@gmail.com>
Fri, 13 Oct 2017 16:48:39 +0000 (19:48 +0300)
committerFredrik Fornwall <fredrik@fornwall.net>
Fri, 13 Oct 2017 16:48:39 +0000 (18:48 +0200)
* radare2: update to 2.0.0

* radare2: fix build

packages/radare2/build.sh
packages/radare2/fix-hardcoded-paths.patch [new file with mode: 0644]
packages/radare2/libr-core-cconfig.c.patch [deleted file]
packages/radare2/paths.patch [deleted file]

index 417d385..c9e6f49 100644 (file)
@@ -1,8 +1,7 @@
 TERMUX_PKG_HOMEPAGE=https://rada.re
 TERMUX_PKG_DESCRIPTION="Advanced Hexadecimal Editor"
-TERMUX_PKG_VERSION=1.6.0
-TERMUX_PKG_REVISION=2
-TERMUX_PKG_SHA256=759d1c65dcd69d1189fc73e427c568ec234a7ca1958c19f5001c255dd31a3787
+TERMUX_PKG_VERSION=2.0.0
+TERMUX_PKG_SHA256=7d734cb3c047774600928110c8f8b970eb6117630b66d2c7284bc4ed68242c83
 TERMUX_PKG_SRCURL=https://github.com/radare/radare2/archive/$TERMUX_PKG_VERSION.tar.gz
 TERMUX_PKG_BUILD_IN_SRC="yes"
 TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--with-compiler=termux-host"
@@ -13,6 +12,9 @@ termux_step_pre_configure() {
        # problems due to name clashes (binutils header files).
        unset CPPFLAGS
 
+    # If this variable is not set, then build will fail on linking with 'pthread'
+    export ANDROID=1
+
        # Remove old libs which may mess with new build:
        rm -f $TERMUX_PREFIX/lib/libr_*
 }
diff --git a/packages/radare2/fix-hardcoded-paths.patch b/packages/radare2/fix-hardcoded-paths.patch
new file mode 100644 (file)
index 0000000..ca11180
--- /dev/null
@@ -0,0 +1,79 @@
+diff -uNr radare2-2.0.0/libr/core/cconfig.c radare2-2.0.0.mod/libr/core/cconfig.c
+--- radare2-2.0.0/libr/core/cconfig.c  2017-10-09 18:05:53.000000000 +0300
++++ radare2-2.0.0.mod/libr/core/cconfig.c      2017-10-11 16:22:54.521006895 +0300
+@@ -2383,10 +2383,8 @@
+       SETPREF ("dir.plugins", R2_LIBDIR"/radare2/"R2_VERSION"/", "Path to plugin files to be loaded at startup");
+ #endif
+       SETCB ("dir.source", "", &cb_dirsrc, "Path to find source files");
+-      SETPREF ("dir.types", "/usr/include", "Default path to look for cparse type files");
+-#if __ANDROID__
+-      SETPREF ("dir.projects", "/data/data/org.radare.radare2installer/radare2/projects", "Default path for projects");
+-#elif __WINDOWS__
++      SETPREF ("dir.types", "@TERMUX_PREFIX@/include", "Default path to look for cparse type files");
++#if __WINDOWS__
+       SETPREF ("dir.projects", "~\\"R2_HOMEDIR"\\projects", "Default path for projects");
+ #else
+       SETPREF ("dir.projects", "~/"R2_HOMEDIR"/projects", "Default path for projects");
+@@ -2528,6 +2526,9 @@
+ #if __WINDOWS__
+       r_config_set (cfg, "http.browser", "start");
+ #else
++#ifdef __ANDROID__
++      r_config_set (cfg, "http.browser", "xdg-open");
++#else
+       if (r_file_exists ("/usr/bin/openURL")) { // iOS ericautils
+               r_config_set (cfg, "http.browser", "/usr/bin/openURL");
+       } else if (r_file_exists ("/system/bin/toolbox")) {
+@@ -2540,14 +2541,13 @@
+       } else {
+               r_config_set (cfg, "http.browser", "firefox");
+       }
++#endif
+       r_config_desc (cfg, "http.browser", "Command to open HTTP URLs");
+ #endif
+       SETI ("http.maxsize", 0, "Maximum file size for upload");
+       SETPREF ("http.bind", "localhost", "Server address");
+       SETPREF ("http.homeroot", "~/.config/radare2/www", "http home root directory");
+-#if __ANDROID__
+-      SETPREF ("http.root", "/data/data/org.radare.radare2installer/www", "http root directory");
+-#elif __WINDOWS__
++#if __WINDOWS__
+       SETPREF ("http.root", "www", "http root directory");
+ #else
+       SETPREF ("http.root", R2_WWWROOT, "http root directory");
+diff -uNr radare2-2.0.0/libr/debug/p/debug_rap.c radare2-2.0.0.mod/libr/debug/p/debug_rap.c
+--- radare2-2.0.0/libr/debug/p/debug_rap.c     2017-10-09 18:05:53.000000000 +0300
++++ radare2-2.0.0.mod/libr/debug/p/debug_rap.c 2017-10-11 16:24:45.152199241 +0300
+@@ -49,7 +49,7 @@
+ }
+ static char *r_debug_rap_reg_profile(RDebug *dbg) {
+-      char *out, *tf = r_file_temp ("/tmp/rap.XXXXXX");
++      char *out, *tf = r_file_temp ("@TERMUX_PREFIX@/tmp/rap.XXXXXX");
+       int fd = r_cons_pipe_open (tf, 1, 0);
+       r_io_system (dbg->iob.io, "drp");
+       r_cons_pipe_close (fd);
+diff -uNr radare2-2.0.0/libr/include/r_magic.h radare2-2.0.0.mod/libr/include/r_magic.h
+--- radare2-2.0.0/libr/include/r_magic.h       2017-10-09 18:05:53.000000000 +0300
++++ radare2-2.0.0.mod/libr/include/r_magic.h   2017-10-11 16:23:00.721073712 +0300
+@@ -12,7 +12,7 @@
+ R_LIB_VERSION_HEADER(r_magic);
+ #ifndef MAGICFILE
+-#define MAGICFILE "/etc/magic"
++#define MAGICFILE "@TERMUX_PREFIX@/etc/magic"
+ #endif
+ #define R_MAGIC_PATH R2_PREFIX "/share/radare2/" R2_VERSION "/magic"
+diff -uNr radare2-2.0.0/libr/util/file.c radare2-2.0.0.mod/libr/util/file.c
+--- radare2-2.0.0/libr/util/file.c     2017-10-09 18:05:53.000000000 +0300
++++ radare2-2.0.0.mod/libr/util/file.c 2017-10-11 16:23:00.731073820 +0300
+@@ -912,7 +912,7 @@
+               }
+       }
+ #elif __ANDROID__
+-      char *path = strdup ("/data/data/org.radare.radare2installer/radare2/tmp");
++      char *path = strdup ("@TERMUX_PREFIX@/tmp");
+ #else
+       char *path = r_sys_getenv ("TMPDIR");
+       if (path && !*path) {
diff --git a/packages/radare2/libr-core-cconfig.c.patch b/packages/radare2/libr-core-cconfig.c.patch
deleted file mode 100644 (file)
index 44660c3..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-diff -uNr radare2-1.6.0/libr/core/cconfig.c radare2-1.6.0.mod/libr/core/cconfig.c
---- radare2-1.6.0/libr/core/cconfig.c  2017-07-11 18:54:22.000000000 +0300
-+++ radare2-1.6.0.mod/libr/core/cconfig.c      2017-10-05 17:44:43.354444523 +0300
-@@ -2202,10 +2202,8 @@
-       SETPREF ("dir.plugins", R2_LIBDIR"/radare2/"R2_VERSION"/", "Path to plugin files to be loaded at startup");
- #endif
-       SETCB ("dir.source", "", &cb_dirsrc, "Path to find source files");
--      SETPREF ("dir.types", "/usr/include", "Default path to look for cparse type files");
--#if __ANDROID__
--      SETPREF ("dir.projects", "/data/data/org.radare.radare2installer/radare2/projects", "Default path for projects");
--#elif __WINDOWS__
-+      SETPREF ("dir.types", "@TERMUX_PREFIX@/include", "Default path to look for cparse type files");
-+#if __WINDOWS__
-       SETPREF ("dir.projects", "~\\"R2_HOMEDIR"\\projects", "Default path for projects");
- #else
-       SETPREF ("dir.projects", "~/"R2_HOMEDIR"/projects", "Default path for projects");
-@@ -2343,6 +2341,9 @@
- #if __WINDOWS__
-       r_config_set (cfg, "http.browser", "start");
- #else
-+#ifdef __ANDROID__
-+      r_config_set (cfg, "http.browser", "xdg-open");
-+#else
-       if (r_file_exists ("/usr/bin/openURL")) { // iOS ericautils
-               r_config_set (cfg, "http.browser", "/usr/bin/openURL");
-       } else if (r_file_exists ("/system/bin/toolbox")) {
-@@ -2355,14 +2356,13 @@
-       } else {
-               r_config_set (cfg, "http.browser", "firefox");
-       }
-+#endif
-       r_config_desc (cfg, "http.browser", "Command to open HTTP URLs");
- #endif
-       SETI ("http.maxsize", 0, "Maximum file size for upload");
-       SETPREF ("http.bind", "localhost", "Server address");
-       SETPREF ("http.homeroot", "~/.config/radare2/www", "http home root directory");
--#if __ANDROID__
--      SETPREF ("http.root", "/data/data/org.radare.radare2installer/www", "http root directory");
--#elif __WINDOWS__
-+#if __WINDOWS__
-       SETPREF ("http.root", "www", "http root directory");
- #else
-       SETPREF ("http.root", R2_WWWROOT, "http root directory");
diff --git a/packages/radare2/paths.patch b/packages/radare2/paths.patch
deleted file mode 100644 (file)
index 66e60a0..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-diff -uNr radare2-1.6.0/libr/include/r_magic.h radare2-1.6.0.mod/libr/include/r_magic.h
---- radare2-1.6.0/libr/include/r_magic.h       2017-07-11 18:54:22.000000000 +0300
-+++ radare2-1.6.0.mod/libr/include/r_magic.h   2017-09-12 12:34:00.112989113 +0300
-@@ -12,7 +12,7 @@
- R_LIB_VERSION_HEADER(r_magic);
- #ifndef MAGICFILE
--#define MAGICFILE "/etc/magic"
-+#define MAGICFILE "@TERMUX_PREFIX@/etc/magic"
- #endif
- #define R_MAGIC_PATH R2_PREFIX "/share/radare2/" R2_VERSION "/magic"
-diff -uNr radare2-1.6.0/libr/util/file.c radare2-1.6.0.mod/libr/util/file.c
---- radare2-1.6.0/libr/util/file.c     2017-07-11 18:54:22.000000000 +0300
-+++ radare2-1.6.0.mod/libr/util/file.c 2017-09-12 12:34:06.732989109 +0300
-@@ -874,7 +874,7 @@
-               path = strdup (tmpdir);
-       }
- #elif __ANDROID__
--      char *path = strdup ("/data/data/org.radare.radare2installer/radare2/tmp");
-+      char *path = strdup ("@TERMUX_PREFIX@/tmp");
- #else
-       char *path = r_sys_getenv ("TMPDIR");
-       if (path && !*path) {