summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorZurab Kvachadze <zurabid2016@gmail.com>2025-11-04 03:28:03 +0100
committerSam James <sam@gentoo.org>2025-11-13 12:33:10 +0000
commitfffbf942fc40a82d37746e70c061864aefa116f5 (patch)
tree6b596738b24b8638c79360ff1eb4b76c75af8fff /eclass
parentc7500d602d788da883866af503ca1fc381a57cd6 (diff)
downloadgentoo-fffbf942fc40a82d37746e70c061864aefa116f5.tar.gz
gentoo-fffbf942fc40a82d37746e70c061864aefa116f5.tar.bz2
gentoo-fffbf942fc40a82d37746e70c061864aefa116f5.zip
nginx-module.eclass: Add NGINX_MOD_CONFIG_DIR, fixup www-nginx/ngx-naxsi
This might be useful for packages having "config" in a non-root directory. For example, imagine the following directory tree for some NGINX module: +--nginx/ | +--config | +--ngx_module.c | +--lib/ | +--defective.c | +--README.md In case defective.c needs to be patched, we need to know both the path to the config file and the root directory of the module. Without this patch, we only know the path to config, making it very hard to patch defective.c This commit introduces a new variable NGINX_MOD_CONFIG_DIR specifying the subdirectory of NGINX_MOD_S containing the config script. NGINX_MOD_S semantics change to "the root directory of the module sources". www-nginx/ngx-naxsi was a special case because it is the only module actually having the config script in a subdirectory of NGINX_MOD_S. This commit edits its patch and ebuild accordingly. Signed-off-by: Zurab Kvachadze <zurabid2016@gmail.com> Part-of: https://github.com/gentoo/gentoo/pull/44576 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/nginx-module.eclass26
1 files changed, 21 insertions, 5 deletions
diff --git a/eclass/nginx-module.eclass b/eclass/nginx-module.eclass
index d25c961af8fd..1c321cb80766 100644
--- a/eclass/nginx-module.eclass
+++ b/eclass/nginx-module.eclass
@@ -353,11 +353,21 @@ ngx_mod_link_module() {
# @ECLASS_VARIABLE: NGINX_MOD_S
# @DESCRIPTION:
-# Holds the path to the module sources directory, used in the
-# nginx-module_src_configure() phase function. If unset at the time of inherit,
-# defaults to ${S}.
+# Holds the path to the module source directory, used in various phase
+# functions. If unset at the time of inherit, defaults to ${S}.
: "${NGINX_MOD_S=${S}}"
+# @ECLASS_VARIABLE: NGINX_MOD_CONFIG_DIR
+# @DESCRIPTION:
+# Holds the path of the directory containing the config script relative to the
+# module source directory specified by the ${NGINX_MOD_S} variable. If unset at
+# the time of inherit, defaults to "" (an empty string, meaning the config
+# script is located at the root of the module source directory).
+#
+# For example, in www-nginx/njs, NGINX_MOD_S="${WORKDIR}/${P}" and
+# NGINX_MOD_CONFIG_DIR="nginx".
+: "${NGINX_MOD_CONFIG_DIR=""}"
+
# The ${S} variable is set to the path of the directory where the actual build
# will be performed. In this directory, symbolic links to NGINX's build system
# and NGINX's headers are created by the nginx-module_src_unpack() phase
@@ -583,7 +593,8 @@ nginx-module_src_unpack() {
# Then, default_src_prepare() is called.
nginx-module_src_prepare() {
debug-print-function "${FUNCNAME[0]}" "$@"
- pushd "${NGINX_MOD_S}" >/dev/null || die "pushd failed"
+ pushd "${NGINX_MOD_S}/${NGINX_MOD_CONFIG_DIR}" >/dev/null ||
+ die "pushd failed"
# Since NGINX does not guarantee ABI or API stability, we utilise
# preprocessor macros that were used to compile NGINX itself, to build third
# party modules. As such, we do not want for the dummy preprocessor macros
@@ -610,8 +621,13 @@ nginx-module_src_prepare() {
die "sed failed"
echo 'mv build/ngx_auto_config.h build/__ngx_gentoo_mod_config.h' \
>> config || die "echo failed"
+
+ # cd into module root and apply patches.
+ pushd "${NGINX_MOD_S}" >/dev/null || die "pushd failed"
default_src_prepare
popd >/dev/null || die "popd failed"
+
+ popd >/dev/null || die "popd failed"
}
# @FUNCTION: nginx-module_src_configure
@@ -637,7 +653,7 @@ nginx-module_src_configure() {
--with-cc-opt="-isystem src/modules"
--with-ld-opt="${LDFLAGS}"
--builddir=build
- --add-dynamic-module="${NGINX_MOD_S}"
+ --add-dynamic-module="${NGINX_MOD_S}/${NGINX_MOD_CONFIG_DIR}"
)
# NGINX build system adds directories under src/ to the include path based