commit:     59c641be74b0f217d0d47763aa9a0f3437b9d76b
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 12 05:27:32 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Mar 12 05:27:32 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=59c641be

net-proxy/nutcracker: add 0.5.0

Closes: https://bugs.gentoo.org/861860
Signed-off-by: Sam James <sam <AT> gentoo.org>

 net-proxy/nutcracker/Manifest                      |  1 +
 .../files/nutcracker-0.5.0-configure-bashism.patch | 11 ++++
 ...tcracker-0.5.0-md5_signature-lto-mismatch.patch | 12 +++++
 .../nutcracker-0.5.0-use-system-libyaml.patch      | 62 ++++++++++++++++++++++
 net-proxy/nutcracker/nutcracker-0.5.0.ebuild       | 51 ++++++++++++++++++
 5 files changed, 137 insertions(+)

diff --git a/net-proxy/nutcracker/Manifest b/net-proxy/nutcracker/Manifest
index e23ed70311fa..d135fda95e43 100644
--- a/net-proxy/nutcracker/Manifest
+++ b/net-proxy/nutcracker/Manifest
@@ -1 +1,2 @@
 DIST nutcracker-0.4.1.tar.gz 1163442 BLAKE2B 
6838fbb5623ad49ef564176ba4c7d4e61cedb9693851cacc06d8ed09e3045b8cff9df1af8e21790cfa0e3f988b81a9c9cfa852449d532a432c05f3f4c3eace56
 SHA512 
581fae1d12feb983ed25b22cd6f597fd28b7070906ac29d3990669ae5c626a468914021cee152a6a2299a2838c838ad907e4c911b911ef04166ac7bbb2982da1
+DIST twemproxy-0.5.0.tar.gz 1298797 BLAKE2B 
f321fb7c44bb1abca2986f458b01234da50973fd75fee1eb2e22e6119be48adab5f45f78317aa99d234a246b26e579050df4b094658139d10207f817f26c14b1
 SHA512 
01a90b4596c0c50535b424f193b172f39d50432b91005bb36e08a6a37fdcb0ba612a905f49ff1c0acf0e168b7cdf7552425fb095f373c180801e1d68b1b0d1c9

