2011年11月1日火曜日

最新のnginxを追いかける


#!/usr/bin/env bash

IS_HEALTHCHECK_NGINX_UPSTREAMS=false

SVN_DIR=~/svn/nginx
USR=www-data
GRP=www-data

for dir in $SVN_DIR
do
		test -d $dir || mkdir $dir
done

cd $SVN_DIR
test ! -d trunk && svn checkout svn://svn.nginx.org/nginx/trunk

for i in $(find trunk/ -name "*.orig")
do
		rm -f $i
		rm -f $(echo $i | sed 's/\.orig$//')
done

cd trunk && svn update

REVISION=$(svn info --xml | xmllint - | grep -E "\s*^<commit" | sed -r 's/\s*<commit\s+revision="([0-9]+)">\s*/\1/')

CONFIG_OPTS=

if $($IS_HEALTHCHECK_NGINX_UPSTREAMS)
then
		test -d module || mkdir module
		cd module
		git clone https://github.com/cep21/healthcheck_nginx_upstreams.git
		cd ..
		patch -p1 < module/healthcheck_nginx_upstreams/nginx.patch
		CONFIG_OPTS=${CONFIG_OPTS}" --add-module=module/healthcheck_nginx_upstreams"
fi

test -e Makefile && make clean

CFLAGS="-O3 -mtune=native -m64 -msse -msse2 -msse3 -fstrict-overflow -fopenmp" ./auto/configure \
		--prefix=/usr/local/nginx-${REVISION} \
		--pid-path=/usr/local/var/run/nginx/nginx.pid \
		--lock-path=/usr/local/var/run/nginx/nginx.lock \
		--user=$USR \
		--group=$GRP \
		--with-ipv6 \
		--with-http_ssl_module \
		--with-http_geoip_module \
		--with-http_gzip_static_module \
		--with-google_perftools_module \
		--with-debug \
		$CONFIG_OPTS

make
sudo make install

exit $(true)

0 件のコメント:

コメントを投稿