Browse Source

fix compilation errors for apt, busybox, imagemagick, libelf, tar

emacs-27
Leonid Plyushch 6 years ago
parent
commit
8926c37a8c
  1. 18
      packages/apt/cmndline-no-strchrnul.patch
  2. 18
      packages/apt/debsrcrecords.patch
  3. 14
      packages/busybox/include-platform.h.patch
  4. 19
      packages/busybox/libbb-platform.c.patch
  5. 1
      packages/imagemagick/build.sh
  6. 26
      packages/libelf/config.h.in.patch
  7. 30
      packages/tar/mkfifoat.patch

18
packages/apt/cmndline-no-strchrnul.patch

@ -1,18 +0,0 @@
diff -u -r ../apt-0.9.16.1/apt-pkg/contrib/cmndline.cc ./apt-pkg/contrib/cmndline.cc
--- ../apt-0.9.16.1/apt-pkg/contrib/cmndline.cc 2014-03-15 17:23:45.000000000 +0100
+++ ./apt-pkg/contrib/cmndline.cc 2014-03-25 01:10:30.764711007 +0100
@@ -27,6 +27,14 @@
/*}}}*/
using namespace std;
+#if defined(__ANDROID__)
+static char* strchrnul(char const* s, int c)
+{
+ char const* result = strchr(s, c);
+ return const_cast<char*>((result == NULL) ? (s + strlen(s)) : result);
+}
+#endif
+
// CommandLine::CommandLine - Constructor /*{{{*/
// ---------------------------------------------------------------------
/* */

18
packages/apt/debsrcrecords.patch

@ -1,18 +0,0 @@
diff -u -r ../apt-0.9.16.1/apt-pkg/deb/debsrcrecords.cc ./apt-pkg/deb/debsrcrecords.cc
--- ../apt-0.9.16.1/apt-pkg/deb/debsrcrecords.cc 2014-03-15 17:23:45.000000000 +0100
+++ ./apt-pkg/deb/debsrcrecords.cc 2014-03-25 01:23:30.652689687 +0100
@@ -26,6 +26,14 @@
#include <string>
#include <vector>
/*}}}*/
+#if defined(__ANDROID__)
+static char* strchrnul(char const* s, int c)
+{
+ char const* result = strchr(s, c);
+ return const_cast<char*>((result == NULL) ? (s + strlen(s)) : result);
+}
+#endif
+
using std::max;
using std::string;

14
packages/busybox/include-platform.h.patch

@ -0,0 +1,14 @@
diff -uNr busybox-1.29.3/include/platform.h busybox-1.29.3.mod/include/platform.h
--- busybox-1.29.3/include/platform.h 2018-07-02 14:23:06.000000000 +0300
+++ busybox-1.29.3.mod/include/platform.h 2019-02-08 16:01:14.437858554 +0200
@@ -579,10 +579,6 @@
extern char *strcasestr(const char *s, const char *pattern) FAST_FUNC;
#endif
-#ifndef HAVE_STRCHRNUL
-extern char *strchrnul(const char *s, int c) FAST_FUNC;
-#endif
-
#ifndef HAVE_STRSEP
extern char *strsep(char **stringp, const char *delim) FAST_FUNC;
#endif

19
packages/busybox/libbb-platform.c.patch

@ -0,0 +1,19 @@
diff -uNr busybox-1.29.3/libbb/platform.c busybox-1.29.3.mod/libbb/platform.c
--- busybox-1.29.3/libbb/platform.c 2018-07-02 14:23:06.000000000 +0300
+++ busybox-1.29.3.mod/libbb/platform.c 2019-02-08 16:10:54.101961593 +0200
@@ -8,15 +8,6 @@
*/
#include "libbb.h"
-#ifndef HAVE_STRCHRNUL
-char* FAST_FUNC strchrnul(const char *s, int c)
-{
- while (*s != '\0' && *s != c)
- s++;
- return (char*)s;
-}
-#endif
-
#ifndef HAVE_USLEEP
int FAST_FUNC usleep(unsigned usec)
{

1
packages/imagemagick/build.sh

@ -15,7 +15,6 @@ TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
--with-lzma
--disable-openmp
ac_cv_func_ftime=no
ac_cv_header_complex_h=no
"
TERMUX_PKG_RM_AFTER_INSTALL="
bin/Magick-config

26
packages/libelf/config.h.in.patch

@ -1,26 +0,0 @@
diff -u -r ../elfutils-0.168/config.h.in ./config.h.in
--- ../elfutils-0.168/config.h.in 2016-12-28 10:33:20.000000000 +0100
+++ ./config.h.in 2017-07-09 23:32:21.305290105 +0200
@@ -1,4 +1,7 @@
/* config.h.in. Generated from configure.ac by autoheader. */
+#include <libgen.h> /* for basename(3) */
+#include <stdio_ext.h> /* for fputc_unlocked(3) */
+#define DL_CALL_FCT(f, args) ((*(f)) args)
/* Building with -fsanitize=undefined or not */
#undef CHECK_UNDEFINED
@@ -117,4 +120,14 @@
/* Define for large files, on AIX-style hosts. */
#undef _LARGE_FILES
+#ifdef __ANDROID__
+# ifndef ANDROID_MEMPCPY
+# define ANDROID_MEMPCPY 1
+static __inline__ void* mempcpy(void* dest, void const* src, size_t n)
+{
+ return memcpy(dest, src, n) + n;
+}
+# endif
+#endif
+
#include <eu-config.h>

30
packages/tar/mkfifoat.patch

@ -1,30 +0,0 @@
mkfifoat() is available in Android only after API 23. We can't use tar's
implementation of mkfifioat() since it will use tar's implementation of
mknodat(). This will cause infinite recursion in file gnu/at-func.c and
segfault.
Snippet of backtrace:
....
#9 0x000000555559819c in mknodat (fd=-100, file=0x7fb7c90050 "sda", mode=25008, dev=2048) at /home/builder/.termux-build/tar/src/gnu/at-func.c:75
#10 0x000000555559819c in mknodat (fd=-100, file=0x7fb7c90050 "sda", mode=25008, dev=2048) at /home/builder/.termux-build/tar/src/gnu/at-func.c:75
#11 0x000000555559819c in mknodat (fd=-100, file=0x7fb7c90050 "sda", mode=25008, dev=2048) at /home/builder/.termux-build/tar/src/gnu/at-func.c:75
#12 0x000000555559819c in mknodat (fd=-100, file=0x7fb7c90050 "sda", mode=25008, dev=2048) at /home/builder/.termux-build/tar/src/gnu/at-func.c:75
#13 0x000000555556a9d4 in extract_node (file_name=0x7fb7c90050 "sda", typeflag=52) at /home/builder/.termux-build/tar/src/src/extract.c:1447
#14 0x0000005555568f38 in extract_archive () at /home/builder/.termux-build/tar/src/src/extract.c:1709
....
diff -uNr tar-1.30/src/extract.c tar-1.30.mod/src/extract.c
--- tar-1.30/src/extract.c 2017-12-16 23:23:12.000000000 +0200
+++ tar-1.30.mod/src/extract.c 2017-12-25 14:31:31.541886176 +0200
@@ -42,6 +42,11 @@
# define fchown(fd, uid, gid) (errno = ENOSYS, -1)
#endif
+static int
+mkfifoat(int fd, const char* path, mode_t mode) {
+ return mknodat(fd, path, (mode & ~S_IFMT) | S_IFIFO, 0);
+}
+
/* Return true if an error number ERR means the system call is
supported in this case. */
static bool
Loading…
Cancel
Save