diff --git 
a/net-proxy/nutcracker/files/nutcracker-0.5.0-configure-bashism.patch 
b/net-proxy/nutcracker/files/nutcracker-0.5.0-configure-bashism.patch
new file mode 100644
index 000000000000..888779a82514
--- /dev/null
+++ b/net-proxy/nutcracker/files/nutcracker-0.5.0-configure-bashism.patch
@@ -0,0 +1,11 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -159,7 +159,7 @@ AS_IF([test "x$ac_cv_epoll_works" = "xno" &&
+ AM_CONDITIONAL([OS_LINUX], [test "x$ac_cv_epoll_works" = "xyes"])
+ AM_CONDITIONAL([OS_BSD], [test "x$ac_cv_kqueue_works" = "xyes"])
+ AM_CONDITIONAL([OS_SOLARIS], [test "x$ac_cv_evports_works" = "xyes"])
+-AM_CONDITIONAL([OS_FREEBSD], [test "$(uname -v | cut -c 1-10)" == "FreeBSD 
10"])
++AM_CONDITIONAL([OS_FREEBSD], [test "$(uname -v | cut -c 1-10)" = "FreeBSD 
10"])
+ 
+ # Package options
+ AC_MSG_CHECKING([whether to enable debug logs and asserts])

diff --git 
a/net-proxy/nutcracker/files/nutcracker-0.5.0-md5_signature-lto-mismatch.patch 
b/net-proxy/nutcracker/files/nutcracker-0.5.0-md5_signature-lto-mismatch.patch
new file mode 100644
index 000000000000..bb493f209bb8
--- /dev/null
+++ 
b/net-proxy/nutcracker/files/nutcracker-0.5.0-md5_signature-lto-mismatch.patch
@@ -0,0 +1,12 @@
+https://bugs.gentoo.org/861860
+--- a/src/hashkit/nc_hashkit.h
++++ b/src/hashkit/nc_hashkit.h
+@@ -55,7 +55,7 @@ typedef enum dist_type {
+ #undef DEFINE_ACTION
+ 
+ uint32_t hash_one_at_a_time(const char *key, size_t key_length);
+-void md5_signature(const unsigned char *key, unsigned int length, unsigned 
char *result);
++void md5_signature(const unsigned char *key, unsigned long length, unsigned 
char *result);
+ uint32_t hash_md5(const char *key, size_t key_length);
+ uint32_t hash_crc16(const char *key, size_t key_length);
+ uint32_t hash_crc32(const char *key, size_t key_length);

diff --git 
a/net-proxy/nutcracker/files/nutcracker-0.5.0-use-system-libyaml.patch 
b/net-proxy/nutcracker/files/nutcracker-0.5.0-use-system-libyaml.patch
new file mode 100644
index 000000000000..ddb6694f05b6
--- /dev/null
+++ b/net-proxy/nutcracker/files/nutcracker-0.5.0-use-system-libyaml.patch
@@ -0,0 +1,62 @@
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -2,7 +2,7 @@ MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure 
config.h.in config.h.in~
+ 
+ ACLOCAL_AMFLAGS = -I m4
+ 
+-SUBDIRS = contrib src
++SUBDIRS = src
+ 
+ dist_man_MANS = man/nutcracker.8
+ 
+--- a/configure.ac
++++ b/configure.ac
+@@ -197,11 +197,8 @@ AS_IF([test "x$disable_stats" = xyes],
+   [AC_DEFINE([HAVE_STATS], [1], [Define to 1 if stats is not disabled])])
+ AC_MSG_RESULT($disable_stats)
+ 
+-# Untar the yaml-0.2.5 in contrib/ before config.status is rerun
+-AC_CONFIG_COMMANDS_PRE([tar xvfz contrib/yaml-0.2.5.tar.gz -C contrib])
+-
+-# Call yaml-0.2.5 ./configure recursively
+-AC_CONFIG_SUBDIRS([contrib/yaml-0.2.5])
++# Use systems libyaml.
++PKG_CHECK_MODULES([YAML], [yaml-0.1 >= 0.2.5])
+ 
+ # Define Makefiles
+ AC_CONFIG_FILES([Makefile
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -7,7 +7,6 @@ endif
+ AM_CPPFLAGS += -I $(top_srcdir)/src/hashkit
+ AM_CPPFLAGS += -I $(top_srcdir)/src/proto
+ AM_CPPFLAGS += -I $(top_srcdir)/src/event
+-AM_CPPFLAGS += -I $(top_srcdir)/contrib/yaml-0.2.5/include
+ 
+ AM_CFLAGS =
+ # about -fno-strict-aliasing: https://github.com/twitter/twemproxy/issues/276
+@@ -20,9 +19,10 @@ AM_CFLAGS += -Wno-unused-parameter -Wno-unused-value
+ AM_CFLAGS += -Wconversion -Wsign-compare
+ AM_CFLAGS += -Wstrict-prototypes -Wmissing-prototypes -Wredundant-decls 
-Wmissing-declarations
+ AM_CFLAGS += -Wno-format-zero-length
++AM_CFLAGS += $(YAML_CFLAGS)
+ 
+ AM_LDFLAGS =
+-AM_LDFLAGS += -lm -lpthread -rdynamic
++AM_LDFLAGS += -lm -lpthread -rdynamic $(YAML_LIBS)
+ if OS_SOLARIS
+ AM_LDFLAGS += -lnsl -lsocket
+ endif
+@@ -58,7 +58,6 @@ nutcracker_SOURCES =                 \
+ 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.2.5/src/.libs/libyaml.a
+ 
+ TESTS = test_all
+ bin_PROGRAMS = test_all
+@@ -86,4 +85,3 @@ test_all_SOURCES = test_all.c \
+ test_all_LDADD = $(top_builddir)/src/hashkit/libhashkit.a
+ test_all_LDADD += $(top_builddir)/src/proto/libproto.a
+ test_all_LDADD += $(top_builddir)/src/event/libevent.a
+-test_all_LDADD += $(top_builddir)/contrib/yaml-0.2.5/src/.libs/libyaml.a

diff --git a/net-proxy/nutcracker/nutcracker-0.5.0.ebuild 
b/net-proxy/nutcracker/nutcracker-0.5.0.ebuild
new file mode 100644
index 000000000000..e3f1f9d6fb92
--- /dev/null
+++ b/net-proxy/nutcracker/nutcracker-0.5.0.ebuild
@@ -0,0 +1,51 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools
+
+DESCRIPTION="A fast, light-weight proxy for Memcached and Redis. (Twitter's 
Twemproxy)"
+HOMEPAGE="https://github.com/twitter/twemproxy";
+SRC_URI="https://github.com/twitter/twemproxy/releases/download/${PV}/twemproxy-${PV}.tar.gz";
+S="${WORKDIR}/twemproxy-${PV}"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="debug doc"
+
+DEPEND=">=dev-libs/libyaml-0.2.5"
+RDEPEND="${DEPEND}"
+BDEPEND="virtual/pkgconfig"
+
+PATCHES=(
+       # Let's use system libyaml
+       "${FILESDIR}"/${PN}-0.5.0-use-system-libyaml.patch
+       "${FILESDIR}"/${PN}-0.5.0-configure-bashism.patch
+       "${FILESDIR}"/${PN}-0.5.0-md5_signature-lto-mismatch.patch
+)
+
+src_prepare() {
+       default
+
+       eautoreconf
+}
+
+src_configure() {
+       econf $(use debug)
+}
+
+src_install() {
+       default
+
+       insinto /etc/nutcracker
+       newins conf/nutcracker.yml nutcracker.yml.example
+
+       newconfd "${FILESDIR}/nutcracker.confd.2" nutcracker
+       newinitd "${FILESDIR}/nutcracker.initd.2" nutcracker
+
+       if use doc; then
+               dodoc -r notes
+       fi
+}

Reply via email to