Skip to content

Commit

Permalink
Merge pull request #75 from VirtuBox/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
VirtuBox authored Aug 29, 2019
2 parents e01263f + 09b69e1 commit 87fdc8a
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 128 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ addons:

script:
- sudo echo "Travis Banch = $TRAVIS_BRANCH"
- sudo apt-get install -y --force-yes nginx curl wget ccze
- sudo bash nginx-build.sh --openssl-dev --travis && sudo bash nginx-build.sh --travis && sudo bash nginx-build.sh --full --travis || sudo bash -c 'tail -n 100 /tmp/nginx-ee.log | ccze -A'
- sudo apt-get install -y --force-yes curl wget ccze
- sudo bash nginx-build.sh --travis && sudo bash nginx-build.sh --travis --stable && sudo bash nginx-build.sh --full --travis || sudo bash -c 'tail -n 100 /tmp/nginx-ee.log | ccze -A'
- sudo ls -alh /usr/sbin/nginx
- sudo chown -R travis /usr/local/src
- sudo chmod 755 /usr/local/src
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,21 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased] - XX-XX-XX

## [3.6.4] - 2019-08-29

### Added

- Debian 10 (buster) support
- Raspbian 10 (buster) support

### Changes

- Updated cronjob
- Improve module cloning duration by adding `--depth=50` to `git clone`
- PCRE, OPENSSL & Brotli are not compiled anymore. But are installed from [APT repository](https://build.opensuse.org/project/show/home:virtubox:nginx-ee) excepted Brotli on Debian 8 (jessie)
- Decrease build duration by 2

# [3.6.3] - 2019-07-15
## [3.6.3] - 2019-07-15

### Added

Expand All @@ -34,7 +39,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

- Missing OpenSSL patch

# [3.6.2] - 2019-04-24
## [3.6.2] - 2019-04-24

### Added

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Automated Nginx compilation from sources with additional modules support
* Brotli Support
* TLS v1.3 support (Final)
* OpenSSL (1.1.1c or 3.0.0-dev or from system-lib) or LibreSSL
* Cloudflare HPACK (for Mainline release only)
* Cloudflare HPACK
* Cloudflare zlib
* Automated nginx updates cronjob
* Compilation with GCC-7/8
Expand Down Expand Up @@ -102,6 +102,7 @@ Optional modules :

* Ubuntu 19.04 (Disco)
* Ubuntu 18.10 (Cosmic)
* Ubuntu 17.10 ()
* Ubuntu 16.04 LTS (Xenial)
* Debian 9 (Stretch)
* Debian 8 (Jessie)
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Automated Nginx compilation from sources with additional modules support
<li>Brotli Support</li>
<li>TLS v1.3 support (Final)</li>
<li>OpenSSL (1.1.1c or 3.0.0-dev or from system-lib) or LibreSSL</li>
<li>Cloudflare HPACK (for Mainline release only)</li>
<li>Cloudflare HPACK</li>
<li>Cloudflare zlib</li>
<li>Automated nginx updates cronjob</li>
<li>Compilation with GCC-7/8</li>
Expand Down
181 changes: 59 additions & 122 deletions nginx-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Copyright (c) 2019 VirtuBox <[email protected]>
# This script is licensed under M.I.T
# -------------------------------------------------------------------------
# Version 3.6.3 - 2019-08-15
# Version 3.6.4 - 2019-08-29
# -------------------------------------------------------------------------

##################################
Expand Down Expand Up @@ -142,19 +142,20 @@ fi
##################################

DIR_SRC="/usr/local/src"
NGINX_EE_VER="3.6.3"
NGINX_EE_VER="3.6.4"
NGINX_MAINLINE="$(curl -sL https://nginx.org/en/download.html 2>&1 | grep -E -o 'nginx\-[0-9.]+\.tar[.a-z]*' | awk -F "nginx-" '/.tar.gz$/ {print $2}' | sed -e 's|.tar.gz||g' | head -n 1 2>&1)"
NGINX_STABLE="$(curl -sL https://nginx.org/en/download.html 2>&1 | grep -E -o 'nginx\-[0-9.]+\.tar[.a-z]*' | awk -F "nginx-" '/.tar.gz$/ {print $2}' | sed -e 's|.tar.gz||g' | head -n 2 | grep 1.16 2>&1)"
LIBRESSL_VER="2.9.1"
OPENSSL_VER="1.1.1c"
TLS13_CIPHERS="TLS13+AESGCM+AES256:TLS13+AESGCM+AES128:TLS13+CHACHA20:EECDH+CHACHA20:EECDH+AESGCM:EECDH+AES"
OS_ARCH="$(uname -m)"
readonly OS_ARCH="$(uname -m)"
OS_DISTRO_FULL="$(lsb_release -ds)"
DISTRO_ID="$(lsb_release -si)"
readonly DISTRO_ID="$(lsb_release -si)"
readonly DISTRO_CODENAME="$(lsb_release -sc)"
readonly DISTRO_NUMBER="$(lsb_release -sr)"
DEB_CFLAGS="$(dpkg-buildflags --get CPPFLAGS) -Wno-error=date-time"
DEB_LFLAGS="$(dpkg-buildflags --get LDFLAGS)"
OPENSSL_COMMIT="3bbec1afed1c65b6f7f645b27808b070e6e7a509"
PCRE_VER=$(curl -sL https://ftp.pcre.org/pub/pcre/ | grep -E -o 'pcre\-[0-9.]+\.tar[.a-z]*gz' | awk -F "pcre-" '/.tar.gz$/ {print $2}' | sed -e 's|.tar.gz||g' | tail -n 1 2>&1)
export DEBIAN_FRONTEND=noninteractive

# Colors
Expand Down Expand Up @@ -314,12 +315,22 @@ else
OPENSSL_VALID="from system"
LIBSSL_DEV="libssl-dev"
else
NGX_SSL_LIB="--with-openssl=../openssl"
NGX_SSL_LIB=""
OPENSSL_VALID="$OPENSSL_VER Stable"
LIBSSL_DEV=""
LIBSSL_DEV="libssl-dev"
fi
fi

##################################
# Set Brotli lib
##################################

if [ "$DISTRO_CODENAME" = "jessie" ]; then
LIBBROTLI_DEV=""
else
LIBBROTLI_DEV="libbrotli-dev"
fi

##################################
# Set Pagespeed module
##################################
Expand Down Expand Up @@ -394,12 +405,12 @@ echo ""
_install_dependencies() {
echo -ne ' Installing dependencies [..]\r'
if {
apt-get -o Dpkg::Options::="--force-confmiss" -o Dpkg::Options::="--force-confold" -y install \
apt-get -o Dpkg::Options::="--force-confmiss" -o Dpkg::Options::="--force-confold" -y install \
git build-essential libtool automake autoconf \
libgd-dev libgeoip-dev libjemalloc-dev \
libbz2-1.0 libreadline-dev libbz2-dev libbz2-ocaml libbz2-ocaml-dev software-properties-common tar \
libgoogle-perftools-dev perl libperl-dev libpam0g-dev libbsd-dev gnupg gnupg2 \
libgmp-dev autotools-dev libxml2-dev "$LIBSSL_DEV"
libgmp-dev autotools-dev libxml2-dev libpcre3-dev "$LIBBROTLI_DEV" "$LIBSSL_DEV"
} >> /tmp/nginx-ee.log 2>&1; then
echo -ne " Installing dependencies [${CGREEN}OK${CEND}]\\r"
echo -ne '\n'
Expand Down Expand Up @@ -485,7 +496,7 @@ _gcc_ubuntu_setup() {
if [ ! -f /etc/apt/sources.list.d/jonathonf-ubuntu-gcc-"$(lsb_release -sc)".list ]; then
{
echo "### adding gcc repository ###"
add-apt-repository -y ppa:jonathonf/gcc -u
add-apt-repository ppa:jonathonf/gcc -yu
} >> /dev/null 2>&1
fi
if [ "$RTMP" != "y" ]; then
Expand Down Expand Up @@ -529,6 +540,37 @@ _gcc_ubuntu_setup() {

}

_dependencies_repo() {
{
curl -sL https://build.opensuse.org/projects/home:virtubox:nginx-ee/public_key | apt-key add -
if [ ! -f /etc/apt/sources.list.d/nginx-ee.list ]; then
if [ "$DISTRO_ID" = "Ubuntu" ]; then
if [ "$DISTRO_CODENAME" = "xenial" ]; then
add-apt-repository ppa:virtubox/brotli -yu
fi
echo "deb http://download.opensuse.org/repositories/home:/virtubox:/nginx-ee/xUbuntu_${DISTRO_NUMBER}/ /" > /etc/apt/sources.list.d/nginx-ee.list

elif [ "$DISTRO_ID" = "Debian" ]; then
if [ "$DISTRO_CODENAME" = "jessie" ]; then
echo 'deb http://download.opensuse.org/repositories/home:/virtubox:/nginx-ee/Debian_8.0/ /' > /etc/apt/sources.list.d/nginx-ee.list
elif [ "$DISTRO_CODENAME" = "strech" ]; then
echo 'deb http://download.opensuse.org/repositories/home:/virtubox:/nginx-ee/Debian_9.0/ /' > /etc/apt/sources.list.d/nginx-ee.list
else
echo 'deb http://download.opensuse.org/repositories/home:/virtubox:/nginx-ee/Debian_10/ /' > /etc/apt/sources.list.d/nginx-ee.list
fi
else
if [ "$DISTRO_CODENAME" = "strech" ]; then
echo 'deb http://download.opensuse.org/repositories/home:/virtubox:/nginx-ee/Raspbian_9.0/ /' > /etc/apt/sources.list.d/nginx-ee.list
else
echo 'deb http://download.opensuse.org/repositories/home:/virtubox:/nginx-ee/Raspbian_10/ /' > /etc/apt/sources.list.d/nginx-ee.list
fi
fi

fi
apt-get update -qq
} >> /tmp/nginx-ee.log 2>&1
}

##################################
# Install ffmpeg for rtmp module
##################################
Expand Down Expand Up @@ -715,74 +757,6 @@ _download_zlib() {

}

##################################
# Download & compile pcre
##################################

_compile_pcre() {

{

cd "$DIR_SRC/pcre" || exit 1
./configure --prefix=/usr \
--enable-utf8 \
--enable-unicode-properties \
--enable-pcre16 \
--enable-pcre32 \
--enable-pcregrep-libz \
--enable-pcregrep-libbz2 \
--enable-pcretest-libreadline \
--enable-jit

make -j "$(nproc)"
make install
mv -v /usr/lib/libpcre.so.* /lib
ln -sfv ../../lib/"$(readlink /usr/lib/libpcre.so)" /usr/lib/libpcre.so

} >> /tmp/nginx-ee.log 2>&1
}

_download_pcre() {

cd "$DIR_SRC" || exit 1

echo -ne ' Downloading pcre [..]\r'
if {
if [ -z "$(command -v pcretest)" ]; then
{
curl -sL https://ftp.pcre.org/pub/pcre/pcre-${PCRE_VER}.tar.gz | /bin/tar zxf - -C "$DIR_SRC"
mv pcre-${PCRE_VER} pcre

_compile_pcre

} \
>> /tmp/nginx-ee.log 2>&1
else
PCRE_VERSION=$(pcretest -C 2>&1 | grep version | awk -F " " '{print $3}')
if [ "$PCRE_VERSION" != "$PCRE_VER" ]; then

{
curl -sL https://ftp.pcre.org/pub/pcre/pcre-${PCRE_VER}.tar.gz | /bin/tar zxf - -C "$DIR_SRC"
mv pcre-${PCRE_VER} pcre

_compile_pcre

ln -sfv ../../lib/"$(readlink /usr/lib/libpcre.so)" /usr/lib/libpcre.so

} >> /tmp/nginx-ee.log 2>&1

fi
fi
}; then
echo -ne " Downloading pcre [${CGREEN}OK${CEND}]\\r"
echo -ne '\n'
else
echo -e " Downloading pcre [${CRED}FAIL${CEND}]"
echo -e '\n Please look at /tmp/nginx-ee.log\n'
exit 1
fi

}

##################################
# Download ngx_broti
Expand All @@ -795,7 +769,11 @@ _download_brotli() {
echo -ne ' Downloading brotli [..]\r'
{
rm /usr/local/src/ngx_brotli -rf
git clone --recursive --depth=50 https://github.com/eustas/ngx_brotli /usr/local/src/ngx_brotli -q
if [ "$DISTRO_CODENAME" = "jessie" ]; then
git clone --recursive --depth=50 https://github.com/eustas/ngx_brotli /usr/local/src/ngx_brotli -q
else
git clone --depth=50 https://github.com/eustas/ngx_brotli /usr/local/src/ngx_brotli -q
fi

} >> /tmp/nginx-ee.log 2>&1

Expand Down Expand Up @@ -871,47 +849,6 @@ _download_openssl_dev() {

}

##################################
# Download and patch OpenSSL
##################################

_download_openssl() {

cd "$DIR_SRC" || exit 1
if {
echo -ne ' Downloading openssl [..]\r'
{
rm -rf /usr/local/src/openssl
curl -sL https://www.openssl.org/source/openssl-${OPENSSL_VER}.tar.gz | /bin/tar xzf - -C "$DIR_SRC"
mv /usr/local/src/openssl-${OPENSSL_VER} /usr/local/src/openssl
} >> /tmp/nginx-ee.log 2>&1

{
if [ -d /usr/local/src/openssl-patch/.git ]; then
cd /usr/local/src/openssl-patch || exit 1
git pull origin master
else
rm -rf /usr/local/src/openssl-patch
git clone --depth=50 https://github.com/VirtuBox/openssl-patch.git /usr/local/src/openssl-patch
fi
cd /usr/local/src/openssl || exit 1
# apply openssl ciphers patch
echo "### openssl ciphers patch ###"
patch -p1 < ../openssl-patch/openssl-${OPENSSL_VER}-chacha_draft.patch
} >> /tmp/nginx-ee.log 2>&1

}; then
echo -ne " Downloading openssl [${CGREEN}OK${CEND}]\\r"
echo -ne '\n'

else
echo -e " Downloading openssl [${CRED}FAIL${CEND}]"
echo -e '\n Please look at /tmp/nginx-ee.log\n'
exit 1
fi

}

##################################
# Download LibreSSL
##################################
Expand Down Expand Up @@ -1380,6 +1317,7 @@ _final_tasks() {
# Main Setup
##################################

_dependencies_repo
_install_dependencies
if [ "$NGINX_FROM_SCRATCH" = "1" ]; then
_nginx_from_scratch_setup
Expand All @@ -1393,7 +1331,6 @@ fi
_cleanup_modules
_download_modules
_download_zlib
_download_pcre
_download_brotli
if [ "$NAXSI" = "y" ]; then
_download_naxsi
Expand All @@ -1406,7 +1343,7 @@ else
elif [ "$OPENSSL_LIB" = "3" ]; then
sleep 1
else
_download_openssl
sleep 1
fi
fi
if [ "$PAGESPEED" = "y" ]; then
Expand Down

0 comments on commit 87fdc8a

Please sign in to comment.