add memcached (#6746)
authorFlorian Fainelli <florian@openwrt.org>
Sun, 28 Feb 2010 12:26:53 +0000 (12:26 +0000)
committerFlorian Fainelli <florian@openwrt.org>
Sun, 28 Feb 2010 12:26:53 +0000 (12:26 +0000)
SVN-Revision: 19902

net/memcached/Makefile [new file with mode: 0644]
net/memcached/files/memcached [new file with mode: 0644]
net/memcached/files/memcached.init [new file with mode: 0644]

diff --git a/net/memcached/Makefile b/net/memcached/Makefile
new file mode 100644 (file)
index 0000000..4fbcca2
--- /dev/null
@@ -0,0 +1,56 @@
+#
+# Copyright (C) 2009-2010 Thomas Heil <heil@terminal-consulting.de>
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=memcached
+PKG_VERSION:=1.2.6
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://memcached.googlecode.com/files
+PKG_MD5SUM:=200d22f7ac2d114f74a6904552e9eb70
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/memcached
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libevent librt
+  TITLE:=The high-performance, distributed memory object caching system
+  SUBMENU:=Web
+  MAINTAINER:=Thomas Heil <heil@terminal-consulting.de>
+endef
+
+define Package/memcached/description
+  Free and open source, high-performance, distributed memory object caching system
+endef
+
+define Package/memcached/conffiles
+/etc/config/memcached
+endef
+
+ifeq ($(CONFIG_BIG_ENDIAN),y)
+CONFIGURE_VARS += ac_cv_c_endian=big
+else
+CONFIGURE_VARS += ac_cv_c_endian=little
+endif
+
+CONFIGURE_ARGS += \
+       --disable-docs \
+       --disable-dtrace \
+       --disable-sasl
+
+define Package/memcached/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/memcached $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_CONF) ./files/memcached $(1)/etc/config/memcached
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/memcached.init $(1)/etc/init.d/memcached
+endef
+
+$(eval $(call BuildPackage,memcached))
diff --git a/net/memcached/files/memcached b/net/memcached/files/memcached
new file mode 100644 (file)
index 0000000..56d1952
--- /dev/null
@@ -0,0 +1,5 @@
+config memcached
+    option user 'nobody'
+    option maxconn '1024'
+    option listen '0.0.0.0'
+    option port '11211'
diff --git a/net/memcached/files/memcached.init b/net/memcached/files/memcached.init
new file mode 100644 (file)
index 0000000..64aea19
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2007 OpenWrt.org
+START=80
+
+start_service () {
+    local section="$1"
+        config_get user "$section" user
+        config_get maxconn "$section" maxconn
+        config_get listen "$section" listen
+        config_get port "$section" port
+        config_get memory "$section" memory
+
+        memcached_args="-d -p ${port:-"11211"} -u ${user:-"nobody"}  -c ${maxconn:-"1024"} -l ${listen:-"0.0.0.0"}  -U ${port:-"11211"} -m${memory:-"64"}"
+        memcached $memcached_args >/dev/null 2>&1
+}
+
+start() {
+    config_load "memcached"
+        config_foreach start_service memcached
+}
+
+stop() {
+    killall memcached
+}