busybox: fix build with ndk r23

Compiler and tool names need to be updated in Makefile.

Also fix some patch offsets while we are at it
This commit is contained in:
Henrik Grimler 2021-08-19 16:57:02 +02:00
parent 948900878e
commit 218a206274
10 changed files with 45 additions and 37 deletions

View File

@ -1,7 +1,6 @@
diff -uNr busybox-1.31.1/Makefile busybox-1.31.1.mod/Makefile
--- busybox-1.31.1/Makefile 2019-10-25 11:44:52.000000000 +0300
+++ busybox-1.31.1.mod/Makefile 2019-11-11 22:19:06.004778909 +0200
@@ -289,7 +289,7 @@
--- ./Makefile.orig 2021-08-19 16:48:15.223628163 +0200
+++ ./Makefile 2021-08-19 16:47:29.456942514 +0200
@@ -289,14 +289,14 @@
# Make variables (CC, etc...)
AS = $(CROSS_COMPILE)as
@ -9,4 +8,16 @@ diff -uNr busybox-1.31.1/Makefile busybox-1.31.1.mod/Makefile
+CC = $(CROSS_COMPILE)clang
LD = $(CC) -nostdlib
CPP = $(CC) -E
AR = $(CROSS_COMPILE)ar
-AR = $(CROSS_COMPILE)ar
-NM = $(CROSS_COMPILE)nm
-STRIP = $(CROSS_COMPILE)strip
-OBJCOPY = $(CROSS_COMPILE)objcopy
-OBJDUMP = $(CROSS_COMPILE)objdump
+AR = llvm-ar
+NM = llvm-nm
+STRIP = llvm-strip
+OBJCOPY = llvm-objcopy
+OBJDUMP = llvm-objdump
PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config
AWK = awk
GENKSYMS = scripts/genksyms/genksyms

View File

@ -1,6 +1,6 @@
--- ../Makefile.flags.orig 2020-07-20 19:17:12.263392471 +0000
+++ ./Makefile.flags 2020-07-20 19:17:22.988106865 +0000
@@ -150,9 +150,9 @@
--- ./Makefile.flags.orig 2021-01-01 11:52:27.000000000 +0100
+++ ./Makefile.flags 2021-08-19 16:49:06.743647568 +0200
@@ -151,9 +151,9 @@
# fall back to using a temp file:
CRYPT_AVAILABLE := $(shell echo 'int main(void){return 0;}' >crypttest.c; $(CC) $(CFLAGS) -lcrypt -o /dev/null crypttest.c >/dev/null 2>&1 && echo "y"; rm crypttest.c)
ifeq ($(CRYPT_AVAILABLE),y)

View File

@ -1,7 +1,6 @@
diff -uNr busybox-1.31.1/networking/ftpd.c busybox-1.31.1.mod/networking/ftpd.c
--- busybox-1.31.1/networking/ftpd.c 2019-06-10 13:50:53.000000000 +0300
+++ busybox-1.31.1.mod/networking/ftpd.c 2019-11-11 22:26:50.216912741 +0200
@@ -1301,8 +1301,11 @@
--- ./networking/ftpd.c.orig 2021-08-19 16:49:06.730314230 +0200
+++ ./networking/ftpd.c 2021-08-19 16:49:06.753647572 +0200
@@ -1302,8 +1302,11 @@
G.root_fd = xopen("/", O_RDONLY | O_DIRECTORY);
close_on_exec_on(G.root_fd);
#endif

View File

