Skip to content

Commit e0ee95e

Browse files
committed
build: use pcre2 if supported
1 parent eed9ea9 commit e0ee95e

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

nginx-build-msys2.sh

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,11 @@ echo "${ZLIB}"
3434
PCRE="$(curl -s 'https://sourceforge.net/projects/pcre/rss?path=/pcre/' | grep -ioP 'pcre-(\d+\.)+\d+' |sort -ruV | head -1)"
3535
PCRE="${PCRE:-pcre-8.45}"
3636
echo "${PCRE}"
37+
PCRE2="$(curl -s 'https://api.github.com/repos/PhilipHazel/pcre2/releases/latest' | grep -ioP 'pcre2-(\d+\.)+\d+' |sort -ruV | head -1)"
38+
PCRE2="${PCRE2:-pcre2-10.39}"
39+
echo "${PCRE2}"
3740
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.1l}"
41+
OPENSSL="${OPENSSL:-openssl-1.1.1m}"
3942
echo "${OPENSSL}"
4043

4144
# clone and patch nginx
@@ -68,8 +71,16 @@ git am -3 ../nginx-*.patch
6871
wget -c -nv "https://zlib.net/${ZLIB}.tar.xz" || \
6972
wget -c -nv "http://prdownloads.sourceforge.net/libpng/${ZLIB}.tar.xz"
7073
tar -xf "${ZLIB}.tar.xz"
71-
wget -c -nv "https://download.sourceforge.net/project/pcre/pcre/$(echo $PCRE | sed 's/pcre-//')/${PCRE}.tar.bz2"
72-
tar -xf "${PCRE}.tar.bz2"
74+
WITH_PCRE="${PCRE}"
75+
if grep -q PCRE2_STATIC ./auto/lib/pcre/conf ; then
76+
echo using pcre2
77+
WITH_PCRE="${PCRE2}"
78+
wget -c -nv "https://github.com/PhilipHazel/pcre2/releases/download/${PCRE2}/${PCRE2}.tar.bz2"
79+
else
80+
wget -c -nv "https://download.sourceforge.net/project/pcre/pcre/$(echo $PCRE | sed 's/pcre-//')/${PCRE}.tar.bz2"
81+
tar -xf "${PCRE}.tar.bz2"
82+
fi
83+
echo using pcre "${WITH_PCRE}"
7384
wget -c -nv "https://www.openssl.org/source/${OPENSSL}.tar.gz"
7485
tar -xf "${OPENSSL}.tar.gz"
7586

@@ -113,7 +124,7 @@ configure_args=(
113124
--with-http_slice_module \
114125
--with-mail \
115126
--with-stream \
116-
"--with-pcre=${PCRE}" \
127+
"--with-pcre=${WITH_PCRE}" \
117128
--with-pcre-jit \
118129
"--with-zlib=${ZLIB}" \
119130
--with-ld-opt="-Wl,--gc-sections,--build-id=none" \

0 commit comments

Comments
 (0)