1
0
mirror of https://github.com/dokku/buildpack-nginx.git synced 2024-12-27 06:15:25 +00:00
buildpack-nginx/bin/compile

90 lines
2.4 KiB
Plaintext
Raw Normal View History

2013-08-17 06:41:19 +00:00
#!/usr/bin/env bash
set -e
2014-11-04 04:36:08 +00:00
NGINX_VERSION="1.6.2"
NGINX_TARBALL="nginx-${NGINX_VERSION}.tar.gz"
PCRE_VERSION="8.34"
PCRE_TARBALL="pcre-${PCRE_VERSION}.tar.gz"
ZLIB_VERSION="1.2.8"
ZLIB_TARBALL="zlib-${ZLIB_VERSION}.tar.gz"
2014-11-05 05:14:27 +00:00
BINDIR=$(dirname "$0")
BUILDDIR="${1}"
CACHEDIR="${2}"
2014-11-05 06:17:31 +00:00
mkdir -p $BUILDDIR/www
mv * $BUILDDIR/www
2014-11-05 05:14:27 +00:00
cd $CACHEDIR
2014-11-04 04:36:08 +00:00
if [[ ! -d "${NGINX_TARBALL%.tar.gz}" ]]; then
2014-11-05 05:14:27 +00:00
curl "http://nginx.org/download/${NGINX_TARBALL}" -o "${NGINX_TARBALL}"
2014-11-04 04:36:08 +00:00
tar xvzf "${NGINX_TARBALL}" && rm -f "${NGINX_TARBALL}"
fi
if [[ ! -d "${PCRE_TARBALL%.tar.gz}" ]]; then
2014-11-05 05:14:27 +00:00
curl "http://ftp.csx.cam.ac.uk/pub/software/programming/pcre/${PCRE_TARBALL}" -o "${PCRE_TARBALL}"
2014-11-04 04:36:08 +00:00
tar xvzf "${PCRE_TARBALL}" && rm -f "${PCRE_TARBALL}"
fi
if [[ ! -d "${ZLIB_TARBALL%.tar.gz}" ]]; then
2014-11-05 05:14:27 +00:00
curl "http://zlib.net/${ZLIB_TARBALL}" -o "${ZLIB_TARBALL}"
2014-11-04 04:36:08 +00:00
tar xvzf "${ZLIB_TARBALL}" && rm -rf "${ZLIB_TARBALL}"
fi
cd "nginx-${NGINX_VERSION}"
2014-11-05 05:14:27 +00:00
mkdir $BUILDDIR/nginx
2014-11-04 04:36:08 +00:00
./configure \
--with-cpu-opt=generic \
2014-11-05 05:14:27 +00:00
--prefix=$BUILDDIR/nginx \
2014-11-04 04:36:08 +00:00
--with-pcre=../pcre-${PCRE_VERSION} \
--sbin-path=. \
--pid-path=./nginx.pid \
--conf-path=./nginx.conf \
--with-ld-opt="-static" \
--with-http_spdy_module \
--with-http_stub_status_module \
--with-http_gzip_static_module \
--with-file-aio \
--with-zlib=../zlib-${ZLIB_VERSION} \
--with-pcre \
--with-cc-opt="-O2 -static -static-libgcc" \
--without-http_charset_module \
--without-http_ssi_module \
--without-http_userid_module \
--without-http_access_module \
--without-http_auth_basic_module \
--without-http_autoindex_module \
--without-http_geo_module \
--without-http_map_module \
--without-http_split_clients_module \
--without-http_referer_module \
--without-http_proxy_module \
--without-http_fastcgi_module \
--without-http_uwsgi_module \
--without-http_scgi_module \
--without-http_memcached_module \
--without-http_empty_gif_module \
--without-http_browser_module \
--without-http_upstream_ip_hash_module \
--without-http_upstream_least_conn_module \
--without-http_upstream_keepalive_module \
--without-mail_pop3_module \
--without-mail_imap_module \
--without-mail_smtp_module
sed -i "/CFLAGS/s/ \-O //g" objs/Makefile
make
make install
rm -rf "nginx-${NGINX_VERSION}"
2013-08-17 06:41:19 +00:00
2014-11-05 05:14:27 +00:00
if [[ ! -f $BUILDDIR/nginx.conf.erb ]]; then
cp $BINDIR/../conf/nginx.conf.erb $BUILDDIR/nginx.conf.erb
2013-08-17 06:41:19 +00:00
fi
2014-02-02 13:54:06 +00:00
2014-11-05 05:14:27 +00:00
if [[ ! -f $BUILDDIR/mime.types ]]; then
cp $BINDIR/../conf/mime.types $BUILDDIR/mime.types
2014-02-02 13:54:06 +00:00
fi