@ -1,7 +1,6 @@
diff -uNr busybox-1.31.1/networking/httpd.c busybox-1.31.1.mod/networking/httpd.c
--- busybox-1.31.1/networking/httpd.c 2019-11-11 21:31:58.406733857 +0200
+++ busybox-1.31.1.mod/networking/httpd.c 2019-11-11 22:29:16.534250966 +0200
@@ -232,7 +232,7 @@
--- ./networking/httpd.c.orig 2021-08-19 16:49:06.730314230 +0200
+++ ./networking/httpd.c 2021-08-19 16:49:06.756980906 +0200
@@ -270,7 +270,7 @@
//usage: "\n -i Inetd mode"
//usage: "\n -f Don't daemonize"
//usage: "\n -v[v] Verbose"
@ -10,8 +9,8 @@ diff -uNr busybox-1.31.1/networking/httpd.c busybox-1.31.1.mod/networking/httpd.
//usage: IF_FEATURE_HTTPD_SETUID(
//usage: "\n -u USER[:GRP] Set uid/gid after binding to port")
//usage: IF_FEATURE_HTTPD_BASIC_AUTH(
@@ -488,7 +488,7 @@
asm volatile("":::"memory"); \
@@ -538,7 +538,7 @@
SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \
IF_FEATURE_HTTPD_BASIC_AUTH(g_realm = "Web Server Authentication";) \
IF_FEATURE_HTTPD_RANGES(range_start = -1;) \
- bind_addr_or_port = "80"; \
@ -19,7 +18,7 @@ diff -uNr busybox-1.31.1/networking/httpd.c busybox-1.31.1.mod/networking/httpd.
index_page = index_html; \
file_size = -1; \
} while (0)
@@ -1004,7 +1004,7 @@
@@ -1030,7 +1030,7 @@
if (!errno && n && n <= 0xffff)
n = create_and_bind_stream_or_die(NULL, n);
else
@ -28,7 +27,7 @@ diff -uNr busybox-1.31.1/networking/httpd.c busybox-1.31.1.mod/networking/httpd.
xlisten(n, 9);
return n;
}
@@ -2209,7 +2209,7 @@
@@ -2279,7 +2279,7 @@
if (proxy_entry) {
if (verbose > 1)
bb_error_msg("proxy:%s", urlcopy);

View File

@ -0,0 +1,15 @@
--- ./networking/tftp.c.orig 2021-01-01 11:52:27.000000000 +0100
+++ ./networking/tftp.c 2021-08-19 16:49:06.763647575 +0200
@@ -917,7 +917,12 @@
G.pw = xgetpwnam(user_opt);
}
if (argv[0]) {
+#ifdef __ANDROID__
+ // chroot may trigger seccomp and is allowed only for root anyway.
+ xchdir(argv[0]);
+#else
xchroot(argv[0]);
+#endif
}
result = recv_from_to(STDIN_FILENO,

View File

@ -1,16 +0,0 @@
diff -uNr busybox-1.31.1/networking/tftp.c busybox-1.31.1.mod/networking/tftp.c
--- busybox-1.31.1/networking/tftp.c 2019-06-10 13:50:53.000000000 +0300
+++ busybox-1.31.1.mod/networking/tftp.c 2019-11-11 22:36:27.592894669 +0200
@@ -907,7 +907,12 @@
G.pw = xgetpwnam(user_opt);
}
if (argv[0]) {
+#ifdef __ANDROID__
+ // chroot may trigger seccomp and is allowed only for root anyway.
+ xchdir(argv[0]);
+#else
xchroot(argv[0]);
+#endif
}
result = recv_from_to(STDIN_FILENO,

View File

@ -3,7 +3,7 @@ TERMUX_PKG_DESCRIPTION="Tiny versions of many common UNIX utilities into a singl
TERMUX_PKG_LICENSE="GPL-2.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=1.33.1
TERMUX_PKG_REVISION=4
TERMUX_PKG_REVISION=5
TERMUX_PKG_SRCURL=https://busybox.net/downloads/busybox-${TERMUX_PKG_VERSION}.tar.bz2
TERMUX_PKG_SHA256=12cec6bd2b16d8a9446dd16130f2b92982f1819f6e1c5f5887b6db03f5660d28
TERMUX_PKG_BUILD_IN_SRC=true