diff options
| author | Zurab Kvachadze <zurabid2016@gmail.com> | 2025-11-04 04:26:12 +0100 |
|---|---|---|
| committer | Sam James <sam@gentoo.org> | 2025-11-13 12:33:10 +0000 |
| commit | 63ce9d6693445ffc44b2685b8e66df4704c9d24c (patch) | |
| tree | 16931d68e3a47e3835c9b86cfc057c89d844c862 /eclass | |
| parent | c9e91f7b6e73fba520c5e9ba25d3b14004d31099 (diff) | |
| download | gentoo-63ce9d6693445ffc44b2685b8e66df4704c9d24c.tar.gz gentoo-63ce9d6693445ffc44b2685b8e66df4704c9d24c.tar.bz2 gentoo-63ce9d6693445ffc44b2685b8e66df4704c9d24c.zip | |
nginx-module.eclass: Add ngx_mod_link_lib helper
The helpers make it easier to link to external libraries from ebuilds
to accommodate to NGINX build system deficiencies.
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.eclass | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/eclass/nginx-module.eclass b/eclass/nginx-module.eclass index f17b7d4445be..714467248de2 100644 --- a/eclass/nginx-module.eclass +++ b/eclass/nginx-module.eclass @@ -24,7 +24,7 @@ # libraries/APIs. In the example HMAC case, the module actually requires # libcrypto, not the http_ssl module, so the ebuild code reflects this by # patching the module's 'config' file and depending on dev-libs/openssl directly -# using the ngx_mod_append_libs() function. +# using the ngx_mod_link_lib() function. # # If the module makes use of the ngx_devel_kit (NDK) or any other NGINX # module, there are two approaches. @@ -349,6 +349,25 @@ ngx_mod_link_module() { ngx_mod_append_libs "${sonames[@]/#/-l:}" } +# @FUNCTION: ngx_mod_link_lib +# @USAGE: <pkgconfig module name> +# @DESCRIPTION: +# Adds the necessary CFLAGS and LDFLAGS to link the NGINX module with the +# library specified by its <pkgconfig module name>. The {C,LD}FLAGS are +# obtained using pkgconfig. The caller must ensure that pkgconfig has been +# added to BDEPEND. +ngx_mod_link_lib() { + debug-print-function "${FUNCNAME[0]}" "$@" + [[ $# -ne 1 ]] && die "${FUNCNAME[0]} must receive exactly one argument" + local pkgconf + pkgconf="$(tc-getPKG_CONFIG)" + + "${pkgconf}" --exists "$1" || die "The pkgconfig library $1 does not exist" + + append-cflags "$("${pkgconf}" --cflags "$1")" + ngx_mod_append_libs "$("${pkgconf}" --libs "$1")" +} + #-----> ebuild-defined variables <----- # @ECLASS_VARIABLE: NGINX_MOD_S |
