new package: libpoco

This commit is contained in:
Tee KOBAYASHI 2021-12-28 23:55:51 +09:00 committed by Leonid Pliushch
parent 7d537368bf
commit 72fff815c7
5 changed files with 123 additions and 0 deletions

View File

@ -0,0 +1,11 @@
--- a/Foundation/src/NamedEvent_UNIX.cpp
+++ b/Foundation/src/NamedEvent_UNIX.cpp
@@ -137,7 +137,7 @@
#if defined(sun) || defined(__APPLE__) || defined(__QNX__)
std::string fn = "/";
#else
- std::string fn = "/tmp/";
+ std::string fn = "@TERMUX_PREFIX@/tmp/";
#endif
fn.append(_name);
fn.append(".event");

View File

@ -0,0 +1,11 @@
--- a/Foundation/src/NamedMutex_UNIX.cpp
+++ b/Foundation/src/NamedMutex_UNIX.cpp
@@ -158,7 +158,7 @@
#if defined(sun) || defined(__APPLE__) || defined(__QNX__)
std::string fn = "/";
#else
- std::string fn = "/tmp/";
+ std::string fn = "@TERMUX_PREFIX@/tmp/";
#endif
fn.append(_name);
fn.append(".mutex");

View File

@ -0,0 +1,20 @@
--- a/Foundation/src/Path_UNIX.cpp
+++ b/Foundation/src/Path_UNIX.cpp
@@ -199,7 +199,7 @@
}
else
{
- path = "/tmp/";
+ path = "@TERMUX_PREFIX@/tmp/";
}
return path;
}
@@ -212,7 +212,7 @@
#if POCO_OS == POCO_OS_MAC_OS_X
path = "/Library/Preferences/";
#else
- path = "/etc/";
+ path = "@TERMUX_PREFIX@/etc/";
#endif
return path;
}

View File

@ -0,0 +1,71 @@
--- a/Foundation/src/SharedMemory_POSIX.cpp
+++ b/Foundation/src/SharedMemory_POSIX.cpp
@@ -21,6 +21,68 @@
#include <fcntl.h>
#include <unistd.h>
+extern "C" {
+#ifdef __ANDROID__
+static int shm_open(const char *name, int oflag, mode_t mode) {
+ size_t namelen;
+ char *fname;
+ int fd;
+
+ /* Construct the filename. */
+ while (name[0] == '/') ++name;
+
+ if (name[0] == '\0') {
+ /* The name "/" is not supported. */
+ errno = EINVAL;
+ return -1;
+ }
+
+ namelen = strlen(name);
+ fname = (char *) alloca(sizeof("@TERMUX_PREFIX@/tmp/") - 1 + namelen + 1);
+ memcpy(fname, "@TERMUX_PREFIX@/tmp/", sizeof("@TERMUX_PREFIX@/tmp/") - 1);
+ memcpy(fname + sizeof("@TERMUX_PREFIX@/tmp/") - 1, name, namelen + 1);
+
+ fd = open(fname, oflag, mode);
+ if (fd != -1) {
+ /* We got a descriptor. Now set the FD_CLOEXEC bit. */
+ int flags = fcntl(fd, F_GETFD, 0);
+ flags |= FD_CLOEXEC;
+ flags = fcntl(fd, F_SETFD, flags);
+
+ if (flags == -1) {
+ /* Something went wrong. We cannot return the descriptor. */
+ int save_errno = errno;
+ close(fd);
+ fd = -1;
+ errno = save_errno;
+ }
+ }
+
+ return fd;
+}
+
+static int shm_unlink(const char *name) {
+ size_t namelen;
+ char *fname;
+
+ /* Construct the filename. */
+ while (name[0] == '/') ++name;
+
+ if (name[0] == '\0') {
+ /* The name "/" is not supported. */
+ errno = EINVAL;
+ return -1;
+ }
+
+ namelen = strlen(name);
+ fname = (char *) alloca(sizeof("@TERMUX_PREFIX@/tmp/") - 1 + namelen + 1);
+ memcpy(fname, "@TERMUX_PREFIX@/tmp/", sizeof("@TERMUX_PREFIX@/tmp/") - 1);
+ memcpy(fname + sizeof("@TERMUX_PREFIX@/tmp/") - 1, name, namelen + 1);
+
+ return unlink(fname);
+}
+#endif
+}
namespace Poco {

10
packages/libpoco/build.sh Normal file
View File

@ -0,0 +1,10 @@
TERMUX_PKG_HOMEPAGE=https://pocoproject.org/
TERMUX_PKG_DESCRIPTION="A comprehensive set of C++ libraries that cover all modern-day programming needs"
TERMUX_PKG_LICENSE="BSL-1.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=1.11.1
TERMUX_PKG_SRCURL=https://github.com/pocoproject/poco/archive/refs/tags/poco-${TERMUX_PKG_VERSION}-release.tar.gz
TERMUX_PKG_SHA256=2412a5819a239ff2ee58f81033bcc39c40460d7a8b330013a687c8c0bd2b4ac0
TERMUX_PKG_DEPENDS="libc++, libexpat, openssl, pcre, sqlite, zlib"
TERMUX_PKG_FORCE_CMAKE=true
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="-DPOCO_UNBUNDLED=ON"