busybox: Set __progname in getopt for -n to work
authorFredrik Fornwall <fredrik@fornwall.net>
Thu, 1 Dec 2016 01:32:23 +0000 (20:32 -0500)
committerFredrik Fornwall <fredrik@fornwall.net>
Thu, 1 Dec 2016 01:32:23 +0000 (20:32 -0500)
packages/busybox/build.sh
packages/busybox/util-linux-getopt.c.patch [new file with mode: 0644]

index edec2af..0d02485 100755 (executable)
@@ -2,6 +2,7 @@ TERMUX_PKG_HOMEPAGE=http://www.busybox.net/
 TERMUX_PKG_DESCRIPTION="Tiny versions of many common UNIX utilities into a single small executable"
 TERMUX_PKG_ESSENTIAL=yes
 TERMUX_PKG_VERSION=1.25.1
+TERMUX_PKG_BUILD_REVISION=1
 TERMUX_PKG_SRCURL=https://www.busybox.net/downloads/busybox-${TERMUX_PKG_VERSION}.tar.bz2
 TERMUX_PKG_BUILD_IN_SRC=yes
 # We replace env in the old coreutils package:
diff --git a/packages/busybox/util-linux-getopt.c.patch b/packages/busybox/util-linux-getopt.c.patch
new file mode 100644 (file)
index 0000000..16f9168
--- /dev/null
@@ -0,0 +1,23 @@
+diff -u -r ../busybox-1.25.1/util-linux/getopt.c ./util-linux/getopt.c
+--- ../busybox-1.25.1/util-linux/getopt.c      2016-10-07 10:47:47.000000000 -0400
++++ ./util-linux/getopt.c      2016-11-30 17:46:48.000185295 -0500
+@@ -358,6 +358,10 @@
+       ;
+ #endif
++#ifdef __ANDROID__
++extern char* __progname;
++#endif
++
+ int getopt_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
+ int getopt_main(int argc, char **argv)
+ {
+@@ -423,5 +427,8 @@
+       }
+       argv[n] = name ? name : argv[0];
++#ifdef __ANDROID__
++      __progname = argv[n];
++#endif
+       return generate_output(argv + n, argc - n, optstr, long_options);
+ }