monetdb: Use libandroid-sysv-semaphore

This commit is contained in:
Tee KOBAYASHI 2022-03-28 07:48:56 +09:00 committed by xtkoba
parent eb0e8b8e99
commit 2c329c8bfd
4 changed files with 7 additions and 108 deletions

View File

@ -3,13 +3,16 @@ TERMUX_PKG_DESCRIPTION="A high-performance database kernel for query-intensive a
TERMUX_PKG_LICENSE="MPL-2.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=11.41.13
TERMUX_PKG_REVISION=2
TERMUX_PKG_REVISION=3
TERMUX_PKG_SRCURL=https://www.monetdb.org/downloads/sources/archive/MonetDB-${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_SHA256=7738e106ac3a39bfb37feb8efa9a050a412fb332ab58c29a8aad23c01ba42197
TERMUX_PKG_DEPENDS="libbz2, libcurl, libiconv, liblz4, liblzma, libpcreposix, libuuid, libxml2, netcdf-c, openssl, readline, zlib"
TERMUX_PKG_DEPENDS="libandroid-sysv-semaphore, libbz2, libcurl, libiconv, liblz4, liblzma, libpcreposix, libuuid, libxml2, netcdf-c, openssl, readline, zlib"
termux_step_post_get_source() {
find . -name '*.c' | xargs -n 1 sed -i \
-e 's:"\(/tmp\):"'$TERMUX_PREFIX'\1:g'
cp $TERMUX_PKG_BUILDER_DIR/sys_sem.c gdk/
}
termux_step_pre_configure() {
LDFLAGS+=" -landroid-sysv-semaphore"
}

View File

@ -1,10 +0,0 @@
--- a/gdk/CMakeLists.txt
+++ b/gdk/CMakeLists.txt
@@ -79,6 +79,7 @@
gdk_analytic_func.c
gdk_analytic.h
gdk_tracer.c gdk_tracer.h
+ sys_sem.c
PUBLIC
${gdk_public_headers})

View File

@ -1,6 +1,6 @@
--- a/gdk/gdk_interprocess.c
+++ b/gdk/gdk_interprocess.c
@@ -19,14 +19,26 @@
@@ -19,7 +19,11 @@
#include <sys/types.h>
#include <sys/ipc.h>
@ -12,18 +12,3 @@
#include <sys/wait.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sched.h>
+#ifndef __ANDROID__
#include <sys/sem.h>
+#else
+#include <linux/sem.h>
+#define semid_ds semid64_ds
+int semctl(int, int, int, ...);
+int semget(key_t, int, int);
+int semop(int, struct sembuf *, size_t);
+#endif
#include <time.h>
static ATOMIC_TYPE interprocess_unique_id = ATOMIC_VAR_INIT(1);

View File

@ -1,79 +0,0 @@
/*
* Copyright (C) 2016 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 <linux/sem.h>
#include <stdarg.h>
#include <sys/syscall.h>
#include <unistd.h>
#pragma GCC visibility push(hidden)
int semtimedop(int id, struct sembuf* ops, size_t op_count, const struct timespec* ts) {
#if defined(SYS_semtimedop)
return syscall(SYS_semtimedop, id, ops, op_count, ts);
#else
return syscall(SYS_ipc, SEMTIMEDOP, id, op_count, 0, ops, ts);
#endif
}
union semun {
int val;
struct semid_ds *buf;
unsigned short *array;
} semu;
int semctl(int id, int num, int cmd, ...) {
#if !defined(__LP64__)
// Annoyingly, the kernel requires this for 32-bit but rejects it for 64-bit.
cmd |= IPC_64;
#endif
va_list ap;
va_start(ap, cmd);
union semun arg = va_arg(ap, union semun);
va_end(ap);
#if defined(SYS_semctl)
return syscall(SYS_semctl, id, num, cmd, arg);
#else
return syscall(SYS_ipc, SEMCTL, id, num, cmd, &arg, 0);
#endif
}
int semget(key_t key, int n, int flags) {
#if defined(SYS_semget)
return syscall(SYS_semget, key, n, flags);
#else
return syscall(SYS_ipc, SEMGET, key, n, flags, 0, 0);
#endif
}
int semop(int id, struct sembuf* ops, size_t op_count) {
return semtimedop(id, ops, op_count, NULL);
}
#pragma GCC visibility pop