summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dev-libs/hiredict')
-rw-r--r--dev-libs/hiredict/Manifest1
-rw-r--r--dev-libs/hiredict/files/hiredict-1.3.1-disable-network-tests.patch16
-rw-r--r--dev-libs/hiredict/hiredict-1.3.1.ebuild96
-rw-r--r--dev-libs/hiredict/metadata.xml23
4 files changed, 136 insertions, 0 deletions
diff --git a/dev-libs/hiredict/Manifest b/dev-libs/hiredict/Manifest
new file mode 100644
index 000000000000..2f0539354c7c
--- /dev/null
+++ b/dev-libs/hiredict/Manifest
@@ -0,0 +1 @@
+DIST hiredict-1.3.1.tar.gz 118800 BLAKE2B 8d051ff9aa0f3f50acca96fa85c40369665769f4ddc2d5275eb19a279196a5ec571f6099f32b820447cdf89c95f88a0350ca70ed58acedfce82bd4d3cd41ded4 SHA512 208672d4dbdcc8bf21cff494ea2191b97b9d67b2c4b5a4f94e2c165613315b28b09e9e03de0495a069320df671e3f9d22a43209f175c2aae71550b0d832c0112
diff --git a/dev-libs/hiredict/files/hiredict-1.3.1-disable-network-tests.patch b/dev-libs/hiredict/files/hiredict-1.3.1-disable-network-tests.patch
new file mode 100644
index 000000000000..94562b57e3ad
--- /dev/null
+++ b/dev-libs/hiredict/files/hiredict-1.3.1-disable-network-tests.patch
@@ -0,0 +1,16 @@
+diff --git a/test.c b/test.c
+index 48d53e9..91bc794 100644
+--- a/test.c
++++ b/test.c
+@@ -2459,9 +2467,11 @@ int main(int argc, char **argv) {
+ }
+ #endif /* HIREDICT_TEST_ASYNC */
+
++#if 0
+ cfg.type = CONN_TCP;
+ printf("\nTesting asynchronous API using polling_adapter TCP (%s:%d):\n", cfg.tcp.host, cfg.tcp.port);
+ test_async_polling(cfg);
++#endif
+ if (test_unix_socket) {
+ cfg.type = CONN_UNIX;
+ printf("\nTesting asynchronous API using polling_adapter UNIX (%s):\n", cfg.unix_sock.path);
diff --git a/dev-libs/hiredict/hiredict-1.3.1.ebuild b/dev-libs/hiredict/hiredict-1.3.1.ebuild
new file mode 100644
index 000000000000..bd7927c958a2
--- /dev/null
+++ b/dev-libs/hiredict/hiredict-1.3.1.ebuild
@@ -0,0 +1,96 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit toolchain-funcs
+
+DESCRIPTION="Minimalistic C client library for the Redict database"
+HOMEPAGE="https://codeberg.org/redict/hiredict"
+SRC_URI="https://codeberg.org/redict/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
+
+S=${WORKDIR}/${PN}
+
+LICENSE="BSD LGPL-3"
+SLOT="0/$(ver_cut 1-2)"
+KEYWORDS="~amd64"
+IUSE="shim ssl static-libs test"
+RESTRICT="!test? ( test )"
+
+DEPEND="
+ ssl? ( dev-libs/openssl:= )
+ shim? ( !dev-libs/hiredis )
+"
+RDEPEND="${DEPEND}"
+BDEPEND="
+ test? (
+ dev-db/redict
+ dev-libs/libevent
+ )
+"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-1.3.1-disable-network-tests.patch
+)
+
+_build() {
+ tc-export AR CC
+ local myconf=(
+ AR="${AR}"
+ CC="${CC}"
+ CFLAGS="${CFLAGS}"
+ LDFLAGS="${LDFLAGS}"
+ DESTDIR="${ED}"
+ PREFIX="/usr"
+ LIBRARY_PATH="$(get_libdir)"
+ USE_SSL=$(usex ssl 1 0)
+ TEST_ASYNC=$(usex test 1 0)
+ DEBUG_FLAGS=
+ OPTIMIZATION=
+ USE_WERROR=0
+ )
+ emake "${myconf[@]}" "$@"
+}
+
+src_compile() {
+ # The static lib re-uses the same objects as the shared lib, so
+ # overhead is low w/creating it all the time. It's also needed
+ # by the tests.
+ _build dynamic static hiredict{,_ssl}.pc
+}
+
+src_test() {
+ # Compare with https://codeberg.org/redict/hiredict/src/tag/1.3.1/Makefile#L37
+ local REDICT_PID="${T}"/hiredict.pid
+ local REDICT_SOCK="${T}"/hiredict.sock
+ local REDICT_PORT=56379
+ local REDICT_TEST_CONFIG="
+ daemonize yes
+ pidfile ${REDICT_PID}
+ port ${REDICT_PORT}
+ bind 127.0.0.1
+ unixsocket //${REDICT_SOCK}
+ "
+
+ _build hiredict-test
+
+ "${EPREFIX}"/usr/bin/redict-server - <<< "${REDICT_TEST_CONFIG}" || die
+ ./hiredict-test -h 127.0.0.1 -p ${REDICT_PORT} -s ${REDICT_SOCK}
+ local ret=$?
+
+ kill "$(<"${REDICT_PID}")" || die
+ [[ ${ret} != "0" ]] && die "tests failed"
+}
+
+src_install() {
+ _build install
+
+ if ! use static-libs ; then
+ find "${ED}" -name '*.a' -delete || die
+ fi
+
+ if ! use shim; then
+ find "${ED}" -type d -name 'hiredis' -exec rm -r {} + || die
+ find "${ED}" -name 'hiredis*.pc' -delete || die
+ fi
+}
diff --git a/dev-libs/hiredict/metadata.xml b/dev-libs/hiredict/metadata.xml
new file mode 100644
index 000000000000..8184c9d384cc
--- /dev/null
+++ b/dev-libs/hiredict/metadata.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person" proxied="yes">
+ <email>navi@vlhl.dev</email>
+ <name>Anna (navi) Figueiredo Gomes</name>
+ </maintainer>
+ <maintainer type="project" proxied="proxy">
+ <email>proxy-maint@gentoo.org</email>
+ <name>Proxy Maintainers</name>
+ </maintainer>
+ <slots>
+ <subslots>Reflect ABI of libhiredict.so.</subslots>
+ </slots>
+ <upstream>
+ <remote-id type="codeberg">redict/hiredict</remote-id>
+ </upstream>
+ <use>
+ <flag name="shim">
+ Install header shims for the hiredis api.
+ </flag>
+ </use>
+</pkgmetadata>