diff --git a/cross/libmemcached/Makefile b/cross/libmemcached/Makefile new file mode 100644 index 00000000000..be4233872da --- /dev/null +++ b/cross/libmemcached/Makefile @@ -0,0 +1,21 @@ +PKG_NAME = libmemcached +PKG_VERS = 1.0.18 +PKG_EXT = tar.gz +PKG_DIST_NAME = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT) +PKG_DIST_SITE = https://launchpad.net/libmemcached/1.0/$(PKG_VERS)/+download +PKG_DIR = $(PKG_NAME)-$(PKG_VERS) + +DEPENDS = cross/libevent + +HOMEPAGE = https://libmemcached.org/libMemcached.html +COMMENT = libMemcached is an open source C/C++ client library and tools for the memcached server. +LICENSE = 3-Clause BSD + +GNU_CONFIGURE = 1 +CONFIGURE_ARGS = --disable-static +CONFIGURE_ARGS += --enable-memaslap +CONFIGURE_ARGS += ax_cv_gcc_atomic_builtins=yes +# https://medium.com/swlh/the-complete-guide-to-benchmark-the-performance-of-memcached-on-ubuntu-16-04-71edeaf6e740 +CONFIGURE_ARGS += ax_cv_libevent=yes + +include ../../mk/spksrc.cross-cc.mk diff --git a/cross/libmemcached/PLIST b/cross/libmemcached/PLIST new file mode 100644 index 00000000000..ddba525d252 --- /dev/null +++ b/cross/libmemcached/PLIST @@ -0,0 +1,23 @@ +bin:bin/memaslap +bin:bin/memcapable +bin:bin/memcat +bin:bin/memcp +bin:bin/memdump +bin:bin/memerror +bin:bin/memexist +bin:bin/memflush +bin:bin/memparse +bin:bin/memping +bin:bin/memrm +bin:bin/memslap +bin:bin/memstat +bin:bin/memtouch +lnk:lib/libhashkit.so +lnk:lib/libhashkit.so.2 +lib:lib/libhashkit.so.2.0.0 +lnk:lib/libmemcached.so +lnk:lib/libmemcached.so.11 +lib:lib/libmemcached.so.11.0.0 +lnk:lib/libmemcachedutil.so +lnk:lib/libmemcachedutil.so.2 +lib:lib/libmemcachedutil.so.2.0.0 diff --git a/cross/libmemcached/digests b/cross/libmemcached/digests new file mode 100644 index 00000000000..aae74bf44b3 --- /dev/null +++ b/cross/libmemcached/digests @@ -0,0 +1,3 @@ +libmemcached-1.0.18.tar.gz SHA1 8be06b5b95adbc0a7cb0f232e237b648caf783e1 +libmemcached-1.0.18.tar.gz SHA256 e22c0bb032fde08f53de9ffbc5a128233041d9f33b5de022c0978a2149885f82 +libmemcached-1.0.18.tar.gz MD5 b3958716b4e53ddc5992e6c49d97e819 diff --git a/cross/libmemcached/patches/001-fix-clients_memflush-for-newer-compilers.patch b/cross/libmemcached/patches/001-fix-clients_memflush-for-newer-compilers.patch new file mode 100644 index 00000000000..d777f9bfd99 --- /dev/null +++ b/cross/libmemcached/patches/001-fix-clients_memflush-for-newer-compilers.patch @@ -0,0 +1,23 @@ +# avoid comparison of pointer with integer +# error: ISO C++ forbids comparison between pointer and integer [-fpermissive] +# +--- clients/memflush.cc.orig 2014-02-09 12:52:42.000000000 +0100 ++++ clients/memflush.cc 2022-06-03 10:06:40.989938212 +0200 +@@ -39,7 +39,7 @@ + { + options_parse(argc, argv); + +- if (opt_servers == false) ++ if (opt_servers == NULL) + { + char *temp; + +@@ -48,7 +48,7 @@ + opt_servers= strdup(temp); + } + +- if (opt_servers == false) ++ if (opt_servers == NULL) + { + std::cerr << "No Servers provided" << std::endl; + exit(EXIT_FAILURE); diff --git a/cross/libmemcached/patches/002-avoid-build-of-test-programs.patch b/cross/libmemcached/patches/002-avoid-build-of-test-programs.patch new file mode 100644 index 00000000000..3ff16e31940 --- /dev/null +++ b/cross/libmemcached/patches/002-avoid-build-of-test-programs.patch @@ -0,0 +1,15 @@ +# For faster build: +# - remove target with test programs (noinst_PROGRAMS) in generated Makefile. +# PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) +# +--- Makefile.in.orig 2014-02-09 11:52:56.000000000 +0000 ++++ Makefile.in 2022-06-03 08:39:02.989627735 +0000 +@@ -9961,7 +9961,7 @@ + $(MAKE) $(AM_MAKEFLAGS) check-TESTS + check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-am +-all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(MANS) $(DATA) $(HEADERS) \ ++all-am: Makefile $(LTLIBRARIES) $(bin_PROGRAMS) $(MANS) $(DATA) $(HEADERS) \ + mem_config.h + install-binPROGRAMS: install-libLTLIBRARIES + diff --git a/cross/libmemcached/patches/003-adjust-programname-of-memaslap.patch b/cross/libmemcached/patches/003-adjust-programname-of-memaslap.patch new file mode 100644 index 00000000000..f7f0697e6be --- /dev/null +++ b/cross/libmemcached/patches/003-adjust-programname-of-memaslap.patch @@ -0,0 +1,100 @@ +# Adjust the program name to be able to identify the tool as memaslap +# +# memslap is another tool of libmemcached, that is not as useful +# as it does not show stats nor accepts parameters such as threads or time. +# +--- clients/memaslap.c.orig 2014-02-09 11:52:42.000000000 +0000 ++++ clients/memaslap.c 2022-06-03 09:57:33.085672134 +0000 +@@ -1,5 +1,5 @@ + /* +- * memslap ++ * memaslap + * + * (c) Copyright 2009, Schooner Information Technology, Inc. + * All rights reserved. +@@ -32,7 +32,7 @@ + #include "ms_setting.h" + #include "ms_thread.h" + +-#define PROGRAM_NAME "memslap" ++#define PROGRAM_NAME "memaslap" + #define PROGRAM_DESCRIPTION \ + "Generates workload against memcached servers." + +@@ -111,7 +111,7 @@ + static void ms_statistic_init(void); + static void ms_stats_init(void); + static void ms_print_statistics(int in_time); +-static void ms_print_memslap_stats(struct timeval *start_time, ++static void ms_print_memaslap_stats(struct timeval *start_time, + struct timeval *end_time); + static void ms_monitor_slap_mode(void); + +@@ -130,7 +130,7 @@ + printf(" %s\n\n", description); + printf( + "Usage:\n" +- " memslap -hV | -s servers [-F config_file] [-t time | -x exe_num] [...]\n\n" ++ " memaslap -hV | -s servers [-F config_file] [-t time | -x exe_num] [...]\n\n" + "Options:\n"); + + for (int x= 0; long_options[x].name; x++) +@@ -146,13 +146,13 @@ + + printf( + "\nExamples:\n" +- " memslap -s 127.0.0.1:11211 -S 5s\n" +- " memslap -s 127.0.0.1:11211 -t 2m -v 0.2 -e 0.05 -b\n" +- " memslap -s 127.0.0.1:11211 -F config -t 2m -w 40k -S 20s -o 0.2\n" +- " memslap -s 127.0.0.1:11211 -F config -t 2m -T 4 -c 128 -d 20 -P 40k\n" +- " memslap -s 127.0.0.1:11211 -F config -t 2m -d 50 -a -n 40\n" +- " memslap -s 127.0.0.1:11211,127.0.0.1:11212 -F config -t 2m\n" +- " memslap -s 127.0.0.1:11211,127.0.0.1:11212 -F config -t 2m -p 2\n\n"); ++ " memaslap -s 127.0.0.1:11211 -S 5s\n" ++ " memaslap -s 127.0.0.1:11211 -t 2m -v 0.2 -e 0.05 -b\n" ++ " memaslap -s 127.0.0.1:11211 -F config -t 2m -w 40k -S 20s -o 0.2\n" ++ " memaslap -s 127.0.0.1:11211 -F config -t 2m -T 4 -c 128 -d 20 -P 40k\n" ++ " memaslap -s 127.0.0.1:11211 -F config -t 2m -d 50 -a -n 40\n" ++ " memaslap -s 127.0.0.1:11211,127.0.0.1:11212 -F config -t 2m\n" ++ " memaslap -s 127.0.0.1:11211,127.0.0.1:11212 -F config -t 2m -p 2\n\n"); + + exit(0); + } /* ms_help_command */ +@@ -286,7 +286,7 @@ + + case OPT_UDP: + return +- "UDP support, default memslap uses TCP, TCP port and UDP port of\n" ++ "UDP support, default memaslap uses TCP, TCP port and UDP port of\n" + " server must be same."; + + case OPT_EXPIRE: +@@ -708,8 +708,8 @@ + } /* ms_print_statistics */ + + +-/* used to print the states of memslap */ +-static void ms_print_memslap_stats(struct timeval *start_time, ++/* used to print the states of memaslap */ ++static void ms_print_memaslap_stats(struct timeval *start_time, + struct timeval *end_time) + { + char buf[1024]; +@@ -803,7 +803,7 @@ + + fprintf(stdout, "%s", buf); + fflush(stdout); +-} /* ms_print_memslap_stats */ ++} /* ms_print_memaslap_stats */ + + + /* the loop of the main thread, wait the work threads to complete */ +@@ -883,7 +883,7 @@ + gettimeofday(&end_time, NULL); + } + +- ms_print_memslap_stats(&start_time, &end_time); ++ ms_print_memaslap_stats(&start_time, &end_time); + } /* ms_monitor_slap_mode */ + + diff --git a/cross/memcached/Makefile b/cross/memcached/Makefile index f03a7b0db39..27ed6e577ff 100644 --- a/cross/memcached/Makefile +++ b/cross/memcached/Makefile @@ -1,5 +1,5 @@ PKG_NAME = memcached -PKG_VERS = 1.4.15 +PKG_VERS = 1.6.15 PKG_EXT = tar.gz PKG_DIST_NAME = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT) PKG_DIST_SITE = http://www.memcached.org/files @@ -9,14 +9,16 @@ DEPENDS = cross/libevent HOMEPAGE = https://www.memcached.org/ COMMENT = Free & open source, high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load. -LICENSE = BSD +LICENSE = 3-Clause BSD -PRE_CONFIGURE_TARGET = memcached_pre_configure -CONFIGURE_ARGS = ac_cv_c_endian=little GNU_CONFIGURE = 1 +ADDITIONAL_CFLAGS = -O -include ../../mk/spksrc.cross-cc.mk +include ../../mk/spksrc.archs.mk +ifeq ($(findstring $(ARCH),$(OLD_PPC_ARCHS)),$(ARCH)) +# EFD_NONBLOCK is not defined (define it OR disable use of eventfd) +#ADDITIONAL_CFLAGS += -DEFD_NONBLOCK=0x0004000 +CONFIGURE_ARGS = ac_cv_func_eventfd=no +endif -.PHONY: memcached_pre_configure -memcached_pre_configure: - @$(RUN) autoconf +include ../../mk/spksrc.cross-cc.mk diff --git a/cross/memcached/digests b/cross/memcached/digests index 0c09b9dc326..ec388fbd611 100644 --- a/cross/memcached/digests +++ b/cross/memcached/digests @@ -1,3 +1,3 @@ -memcached-1.4.15.tar.gz SHA1 12ec84011f408846250a462ab9e8e967a2e8cbbc -memcached-1.4.15.tar.gz SHA256 169721ab7a7531add6ae9f6b14b6b5641725fe0b1f0bdf5c3a4327725901e2b4 -memcached-1.4.15.tar.gz MD5 36ea966f5a29655be1746bf4949f7f69 +memcached-1.6.15.tar.gz SHA1 badcfa0d65f5797cc9c2f957f3fbfedbd8c13411 +memcached-1.6.15.tar.gz SHA256 8d7abe3d649378edbba16f42ef1d66ca3f2ac075f2eb97145ce164388e6ed515 +memcached-1.6.15.tar.gz MD5 8a21ef7bc1c427e6cd88cac270394898 diff --git a/cross/memcached/patches/001-remove-werror.patch b/cross/memcached/patches/001-remove-werror.patch index db1be904361..df9880282cb 100644 --- a/cross/memcached/patches/001-remove-werror.patch +++ b/cross/memcached/patches/001-remove-werror.patch @@ -1,17 +1,17 @@ --- configure.ac.orig 2012-09-03 09:35:54.000000000 +0200 +++ configure.ac 2012-12-08 00:31:35.000000000 +0100 -@@ -534,12 +534,12 @@ +@@ -788,12 +788,12 @@ if test "$ICC" = "yes" then dnl ICC trying to be gcc. - CFLAGS="$CFLAGS -diag-disable 187 -Wall -Werror" + CFLAGS="$CFLAGS -diag-disable 187 -Wall" - AC_DEFINE([_GNU_SOURCE],[1],[find sigignore on Linux]) + AC_DEFINE([_GNU_SOURCE],[1],[make sure IOV_MAX is defined]) elif test "$GCC" = "yes" then GCC_VERSION=`$CC -dumpversion` - CFLAGS="$CFLAGS -Wall -Werror -pedantic -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls" + CFLAGS="$CFLAGS -Wall -pedantic -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls" - case $GCC_VERSION in - 4.4.*) - CFLAGS="$CFLAGS -fno-strict-aliasing" + if test "x$enable_asan" = "xyes"; then + CFLAGS="$CFLAGS -fsanitize=address" + fi diff --git a/cross/phpmemcachedadmin/Makefile b/cross/phpmemcachedadmin/Makefile index a28c3347f48..02b21b3fa7a 100644 --- a/cross/phpmemcachedadmin/Makefile +++ b/cross/phpmemcachedadmin/Makefile @@ -1,24 +1,35 @@ PKG_NAME = phpMemcachedAdmin -PKG_VERS = 1.2.2-r262 PKG_EXT = tar.gz -PKG_DIST_NAME = $(PKG_NAME)-$(PKG_VERS).$(PKG_EXT) -PKG_DIST_SITE = https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/phpmemcacheadmin -PKG_DIR = $(PKG_NAME)-$(PKG_VERS) +PKG_DOWNLOAD_METHOD = git +PKG_GIT_HASH = aaf3d16a2a1e3dff72dd358f1758d96f0f174cb3 +PKG_DIST_SITE = https://github.com/elijaa/phpmemcachedadmin.git +PKG_DIST_FILE = $(PKG_NAME)-git$(PKG_GIT_HASH).$(PKG_EXT) +PKG_DIR = $(PKG_NAME)-git$(PKG_GIT_HASH) + +# Unfortunately only version 1.3.0 is officially released, but +# we need the commit aaf3d16 of 12 Jun 2020 for memcached 1.6.x +# Issue #19: fix mem_requested key change in Memcached 1.5.17 DEPENDS = HOMEPAGE = https://github.com/elijaa/phpmemcachedadmin -COMMENT = Graphic stand-alone administration for memcached to monitor and debug purpose -LICENSE = Apache License 2.0 +COMMENT = Graphic stand-alone administration for memcached to monitor and debug purpose. +LICENSE = Apache 2.0 -EXTRACT_PATH = $(WORK_DIR)/$(PKG_DIR) -CONFIGURE_TARGET = nop -COMPILE_TARGET = nop +EXTRACT_PATH = $(WORK_DIR) INSTALL_TARGET = phpmemcachedadmin_install -include ../../mk/spksrc.cross-cc.mk +include ../../mk/spksrc.install-resources.mk + +CONFIG_FOLDER = $(STAGING_INSTALL_PREFIX)/var/phpmemcachedadmin.config .PHONY: phpmemcachedadmin_install +# link the Config folder into var for backup/restore on package update +# and for on demand creation of the default config on DSM 7. phpmemcachedadmin_install: - mkdir -p $(STAGING_INSTALL_PREFIX)/share/phpMemcachedAdmin - tar -cf - -C $(WORK_DIR)/$(PKG_DIR) . | tar -xf - -C $(STAGING_INSTALL_PREFIX)/share/phpMemcachedAdmin + @mkdir -p $(STAGING_INSTALL_PREFIX)/share/$(PKG_NAME) + @tar -cf - -C $(WORK_DIR)/$(PKG_DIR) --exclude Config . | tar -xf - -C $(STAGING_INSTALL_PREFIX)/share/$(PKG_NAME) + @echo folder=$(CONFIG_FOLDER) + @install -d -m 755 $(CONFIG_FOLDER) + @install -m 755 $(WORK_DIR)/$(PKG_DIR)/Config/* $(CONFIG_FOLDER)/ + @cd $(STAGING_INSTALL_PREFIX)/share/$(PKG_NAME) && ln -sf $(INSTALL_PREFIX_VAR)/phpmemcachedadmin.config Config diff --git a/cross/phpmemcachedadmin/PLIST b/cross/phpmemcachedadmin/PLIST index b713ed4cad8..46955e2bfb8 100644 --- a/cross/phpmemcachedadmin/PLIST +++ b/cross/phpmemcachedadmin/PLIST @@ -1 +1,2 @@ -rsc:share/phpMemcachedAdmin +rsc:share/phpMemcachedAdmin/ +rsc:var/phpmemcachedadmin.config/ diff --git a/cross/phpmemcachedadmin/digests b/cross/phpmemcachedadmin/digests index 71cefe85750..aae29a33749 100644 --- a/cross/phpmemcachedadmin/digests +++ b/cross/phpmemcachedadmin/digests @@ -1,3 +1,3 @@ -phpMemcachedAdmin-1.2.2-r262.tar.gz SHA1 616d33deeb54c7bb0b894b23589afc81aa3f67f5 -phpMemcachedAdmin-1.2.2-r262.tar.gz SHA256 10022211593c78b4eaaec16054843979f0b98ed72e86ee93e4fe79bf35c383e3 -phpMemcachedAdmin-1.2.2-r262.tar.gz MD5 93ce23bc02f8f262d55d749d40058388 +phpMemcachedAdmin-gitaaf3d16a2a1e3dff72dd358f1758d96f0f174cb3.tar.gz SHA1 28d8c233e6e1814fd25a37a2c1f7d3ee35a94d32 +phpMemcachedAdmin-gitaaf3d16a2a1e3dff72dd358f1758d96f0f174cb3.tar.gz SHA256 1248fe1c6df610b6ea69dfba1a2774d182160a444759d3bf1b4782458d40fe00 +phpMemcachedAdmin-gitaaf3d16a2a1e3dff72dd358f1758d96f0f174cb3.tar.gz MD5 e1e846983f33fcdb480c91c365bc7cac diff --git a/diyspk/memaslap/Makefile b/diyspk/memaslap/Makefile new file mode 100644 index 00000000000..eeffd97d6b4 --- /dev/null +++ b/diyspk/memaslap/Makefile @@ -0,0 +1,16 @@ +SPK_NAME = memaslap +SPK_VERS = 1.0 +SPK_REV = 1 + +DEPENDS = cross/libmemcached + +MAINTAINER = SynoCommunity +DESCRIPTION = memaslap is a load generation and benchmark tool for memcached servers. It generates configurable workload such as threads, concurrencies, connections, run time, overwrite, miss rate, key size, value size, get/set proportion, expected throughput, and so on. +STARTABLE = no + +HOMEPAGE = http://docs.libmemcached.org/bin/memaslap.html +LICENSE = 3-Clause BSD + +SPK_COMMANDS = bin/memaslap + +include ../../mk/spksrc.spk.mk diff --git a/mk/spksrc.service.installer.dsm5 b/mk/spksrc.service.installer.dsm5 index 8c2ec936a18..0efcc29af17 100644 --- a/mk/spksrc.service.installer.dsm5 +++ b/mk/spksrc.service.installer.dsm5 @@ -174,11 +174,7 @@ set_unix_permissions () DIRNAME=$1 if [ -n "${EFF_USER}" ]; then echo "Granting '${EFF_USER}' unix ownership on ${DIRNAME}" - if [ $SYNOPKG_DSM_VERSION_MAJOR -lt 6 ]; then - chown -R ${EFF_USER}:root "${DIRNAME}" - else - chown -R ${EFF_USER}:${USER} "${DIRNAME}" - fi + chown -R ${EFF_USER}:root "${DIRNAME}" fi } @@ -246,16 +242,14 @@ postinst () # Service user management if [ -n "${EFF_USER}" ]; then - if [ $SYNOPKG_DSM_VERSION_MAJOR -lt 6 ]; then - # DSM 5 specific operations - # Create prefixed synouser - if ! cat /etc/passwd | grep "${EFF_USER}:x:" &> /dev/null; then - synouser --add "${EFF_USER}" "" "$USER_DESC" 0 "" 0 2>&1 | install_log - # Set HOME for consistency with DSM 6, location available even if homes not enabled - BACKUP_PASSWD="/tmp/install_${SYNOPKG_PKGNAME}_passwd" - cp /etc/passwd ${BACKUP_PASSWD} 2>&1 | install_log - sed -i "s#/var/services/homes/${EFF_USER}#/var/packages/${SYNOPKG_PKGNAME}/target#" /etc/passwd 2>&1 | install_log - fi + # DSM 5 specific operations + # Create prefixed synouser + if ! cat /etc/passwd | grep "${EFF_USER}:x:" &> /dev/null; then + synouser --add "${EFF_USER}" "" "$USER_DESC" 0 "" 0 2>&1 | install_log + # Set HOME for consistency with DSM 6, location available even if homes not enabled + BACKUP_PASSWD="/tmp/install_${SYNOPKG_PKGNAME}_passwd" + cp /etc/passwd ${BACKUP_PASSWD} 2>&1 | install_log + sed -i "s#/var/services/homes/${EFF_USER}#/var/packages/${SYNOPKG_PKGNAME}/target#" /etc/passwd 2>&1 | install_log fi # Register service in "users" group to access any content if [ "$ADD_USER_IN_USERS" = "yes" ]; then diff --git a/mk/spksrc.service.installer.dsm6 b/mk/spksrc.service.installer.dsm6 index 264e4c9d118..c501184d118 100644 --- a/mk/spksrc.service.installer.dsm6 +++ b/mk/spksrc.service.installer.dsm6 @@ -178,8 +178,8 @@ set_unix_permissions () DIRNAME=$1 if [ -n "${EFF_USER}" ]; then echo "Granting '${EFF_USER}' unix ownership on ${DIRNAME}" - if [ $SYNOPKG_DSM_VERSION_MAJOR -lt 6 ]; then - chown -R ${EFF_USER}:root "${DIRNAME}" + if [ -n "${GROUP}" ]; then + chown -R ${EFF_USER}:${GROUP} "${DIRNAME}" else chown -R ${EFF_USER}:${USER} "${DIRNAME}" fi diff --git a/mk/spksrc.service.mk b/mk/spksrc.service.mk index 08d9bba2897..08ffafe30fe 100644 --- a/mk/spksrc.service.mk +++ b/mk/spksrc.service.mk @@ -7,7 +7,7 @@ # conf/SPK_NAME.sc if SERVICE_PORT and DSM<7 # conf/resource if SERVICE_CERT or DSM7 # app/SPK_NAME.sc if SERVICE_PORT and DSM7 -# app/config if DSM_UI_DIR +# app/config if DSM_UI_DIR (may be overwritten by DSM_UI_CONFIG) # # Targets are executed in the following order: # service_msg_target @@ -418,6 +418,9 @@ endif DESC=$(shell echo ${DESCRIPTION} | sed -e 's/\\//g' -e 's/"/\\"/g') $(STAGING_DIR)/$(DSM_UI_DIR)/config: $(create_target_dir) +ifneq ($(wildcard $(DSM_UI_CONFIG)),) + cat $(DSM_UI_CONFIG) > $@ +else @echo '{}' | jq --arg name "${DISPLAY_NAME}" \ --arg desc "${DESC}" \ --arg id "com.synocommunity.packages.${SPK_NAME}" \ @@ -428,7 +431,7 @@ $(STAGING_DIR)/$(DSM_UI_DIR)/config: --arg type "${SERVICE_TYPE}" \ --argjson allUsers ${SERVICE_PORT_ALL_USERS} \ '{".url":{($$id):{"title":$$name, "desc":$$desc, "icon":$$icon, "type":$$type, "protocol":$$prot, "port":$$port, "url":$$url, "allUsers":$$allUsers, "grantPrivilege":"all", "advanceGrantPrivilege":true}}}' > $@ - +endif SERVICE_FILES += $(STAGING_DIR)/$(DSM_UI_DIR)/config endif endif diff --git a/spk/memcached/Makefile b/spk/memcached/Makefile index c26e9355147..a6f0c6fb290 100644 --- a/spk/memcached/Makefile +++ b/spk/memcached/Makefile @@ -1,37 +1,38 @@ SPK_NAME = memcached -SPK_VERS = 1.4.15 -SPK_REV = 2 +SPK_VERS = 1.6.15 +SPK_REV = 3 SPK_ICON = src/memcached.png DSM_UI_DIR = app -DEPENDS = cross/busybox cross/phpmemcachedadmin cross/$(SPK_NAME) +DEPENDS = cross/phpmemcachedadmin cross/$(SPK_NAME) MAINTAINER = Diaoul DESCRIPTION = Free \& open source, high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load. It comes with phpMemcachedAdmin, a graphic stand-alone administration for memcached to monitor and debug purpose. ADMIN_URL = /phpMemcachedAdmin/ DISPLAY_NAME = Memcached -CHANGELOG = "1. Use 64-bit toolchains for bromolow, cedarview and x86" +CHANGELOG = "1. Update memcached from v1.4.13 to v1.6.15.
2. Add DSM 7 compliance." HOMEPAGE = https://memcached.org/ -LICENSE = +LICENSE = 3-Clause BSD -INSTALLER_SCRIPT = src/installer.sh -SSS_SCRIPT = src/dsm-control.sh -CONF_DIR = src/conf/ +CONF_DIR = src/conf + +SERVICE_USER = auto +SERVICE_PORT = 11211 +DSM_UI_CONFIG = src/app/config + +# SERVICE_COMMAND is defined in service setup script +STARTABLE = yes +SERVICE_SETUP = src/service-setup.sh INSTALL_DEP_SERVICES = apache-web START_DEP_SERVICES = apache-web -INSTALL_PREFIX = /usr/local/$(SPK_NAME) - POST_STRIP_TARGET = memcached_extra_install -BUSYBOX_CONFIG = usrmng -ENV += BUSYBOX_CONFIG="$(BUSYBOX_CONFIG)" - include ../../mk/spksrc.spk.mk .PHONY: memcached_extra_install memcached_extra_install: - install -m 755 -d $(STAGING_DIR)/app - install -m 644 src/app/config $(STAGING_DIR)/app/config + @install -m 755 -d $(STAGING_DIR)/app + @install -m 644 src/app/config $(STAGING_DIR)/app/config diff --git a/spk/memcached/src/app/config b/spk/memcached/src/app/config index 01724a61926..afa92b18eb5 100644 --- a/spk/memcached/src/app/config +++ b/spk/memcached/src/app/config @@ -2,8 +2,9 @@ ".url" : { "com.synocommunity.packages.memcached" : { "title": "phpMemcachedAdmin", - "desc": "phpMemcachedAdmin", + "desc": "PHPMemcachedAdmin - memcached admin interface", "icon": "images/memcached-{0}.png", + "protocol": "http", "type": "url", "url": "/phpMemcachedAdmin", "port": "80" diff --git a/spk/memcached/src/conf/privilege b/spk/memcached/src/conf/privilege deleted file mode 100644 index f6c56ec88ff..00000000000 --- a/spk/memcached/src/conf/privilege +++ /dev/null @@ -1,31 +0,0 @@ -{ - "defaults":{ - "run-as": "package" - }, - "username": "sc-memcached", - "ctrl-script": [{ - "action": "preinst", - "run-as": "root" - }, { - "action": "postinst", - "run-as": "root" - }, { - "action": "preuninst", - "run-as": "root" - }, { - "action": "postuninst", - "run-as": "root" - }, { - "action": "preupgrade", - "run-as": "root" - }, { - "action": "postupgrade", - "run-as": "root" - }, { - "action": "start", - "run-as": "root" - }, { - "action": "stop", - "run-as": "root" - }] -} \ No newline at end of file diff --git a/spk/memcached/src/conf/resource b/spk/memcached/src/conf/resource new file mode 100644 index 00000000000..e0ee9f965b9 --- /dev/null +++ b/spk/memcached/src/conf/resource @@ -0,0 +1,49 @@ +{ + "port-config": { + "protocol-file": "app/memcached.sc" + }, + "webservice": { + "services": [{ + "service": "phpMemcachedAdmin", + "display_name": "phpMemcachedAdmin", + "type": "apache_php", + "root": "phpMemcachedAdmin", + "icon": "app/images/memcached-{0}.png", + "backend": 2, + "php": { + "profile_name": "php-memcached-admin", + "profile_desc": "PHP profile used by phpMemcachedAdmin", + "backend": 6, + "extensions": [ + "gd", + "intl", + "zip" + ], + "user": "sc-memcached", + "group": "http" + } + }], + "portals": [ + { + "service": "phpMemcachedAdmin", + "type": "alias", + "name": "PHP Memcached Admin", + "alias": "phpMemcachedAdmin", + "app": "com.synocommunity.packages.memcached" + } + ], + "migrate": { + "root": [{ + "old": "phpMemcachedAdmin", + "new": "phpMemcachedAdmin" + }] + }, + "pkg_dir_prepare": [{ + "source": "/var/packages/memcached/target/share/phpMemcachedAdmin", + "target": "phpMemcachedAdmin", + "mode": "0755", + "user": "sc-memcached", + "group": "http" + }] + } +} \ No newline at end of file diff --git a/spk/memcached/src/dsm-control.sh b/spk/memcached/src/dsm-control.sh deleted file mode 100755 index 89e5b9b3de1..00000000000 --- a/spk/memcached/src/dsm-control.sh +++ /dev/null @@ -1,93 +0,0 @@ -#!/bin/sh - -# Package -PACKAGE="memcached" -DNAME="Memcached" - -# Others -INSTALL_DIR="/usr/local/${PACKAGE}" -PATH="${INSTALL_DIR}/bin:${PATH}" -BUILDNUMBER="$(/bin/get_key_value /etc.defaults/VERSION buildnumber)" -MEMCACHED="${INSTALL_DIR}/bin/memcached" -PID_FILE="${INSTALL_DIR}/var/memcached.pid" - -# Use 15% of total physical memory with maximum of 64MB -MEMORY=`awk '/MemTotal/{memory=$2/1024*0.15; if (memory > 64) memory=64; printf "%0.f", memory}' /proc/meminfo` - -SC_USER="sc-memcached" -LEGACY_USER="memcached" -USER="$([ "${BUILDNUMBER}" -ge "7321" ] && echo -n ${SC_USER} || echo -n ${LEGACY_USER})" - - -start_daemon () -{ - su ${USER} -s /bin/sh -c "${MEMCACHED} -d -m ${MEMORY} -P ${PID_FILE}" -} - -stop_daemon () -{ - kill `cat ${PID_FILE}` - wait_for_status 1 20 || kill -9 `cat ${PID_FILE}` - rm -f ${PID_FILE} -} - -daemon_status () -{ - if [ -f ${PID_FILE} ] && kill -0 `cat ${PID_FILE}` > /dev/null 2>&1; then - return - fi - rm -f ${PID_FILE} - return 1 -} - -wait_for_status () -{ - counter=$2 - while [ ${counter} -gt 0 ]; do - daemon_status - [ $? -eq $1 ] && return - let counter=counter-1 - sleep 1 - done - return 1 -} - - -case $1 in - start) - if daemon_status; then - echo ${DNAME} is already running - exit 0 - else - echo Starting ${DNAME} ... - start_daemon - exit $? - fi - ;; - stop) - if daemon_status; then - echo Stopping ${DNAME} ... - stop_daemon - exit $? - else - echo ${DNAME} is not running - exit 0 - fi - ;; - status) - if daemon_status; then - echo ${DNAME} is running - exit 0 - else - echo ${DNAME} is not running - exit 1 - fi - ;; - log) - echo ${LOG_FILE} - exit 0 - ;; - *) - exit 1 - ;; -esac diff --git a/spk/memcached/src/installer.sh b/spk/memcached/src/installer.sh deleted file mode 100755 index 6daa27f0f99..00000000000 --- a/spk/memcached/src/installer.sh +++ /dev/null @@ -1,106 +0,0 @@ -#!/bin/sh - -# Package -PACKAGE="memcached" -DNAME="Memcached" - -# Others -INSTALL_DIR="/usr/local/${PACKAGE}" -WEB_DIR="/var/services/web" -SSS="/var/packages/${PACKAGE}/scripts/start-stop-status" -PATH="${INSTALL_DIR}/bin:/usr/local/bin:/bin:/usr/bin:/usr/syno/bin" -MEMCACHED="${INSTALL_DIR}/bin/memcached" -TMP_DIR="${SYNOPKG_PKGDEST}/../../@tmp" -BUILDNUMBER="$(/bin/get_key_value /etc.defaults/VERSION buildnumber)" - -DSM6_UPGRADE="${INSTALL_DIR}/var/.dsm6_upgrade" -SC_USER="sc-memcached" -LEGACY_USER="memcached" -LEGACY_GROUP="nobody" -USER="$([ "${BUILDNUMBER}" -ge "7321" ] && echo -n ${SC_USER} || echo -n ${LEGACY_USER})" - - -preinst () -{ - exit 0 -} - -postinst () -{ - # Link - ln -s ${SYNOPKG_PKGDEST} ${INSTALL_DIR} - - # Install the web interface - cp -R ${INSTALL_DIR}/share/phpMemcachedAdmin ${WEB_DIR} - - # Install busybox stuff - ${INSTALL_DIR}/bin/busybox --install ${INSTALL_DIR}/bin - - # Create legacy user - if [ "${BUILDNUMBER}" -lt "7321" ]; then - adduser -h ${INSTALL_DIR}/var -g "${DNAME} User" -G ${LEGACY_GROUP} -s /bin/sh -S -D ${LEGACY_USER} - fi - - # Correct the files ownership - chown -R ${USER}:root ${SYNOPKG_PKGDEST} - - exit 0 -} - -preuninst () -{ - # Stop the package - ${SSS} stop > /dev/null - - if [ "${SYNOPKG_PKG_STATUS}" != "UPGRADE" ]; then - # Remove the user (if not upgrading) - delgroup ${LEGACY_USER} ${LEGACY_GROUP} - deluser ${USER} - - # Remove firewall configuration - ${SERVICETOOL} --remove-configure-file --package ${PACKAGE}.sc >> /dev/null - fi - - exit 0 -} - -postuninst () -{ - # Remove the web interface - rm -fr ${WEB_DIR}/phpMemcachedAdmin - - # Remove link - rm -f ${INSTALL_DIR} - - exit 0 -} - -preupgrade () -{ - # Stop the package - ${SSS} stop > /dev/null - - # DSM6 Upgrade handling - if [ "${BUILDNUMBER}" -ge "7321" ] && [ ! -f ${DSM6_UPGRADE} ]; then - echo "Deleting legacy user" > ${DSM6_UPGRADE} - delgroup ${LEGACY_USER} ${LEGACY_GROUP} - deluser ${LEGACY_USER} - fi - - # Save some stuff - rm -fr ${TMP_DIR}/${PACKAGE} - mkdir -p ${TMP_DIR}/${PACKAGE} - mv ${INSTALL_DIR}/var ${TMP_DIR}/${PACKAGE}/ - - exit 0 -} - -postupgrade () -{ - # Restore some stuff - rm -fr ${INSTALL_DIR}/var - mv ${TMP_DIR}/${PACKAGE}/var ${INSTALL_DIR}/ - rm -fr ${TMP_DIR}/${PACKAGE} - - exit 0 -} diff --git a/spk/memcached/src/memcached.png b/spk/memcached/src/memcached.png index f9e20335a66..85b5e396cbf 100644 Binary files a/spk/memcached/src/memcached.png and b/spk/memcached/src/memcached.png differ diff --git a/spk/memcached/src/service-setup.sh b/spk/memcached/src/service-setup.sh new file mode 100644 index 00000000000..0ead8cf1e45 --- /dev/null +++ b/spk/memcached/src/service-setup.sh @@ -0,0 +1,29 @@ + +if [ "${SYNOPKG_DSM_VERSION_MAJOR}" -lt 7 ]; then + # for DSM < 7 + CONFIG_DIR="${SYNOPKG_PKGVAR}/phpmemcachedadmin.config" + # for owner of var folder + GROUP=http +fi + +PATH="${SYNOPKG_PKGDEST}/bin:${PATH}" +MEMCACHED="${SYNOPKG_PKGDEST}/bin/memcached" +MEMORY=$(awk '/MemTotal/{memory=$2/1024*0.15; if (memory > 64) memory=64; printf "%0.f", memory}' /proc/meminfo) +SERVICE_COMMAND="${MEMCACHED} -d -m ${MEMORY} -P ${PID_FILE}" + +service_postinst () +{ + # create Memcache.php on demand + if [ ! -e "${SYNOPKG_PKGVAR}/phpmemcachedadmin.config/Memcache.php" ]; then + echo "Create default config file Memcache.php" + cp -f ${SYNOPKG_PKGVAR}/phpmemcachedadmin.config/Memcache.sample.php ${SYNOPKG_PKGVAR}/phpmemcachedadmin.config/Memcache.php + fi + + if [ "${SYNOPKG_DSM_VERSION_MAJOR}" -lt 7 ]; then + # make config writable by http group + chmod -R g+w ${CONFIG_DIR} + chown -R :http ${SYNOPKG_PKGDEST}/share + # make Temp and other folders writable by http group + chmod -R g+w ${SYNOPKG_PKGDEST}/share + fi +}