From: Zurab Kvachadze <zurabid2016@gmail.com>
To: gentoo-dev@lists.gentoo.org
Cc: Zurab Kvachadze <zurabid2016@gmail.com>
Subject: [gentoo-dev] [PATCH v4 23/44] www-nginx/ngx-set-misc: new package, add 0.33
Date: Thu, 3 Jul 2025 00:06:43 +0200 [thread overview]
Message-ID: <20250702220705.4649-24-zurabid2016@gmail.com> (raw)
In-Reply-To: <20250702220705.4649-1-zurabid2016@gmail.com>
The build system of this package automagically enables HMAC support
based on SSL functionality being enabled in the installed NGINX.
In order to enable this support independently, via a USE flag, a "hack"
is applied: only if GENTOO_USE_HMAC environmental variable and
preprocessor definition are defined, HMAC support is enabled.
Signed-off-by: Zurab Kvachadze <zurabid2016@gmail.com>
---
www-nginx/ngx-set-misc/Manifest | 1 +
.../ngx-set-misc-0.33-hmac-configurable.patch | 71 +++++++++++++++++++
www-nginx/ngx-set-misc/metadata.xml | 25 +++++++
.../ngx-set-misc/ngx-set-misc-0.33.ebuild | 43 +++++++++++
4 files changed, 140 insertions(+)
create mode 100644 www-nginx/ngx-set-misc/Manifest
create mode 100644 www-nginx/ngx-set-misc/files/ngx-set-misc-0.33-hmac-configurable.patch
create mode 100644 www-nginx/ngx-set-misc/metadata.xml
create mode 100644 www-nginx/ngx-set-misc/ngx-set-misc-0.33.ebuild
diff --git a/www-nginx/ngx-set-misc/Manifest b/www-nginx/ngx-set-misc/Manifest
new file mode 100644
index 000000000000..34be9e483747
--- /dev/null
+++ b/www-nginx/ngx-set-misc/Manifest
@@ -0,0 +1 @@
+DIST ngx-set-misc-0.33.tar.gz 30084 BLAKE2B 1aabf47e86946054d128a10290c36829152d427cf415378f5042e00e428baaf94a91e1d8ee1037b8a40197637c721492b01a82c800064decb9471149ad47bcff SHA512 1ff4c947538a5bd5f9d6adcd87b37f2702f5cc90e3342bc08359cbe8f290b705a3a2daa3dedfb1df3ce4bc19478c8fcac07081c4a53a804fc2862d50078278dc
diff --git a/www-nginx/ngx-set-misc/files/ngx-set-misc-0.33-hmac-configurable.patch b/www-nginx/ngx-set-misc/files/ngx-set-misc-0.33-hmac-configurable.patch
new file mode 100644
index 000000000000..49302624efa3
--- /dev/null
+++ b/www-nginx/ngx-set-misc/files/ngx-set-misc-0.33-hmac-configurable.patch
@@ -0,0 +1,71 @@
+From 01292430b8eb0972670a3221c4809fc6a9bd98f2 Mon Sep 17 00:00:00 2001
+From: Zurab Kvachadze <zurabid2016@gmail.com>
+Date: Mon, 23 Dec 2024 00:32:18 +0100
+Subject: [PATCH] Make HMAC support easily toggleable
+
+set-misc-nginx-module tries to automagically detect the presence of the
+crypto library by checking USE_OPENSSL and MAIL_SSL shell variables.
+These variables are set by NGINX build system (see 'auto/modules') if
+OpenSSL and mail_ssl modules are being used respectively. Since set-misc
+does not actually depend on any of the NGINX's SSL modules, but rather
+on OpenSSL itself, we change the guard variable to GENTOO_USE_HMAC and
+set from within ebuild based on a USE flag.
+
+This also makes a similar change to ngx_http_set_misc_module.c file.
+
+Signed-off-by: Zurab Kvachadze <zurabid2016@gmail.com>
+---
+ config | 3 ++-
+ src/ngx_http_set_misc_module.c | 6 +++---
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/config b/config
+index 7bb00af..58bffd4 100755
+--- a/config
++++ b/config
+@@ -54,9 +54,10 @@ SET_MISC_DEPS=" \
+ $ngx_addon_dir/src/ngx_http_set_misc_module.h \
+ "
+
+-if [ $USE_OPENSSL = YES -o $MAIL_SSL = YES ]; then
++if [ $GENTOO_USE_HMAC = YES ]; then
+ SET_MISC_DEPS="$SET_MISC_DEPS $ngx_addon_dir/src/ngx_http_set_hmac.h"
+ SET_MISC_SRCS="$SET_MISC_SRCS $ngx_addon_dir/src/ngx_http_set_hmac.c"
++ CFLAGS="$CFLAGS -DGENTOO_USE_HMAC=1"
+ fi
+
+ CFLAGS="$CFLAGS -DNDK_SET_VAR -DNDK_UPSTREAM_LIST"
+diff --git a/src/ngx_http_set_misc_module.c b/src/ngx_http_set_misc_module.c
+index 3b12b0e..6d4df68 100644
+--- a/src/ngx_http_set_misc_module.c
++++ b/src/ngx_http_set_misc_module.c
+@@ -18,7 +18,7 @@
+ #include "ngx_http_set_hex.h"
+ #include "ngx_http_set_base64.h"
+ #include "ngx_http_set_base64url.h"
+-#if NGX_OPENSSL
++#if GENTOO_USE_HMAC
+ #include "ngx_http_set_hmac.h"
+ #endif
+ #include "ngx_http_set_random.h"
+@@ -90,7 +90,7 @@ static ndk_set_var_t ngx_http_set_misc_set_encode_hex_filter = {
+ };
+
+
+-#if NGX_OPENSSL
++#if GENTOO_USE_HMAC
+ static ndk_set_var_t ngx_http_set_misc_set_hmac_sha1_filter = {
+ NDK_SET_VAR_MULTI_VALUE,
+ (void *) ngx_http_set_misc_set_hmac_sha1,
+@@ -281,7 +281,7 @@ static ngx_command_t ngx_http_set_misc_commands[] = {
+ 0,
+ &ngx_http_set_misc_set_encode_hex_filter
+ },
+-#if NGX_OPENSSL
++#if GENTOO_USE_HMAC
+ { ngx_string ("set_hmac_sha1"),
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF
+ |NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE3,
+--
+2.45.3
+
diff --git a/www-nginx/ngx-set-misc/metadata.xml b/www-nginx/ngx-set-misc/metadata.xml
new file mode 100644
index 000000000000..327c79a8fbb6
--- /dev/null
+++ b/www-nginx/ngx-set-misc/metadata.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person" proxied="yes">
+ <email>zurabid2016@gmail.com</email>
+ <name>Zurab Kvachadze</name>
+ </maintainer>
+ <maintainer type="project" proxied="proxy">
+ <email>proxy-maint@gentoo.org</email>
+ <name>Proxy Maintainers</name>
+ </maintainer>
+ <longdescription>
+ The ngx-set-mist module extends the standard NGINX HttpRewriteModule's directive set to
+ provide more functionalities like URI escaping and unescaping, JSON quoting,
+ Hexadecimal/MD5/SHA1/Base32/Base64 digest encoding and decoding, random number generator,
+ and more.
+ </longdescription>
+ <use>
+ <flag name="hmac">Enable support for generating HMAC digests using <pkg>dev-libs/openssl</pkg></flag>
+ </use>
+ <upstream>
+ <bugs-to>https://github.com/openresty/set-misc-nginx-module/issues</bugs-to>
+ <remote-id type="github">openresty/set-misc-nginx-module</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/www-nginx/ngx-set-misc/ngx-set-misc-0.33.ebuild b/www-nginx/ngx-set-misc/ngx-set-misc-0.33.ebuild
new file mode 100644
index 000000000000..c71366126ffe
--- /dev/null
+++ b/www-nginx/ngx-set-misc/ngx-set-misc-0.33.ebuild
@@ -0,0 +1,43 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+MY_PN="set-misc-nginx-module"
+NGINX_MOD_S="${WORKDIR}/${MY_PN}-${PV}"
+
+NGINX_MOD_LINK_MODULES=( www-nginx/ngx_devel_kit )
+
+inherit toolchain-funcs nginx-module
+
+DESCRIPTION="An NGINX module that adds various set_xxx directives to NGINX's rewrite module"
+HOMEPAGE="https://github.com/openresty/set-misc-nginx-module"
+SRC_URI="
+ https://github.com/openresty/set-misc-nginx-module/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
+"
+
+LICENSE="BSD-2"
+SLOT="0"
+
+IUSE="+hmac"
+
+RESTRICT="test"
+
+BDEPEND="virtual/pkgconfig"
+DEPEND="hmac? ( dev-libs/openssl:= )"
+RDEPEND="${DEPEND}"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-0.33-hmac-configurable.patch"
+)
+
+src_configure() {
+ # These are variables patched into the build system to be able to control
+ # HMAC support. For more details, see the "hmac-configurable" patch above.
+ local -x GENTOO_USE_HMAC=NO
+ if use hmac; then
+ GENTOO_USE_HMAC=YES
+ ngx_mod_append_libs "$("$(tc-getPKG_CONFIG)" --libs libcrypto)"
+ fi
+ nginx-module_src_configure
+}
--
2.49.0
next prev parent reply other threads:[~2025-07-02 22:29 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-02 22:06 [gentoo-dev] [PATCH v4 00/44] Rework NGINX packaging in Gentoo by introducing nginx{,-module}.eclass Zurab Kvachadze
2025-07-02 22:06 ` [gentoo-dev] [PATCH v4 01/44] nginx.eclass: Add new eclass for building the NGINX server Zurab Kvachadze
2025-07-02 22:06 ` [gentoo-dev] [PATCH v4 02/44] dev-perl/Test-Nginx: new package, add 0.31 Zurab Kvachadze
2025-07-02 22:06 ` [gentoo-dev] [PATCH v4 03/44] nginx-module.eclass: Add new eclass for building NGINX external modules Zurab Kvachadze
2025-07-02 22:06 ` [gentoo-dev] [PATCH v4 04/44] profiles/arch/powerpc/ppc64: mask tests for www-servers/nginx Zurab Kvachadze
2025-07-02 22:06 ` [gentoo-dev] [PATCH v4 05/44] profiles/arch/riscv: " Zurab Kvachadze
2025-07-02 22:06 ` [gentoo-dev] [PATCH v4 06/44] www-servers/nginx: add myself as a proxy maintainer; update metadata.xml Zurab Kvachadze
2025-07-02 22:06 ` [gentoo-dev] [PATCH v4 07/44] www-servers/nginx: add nginx.tmpfiles for managing /var/tmp/nginx Zurab Kvachadze
2025-07-02 22:06 ` [gentoo-dev] [PATCH v4 08/44] www-servers/nginx: add nginx-r5.initd Zurab Kvachadze
2025-07-02 22:06 ` [gentoo-dev] [PATCH v4 09/44] www-servers/nginx: add nginx-r1.confd Zurab Kvachadze
2025-07-02 22:06 ` [gentoo-dev] [PATCH v4 10/44] www-servers/nginx: add nginx-r2.service Zurab Kvachadze
2025-07-02 22:06 ` [gentoo-dev] [PATCH v4 11/44] www-servers/nginx: add nginx-r2.logrotate Zurab Kvachadze
2025-07-02 22:06 ` [gentoo-dev] [PATCH v4 12/44] www-servers/nginx: add nginx-r4.conf Zurab Kvachadze
2025-07-02 22:06 ` [gentoo-dev] [PATCH v4 13/44] profiles/desc: reword and update nginx_modules_http.desc Zurab Kvachadze
2025-07-02 22:06 ` [gentoo-dev] [PATCH v4 14/44] profiles/desc: reword and update nginx_modules_mail.desc Zurab Kvachadze
2025-07-02 22:06 ` [gentoo-dev] [PATCH v4 15/44] profiles/desc: reword and update nginx_modules_stream.desc Zurab Kvachadze
2025-07-02 22:06 ` [gentoo-dev] [PATCH v4 16/44] profiles/categories: Add www-nginx category for external NGINX modules Zurab Kvachadze
2025-07-02 22:06 ` [gentoo-dev] [PATCH v4 17/44] app-metrics/nginx-lua-prometheus: revbump to r101, update EAPI 7 -> 8, remove r100 Zurab Kvachadze
2025-07-02 22:06 ` [gentoo-dev] [PATCH v4 18/44] www-servers/nginx: add 1.29.0, use nginx.eclass Zurab Kvachadze
2025-07-02 22:06 ` [gentoo-dev] [PATCH v4 19/44] www-servers/nginx: add 9999 live version, " Zurab Kvachadze
2025-07-02 22:06 ` [gentoo-dev] [PATCH v4 20/44] www-nginx/ngx_devel_kit: new package, add 0.3.4 Zurab Kvachadze
2025-07-02 22:06 ` [gentoo-dev] [PATCH v4 21/44] www-nginx/ngx-echo: new package, add 0.63 Zurab Kvachadze
2025-07-02 22:06 ` [gentoo-dev] [PATCH v4 22/44] www-nginx/ngx-encrypted-session: new package, add 0.09 Zurab Kvachadze
2025-07-02 22:06 ` Zurab Kvachadze [this message]
2025-07-02 22:06 ` [gentoo-dev] [PATCH v4 24/44] www-nginx/ngx-brotli: new package, add 20231109 Zurab Kvachadze
2025-07-02 22:06 ` [gentoo-dev] [PATCH v4 25/44] www-nginx/ngx-headers-more: new package, add 0.37 Zurab Kvachadze
2025-07-02 22:06 ` [gentoo-dev] [PATCH v4 26/44] www-nginx/ngx-upload-progress: new package, add 0.9.3 Zurab Kvachadze
2025-07-02 22:06 ` [gentoo-dev] [PATCH v4 27/44] dev-lua/lua-resty-core: new package, add 0.1.30 Zurab Kvachadze
2025-07-02 22:06 ` [gentoo-dev] [PATCH v4 28/44] dev-lua/lua-resty-lrucache: new package, add 0.15 Zurab Kvachadze
2025-07-02 22:06 ` [gentoo-dev] [PATCH v4 29/44] www-nginx/ngx-lua-module: new package, add 0.10.27 Zurab Kvachadze
2025-07-02 22:06 ` [gentoo-dev] [PATCH v4 30/44] dev-lua/lua-resty-string: new package, add 0.16 Zurab Kvachadze
2025-07-02 22:06 ` [gentoo-dev] [PATCH v4 31/44] dev-lua/lua-resty-mysql: new package, add 0.27 Zurab Kvachadze
2025-07-02 22:06 ` [gentoo-dev] [PATCH v4 32/44] dev-lua/lua-resty-memcached: new package, add 0.17 Zurab Kvachadze
2025-07-02 22:06 ` [gentoo-dev] [PATCH v4 33/44] www-nginx/ngx-xss: new package, add 0.06 Zurab Kvachadze
2025-07-02 22:06 ` [gentoo-dev] [PATCH v4 34/44] www-nginx/ngx-eval: new package, add 0_p20240817 Zurab Kvachadze
2025-07-02 22:06 ` [gentoo-dev] [PATCH v4 35/44] www-nginx/ngx-iconv: new package, add 0.14 Zurab Kvachadze
2025-07-02 22:06 ` [gentoo-dev] [PATCH v4 36/44] www-nginx/ngx-srcache: new package, add 0.33 Zurab Kvachadze
2025-07-02 22:06 ` [gentoo-dev] [PATCH v4 37/44] www-nginx/ngx-lua-upstream: new package, add 0.07 Zurab Kvachadze
2025-07-02 22:06 ` [gentoo-dev] [PATCH v4 38/44] www-nginx/ngx-memc: new package, add 0.20 Zurab Kvachadze
2025-07-02 22:06 ` [gentoo-dev] [PATCH v4 39/44] www-nginx: enable tests for OpenResty modules Zurab Kvachadze
2025-07-02 22:07 ` [gentoo-dev] [PATCH v4 40/44] www-nginx/ngx-dav-ext: new package, add 3.0.0 Zurab Kvachadze
2025-07-02 22:07 ` [gentoo-dev] [PATCH v4 41/44] www-nginx/ngx-geoip2: new package, add 3.4 Zurab Kvachadze
2025-07-02 22:07 ` [gentoo-dev] [PATCH v4 42/44] www-nginx/ngx-fancyindex: new package, add 0.5.2 Zurab Kvachadze
2025-07-02 22:07 ` [gentoo-dev] [PATCH v4 43/44] www-nginx/ngx-vod: new package, add 1.33 Zurab Kvachadze
2025-07-02 22:07 ` [gentoo-dev] [PATCH v4 44/44] www-nginx/ngx-modsecurity: new package, add 1.0.3 Zurab Kvachadze
2025-07-05 7:23 ` [gentoo-dev] [PATCH v4 00/44] Rework NGINX packaging in Gentoo by introducing nginx{,-module}.eclass Sam James
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250702220705.4649-24-zurabid2016@gmail.com \
--to=zurabid2016@gmail.com \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox