Mail archive
alpine-aports

[alpine-aports] [PATCH] testing/twemproxy: new aport

From: Yagnesh Mistry <ysh_at_live.in>
Date: Sun, 18 Oct 2015 23:22:07 +0530

https://github.com/twitter/twemproxy
A fast, light-weight proxy for memcached and redis
---
  testing/twemproxy/APKBUILD                 | 88 
++++++++++++++++++++++++++++++
  testing/twemproxy/nutcracker.confd         |  6 ++
  testing/twemproxy/nutcracker.initd         | 39 +++++++++++++
  testing/twemproxy/use-system-libyaml.patch | 60 ++++++++++++++++++++
  4 files changed, 193 insertions(+)
  create mode 100644 testing/twemproxy/APKBUILD
  create mode 100644 testing/twemproxy/nutcracker.confd
  create mode 100644 testing/twemproxy/nutcracker.initd
  create mode 100644 testing/twemproxy/use-system-libyaml.patch
diff --git a/testing/twemproxy/APKBUILD b/testing/twemproxy/APKBUILD
new file mode 100644
index 0000000..753f0d4
--- /dev/null
+++ b/testing/twemproxy/APKBUILD
_at_@ -0,0 +1,88 @@
+# Maintainer: Yagnesh Mistry <ysh_at_live.in>
+
+pkgname=twemproxy
+akaname=nutcracker
+pkgver=0.4.1
+pkgrel=0
+pkgdesc="A fast, light-weight proxy for memcached and redis"
+url="https://github.com/twitter/twemproxy"
+arch="all"
+license="ASL 2.0"
+depends="yaml"
+depends_dev=""
+makedepends="automake autoconf libtool yaml-dev"
+subpackages="$pkgname-doc"
+source="saveas-https://github.com/twitter/twemproxy/archive/v$pkgver.tar.gz/$pkgname-$pkgver.tar.gz
+       nutcracker.initd
+       nutcracker.confd
+       use-system-libyaml.patch
+       "
+
+_builddir="$srcdir"/$pkgname-$pkgver
+_logdir=/var/log/$akaname
+_rundir=/var/run/$akaname
+
+prepare() {
+       local i
+       cd "$_builddir"
+       for i in $source; do
+               case $i in
+               *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+               esac
+       done
+}
+
+build() {
+       cd "$_builddir"
+       autoreconf -vif
+       ./configure \
+               --build=$CBUILD \
+               --host=$CHOST \
+               --prefix=/usr \
+               || return 1
+       make || return 1
+}
+
+package() {
+       cd "$_builddir"
+       make DESTDIR="$pkgdir" install || return 1
+       install -m644 -D "$srcdir"/$pkgname-$pkgver/conf/nutcracker.yml \
+               "$pkgdir"/etc/$akaname/nutcracker.yml || return 1
+        install -m644 -D 
"$srcdir"/$pkgname-$pkgver/conf/nutcracker.leaf.yml \
+               "$pkgdir"/etc/$akaname/nutcracker.leaf.yml || return 1
+        install -m644 -D 
"$srcdir"/$pkgname-$pkgver/conf/nutcracker.root.yml \
+               "$pkgdir"/etc/$akaname/nutcracker.root.yml || return 1
+       install -m755 -D "$srcdir"/$akaname.initd \
+               "$pkgdir"/etc/init.d/$akaname || return 1
+       install -m644 -D "$srcdir"/$akaname.confd \
+               "$pkgdir"/etc/conf.d/$akaname || return 1
+
+       install -m0700 -d "$pkgdir"/$_rundir || return 1
+       install -m0700 -d "$pkgdir"/$_logdir || return 1
+}
+
+doc () {
+       default_doc || return 1
+
+       _docs="README.md NOTICE ChangeLog"
+       for _doc in $_docs; do
+               install -m644 -D "$srcdir"/$pkgname-$pkgver/$_doc \
+                       "$pkgdir"/usr/share/doc/$akaname/$_doc || return 1
+       done
+
+       install -m644 -D "$srcdir"/$pkgname-$pkgver/LICENSE \
+               "$pkgdir"/usr/share/licenses/$akaname/LICENSE || return 1
+}
+
+md5sums="6b27455285f81e4335d00983076cf4b8  twemproxy-0.4.1.tar.gz
+6af0d24e69f0524dbff15f92a02bd4ea  nutcracker.initd
+2a81c4e8eff801c5ae6d6c374f20f30c  nutcracker.confd
+521837066110c2d0248c11620bf66e15  use-system-libyaml.patch"
+sha256sums="00c2940f91947bea9457a348316aac1aa1d4e757238aafbefc9d51057da8ede0 
twemproxy-0.4.1.tar.gz
+eed207f670095a2376d95e2413ff21251e4469e0e8a3bbc7f1f1c0f9fae9c2c2 
nutcracker.initd
+7de80f41306ebbd66af727f2a67dabf6664b4dcc0092b391f2ce1bbeedab5c8b 
nutcracker.confd
+718fe0cf3a48f51f5b8a2b6ef8120068b1604c7588b33e5db27de8301e77fdf4 
use-system-libyaml.patch"
+sha512sums="581fae1d12feb983ed25b22cd6f597fd28b7070906ac29d3990669ae5c626a468914021cee152a6a2299a2838c838ad907e4c911b911ef04166ac7bbb2982da1 
twemproxy-0.4.1.tar.gz
+edc7d4dd54ab7f71b8a3b8d4644593b37fb4f552a996dabcedf4ca5709b89c5618ca853f1cb8fab3fe0852843e72954943d63cdee1f95e9b4ffe7c3103a91ce6 
nutcracker.initd
+d636a3e9c1e9ad66abb7ac212b8f9f83badfb1619e03d35e9df81c0020c42b287763f9b79331dfbf1155ae99de68188d717445e858b7825cac29b9223c1f189d 
nutcracker.confd
+beadf407de53378bfe0ee12bbdf2315bde220a322aa13fc1993b487e1503f8825280408c500c902db683ee35b255e304acfe2cb011a6e9ffe02cdbfcfb1d2bf5 
use-system-libyaml.patch"
diff --git a/testing/twemproxy/nutcracker.confd 
b/testing/twemproxy/nutcracker.confd
new file mode 100644
index 0000000..7f25419
--- /dev/null
+++ b/testing/twemproxy/nutcracker.confd
_at_@ -0,0 +1,6 @@
+CONFFILE=/etc/nutcracker/nutcracker.yml
+PIDFILE=/var/run/nutcracker/nutcracker.pid
+LOGFILE=/var/log/nutcracker/nutcracker.log
+STATSPORT=22222
+
+DAEMON_ARGS="-c $CONFFILE -o $LOGFILE -p $PIDFILE -s $STATSPORT -v 11 
-m 2048 -d"
diff --git a/testing/twemproxy/nutcracker.initd 
b/testing/twemproxy/nutcracker.initd
new file mode 100644
index 0000000..fc802ff
--- /dev/null
+++ b/testing/twemproxy/nutcracker.initd
_at_@ -0,0 +1,39 @@
+#!/sbin/openrc-run
+
+NAME="nutcracker"
+DAEMON=/usr/sbin/nutcracker
+USER=${USER:-nobody}
+
+CONFFILE=${CONFFILE:-/etc/nutcracker/nutcracker.yml}
+PIDFILE=/var/run/nutcracker/nutcracker.pid
+LOGFILE=/var/log/nutcracker/nutcracker.log
+STATSPORT=22222
+
+DAEMON_ARGS=${DAEMON_ARGS:-"-c $CONFFILE -o $LOGFILE -p $PIDFILE -s 
$STATSPORT -v 11 -m 2048 -d"}
+
+depend() {
+       need net
+       after firewall
+}
+
+start() {
+       touch $PIDFILE
+       chown $USER:$USER -R /var/run/nutcracker
+       chmod 755 /var/run/nutcracker
+
+       ebegin "Starting ${NAME}: "
+               start-stop-daemon --start --quiet \
+                       --pidfile ${PIDFILE} \
+                       --chuid ${USER}:${USER} \
+                       --exec ${DAEMON} -- ${DAEMON_ARGS}
+       eend $?
+}
+
+stop() {
+       ebegin "Stopping ${NAME}: "
+               start-stop-daemon --stop --quiet \
+                       --pidfile ${PIDFILE} \
+                       --exec ${DAEMON}
+       eend $?
+}
+
diff --git a/testing/twemproxy/use-system-libyaml.patch 
b/testing/twemproxy/use-system-libyaml.patch
new file mode 100644
index 0000000..e3ec54a
--- /dev/null
+++ b/testing/twemproxy/use-system-libyaml.patch
_at_@ -0,0 +1,60 @@
+--- twemproxy-0.4.1/Makefile.am
++++ twemproxy/src/twemproxy-0.4.1/Makefile.am
+_at_@ -2,7 +2,7 @@
+
+ ACLOCAL_AMFLAGS = -I m4
+
+-SUBDIRS = contrib src
++SUBDIRS = src
+
+ dist_man_MANS = man/nutcracker.8
+
+--- twemproxy-0.4.1/configure.ac
++++ twemproxy/src/twemproxy-0.4.1/configure.ac
+_at_@ -75,6 +75,14 @@
+ # Checks for libraries
+ AC_CHECK_LIB([m], [pow])
+ AC_CHECK_LIB([pthread], [pthread_create])
++AC_CHECK_LIB([yaml], [yaml_get_version_string],,LIBYAML="no")
++if test "$LIBYAML" = "no"; then
++    echo
++    echo "    Error: libyaml library not found."
++    echo "    Run apk add yaml-dev"
++    echo
++    exit 1
++fi
+
+ # Checks for library functions
+ AC_FUNC_FORK
+_at_@ -196,15 +204,8 @@
+   [AC_DEFINE([HAVE_STATS], [1], [Define to 1 if stats is not disabled])])
+ AC_MSG_RESULT($disable_stats)
+
+-# Untar the yaml-0.1.4 in contrib/ before config.status is rerun
+-AC_CONFIG_COMMANDS_PRE([tar xvfz contrib/yaml-0.1.4.tar.gz -C contrib])
+-
+-# Call yaml-0.1.4 ./configure recursively
+-AC_CONFIG_SUBDIRS([contrib/yaml-0.1.4])
+-
+ # Define Makefiles
+ AC_CONFIG_FILES([Makefile
+-                 contrib/Makefile
+                  src/Makefile
+                  src/hashkit/Makefile
+                  src/proto/Makefile
+--- twemproxy-0.4.1/src/Makefile.am
++++ twemproxy/src/twemproxy-0.4.1/src/Makefile.am
+_at_@ -21,7 +21,7 @@
+ AM_CFLAGS += -Wstrict-prototypes -Wmissing-prototypes 
-Wredundant-decls -Wmissing-declarations
+
+ AM_LDFLAGS =
+-AM_LDFLAGS += -lm -lpthread -rdynamic
++AM_LDFLAGS += -lm -lpthread -lyaml -rdynamic
+ if OS_SOLARIS
+ AM_LDFLAGS += -lnsl -lsocket
+ endif
+_at_@ -57,4 +57,3 @@
+ nutcracker_LDADD = $(top_builddir)/src/hashkit/libhashkit.a
+ nutcracker_LDADD += $(top_builddir)/src/proto/libproto.a
+ nutcracker_LDADD += $(top_builddir)/src/event/libevent.a
+-nutcracker_LDADD += $(top_builddir)/contrib/yaml-0.1.4/src/.libs/libyaml.a
--
2.4.1
---
Unsubscribe:  alpine-aports+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-aports+help_at_lists.alpinelinux.org
---
Received on Sun Oct 18 2015 - 23:22:07 GMT