updated on Thu Jan 12 08:01:00 UTC 2012
[aur-mirror.git] / passenger-enterprise-nginx / PKGBUILD
blob7c46bb7a4f49c37751aa5dd580aabe9e3cd55860
1 # $Id$
2 # Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
3 # Contributor: Miroslaw Szot <mss@czlug.icis.pcz.pl>
5 _doc_root=/srv/http/nginx
6 _server_root=/etc/nginx
7 _conf_path=${_server_root}/conf
8 _tmp_path=/var/spool/nginx
9 _log_path=/var/log/nginx
10 _user=http
11 _group=http
13 pkgname=passenger-enterprise-nginx
14 pkgver=2.2.9
15 pkgrel=1
16 _nginxver=0.7.64
18 pkgdesc="Nginx with mod_rails module"
19 arch=('i686' 'x86_64')
20 depends=('pcre' 'zlib' 'openssl' 'passenger-enterprise-common')
21 url="http://www.modrails.com"
22 license=('custom')
23 backup=("${_conf_path#/}/nginx.conf" \
24         "${_conf_path#/}/koi-win" \
25         "${_conf_path#/}/koi-utf" \
26         "${_conf_path#/}/win-utf" \
27         "${_conf_path#/}/mime.types" \
28         "${_conf_path#/}/fastcgi_params" \
29         "etc/logrotate.d/nginx")
30 source=(http://sysoev.ru/nginx/nginx-${_nginxver}.tar.gz \
31         nginx http://rubyforge.org/frs/download.php/68501/passenger-$pkgver.tar.gz)
32 md5sums=('cfa97c0f784532820110b5eee57fef6d'
33          '0eb8611bf5bc1192ee7ee606fce772e2'
34          'ca4379e87db2de0336e5b096d296a767')
36 build() {
37   # >>>>>>>>>>> passenger-nginx part <<<<<<<<<<<<
38   cd $srcdir/passenger-$pkgver
39   /opt/ruby-enterprise/bin/rake nginx
41   extdir=$pkgdir/opt/ruby-enterprise/ext/nginx
43   mkdir -p $extdir
44   cp ext/nginx/HelperServer $extdir/
46   # >>>>>>>>>>>>> nginx part <<<<<<<<<<<<<<
47   # (completely stolen from nginx PKGBUILD)
49         local _src_dir=$startdir/src/nginx-${_nginxver}
50         local _build_dir=$_src_dir/objs
52         cd $_src_dir
53         ./configure \
54                 --prefix=${_server_root} \
55                 --sbin-path=/usr/sbin/nginx \
56                 --pid-path=/var/run/nginx.pid \
57                 --lock-path=/var/lock/nginx.lock \
58                 --http-client-body-temp-path=${_tmp_path}/client_body_temp \
59                 --http-proxy-temp-path=${_tmp_path}/proxy_temp \
60                 --http-fastcgi-temp-path=${_tmp_path}/fastcgi_temp \
61                 --http-log-path=${_log_path}/access.log \
62                 --error-log-path=${_log_path}/error.log \
63                 --user=${_user} --group=${_group} \
64                 --with-imap --with-imap_ssl_module --with-http_ssl_module \
65                 --with-http_stub_status_module \
66     --add-module=$srcdir/passenger-$pkgver/ext/nginx
68         make || return 1
69         make DESTDIR=$startdir/pkg install || return 1
71         install -d $startdir/pkg/etc/logrotate.d/
72         cat <<- EOF > $startdir/pkg/etc/logrotate.d/nginx
73         $_log_path/*log {
74                 create 640 http log
75                 compress
76                 postrotate
77                         /bin/kill -HUP `cat /var/run/nginx.pid 2>/dev/null` 2> /dev/null || true
78                 endscript
79         }
80         EOF
82         sed -i -e "s/\<user\s\+\w\+;/user $_user;/g" $startdir/pkg/$_conf_path/nginx.conf 
84         install -d $startdir/pkg/$_tmp_path
86         # move default document root outside server root
87         install -d $startdir/pkg/$_doc_root
88         mv $startdir/pkg/$_server_root/html/* $startdir/pkg/$_doc_root/
89         rm -rf $startdir/pkg/$_server_root/html
90         rm -f $startdir/pkg/$_doc_root/index.html
92         # let's create links for relative paths in config file
93         ln -s $_log_path ${startdir}/pkg/$_server_root/logs && \
94         ln -s $_doc_root ${startdir}/pkg/$_server_root/html || return 1
96         install -D -m755 $startdir/src/nginx $startdir/pkg/etc/rc.d/nginx && \
97         install -D -m644 LICENSE $startdir/pkg/usr/share/licenses/nginx/LICENSE && \
98         mkdir -p $pkgdir/etc/conf.d && \
99         echo "NGINX_CONFIG=/etc/nginx/conf/nginx.conf" >$pkgdir/etc/conf.d/nginx