diff --git a/packages/libpoco/Foundation-src-NamedEvent_UNIX.cpp.patch b/packages/libpoco/Foundation-src-NamedEvent_UNIX.cpp.patch new file mode 100644 index 000000000..42a1c2115 --- /dev/null +++ b/packages/libpoco/Foundation-src-NamedEvent_UNIX.cpp.patch @@ -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"); diff --git a/packages/libpoco/Foundation-src-NamedMutex_UNIX.cpp.patch b/packages/libpoco/Foundation-src-NamedMutex_UNIX.cpp.patch new file mode 100644 index 000000000..ab992c639 --- /dev/null +++ b/packages/libpoco/Foundation-src-NamedMutex_UNIX.cpp.patch @@ -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"); diff --git a/packages/libpoco/Foundation-src-Path_UNIX.cpp.patch b/packages/libpoco/Foundation-src-Path_UNIX.cpp.patch new file mode 100644 index 000000000..32b3c0d94 --- /dev/null +++ b/packages/libpoco/Foundation-src-Path_UNIX.cpp.patch @@ -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; + } diff --git a/packages/libpoco/Foundation-src-SharedMemory_POSIX.cpp.patch b/packages/libpoco/Foundation-src-SharedMemory_POSIX.cpp.patch new file mode 100644 index 000000000..e8df938ed --- /dev/null +++ b/packages/libpoco/Foundation-src-SharedMemory_POSIX.cpp.patch @@ -0,0 +1,71 @@ +--- a/Foundation/src/SharedMemory_POSIX.cpp ++++ b/Foundation/src/SharedMemory_POSIX.cpp +@@ -21,6 +21,68 @@ + #include + #include + ++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 { + diff --git a/packages/libpoco/build.sh b/packages/libpoco/build.sh new file mode 100644 index 000000000..ffee8740c --- /dev/null +++ b/packages/libpoco/build.sh @@ -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"