mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-01-06 02:17:34 -08:00
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>
This commit is contained in:
parent
c7500d602d
commit
fffbf942fc
@ -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
|
||||
|
||||
@ -14,8 +14,8 @@ Signed-off-by: Zurab Kvachadze <zurabid2016@gmail.com>
|
||||
|
||||
diff --git a/naxsi_src/config b/naxsi_src/config
|
||||
index 0b8d438..cd27c20 100644
|
||||
--- a/config
|
||||
+++ b/config
|
||||
--- a/naxsi_src/config
|
||||
+++ b/naxsi_src/config
|
||||
@@ -49,7 +49,7 @@ if [ "$LIBINJECTION_FOUND" != "0" ]; then
|
||||
else
|
||||
echo "Using system libinjection"
|
||||
|
||||
@ -4,7 +4,8 @@
|
||||
EAPI=8
|
||||
|
||||
MY_PN="naxsi"
|
||||
NGINX_MOD_S="${WORKDIR}/${MY_PN}-${PV}/naxsi_src"
|
||||
NGINX_MOD_S="${WORKDIR}/${MY_PN}-${PV}"
|
||||
NGINX_MOD_CONFIG_DIR="naxsi_src"
|
||||
|
||||
inherit nginx-module
|
||||
|
||||
@ -31,7 +32,7 @@ PATCHES=(
|
||||
src_install() {
|
||||
nginx-module_src_install
|
||||
insinto /etc/nginx/naxsi
|
||||
doins -r "${NGINX_MOD_S}"/../naxsi_rules/*
|
||||
doins -r "${NGINX_MOD_S}"/naxsi_rules/*
|
||||
docompress -x "/usr/share/doc/${PF}"
|
||||
dodoc -r "${NGINX_MOD_S}"/../docs/*
|
||||
dodoc -r "${NGINX_MOD_S}"/docs/*
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user