Skip to content

Commit 9dbca5b

Browse files
committed
build: slim build without openssl
1 parent 3d12f03 commit 9dbca5b

File tree

1 file changed

+33
-18
lines changed

1 file changed

+33
-18
lines changed

nginx-build-msys2.sh

Lines changed: 33 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,19 @@ if [[ "${GIT_USER_NAME}" = "" ]]; then
2424
git config --global user.name "Build Bot"
2525
fi
2626
if [[ "${GIT_USER_EMAIL}" = "" ]]; then
27-
git config --global user.email "you@example.com"
27+
git config --global user.email "nobody@example.com"
2828
fi
2929

3030
# dep versions
3131
ZLIB="$(curl -s 'https://zlib.net/' | grep -ioP 'zlib-(\d+\.)+\d+' | sort -ruV | head -1)"
3232
ZLIB="${ZLIB:-zlib-1.2.11}"
33-
echo $ZLIB
33+
echo "${ZLIB}"
3434
PCRE="$(curl -s 'https://ftp.pcre.org/pub/pcre/' | grep -ioP 'pcre-(\d+\.)+\d+' | sort -ruV | head -1)"
35-
PCRE="${PCRE:-pcre-8.44}"
36-
echo $PCRE
35+
PCRE="${PCRE:-pcre-8.45}"
36+
echo "${PCRE}"
3737
OPENSSL="$(curl -s 'https://www.openssl.org/source/' | grep -ioP 'openssl-1\.(\d+\.)+[a-z\d]+' | sort -ruV | head -1)"
38-
OPENSSL="${OPENSSL:-openssl-1.1.1g}"
39-
echo $OPENSSL
38+
OPENSSL="${OPENSSL:-openssl-1.1.1l}"
39+
echo "${OPENSSL}"
4040

4141
# clone and patch nginx
4242
if [[ -d nginx ]]; then
@@ -98,7 +98,6 @@ configure_args=(
9898
--http-fastcgi-temp-path=temp/fastcgi \
9999
--http-scgi-temp-path=temp/scgi \
100100
--http-uwsgi-temp-path=temp/uwsgi \
101-
--with-http_v2_module \
102101
--with-http_realip_module \
103102
--with-http_addition_module \
104103
--with-http_sub_module \
@@ -114,35 +113,51 @@ configure_args=(
114113
--with-http_slice_module \
115114
--with-mail \
116115
--with-stream \
117-
--with-pcre=${PCRE} \
116+
"--with-pcre=${PCRE}" \
118117
--with-pcre-jit \
119-
--with-zlib=${ZLIB} \
120-
--with-openssl=${OPENSSL} \
121-
--with-http_ssl_module \
122-
--with-mail_ssl_module \
123-
--with-stream_ssl_module \
118+
"--with-zlib=${ZLIB}" \
124119
--with-ld-opt="-Wl,--gc-sections,--build-id=none" \
125120
--prefix=
126121
)
127-
echo ${configure_args[@]}
128-
auto/configure ${configure_args[@]} \
122+
123+
# no-ssl build
124+
echo "${configure_args[@]}"
125+
auto/configure "${configure_args[@]}" \
126+
--with-cc-opt='-s -O2 -fno-strict-aliasing -pipe'
127+
128+
# build
129+
make "-j$(nproc)"
130+
strip -s objs/nginx.exe
131+
version="$(cat src/core/nginx.h | grep NGINX_VERSION | grep -ioP '((\d+\.)+\d+)')"
132+
mv -f "objs/nginx.exe" "../nginx-slim-${version}-${machine_str}.exe"
133+
134+
# re-configure with ssl
135+
configure_args+=(
136+
--with-http_v2_module \
137+
"--with-openssl=${OPENSSL}" \
138+
--with-http_ssl_module \
139+
--with-mail_ssl_module \
140+
--with-stream_ssl_module
141+
)
142+
echo "${configure_args[@]}"
143+
auto/configure "${configure_args[@]}" \
129144
--with-cc-opt='-s -O2 -fno-strict-aliasing -pipe' \
130145
--with-openssl-opt='no-tests -D_WIN32_WINNT=0x0501'
131146

132147
# build
133-
make -j$(nproc)
148+
make "-j$(nproc)"
134149
strip -s objs/nginx.exe
135150
version="$(cat src/core/nginx.h | grep NGINX_VERSION | grep -ioP '((\d+\.)+\d+)')"
136151
mv -f "objs/nginx.exe" "../nginx-${version}-${machine_str}.exe"
137152

138153
# re-configure with debugging log
139154
configure_args+=(--with-debug)
140-
auto/configure ${configure_args[@]} \
155+
auto/configure "${configure_args[@]}" \
141156
--with-cc-opt='-O2 -fno-strict-aliasing -pipe' \
142157
--with-openssl-opt='no-tests -D_WIN32_WINNT=0x0501'
143158

144159
# re-build with debugging log
145-
make -j$(nproc)
160+
make "-j$(nproc)"
146161
mv -f "objs/nginx.exe" "../nginx-${version}-${machine_str}-debug.exe"
147162

148163
# clean up

0 commit comments

Comments
 (0)