new package: cups (#5472)

This commit is contained in:
Janrupf 2020-07-09 01:02:18 +02:00 committed by GitHub
parent 7c5b881d04
commit 583cef40fc
5 changed files with 177 additions and 0 deletions

16
packages/cups/build.sh Normal file
View File

@ -0,0 +1,16 @@
TERMUX_PKG_HOMEPAGE="https://www.cups.org/"
TERMUX_PKG_DESCRIPTION="Common UNIX Printing System"
TERMUX_PKG_LICENSE="Apache-2.0"
TERMUX_PKG_LICENSE_FILE="LICENSE"
TERMUX_PKG_VERSION="2.3.3"
TERMUX_PKG_SRCURL="https://github.com/apple/cups/releases/download/v${TERMUX_PKG_VERSION}/cups-${TERMUX_PKG_VERSION}-source.tar.gz"
TERMUX_PKG_SHA256="261fd948bce8647b6d5cb2a1784f0c24cc52b5c4e827b71d726020bcc502f3ee"
TERMUX_PKG_DEPENDS="libiconv, libcrypt"
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_CONFFILES="etc/cups/cups-files.conf, etc/cups/cupsd.conf, etc/cups/snmp.conf"
termux_step_make() {
cd "$TERMUX_PKG_BUILDDIR"
make LIBS="-pthread -lm -lcrypt -liconv -lz -L$TERMUX_PREFIX/lib -Wl,-rpath=$TERMUX_PREFIX/lib -Wl,--enable-new-dtags -Wl,--as-needed -Wl,-z,relro,-z,now -Wl,--hash-style=both" -j${TERMUX_MAKE_PROCESSES}
}

View File

@ -0,0 +1,26 @@
--- src/desktop/Makefile 2020-04-27 18:04:29.000000000 +0000
+++ src-mod/desktop/Makefile 2020-07-05 14:29:13.280000000 +0000
@@ -62,23 +62,6 @@
$(INSTALL_DIR) -m 755 $(BUILDROOT)$(DBUSDIR)/system.d; \
$(INSTALL_DATA) cups.conf $(BUILDROOT)$(DBUSDIR)/system.d/cups.conf; \
fi
- if test "x$(MENUDIR)" != x; then \
- echo Installing desktop menu...; \
- $(INSTALL_DIR) -m 755 $(BUILDROOT)$(MENUDIR); \
- $(INSTALL_DATA) cups.desktop $(BUILDROOT)$(MENUDIR); \
- fi
- if test "x$(ICONDIR)" != x; then \
- echo Installing desktop icons...; \
- $(INSTALL_DIR) -m 755 $(BUILDROOT)$(ICONDIR)/hicolor/16x16/apps; \
- $(INSTALL_DATA) cups-16.png $(BUILDROOT)$(ICONDIR)/hicolor/16x16/apps/cups.png; \
- $(INSTALL_DIR) -m 755 $(BUILDROOT)$(ICONDIR)/hicolor/32x32/apps; \
- $(INSTALL_DATA) cups-32.png $(BUILDROOT)$(ICONDIR)/hicolor/32x32/apps/cups.png; \
- $(INSTALL_DIR) -m 755 $(BUILDROOT)$(ICONDIR)/hicolor/64x64/apps; \
- $(INSTALL_DATA) cups-64.png $(BUILDROOT)$(ICONDIR)/hicolor/64x64/apps/cups.png; \
- $(INSTALL_DIR) -m 755 $(BUILDROOT)$(ICONDIR)/hicolor/128x128/apps; \
- $(INSTALL_DATA) cups-128.png $(BUILDROOT)$(ICONDIR)/hicolor/128x128/apps/cups.png; \
- fi
-
#
# Install programs...

View File

@ -0,0 +1,52 @@
--- src/scheduler/Makefile 2020-04-27 18:04:29.000000000 +0000
+++ src-mod/scheduler/Makefile 2020-07-05 14:20:05.730000000 +0000
@@ -163,48 +163,11 @@
$(INSTALL_DIR) -m 1770 -g $(CUPS_GROUP) $(REQUESTS)/tmp
echo Creating $(CACHEDIR)...
$(INSTALL_DIR) -m 770 -g $(CUPS_GROUP) $(CACHEDIR)
- if test "x$(INITDIR)" != x; then \
- echo Installing init scripts...; \
- $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/init.d; \
- $(INSTALL_SCRIPT) cups.sh $(BUILDROOT)$(INITDIR)/init.d/cups; \
- for level in $(RCLEVELS); do \
- $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc$${level}.d; \
- $(LN) ../init.d/cups $(BUILDROOT)$(INITDIR)/rc$${level}.d/S$(RCSTART)cups; \
- $(LN) ../init.d/cups $(BUILDROOT)$(INITDIR)/rc$${level}.d/K$(RCSTOP)cups; \
- done; \
- $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDIR)/rc0.d; \
- $(LN) ../init.d/cups $(BUILDROOT)$(INITDIR)/rc0.d/K$(RCSTOP)cups; \
- fi
- if test "x$(INITDDIR)" != x; then \
- echo Installing init script...; \
- $(INSTALL_DIR) -m 755 $(BUILDROOT)$(INITDDIR); \
- $(INSTALL_SCRIPT) cups.sh $(BUILDROOT)$(INITDDIR); \
- fi
- if test "x$(LAUNCHD_DIR)" != x; then \
- echo Installing launchd configuration files...; \
- $(INSTALL_DIR) $(BUILDROOT)$(LAUNCHD_DIR); \
- $(INSTALL_DATA) org.cups.cupsd.plist $(BUILDROOT)$(LAUNCHD_DIR); \
- $(INSTALL_DATA) org.cups.cups-lpd.plist $(BUILDROOT)$(LAUNCHD_DIR); \
- fi
if test "x$(SMFMANIFESTDIR)" != x; then \
echo Installing SMF manifest in $(SMFMANIFESTDIR)...;\
$(INSTALL_DIR) $(BUILDROOT)/$(SMFMANIFESTDIR); \
$(INSTALL_SCRIPT) cups.xml $(BUILDROOT)$(SMFMANIFESTDIR)/cups.xml; \
- fi
- if test "x$(SYSTEMD_DIR)" != x; then \
- echo Installing systemd configuration files...; \
- $(INSTALL_DIR) $(BUILDROOT)$(SYSTEMD_DIR); \
- $(INSTALL_DATA) org.cups.cupsd.path $(BUILDROOT)$(SYSTEMD_DIR); \
- $(INSTALL_DATA) org.cups.cupsd.service $(BUILDROOT)$(SYSTEMD_DIR); \
- $(INSTALL_DATA) org.cups.cupsd.socket $(BUILDROOT)$(SYSTEMD_DIR); \
- $(INSTALL_DATA) org.cups.cups-lpdAT.service $(BUILDROOT)$(SYSTEMD_DIR)/org.cups.cups-lpd@.service; \
- $(INSTALL_DATA) org.cups.cups-lpd.socket $(BUILDROOT)$(SYSTEMD_DIR); \
- elif test "x$(XINETD)" != x; then \
- echo Installing xinetd configuration file for cups-lpd...; \
- $(INSTALL_DIR) -m 755 $(BUILDROOT)$(XINETD); \
- $(INSTALL_DATA) cups-lpd.xinetd $(BUILDROOT)$(XINETD)/cups-lpd; \
- fi
-
+ fi
#
# Install programs...

