blob: 323d0bca8e5957f0c3d67e01c9c66ad3ab5df035 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
NGINX_MOD_CONFIG_DIR="nginx"
inherit edo nginx-module toolchain-funcs
DESCRIPTION="A subset of JavaScript language to use in NGINX"
HOMEPAGE="https://github.com/nginx/njs https://nginx.org/en/docs/njs/"
SRC_URI="
https://github.com/nginx/njs/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz
"
LICENSE="BSD-2"
SLOT="0"
KEYWORDS="~amd64 ~arm64"
IUSE="tools +ssl +xml +zlib"
RDEPEND="
dev-libs/quickjs-ng:=
tools? (
dev-libs/libpcre2:=
sys-libs/readline:=
)
ssl? ( dev-libs/openssl:= )
xml? (
dev-libs/libxml2:=
dev-libs/libxslt:=
)
zlib? ( virtual/zlib:= )
"
DEPEND="${RDEPEND}"
BDEPEND="virtual/pkgconfig"
PATCHES=(
# Note: drop on the next upgrade, has been merged upstream as PR 989.
"${FILESDIR}/${PN}-0.9.4-support-quickjs-ng.patch"
"${FILESDIR}/${PN}-0.9.4-do-not-add-opt-debug-cflags.patch"
)
src_configure() {
## The core part, i.e. libnjs and libqjs.
local myargs=(
--build-dir=build
--cc="$(tc-getCC)"
--ld-opt="${LDFLAGS}"
--ar="$(tc-getAR)"
)
local nocliargs=(
--no-openssl
--no-libxml2
--no-zlib
)
if use tools; then
use !ssl && myargs+=( '--no-openssl' )
use !xml && myargs+=( '--no-libxml2' )
use !zlib && myargs+=( '--no-zlib' )
else
myargs+=( "${nocliargs[@]}" )
fi
pushd "${NGINX_MOD_S}" >/dev/null || die "pushd failed"
edo ./configure "${myargs[@]}"
popd >/dev/null || die "popd failed"
## The NGINX module part.
# Build the stream module unconditionally.
sed -i "s/\\\$STREAM/YES/" "${NGINX_MOD_S}/${NGINX_MOD_CONFIG_DIR}/config" ||
die "sed failed"
# Export PKG_CONFIG for pkg-config-based QuickJS-NG detection.
tc-export PKG_CONFIG
if use ssl; then
# Because NGINX build system refuses to link OPENSSL and ZLIB normally
# like other libraries.
ngx_mod_link_lib openssl
else
local -x NJS_OPENSSL=NO
fi
if use zlib; then
# Ditto.
ngx_mod_link_lib zlib
else
local -x NJS_ZLIB=NO
fi
use !xml && local -x NJS_LIBXSLT=NO
nginx-module_src_configure
}
src_compile() {
# Build the core first.
if use tools; then
emake -C "${NGINX_MOD_S}"
else
emake -C "${NGINX_MOD_S}" libnjs libqjs
fi
nginx-module_src_compile
}
src_install() {
use tools && dobin "${NGINX_MOD_S}"/build/njs
nginx-module_src_install
}
|