Fredrik Fornwall
6 years ago
committed by
GitHub
45 changed files with 642 additions and 548 deletions
@ -1,14 +0,0 @@ |
|||
--- /home/builder/cstddef.orig 2017-07-15 01:17:10.637496279 +0000 |
|||
+++ ./cstddef 2017-07-15 10:28:28.526713523 +0000 |
|||
@@ -40,7 +40,11 @@ |
|||
#endif |
|||
|
|||
// Don't include our own <stddef.h>; we don't want to declare ::nullptr_t. |
|||
+#ifdef __clang__ |
|||
#include_next <stddef.h> |
|||
+#else |
|||
+#include "../../../lib/gcc/@TERMUX_HOST_PLATFORM@/4.9.x/include/stddef.h" |
|||
+#endif |
|||
#include <__nullptr> |
|||
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD |
@ -1,11 +1,49 @@ |
|||
--- ../cache/cfe-6.0.0.src/lib/Driver/ToolChains/Linux.cpp 2017-12-11 18:14:51.000000000 +0000
|
|||
+++ ./tools/clang/lib/Driver/ToolChains/Linux.cpp 2018-03-13 03:32:36.142985756 +0000
|
|||
@@ -816,7 +816,7 @@
|
|||
--- ./linux.cpp.orig 2019-02-18 04:44:14.793138642 +0000
|
|||
+++ ./tools/clang/lib/Driver/ToolChains/Linux.cpp 2019-02-18 04:52:44.527535617 +0000
|
|||
@@ -311,6 +311,8 @@
|
|||
// possible permutations of these directories, and seeing which ones it added |
|||
// to the link paths. |
|||
path_list &Paths = getFilePaths(); |
|||
+ if(IsAndroid)
|
|||
+ addPathIfExists(D, "@TERMUX_PREFIX@/lib", Paths);
|
|||
|
|||
const std::string OSLibDir = getOSLibDir(Triple, Args); |
|||
const std::string MultiarchTriple = getMultiarchTriple(D, Triple, SysRoot); |
|||
@@ -652,8 +654,27 @@
|
|||
return; |
|||
|
|||
if (!DriverArgs.hasArg(options::OPT_nostdlibinc)) |
|||
+ if (getTriple().isAndroid()) {
|
|||
+ switch (getTriple().getArch()) {
|
|||
+ case llvm::Triple::x86_64:
|
|||
+ addSystemInclude(DriverArgs, CC1Args, SysRoot + "@TERMUX_PREFIX@/include/x86_64-linux-android");
|
|||
+ break;
|
|||
+ case llvm::Triple::x86:
|
|||
+ addSystemInclude(DriverArgs, CC1Args, SysRoot + "@TERMUX_PREFIX@/include/i686-linux-android");
|
|||
+ break;
|
|||
+ case llvm::Triple::aarch64:
|
|||
+ addSystemInclude(DriverArgs, CC1Args, SysRoot + "@TERMUX_PREFIX@/include/aarch64-linux-android");
|
|||
+ break;
|
|||
+ case llvm::Triple::arm:
|
|||
+ case llvm::Triple::thumb:
|
|||
+ addSystemInclude(DriverArgs, CC1Args, SysRoot + "@TERMUX_PREFIX@/include/arm-linux-androideabi");
|
|||
+ break;
|
|||
+ default:
|
|||
+ break;
|
|||
+ }
|
|||
+
|
|||
addSystemInclude(DriverArgs, CC1Args, SysRoot + "/usr/local/include"); |
|||
-
|
|||
+ }
|
|||
if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) { |
|||
SmallString<128> P(D.ResourceDir); |
|||
llvm::sys::path::append(P, "include"); |
|||
@@ -968,7 +989,7 @@
|
|||
} |
|||
|
|||
bool Linux::isPIEDefault() const { |
|||
- return (getTriple().isAndroid() && !getTriple().isAndroidVersionLT(16)) ||
|
|||
+ return getTriple().isAndroid() ||
|
|||
+ return getTriple().isAndroid() ||
|
|||
getTriple().isMusl() || getSanitizerArgs().requiresPIE(); |
|||
} |
|||
|
|||
|
@ -1,22 +0,0 @@ |
|||
TERMUX_PKG_HOMEPAGE=https://developer.android.com/tools/sdk/ndk/index.html |
|||
TERMUX_PKG_DESCRIPTION="Header files from the Android NDK needed for compiling C++ programs using STL" |
|||
TERMUX_PKG_LICENSE="NCSA" |
|||
TERMUX_PKG_VERSION=$TERMUX_NDK_VERSION |
|||
TERMUX_PKG_REVISION=4 |
|||
TERMUX_PKG_NO_DEVELSPLIT=yes |
|||
|
|||
termux_step_extract_into_massagedir() { |
|||
mkdir -p $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/include/c++/v1/ |
|||
cp -Rf $TERMUX_STANDALONE_TOOLCHAIN/include/c++/4.9.x/* $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/include/c++/v1/ |
|||
|
|||
( cd $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/include/c++/v1/ && patch -p1 < $TERMUX_PKG_BUILDER_DIR/math-header.diff ) |
|||
|
|||
# Revert the patch for <cstddef> that's only used for using g++ |
|||
# from the ndk (https://github.com/android-ndk/ndk/issues/215): |
|||
cd $TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX/include/c++/v1/ |
|||
sed "s%\@TERMUX_HOST_PLATFORM\@%${TERMUX_HOST_PLATFORM}%g" $TERMUX_SCRIPTDIR/ndk-patches/cstddef.cpppatch | patch -p1 -R |
|||
} |
|||
|
|||
termux_step_massage() { |
|||
echo "overriding termux_step_massage to avoid removing header files" |
|||
} |
@ -1,24 +0,0 @@ |
|||
diff -u -r ../../../../../../../../../massage-pristine/data/data/com.termux/files/usr/include/c++/v1/cmath ./cmath
|
|||
--- ../../../../../../../../../massage-pristine/data/data/com.termux/files/usr/include/c++/v1/cmath 2018-01-03 00:47:31.973545021 +0100
|
|||
+++ ./cmath 2018-01-03 00:48:02.453189261 +0100
|
|||
@@ -302,7 +302,7 @@
|
|||
*/ |
|||
|
|||
#include <__config> |
|||
-#include <math.h>
|
|||
+#include <c++/v1/math.h>
|
|||
|
|||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
|||
#pragma GCC system_header |
|||
diff -u -r ../../../../../../../../../massage-pristine/data/data/com.termux/files/usr/include/c++/v1/math.h ./math.h
|
|||
--- ../../../../../../../../../massage-pristine/data/data/com.termux/files/usr/include/c++/v1/math.h 2018-01-03 00:47:31.985544880 +0100
|
|||
+++ ./math.h 2018-01-03 00:48:24.732929153 +0100
|
|||
@@ -298,7 +298,7 @@
|
|||
#pragma GCC system_header |
|||
#endif |
|||
|
|||
-#include_next <math.h>
|
|||
+#include <../../math.h>
|
|||
|
|||
#ifdef __cplusplus |
|||
|
@ -1,162 +0,0 @@ |
|||
diff --git a/src/posix_spawn.c b/src/posix_spawn.c
|
|||
new file mode 100644 |
|||
index 0000000..18ceb06
|
|||
--- /dev/null
|
|||
+++ b/src/posix_spawn.c
|
|||
@@ -0,0 +1,156 @@
|
|||
+/*
|
|||
+ * dhcpcd - DHCP client daemon
|
|||
+ * Copyright (c) 2006-2012 Roy Marples <roy@marples.name>
|
|||
+ * All rights reserved
|
|||
+
|
|||
+ * Redistribution and use in source and binary forms, with or without
|
|||
+ * modification, are permitted provided that the following conditions
|
|||
+ * are met:
|
|||
+ * 1. Redistributions of source code must retain the above copyright
|
|||
+ * notice, this list of conditions and the following disclaimer.
|
|||
+ * 2. Redistributions in binary form must reproduce the above copyright
|
|||
+ * notice, this list of conditions and the following disclaimer in the
|
|||
+ * documentation and/or other materials provided with the distribution.
|
|||
+ *
|
|||
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|||
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|||
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|||
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|||
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|||
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|||
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|||
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|||
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|||
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|||
+ * SUCH DAMAGE.
|
|||
+ */
|
|||
+
|
|||
+/* This implementation of posix_spawn is only suitable for the needs of dhcpcd
|
|||
+ * but it could easily be extended to other applications. */
|
|||
+
|
|||
+#include <sys/types.h>
|
|||
+#include <sys/wait.h>
|
|||
+
|
|||
+#include <errno.h>
|
|||
+#include <signal.h>
|
|||
+#include <stdlib.h>
|
|||
+#include <string.h>
|
|||
+#include <unistd.h>
|
|||
+
|
|||
+#include "posix_spawn.h"
|
|||
+
|
|||
+#ifndef _NSIG
|
|||
+#ifdef _SIG_MAXSIG
|
|||
+#define _NSIG _SIG_MAXSIG + 1
|
|||
+#else
|
|||
+/* Guess */
|
|||
+#define _NSIG SIGPWR + 1
|
|||
+#endif
|
|||
+#endif
|
|||
+
|
|||
+extern char **environ;
|
|||
+
|
|||
+static int
|
|||
+posix_spawnattr_handle(const posix_spawnattr_t *attrp)
|
|||
+{
|
|||
+ struct sigaction sa;
|
|||
+ int i;
|
|||
+
|
|||
+ if (attrp->posix_attr_flags & POSIX_SPAWN_SETSIGMASK)
|
|||
+ sigprocmask(SIG_SETMASK, &attrp->posix_attr_sigmask, NULL);
|
|||
+
|
|||
+ if (attrp->posix_attr_flags & POSIX_SPAWN_SETSIGDEF) {
|
|||
+ memset(&sa, 0, sizeof(sa));
|
|||
+ sa.sa_handler = SIG_DFL;
|
|||
+ for (i = 1; i < _NSIG; i++) {
|
|||
+ if (sigismember(&attrp->posix_attr_sigdefault, i)) {
|
|||
+ if (sigaction(i, &sa, NULL) == -1)
|
|||
+ return -1;
|
|||
+ }
|
|||
+ }
|
|||
+ }
|
|||
+
|
|||
+ return 0;
|
|||
+}
|
|||
+
|
|||
+inline static int
|
|||
+is_vfork_safe(short int flags)
|
|||
+{
|
|||
+ return !(flags & (POSIX_SPAWN_SETSIGDEF | POSIX_SPAWN_SETSIGMASK));
|
|||
+}
|
|||
+
|
|||
+int
|
|||
+posix_spawn(pid_t *pid, const char *path,
|
|||
+ const posix_spawn_file_actions_t *file_actions,
|
|||
+ const posix_spawnattr_t *attrp,
|
|||
+ char *const argv[], char *const envp[])
|
|||
+{
|
|||
+ short int flags;
|
|||
+ pid_t p;
|
|||
+ volatile int error;
|
|||
+
|
|||
+ error = 0;
|
|||
+ flags = attrp ? attrp->posix_attr_flags : 0;
|
|||
+ if (file_actions == NULL && is_vfork_safe(flags))
|
|||
+ p = vfork();
|
|||
+ else
|
|||
+#ifdef THERE_IS_NO_FORK
|
|||
+ return ENOSYS;
|
|||
+#else
|
|||
+ p = fork();
|
|||
+#endif
|
|||
+ switch (p) {
|
|||
+ case -1:
|
|||
+ return errno;
|
|||
+ case 0:
|
|||
+ if (attrp) {
|
|||
+ error = posix_spawnattr_handle(attrp);
|
|||
+ if (error)
|
|||
+ _exit(127);
|
|||
+ }
|
|||
+ execve(path, argv, envp);
|
|||
+ error = errno;
|
|||
+ _exit(127);
|
|||
+ default:
|
|||
+ if (error != 0)
|
|||
+ waitpid(p, NULL, WNOHANG);
|
|||
+ else if (pid != NULL)
|
|||
+ *pid = p;
|
|||
+ return error;
|
|||
+ }
|
|||
+}
|
|||
+
|
|||
+int
|
|||
+posix_spawnattr_init(posix_spawnattr_t *attr)
|
|||
+{
|
|||
+
|
|||
+ memset(attr, 0, sizeof(*attr));
|
|||
+ attr->posix_attr_flags = 0;
|
|||
+ sigprocmask(0, NULL, &attr->posix_attr_sigmask);
|
|||
+ sigemptyset(&attr->posix_attr_sigdefault);
|
|||
+ return 0;
|
|||
+}
|
|||
+
|
|||
+int
|
|||
+posix_spawnattr_setflags(posix_spawnattr_t *attr, short flags)
|
|||
+{
|
|||
+
|
|||
+ attr->posix_attr_flags = flags;
|
|||
+ return 0;
|
|||
+}
|
|||
+
|
|||
+int
|
|||
+posix_spawnattr_setsigmask(posix_spawnattr_t *attr, const sigset_t *sigmask)
|
|||
+{
|
|||
+
|
|||
+ attr->posix_attr_sigmask = *sigmask;
|
|||
+ return 0;
|
|||
+}
|
|||
+
|
|||
+int
|
|||
+posix_spawnattr_setsigdefault(posix_spawnattr_t *attr, const sigset_t *sigmask)
|
|||
+{
|
|||
+
|
|||
+ attr->posix_attr_sigdefault = *sigmask;
|
|||
+ return 0;
|
|||
+}
|
@ -1,59 +0,0 @@ |
|||
diff --git a/src/posix_spawn.h b/src/posix_spawn.h
|
|||
new file mode 100644 |
|||
index 0000000..ccfb0f0
|
|||
--- /dev/null
|
|||
+++ b/src/posix_spawn.h
|
|||
@@ -0,0 +1,53 @@
|
|||
+/*
|
|||
+ * dhcpcd - DHCP client daemon
|
|||
+ * Copyright (c) 2006-2012 Roy Marples <roy@marples.name>
|
|||
+ * All rights reserved
|
|||
+
|
|||
+ * Redistribution and use in source and binary forms, with or without
|
|||
+ * modification, are permitted provided that the following conditions
|
|||
+ * are met:
|
|||
+ * 1. Redistributions of source code must retain the above copyright
|
|||
+ * notice, this list of conditions and the following disclaimer.
|
|||
+ * 2. Redistributions in binary form must reproduce the above copyright
|
|||
+ * notice, this list of conditions and the following disclaimer in the
|
|||
+ * documentation and/or other materials provided with the distribution.
|
|||
+ *
|
|||
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|||
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|||
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|||
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|||
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|||
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|||
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|||
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|||
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|||
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|||
+ * SUCH DAMAGE.
|
|||
+ */
|
|||
+
|
|||
+#ifndef POSIX_SPAWN_H
|
|||
+#define POSIX_SPAWN_H
|
|||
+
|
|||
+#include <signal.h>
|
|||
+
|
|||
+typedef struct {
|
|||
+ short posix_attr_flags;
|
|||
+#define POSIX_SPAWN_SETSIGDEF 0x10
|
|||
+#define POSIX_SPAWN_SETSIGMASK 0x20
|
|||
+ sigset_t posix_attr_sigmask;
|
|||
+ sigset_t posix_attr_sigdefault;
|
|||
+} posix_spawnattr_t;
|
|||
+
|
|||
+typedef struct {
|
|||
+// int unused;
|
|||
+} posix_spawn_file_actions_t;
|
|||
+
|
|||
+int posix_spawn(pid_t *, const char *,
|
|||
+ const posix_spawn_file_actions_t *, const posix_spawnattr_t *,
|
|||
+ char *const [], char *const []);
|
|||
+int posix_spawnattr_init(posix_spawnattr_t *);
|
|||
+int posix_spawnattr_setflags(posix_spawnattr_t *, short);
|
|||
+int posix_spawnattr_setsigmask(posix_spawnattr_t *, const sigset_t *);
|
|||
+int posix_spawnattr_setsigdefault(posix_spawnattr_t *, const sigset_t *);
|
|||
+
|
|||
+#endif
|
@ -0,0 +1,387 @@ |
|||
diff --git a/src/spawn.cc b/src/spawn.cc
|
|||
new file mode 100644 |
|||
index 0000000..1eed715
|
|||
--- /dev/null
|
|||
+++ b/src/spawn.cc
|
|||
@@ -0,0 +1,381 @@
|
|||
+/*
|
|||
+ * Copyright (C) 2017 The Android Open Source Project
|
|||
+ * All rights reserved.
|
|||
+ *
|
|||
+ * Redistribution and use in source and binary forms, with or without
|
|||
+ * modification, are permitted provided that the following conditions
|
|||
+ * are met:
|
|||
+ * * Redistributions of source code must retain the above copyright
|
|||
+ * notice, this list of conditions and the following disclaimer.
|
|||
+ * * Redistributions in binary form must reproduce the above copyright
|
|||
+ * notice, this list of conditions and the following disclaimer in
|
|||
+ * the documentation and/or other materials provided with the
|
|||
+ * distribution.
|
|||
+ *
|
|||
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|||
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|||
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|||
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|||
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|||
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|||
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|||
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|||
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|||
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
|||
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|||
+ * SUCH DAMAGE.
|
|||
+ */
|
|||
+
|
|||
+#include <errno.h>
|
|||
+#include <fcntl.h>
|
|||
+#include <signal.h>
|
|||
+#include <stdlib.h>
|
|||
+#include <string.h>
|
|||
+#include <unistd.h>
|
|||
+
|
|||
+#include <android/fdsan.h>
|
|||
+
|
|||
+#include "spawn.h"
|
|||
+
|
|||
+// Bionic "private/ScopedSignalBlocker.h" + one macro needed
|
|||
+#define BIONIC_DISALLOW_COPY_AND_ASSIGN(TypeName) \
|
|||
+ TypeName(const TypeName&) = delete; \
|
|||
+ void operator=(const TypeName&) = delete
|
|||
+
|
|||
+class ScopedSignalBlocker {
|
|||
+ public:
|
|||
+ // Block all signals.
|
|||
+ explicit ScopedSignalBlocker() {
|
|||
+ sigset_t set;
|
|||
+ sigfillset(&set);
|
|||
+ sigprocmask(SIG_BLOCK, &set, &old_set_);
|
|||
+ }
|
|||
+
|
|||
+ // Block just the specified signal.
|
|||
+ explicit ScopedSignalBlocker(int signal) {
|
|||
+ sigset_t set = {};
|
|||
+ sigaddset(&set, signal);
|
|||
+ sigprocmask(SIG_BLOCK, &set, &old_set_);
|
|||
+ }
|
|||
+
|
|||
+ ~ScopedSignalBlocker() {
|
|||
+ reset();
|
|||
+ }
|
|||
+
|
|||
+ void reset() {
|
|||
+ sigprocmask(SIG_SETMASK, &old_set_, nullptr);
|
|||
+ }
|
|||
+
|
|||
+ sigset_t old_set_;
|
|||
+
|
|||
+ BIONIC_DISALLOW_COPY_AND_ASSIGN(ScopedSignalBlocker);
|
|||
+};
|
|||
+
|
|||
+// Bionic "private/SigSetConverter.h"
|
|||
+union SigSetConverter {
|
|||
+ int bsd;
|
|||
+ sigset_t sigset;
|
|||
+ sigset64_t sigset64;
|
|||
+};
|
|||
+
|
|||
+enum Action {
|
|||
+ kOpen,
|
|||
+ kClose,
|
|||
+ kDup2
|
|||
+};
|
|||
+
|
|||
+struct __posix_spawn_file_action {
|
|||
+ __posix_spawn_file_action* next;
|
|||
+
|
|||
+ Action what;
|
|||
+ int fd;
|
|||
+ int new_fd;
|
|||
+ char* path;
|
|||
+ int flags;
|
|||
+ mode_t mode;
|
|||
+
|
|||
+ void Do() {
|
|||
+ if (what == kOpen) {
|
|||
+ fd = open(path, flags, mode);
|
|||
+ if (fd == -1) _exit(127);
|
|||
+ // If it didn't land where we wanted it, move it.
|
|||
+ if (fd != new_fd) {
|
|||
+ if (dup2(fd, new_fd) == -1) _exit(127);
|
|||
+ close(fd);
|
|||
+ }
|
|||
+ } else if (what == kClose) {
|
|||
+ // Failure to close is ignored.
|
|||
+ close(fd);
|
|||
+ } else {
|
|||
+ if (dup2(fd, new_fd) == -1) _exit(127);
|
|||
+ }
|
|||
+ }
|
|||
+};
|
|||
+
|
|||
+struct __posix_spawn_file_actions {
|
|||
+ __posix_spawn_file_action* head;
|
|||
+ __posix_spawn_file_action* last;
|
|||
+
|
|||
+ void Do() {
|
|||
+ for (__posix_spawn_file_action* action = head; action != nullptr; action = action->next) {
|
|||
+ action->Do();
|
|||
+ }
|
|||
+ }
|
|||
+};
|
|||
+
|
|||
+struct __posix_spawnattr {
|
|||
+ short flags;
|
|||
+ pid_t pgroup;
|
|||
+ sched_param schedparam;
|
|||
+ int schedpolicy;
|
|||
+ SigSetConverter sigmask;
|
|||
+ SigSetConverter sigdefault;
|
|||
+};
|
|||
+
|
|||
+static void ApplyAttrs(short flags, const posix_spawnattr_t* attr) {
|
|||
+ // POSIX: "If POSIX_SPAWN_SETSIGDEF is set ... signals in sigdefault ...
|
|||
+ // shall be set to their default actions in the child process."
|
|||
+ // POSIX: "Signals set to be caught by the calling process shall be
|
|||
+ // set to the default action in the child process."
|
|||
+ bool use_sigdefault = ((flags & POSIX_SPAWN_SETSIGDEF) != 0);
|
|||
+ const struct sigaction default_sa = { .sa_handler = SIG_DFL };
|
|||
+ for (int s = 1; s < _NSIG; ++s) {
|
|||
+ bool reset = false;
|
|||
+ if (use_sigdefault && sigismember(&(*attr)->sigdefault.sigset, s)) {
|
|||
+ reset = true;
|
|||
+ } else {
|
|||
+ struct sigaction current;
|
|||
+ if (sigaction(s, nullptr, ¤t) == -1) _exit(127);
|
|||
+ reset = (current.sa_handler != SIG_IGN && current.sa_handler != SIG_DFL);
|
|||
+ }
|
|||
+ if (reset && sigaction(s, &default_sa, nullptr) == -1) _exit(127);
|
|||
+ }
|
|||
+
|
|||
+ if ((flags & POSIX_SPAWN_SETPGROUP) != 0 && setpgid(0, (*attr)->pgroup) == -1) _exit(127);
|
|||
+ if ((flags & POSIX_SPAWN_SETSID) != 0 && setsid() == -1) _exit(127);
|
|||
+
|
|||
+ // POSIX_SPAWN_SETSCHEDULER overrides POSIX_SPAWN_SETSCHEDPARAM, but it is not an error
|
|||
+ // to set both.
|
|||
+ if ((flags & POSIX_SPAWN_SETSCHEDULER) != 0) {
|
|||
+ if (sched_setscheduler(0, (*attr)->schedpolicy, &(*attr)->schedparam) == -1) _exit(127);
|
|||
+ } else if ((flags & POSIX_SPAWN_SETSCHEDPARAM) != 0) {
|
|||
+ if (sched_setparam(0, &(*attr)->schedparam) == -1) _exit(127);
|
|||
+ }
|
|||
+
|
|||
+ if ((flags & POSIX_SPAWN_RESETIDS) != 0) {
|
|||
+ if (seteuid(getuid()) == -1 || setegid(getgid()) == -1) _exit(127);
|
|||
+ }
|
|||
+
|
|||
+ if ((flags & POSIX_SPAWN_SETSIGMASK) != 0) {
|
|||
+ if (sigprocmask(SIG_SETMASK, &(*attr)->sigmask.sigset, nullptr)) _exit(127);
|
|||
+ }
|
|||
+}
|
|||
+
|
|||
+static int posix_spawn(pid_t* pid_ptr,
|
|||
+ const char* path,
|
|||
+ const posix_spawn_file_actions_t* actions,
|
|||
+ const posix_spawnattr_t* attr,
|
|||
+ char* const argv[],
|
|||
+ char* const env[],
|
|||
+ int exec_fn(const char* path, char* const argv[], char* const env[])) {
|
|||
+ // See http://man7.org/linux/man-pages/man3/posix_spawn.3.html
|
|||
+ // and http://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_spawn.html
|
|||
+
|
|||
+ ScopedSignalBlocker ssb;
|
|||
+
|
|||
+ short flags = attr ? (*attr)->flags : 0;
|
|||
+ bool use_vfork = ((flags & POSIX_SPAWN_USEVFORK) != 0) || (actions == nullptr && flags == 0);
|
|||
+
|
|||
+ pid_t pid = use_vfork ? vfork() : fork();
|
|||
+ if (pid == -1) return errno;
|
|||
+
|
|||
+ if (pid == 0) {
|
|||
+ // Child.
|
|||
+ ApplyAttrs(flags, attr);
|
|||
+ if (actions) (*actions)->Do();
|
|||
+ if ((flags & POSIX_SPAWN_SETSIGMASK) == 0) ssb.reset();
|
|||
+ exec_fn(path, argv, env ? env : environ);
|
|||
+ _exit(127);
|
|||
+ }
|
|||
+
|
|||
+ // Parent.
|
|||
+ if (pid_ptr) *pid_ptr = pid;
|
|||
+ return 0;
|
|||
+}
|
|||
+
|
|||
+int posix_spawn(pid_t* pid, const char* path, const posix_spawn_file_actions_t* actions,
|
|||
+ const posix_spawnattr_t* attr, char* const argv[], char* const env[]) {
|
|||
+ return posix_spawn(pid, path, actions, attr, argv, env, execve);
|
|||
+}
|
|||
+
|
|||
+int posix_spawnp(pid_t* pid, const char* file, const posix_spawn_file_actions_t* actions,
|
|||
+ const posix_spawnattr_t* attr, char* const argv[], char* const env[]) {
|
|||
+ return posix_spawn(pid, file, actions, attr, argv, env, execvpe);
|
|||
+}
|
|||
+
|
|||
+int posix_spawnattr_init(posix_spawnattr_t* attr) {
|
|||
+ *attr = reinterpret_cast<__posix_spawnattr*>(calloc(1, sizeof(__posix_spawnattr)));
|
|||
+ return (*attr == nullptr) ? errno : 0;
|
|||
+}
|
|||
+
|
|||
+int posix_spawnattr_destroy(posix_spawnattr_t* attr) {
|
|||
+ free(*attr);
|
|||
+ *attr = nullptr;
|
|||
+ return 0;
|
|||
+}
|
|||
+
|
|||
+int posix_spawnattr_setflags(posix_spawnattr_t* attr, short flags) {
|
|||
+ if ((flags & ~(POSIX_SPAWN_RESETIDS | POSIX_SPAWN_SETPGROUP | POSIX_SPAWN_SETSIGDEF |
|
|||
+ POSIX_SPAWN_SETSIGMASK | POSIX_SPAWN_SETSCHEDPARAM | POSIX_SPAWN_SETSCHEDULER |
|
|||
+ POSIX_SPAWN_USEVFORK | POSIX_SPAWN_SETSID)) != 0) {
|
|||
+ return EINVAL;
|
|||
+ }
|
|||
+ (*attr)->flags = flags;
|
|||
+ return 0;
|
|||
+}
|
|||
+
|
|||
+int posix_spawnattr_getflags(const posix_spawnattr_t* attr, short* flags) {
|
|||
+ *flags = (*attr)->flags;
|
|||
+ return 0;
|
|||
+}
|
|||
+
|
|||
+int posix_spawnattr_setpgroup(posix_spawnattr_t* attr, pid_t pgroup) {
|
|||
+ (*attr)->pgroup = pgroup;
|
|||
+ return 0;
|
|||
+}
|
|||
+
|
|||
+int posix_spawnattr_getpgroup(const posix_spawnattr_t* attr, pid_t* pgroup) {
|
|||
+ *pgroup = (*attr)->pgroup;
|
|||
+ return 0;
|
|||
+}
|
|||
+
|
|||
+int posix_spawnattr_setsigmask(posix_spawnattr_t* attr, const sigset_t* mask) {
|
|||
+ (*attr)->sigmask.sigset = *mask;
|
|||
+ return 0;
|
|||
+}
|
|||
+
|
|||
+int posix_spawnattr_setsigmask64(posix_spawnattr_t* attr, const sigset64_t* mask) {
|
|||
+ (*attr)->sigmask.sigset64 = *mask;
|
|||
+ return 0;
|
|||
+}
|
|||
+
|
|||
+int posix_spawnattr_getsigmask(const posix_spawnattr_t* attr, sigset_t* mask) {
|
|||
+ *mask = (*attr)->sigmask.sigset;
|
|||
+ return 0;
|
|||
+}
|
|||
+
|
|||
+int posix_spawnattr_getsigmask64(const posix_spawnattr_t* attr, sigset64_t* mask) {
|
|||
+ *mask = (*attr)->sigmask.sigset64;
|
|||
+ return 0;
|
|||
+}
|
|||
+
|
|||
+int posix_spawnattr_setsigdefault(posix_spawnattr_t* attr, const sigset_t* mask) {
|
|||
+ (*attr)->sigdefault.sigset = *mask;
|
|||
+ return 0;
|
|||
+}
|
|||
+
|
|||
+int posix_spawnattr_setsigdefault64(posix_spawnattr_t* attr, const sigset64_t* mask) {
|
|||
+ (*attr)->sigdefault.sigset64 = *mask;
|
|||
+ return 0;
|
|||
+}
|
|||
+
|
|||
+int posix_spawnattr_getsigdefault(const posix_spawnattr_t* attr, sigset_t* mask) {
|
|||
+ *mask = (*attr)->sigdefault.sigset;
|
|||
+ return 0;
|
|||
+}
|
|||
+
|
|||
+int posix_spawnattr_getsigdefault64(const posix_spawnattr_t* attr, sigset64_t* mask) {
|
|||
+ *mask = (*attr)->sigdefault.sigset64;
|
|||
+ return 0;
|
|||
+}
|
|||
+
|
|||
+int posix_spawnattr_setschedparam(posix_spawnattr_t* attr, const struct sched_param* param) {
|
|||
+ (*attr)->schedparam = *param;
|
|||
+ return 0;
|
|||
+}
|
|||
+
|
|||
+int posix_spawnattr_getschedparam(const posix_spawnattr_t* attr, struct sched_param* param) {
|
|||
+ *param = (*attr)->schedparam;
|
|||
+ return 0;
|
|||
+}
|
|||
+
|
|||
+int posix_spawnattr_setschedpolicy(posix_spawnattr_t* attr, int policy) {
|
|||
+ (*attr)->schedpolicy = policy;
|
|||
+ return 0;
|
|||
+}
|
|||
+
|
|||
+int posix_spawnattr_getschedpolicy(const posix_spawnattr_t* attr, int* policy) {
|
|||
+ *policy = (*attr)->schedpolicy;
|
|||
+ return 0;
|
|||
+}
|
|||
+
|
|||
+int posix_spawn_file_actions_init(posix_spawn_file_actions_t* actions) {
|
|||
+ *actions = reinterpret_cast<__posix_spawn_file_actions*>(calloc(1, sizeof(**actions)));
|
|||
+ return (*actions == nullptr) ? errno : 0;
|
|||
+}
|
|||
+
|
|||
+int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t* actions) {
|
|||
+ __posix_spawn_file_action* a = (*actions)->head;
|
|||
+ while (a) {
|
|||
+ __posix_spawn_file_action* last = a;
|
|||
+ a = a->next;
|
|||
+ free(last->path);
|
|||
+ free(last);
|
|||
+ }
|
|||
+ free(*actions);
|
|||
+ *actions = nullptr;
|
|||
+ return 0;
|
|||
+}
|
|||
+
|
|||
+static int posix_spawn_add_file_action(posix_spawn_file_actions_t* actions,
|
|||
+ Action what,
|
|||
+ int fd,
|
|||
+ int new_fd,
|
|||
+ const char* path,
|
|||
+ int flags,
|
|||
+ mode_t mode) {
|
|||
+ __posix_spawn_file_action* action =
|
|||
+ reinterpret_cast<__posix_spawn_file_action*>(malloc(sizeof(*action)));
|
|||
+ if (action == nullptr) return errno;
|
|||
+
|
|||
+ action->next = nullptr;
|
|||
+ if (path != nullptr) {
|
|||
+ action->path = strdup(path);
|
|||
+ if (action->path == nullptr) {
|
|||
+ free(action);
|
|||
+ return errno;
|
|||
+ }
|
|||
+ } else {
|
|||
+ action->path = nullptr;
|
|||
+ }
|
|||
+ action->what = what;
|
|||
+ action->fd = fd;
|
|||
+ action->new_fd = new_fd;
|
|||
+ action->flags = flags;
|
|||
+ action->mode = mode;
|
|||
+
|
|||
+ if ((*actions)->head == nullptr) {
|
|||
+ (*actions)->head = (*actions)->last = action;
|
|||
+ } else {
|
|||
+ (*actions)->last->next = action;
|
|||
+ (*actions)->last = action;
|
|||
+ }
|
|||
+
|
|||
+ return 0;
|
|||
+}
|
|||
+
|
|||
+int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t* actions,
|
|||
+ int fd, const char* path, int flags, mode_t mode) {
|
|||
+ if (fd < 0) return EBADF;
|
|||
+ return posix_spawn_add_file_action(actions, kOpen, -1, fd, path, flags, mode);
|
|||
+}
|
|||
+
|
|||
+int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t* actions, int fd) {
|
|||
+ if (fd < 0) return EBADF;
|
|||
+ return posix_spawn_add_file_action(actions, kClose, fd, -1, nullptr, 0, 0);
|
|||
+}
|
|||
+
|
|||
+int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t* actions, int fd, int new_fd) {
|
|||
+ if (fd < 0 || new_fd < 0) return EBADF;
|
|||
+ return posix_spawn_add_file_action(actions, kDup2, fd, new_fd, nullptr, 0, 0);
|
|||
+}
|
@ -0,0 +1,96 @@ |
|||
diff --git a/src/spawn.h b/src/spawn.h
|
|||
new file mode 100644 |
|||
index 0000000..2e239bf
|
|||
--- /dev/null
|
|||
+++ b/src/spawn.h
|
|||
@@ -0,0 +1,90 @@
|
|||
+/*
|
|||
+ * Copyright (C) 2017 The Android Open Source Project
|
|||
+ * All rights reserved.
|
|||
+ *
|
|||
+ * Redistribution and use in source and binary forms, with or without
|
|||
+ * modification, are permitted provided that the following conditions
|
|||
+ * are met:
|
|||
+ * * Redistributions of source code must retain the above copyright
|
|||
+ * notice, this list of conditions and the following disclaimer.
|
|||
+ * * Redistributions in binary form must reproduce the above copyright
|
|||
+ * notice, this list of conditions and the following disclaimer in
|
|||
+ * the documentation and/or other materials provided with the
|
|||
+ * distribution.
|
|||
+ *
|
|||
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|||
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|||
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|||
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|||
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|||
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|||
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|||
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|||
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|||
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
|||
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|||
+ * SUCH DAMAGE.
|
|||
+ */
|
|||
+
|
|||
+#ifndef _SPAWN_H_
|
|||
+#define _SPAWN_H_
|
|||
+
|
|||
+#include <sys/cdefs.h>
|
|||
+#include <sys/types.h>
|
|||
+#include <sched.h>
|
|||
+#include <signal.h>
|
|||
+
|
|||
+__BEGIN_DECLS
|
|||
+
|
|||
+#define POSIX_SPAWN_RESETIDS 1
|
|||
+#define POSIX_SPAWN_SETPGROUP 2
|
|||
+#define POSIX_SPAWN_SETSIGDEF 4
|
|||
+#define POSIX_SPAWN_SETSIGMASK 8
|
|||
+#define POSIX_SPAWN_SETSCHEDPARAM 16
|
|||
+#define POSIX_SPAWN_SETSCHEDULER 32
|
|||
+#if defined(__USE_GNU)
|
|||
+#define POSIX_SPAWN_USEVFORK 64
|
|||
+#define POSIX_SPAWN_SETSID 128
|
|||
+#endif
|
|||
+
|
|||
+typedef struct __posix_spawnattr* posix_spawnattr_t;
|
|||
+typedef struct __posix_spawn_file_actions* posix_spawn_file_actions_t;
|
|||
+
|
|||
+int posix_spawn(pid_t* __pid, const char* __path, const posix_spawn_file_actions_t* __actions, const posix_spawnattr_t* __attr, char* const __argv[], char* const __env[]) __INTRODUCED_IN(28);
|
|||
+int posix_spawnp(pid_t* __pid, const char* __file, const posix_spawn_file_actions_t* __actions, const posix_spawnattr_t* __attr, char* const __argv[], char* const __env[]) __INTRODUCED_IN(28);
|
|||
+
|
|||
+int posix_spawnattr_init(posix_spawnattr_t* __attr) __INTRODUCED_IN(28);
|
|||
+int posix_spawnattr_destroy(posix_spawnattr_t* __attr) __INTRODUCED_IN(28);
|
|||
+
|
|||
+int posix_spawnattr_setflags(posix_spawnattr_t* __attr, short __flags) __INTRODUCED_IN(28);
|
|||
+int posix_spawnattr_getflags(const posix_spawnattr_t* __attr, short* __flags) __INTRODUCED_IN(28);
|
|||
+
|
|||
+int posix_spawnattr_setpgroup(posix_spawnattr_t* __attr, pid_t __pgroup) __INTRODUCED_IN(28);
|
|||
+int posix_spawnattr_getpgroup(const posix_spawnattr_t* __attr, pid_t* __pgroup) __INTRODUCED_IN(28);
|
|||
+
|
|||
+int posix_spawnattr_setsigmask(posix_spawnattr_t* __attr, const sigset_t* __mask) __INTRODUCED_IN(28);
|
|||
+int posix_spawnattr_setsigmask64(posix_spawnattr_t* __attr, const sigset64_t* __mask) __INTRODUCED_IN(28);
|
|||
+int posix_spawnattr_getsigmask(const posix_spawnattr_t* __attr, sigset_t* __mask) __INTRODUCED_IN(28);
|
|||
+int posix_spawnattr_getsigmask64(const posix_spawnattr_t* __attr, sigset64_t* __mask) __INTRODUCED_IN(28);
|
|||
+
|
|||
+int posix_spawnattr_setsigdefault(posix_spawnattr_t* __attr, const sigset_t* __mask) __INTRODUCED_IN(28);
|
|||
+int posix_spawnattr_setsigdefault64(posix_spawnattr_t* __attr, const sigset64_t* __mask) __INTRODUCED_IN(28);
|
|||
+int posix_spawnattr_getsigdefault(const posix_spawnattr_t* __attr, sigset_t* __mask) __INTRODUCED_IN(28);
|
|||
+int posix_spawnattr_getsigdefault64(const posix_spawnattr_t* __attr, sigset64_t* __mask) __INTRODUCED_IN(28);
|
|||
+
|
|||
+int posix_spawnattr_setschedparam(posix_spawnattr_t* __attr, const struct sched_param* __param) __INTRODUCED_IN(28);
|
|||
+int posix_spawnattr_getschedparam(const posix_spawnattr_t* __attr, struct sched_param* __param) __INTRODUCED_IN(28);
|
|||
+
|
|||
+int posix_spawnattr_setschedpolicy(posix_spawnattr_t* __attr, int __policy) __INTRODUCED_IN(28);
|
|||
+int posix_spawnattr_getschedpolicy(const posix_spawnattr_t* __attr, int* __policy) __INTRODUCED_IN(28);
|
|||
+
|
|||
+int posix_spawn_file_actions_init(posix_spawn_file_actions_t* __actions) __INTRODUCED_IN(28);
|
|||
+int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t* __actions) __INTRODUCED_IN(28);
|
|||
+
|
|||
+int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t* __actions, int __fd, const char* __path, int __flags, mode_t __mode) __INTRODUCED_IN(28);
|
|||
+int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t* __actions, int __fd) __INTRODUCED_IN(28);
|
|||
+int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t* __actions, int __fd, int __new_fd) __INTRODUCED_IN(28);
|
|||
+
|
|||
+__END_DECLS
|
|||
+
|
|||
+#endif
|
@ -1,8 +1,8 @@ |
|||
TERMUX_PKG_HOMEPAGE=https://github.com/jarun/nnn |
|||
TERMUX_PKG_DESCRIPTION="Free, fast, friendly file browser" |
|||
TERMUX_PKG_LICENSE="BSD 2-Clause" |
|||
TERMUX_PKG_VERSION=2.2 |
|||
TERMUX_PKG_SHA256=88dd08d624ae7a61ef749b1e258e4b29ed61ba9fcc5a18813f291ce80efc5e74 |
|||
TERMUX_PKG_VERSION=2.3 |
|||
TERMUX_PKG_SHA256=eaad2ccf0d781aeeb38fdfc4ad75a0405ca3da4f82ded64cce766a74a2b299ab |
|||
TERMUX_PKG_SRCURL=https://github.com/jarun/nnn/archive/v${TERMUX_PKG_VERSION}.tar.gz |
|||
TERMUX_PKG_DEPENDS="file, findutils, ncurses" |
|||
TERMUX_PKG_DEPENDS="file, findutils, readline" |
|||
TERMUX_PKG_BUILD_IN_SRC=yes |
|||
|
@ -1,23 +1,25 @@ |
|||
TERMUX_PKG_HOMEPAGE=http://profanity.im |
|||
TERMUX_PKG_DESCRIPTION="Profanity is a console based XMPP client written in C using ncurses and libstrophe, inspired by Irssi" |
|||
TERMUX_PKG_LICENSE="GPL-3.0" |
|||
TERMUX_PKG_VERSION=0.5.1 |
|||
TERMUX_PKG_REVISION=3 |
|||
TERMUX_PKG_VERSION=0.6.0 |
|||
TERMUX_PKG_REVISION=1 |
|||
TERMUX_PKG_MAINTAINER="Oliver Schmidhauser @Neo-Oli" |
|||
TERMUX_PKG_SRCURL=http://profanity.im/profanity-${TERMUX_PKG_VERSION}.tar.gz |
|||
TERMUX_PKG_SHA256=e3513713e74ec3363fbdbac2919bdc17e249988780cc5a4589d1425807a7feb8 |
|||
TERMUX_PKG_DEPENDS="libandroid-support,ncurses,glib,libmesode,libcurl,readline,libuuid,libotr,gpgme,python" |
|||
TERMUX_PKG_SHA256=51b0932924a391656423af0d85f14dde049ac1e94214f948849d37df1c2759c4 |
|||
TERMUX_PKG_DEPENDS="libandroid-support, ncurses, glib, libmesode, libcurl, readline, libuuid, libotr, gpgme, python, libassuan, libgpg-error" |
|||
# openssl, libexpat needed by libmesode, pcre needed by glib: |
|||
TERMUX_PKG_BUILD_DEPENDS="openssl, libexpat, pcre, libgcrypt-dev, libcrypt-dev" |
|||
TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" --disable-python-plugins" |
|||
TERMUX_PKG_BUILD_IN_SRC=yes |
|||
|
|||
termux_step_pre_configure() { |
|||
CPPFLAGS+=" -I$TERMUX_PREFIX/include/python3.7m" |
|||
LDFLAGS+=" -lpython3.7m" |
|||
CPPFLAGS+=" -I$TERMUX_PREFIX/include/python3.7m" |
|||
LDFLAGS+=" -lpython3.7m" |
|||
} |
|||
|
|||
termux_step_post_configure() { |
|||
# Enable python support manually, as trying to go using --enable-python-plugins |
|||
# causes configure trying to execut python: |
|||
echo '#define HAVE_PYTHON 1' >> $TERMUX_PKG_SRCDIR/src/config.h |
|||
perl -p -i -e 's|#am__objects_2|am__objects_2|' $TERMUX_PKG_SRCDIR/Makefile |
|||
# Enable python support manually, as trying to go using --enable-python-plugins |
|||
# causes configure trying to execute python: |
|||
echo '#define HAVE_PYTHON 1' >> $TERMUX_PKG_SRCDIR/src/config.h |
|||
perl -p -i -e 's|#am__objects_2|am__objects_2|' $TERMUX_PKG_SRCDIR/Makefile |
|||
} |
|||
|
@ -1,21 +0,0 @@ |
|||
--- /home/vagrant/ruby-2.5.0/configure.ac 2017-12-15 09:43:40.000000000 +0000
|
|||
+++ src/configure.ac 2018-02-14 19:07:11.272257521 +0000
|
|||
@@ -742,7 +742,7 @@
|
|||
rb_cv_warnflags="$warnflags" |
|||
AS_IF([test "$GCC:${warnflags+set}:no" = yes::no], [ |
|||
AS_IF([test $gcc_major -ge 4], [ |
|||
- extra_warning=-Werror=extra-tokens
|
|||
+ extra_warning=
|
|||
], [ |
|||
extra_warning= |
|||
]) |
|||
@@ -765,9 +765,7 @@
|
|||
-Werror=pointer-arith \ |
|||
-Werror=write-strings \ |
|||
-Werror=declaration-after-statement \ |
|||
- -Werror=shorten-64-to-32 \
|
|||
-Werror=implicit-function-declaration \ |
|||
- -Werror=division-by-zero \
|
|||
-Werror=deprecated-declarations \ |
|||
-Werror=misleading-indentation \ |
|||
-Wno-packed-bitfield-compat \ |
@ -1,21 +0,0 @@ |
|||
--- /home/vagrant/ruby-2.5.0/configure 2017-12-25 07:00:28.000000000 +0000
|
|||
+++ src/configure 2018-02-14 19:06:28.742701948 +0000
|
|||
@@ -7434,7 +7434,7 @@
|
|||
|
|||
if test $gcc_major -ge 4; then : |
|||
|
|||
- extra_warning=-Werror=extra-tokens
|
|||
+ extra_warning=
|
|||
|
|||
else |
|||
|
|||
@@ -7464,9 +7464,7 @@
|
|||
-Werror=pointer-arith \ |
|||
-Werror=write-strings \ |
|||
-Werror=declaration-after-statement \ |
|||
- -Werror=shorten-64-to-32 \
|
|||
-Werror=implicit-function-declaration \ |
|||
- -Werror=division-by-zero \
|
|||
-Werror=deprecated-declarations \ |
|||
-Werror=misleading-indentation \ |
|||
-Wno-packed-bitfield-compat \ |
@ -1,13 +0,0 @@ |
|||
--- /home/vagrant/ruby-2.5.0/lib/fileutils.rb 2017-12-22 08:00:10.000000000 +0000
|
|||
+++ ./lib/fileutils.rb 2018-02-17 23:19:55.344655246 +0000
|
|||
@@ -744,8 +744,8 @@
|
|||
# |
|||
def compare_stream(a, b) |
|||
bsize = fu_stream_blksize(a, b) |
|||
- sa = String.new(capacity: bsize)
|
|||
- sb = String.new(capacity: bsize)
|
|||
+ sa = String.new
|
|||
+ sb = String.new
|
|||
begin |
|||
a.read(bsize, sa) |
|||
b.read(bsize, sb) |
@ -1,14 +0,0 @@ |
|||
diff -u -r ../ruby-2.4.0/lib/rubygems/defaults.rb ./lib/rubygems/defaults.rb
|
|||
--- ../ruby-2.4.0/lib/rubygems/defaults.rb 2016-06-24 06:13:11.000000000 +0200
|
|||
+++ ./lib/rubygems/defaults.rb 2017-01-31 22:53:59.125074751 +0100
|
|||
@@ -191,6 +191,9 @@
|
|||
# end |
|||
|
|||
def self.platform_defaults |
|||
- {}
|
|||
+ {
|
|||
+ 'install' => '--no-rdoc --no-ri --env-shebang',
|
|||
+ 'update' => '--no-rdoc --no-ri --env-shebang'
|
|||
+ }
|
|||
end |
|||
end |
@ -1,12 +0,0 @@ |
|||
diff -u -r ../ruby-2.4.0/lib/rubygems/installer.rb ./lib/rubygems/installer.rb
|
|||
--- ../ruby-2.4.0/lib/rubygems/installer.rb 2016-09-28 03:16:43.000000000 +0200
|
|||
+++ ./lib/rubygems/installer.rb 2017-01-31 22:49:11.992624578 +0100
|
|||
@@ -31,7 +31,7 @@
|
|||
# Paths where env(1) might live. Some systems are broken and have it in |
|||
# /bin |
|||
|
|||
- ENV_PATHS = %w[/usr/bin/env /bin/env]
|
|||
+ ENV_PATHS = %w[@TERMUX_PREFIX@/bin/env /usr/bin/env]
|
|||
|
|||
## |
|||
# Deprecated in favor of Gem::Ext::BuildError |
@ -1,11 +0,0 @@ |
|||
--- /home/vagrant/ruby-2.5.0/template/configure-ext.mk.tmpl 2017-04-23 16:19:22.000000000 +0000
|
|||
+++ ./template/configure-ext.mk.tmpl 2018-02-17 23:31:02.304445580 +0000
|
|||
@@ -24,7 +24,7 @@
|
|||
MINIRUBY = <%=miniruby%> |
|||
SCRIPT_ARGS = <%=script_args%> |
|||
EXTMK_ARGS = $(SCRIPT_ARGS) --gnumake=$(gnumake) --extflags="$(EXTLDFLAGS)" \ |
|||
- --make-flags='MINIRUBY=$(MINIRUBY)'
|
|||
+ --make-flags="MINIRUBY='$(MINIRUBY)'"
|
|||
|
|||
all: exts gems |
|||
exts: |
Loading…
Reference in new issue