commit:     1709f1a075b23a20f2eaa4496efe88b79efdb425
Author:     Petr Vaněk <arkamar <AT> gentoo <DOT> org>
AuthorDate: Fri Nov  1 17:24:26 2024 +0000
Commit:     Petr Vaněk <arkamar <AT> gentoo <DOT> org>
CommitDate: Fri Nov  1 17:53:18 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1709f1a0

app-crypt/onak: add 0.6.3

- update EAPI 7 -> 8
- upstream switched to cmake
- new USE=hkp backend
- introduce USE=dynamic for dynaically loaded backends
- enable tests

Closes: https://bugs.gentoo.org/881011
Closes: https://bugs.gentoo.org/922152
Signed-off-by: Petr Vaněk <arkamar <AT> gentoo.org>

 app-crypt/onak/Manifest                     |  1 +
 app-crypt/onak/files/onak-0.6.3-cmake.patch | 51 +++++++++++++++++++++++
 app-crypt/onak/metadata.xml                 |  7 ++++
 app-crypt/onak/onak-0.6.3.ebuild            | 63 +++++++++++++++++++++++++++++
 4 files changed, 122 insertions(+)

diff --git a/app-crypt/onak/Manifest b/app-crypt/onak/Manifest
index d9eed6864eec..b7bdb2b9f5db 100644
--- a/app-crypt/onak/Manifest
+++ b/app-crypt/onak/Manifest
@@ -1 +1,2 @@
 DIST onak-0.5.0.tar.xz 240764 BLAKE2B 
a42d9a97137ae7fb403d8a20f2a9a5b5060d216fca97447630c8e8659440d5baa0c6e0fbe983feec8b4061263decc1183868055fe53c0797d49dd1f2e4c141f8
 SHA512 
db38793acc82089089ac0b9fb6db9989b6bb8e94c35c14112d028d12f7bb7553b7409121378346625528c4916506d007bf40963f4a346483f51a23b670680a7d
+DIST onak-0.6.3.tar.xz 717040 BLAKE2B 
bae6c5b6022b42f59d6cf978d5e79df7b8bb71692bc11cfd162563f8afacb07c81505e070a7f6154b409db78449cd3b2182a1232e6ff3dacb4588cd977482f44
 SHA512 
3952b2ca8dfc32236dc6fc92a35d0d8223ae03be343fef4fcda49875d9d2b6ceb042c1c2cd63c035c467ee2773a103a36c7407c201f23de176e2121559ea1bff

diff --git a/app-crypt/onak/files/onak-0.6.3-cmake.patch 
b/app-crypt/onak/files/onak-0.6.3-cmake.patch
new file mode 100644
index 000000000000..f1b62577c87d
--- /dev/null
+++ b/app-crypt/onak/files/onak-0.6.3-cmake.patch
@@ -0,0 +1,51 @@
+From 226cb71737b24ab602e26b72b183888cd1385e86 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20Van=C4=9Bk?= <[email protected]>
+Date: Fri, 1 Nov 2024 15:02:07 +0100
+Subject: [PATCH 1/2] Workaround automagic properties of CMakeList.txt
+
+The GENTOO_BACKENDS variable is controlled from the ebuild, therefore it
+can be synchronised with users USE preference, unlike the BACKENDS which
+is filled automagically based on detected libraries.
+
+Additionally, BACKEND_${DBTYPE}_LIBS variable needs to be propagated to
+the parent scope, otherwise non-dynamic db backend cannot link properly.
+---
+ CMakeLists.txt       | 2 +-
+ keydb/CMakeLists.txt | 4 +++-
+ 2 files changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index ed47ba3..d46dcdf 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -123,7 +123,7 @@ add_subdirectory(keydb)
+ if (DBTYPE STREQUAL "dynamic")
+       LIST(APPEND LIBONAK_LIBRARIES "dl")
+ else()
+-      list (FIND BACKENDS ${DBTYPE} _index)
++      list (FIND GENTOO_BACKENDS ${DBTYPE} _index)
+       if (${_index} LESS 0)
+               message(FATAL_ERROR "${DBTYPE} is not a supported DB backend.")
+       endif()
+diff --git a/keydb/CMakeLists.txt b/keydb/CMakeLists.txt
+index 7567b6c..724f208 100644
+--- a/keydb/CMakeLists.txt
++++ b/keydb/CMakeLists.txt
+@@ -50,7 +50,7 @@ if (KEYD STREQUAL "ON")
+ endif()
+ 
+ if (DBTYPE STREQUAL "dynamic")
+-      foreach(BACKEND IN LISTS BACKENDS)
++      foreach(BACKEND IN LISTS GENTOO_BACKENDS)
+               add_library(keydb_${BACKEND} SHARED keydb_${BACKEND}.c)
+               target_include_directories(keydb_${BACKEND} SYSTEM PUBLIC
+                       ${BACKEND_${BACKEND}_INC})
+@@ -59,4 +59,6 @@ if (DBTYPE STREQUAL "dynamic")
+               install(TARGETS keydb_${BACKEND} LIBRARY DESTINATION
+                       ${CMAKE_INSTALL_LIBDIR}/onak/backends/)
+       endforeach(BACKEND)
++else()
++      set(BACKEND_${DBTYPE}_LIBS ${BACKEND_${DBTYPE}_LIBS} PARENT_SCOPE)
+ endif()
+-- 
+2.45.2