View File

@ -0,0 +1,18 @@
--- src/cups/thread-private.h 2020-04-27 18:04:29.000000000 +0000
+++ src-mod/cups/thread-private.h 2020-07-05 13:04:31.500000000 +0000
@@ -34,6 +34,15 @@
typedef pthread_mutex_t _cups_mutex_t;
typedef pthread_rwlock_t _cups_rwlock_t;
typedef pthread_key_t _cups_threadkey_t;
+
+/* Android hacks */
+struct _cups_wrapped_thread_func {
+ _cups_thread_func_t func;
+ void *arg;
+};
+
+typedef struct _cups_wrapped_thread_func _cups_wrapped_thread_func_t;
+
# define _CUPS_COND_INITIALIZER PTHREAD_COND_INITIALIZER
# define _CUPS_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
# define _CUPS_RWLOCK_INITIALIZER PTHREAD_RWLOCK_INITIALIZER

View File

@ -0,0 +1,65 @@
--- src/cups/thread.c 2020-07-05 13:16:28.060000000 +0000
+++ src-mod/cups/thread.c 2020-07-05 13:18:17.010000000 +0000
@@ -145,6 +145,40 @@
pthread_rwlock_unlock(rwlock);
}
+/*
+ * '_cupsThreadAndroidSignalHandler()' - Wrapper around pthread_exit(0) to be called from a signal handler
+ */
+
+void
+_cupsThreadAndroidSignalHandler(int sig)
+{
+ pthread_exit(0);
+}
+
+/*
+ * '_cupsThreadAndroidWrapper()' - Function for wrapping a thread start with a signal handler for cancellation
+ */
+
+void *
+_cupsThreadAndroidWrapper(void *arg)
+{
+ _cups_wrapped_thread_func_t *wrapped = (_cups_wrapped_thread_func_t*) arg;
+
+ struct sigaction actions;
+ memset(&actions, 0, sizeof(actions));
+ sigemptyset(&actions.sa_mask);
+ actions.sa_flags = 0;
+ actions.sa_handler = _cupsThreadAndroidSignalHandler;
+ sigaction(SIGUSR2, &actions, NULL);
+
+ _cups_thread_func_t func = wrapped->func;
+ void *func_arg = wrapped->arg;
+
+ free(wrapped);
+
+ return (*func)(func_arg);
+}
+
/*
* '_cupsThreadCancel()' - Cancel (kill) a thread.
@@ -153,7 +187,7 @@
void
_cupsThreadCancel(_cups_thread_t thread)/* I - Thread ID */
{
- pthread_cancel(thread);
+ pthread_kill(thread, SIGUSR2);
}
@@ -168,7 +202,11 @@
{
pthread_t thread;
- if (pthread_create(&thread, NULL, (void *(*)(void *))func, arg))
+ _cups_wrapped_thread_func_t *wrapped = malloc(sizeof(_cups_wrapped_thread_func_t));
+ wrapped->func = func;
+ wrapped->arg = arg;
+
+ if (pthread_create(&thread, NULL, _cupsThreadAndroidWrapper, wrapped))
return (0);
else
return (thread);