diff --git a/app-crypt/onak/metadata.xml b/app-crypt/onak/metadata.xml
index 115e9d64a669..68c2a2f0f43b 100644
--- a/app-crypt/onak/metadata.xml
+++ b/app-crypt/onak/metadata.xml
@@ -2,4 +2,11 @@
 <!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd";>
 <pkgmetadata>
        <!-- maintainer-needed -->
+       <use>
+               <flag name="dynamic">Support for dynamic loading of 
backends</flag>
+               <flag name="hkp">Proxying backend support</flag>
+       </use>
+       <upstream>
+               <remote-id type="github">u1f35c/onak</remote-id>
+       </upstream>
 </pkgmetadata>

diff --git a/app-crypt/onak/onak-0.6.3.ebuild b/app-crypt/onak/onak-0.6.3.ebuild
new file mode 100644
index 000000000000..d1f63a70acd1
--- /dev/null
+++ b/app-crypt/onak/onak-0.6.3.ebuild
@@ -0,0 +1,63 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake
+
+DESCRIPTION="onak is an OpenPGP keyserver"
+HOMEPAGE="
+       https://www.earth.li/projectpurple/progs/onak.html
+       https://github.com/u1f35c/onak
+"
+SRC_URI="https://www.earth.li/projectpurple/files/${P}.tar.xz";
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="berkdb +dynamic hkp postgres test"
+REQUIRED_USE="test? ( dynamic )"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+       dev-libs/nettle:=
+       dev-libs/gmp:=
+       berkdb? ( sys-libs/db:= )
+       hkp? ( net-misc/curl )
+       postgres? ( dev-db/postgresql:= )
+"
+DEPEND="${RDEPEND}"
+
+DOCS=(
+       README.md onak.sql
+)
+
+PATCHES=(
+       "${FILESDIR}/${PN}-0.5.0-musl-strtouq-fix.patch"
+       "${FILESDIR}/${P}-cmake.patch"
+)
+
+src_configure() {
+       # variable is initialized with default values based on list from
+       # keydb/CMakeLists.txt. The fs backend is the last one in the list for
+       # USE=-dynamic backend options, see DBTYPE option, which mimics 
bahavior of
+       # older ebuild version.
+       local backends=( file keyring stacked keyd fs )
+       use berkdb && backends+=( db4 )
+       use hkp && backends+=( hkp )
+       use postgres && backends+=( pg )
+       local mycmakeargs=(
+               -DCMAKE_INSTALL_SYSCONFDIR="${EPREFIX}/etc"
+               -DGENTOO_BACKENDS=$(IFS=';'; echo "${backends[*]}")
+               -DDBTYPE=$(usex dynamic dynamic "${backends[-1]}")
+       )
+       cmake_src_configure
+}
+
+src_install() {
+       cmake_src_install
+
+       keepdir /var/lib/onak
+       insinto /usr/lib/cgi-bin/pks
+       doins "${BUILD_DIR}"/cgi/{add,gpgwww,hashquery,lookup}
+}

Reply via email to