summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 4f2b4fddc117287d763c94d9c6dbeee636cbf745 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/bin/zsh
_nginx_ver_latest=1.11.6
_nginx_ver_stable=1.10.2

OPTIONS=(!strip debug) #nchan is still young, in case something goes wrong we want good coredumps

if [[ ! -z $MTUNE_GENERIC ]]; then
  CFLAGS="${CFLAGS//mtune=native/mtune=generic}"
fi

_nginx_ver=$_nginx_ver_latest
_pkgname=nginx

_user="http"
_group="http"
_doc_root="/usr/share/${_pkgname}/http"
_sysconf_path="etc"
_conf_path="${_sysconf_path}/${_pkgname}"
_tmp_path="/tmp/"
_pid_path="/run"
_lock_path="/var/lock"
_access_log="/dev/stdout"
_error_log="errors.log"

pkgver() {
  pushd ${startdir}/nchan > /dev/null
  _nchan_ver=`git describe --long --tags| sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'`
  popd > /dev/null
  echo "${_nginx_ver}.nchan.${_nchan_ver}"
}


pkgname=nginx-nchan-git
pkgver=1.11.6.nchan.1.0.7.r0.gc940f6a
pkgrel=1
pkgdesc="Nginx + Nchan - a flexible pub/sub server (git version)"
arch=('i686' 'x86_64' 'armv7h')


depends=('pcre' 'zlib' 'openssl')
url="https://nchan.slact.net"
license=('custom')
conflicts=('nginx' 'nginx-unstable' 'nginx-svn' 'nginx-devel' ) 
provides=('nginx')
backup=("${_conf_path}/conf/nginx.conf"
  "${_conf_path}/conf/koi-win"
  "${_conf_path}/conf/koi-utf"
  "${_conf_path}/conf/win-utf"
  "${_conf_path}/conf/mime.types"
  "${_conf_path}/conf/fastcgi.conf"
  "${_conf_path}/conf/fastcgi_params"
  "${_conf_path}/conf/scgi_params"
  "${_conf_path}/conf/uwsgi_params"
  "etc/logrotate.d/nginx")
_user=http
_group=http

source=("http://nginx.org/download/nginx-${_nginx_ver}.tar.gz"
  "nginx.conf"
  "nginx.logrotate"
  "nginx.service"
  "git+https://github.com/slact/nchan.git"
       )

md5sums=('4e29a07a7c74376fa032e5af0d1c5369'
         '845cab784b50f1666bbf89d7435ac7af'
         '79031b58828462dec53a9faed9ddb36a'
         '6696dc228a567506bca3096b5197c9db'
         'SKIP')

build() {
  local _src_dir="${srcdir}/nginx-$_nginx_ver"
  local _build_dir="${_src_dir}/objs"
  cd $_src_dir
  
  CONFIGURE=(
    --prefix=/${_conf_path}
    --sbin-path=/usr/bin/nginx
    --pid-path=${_pid_path}/nginx.pid
    --lock-path=${_pid_path}/nginx.lock
    --http-client-body-temp-path=${_tmp_path}/client_body_temp
    --http-proxy-temp-path=${_tmp_path}/proxy_temp
    --http-fastcgi-temp-path=${_tmp_path}/fastcgi_temp
    --http-uwsgi-temp-path=${_tmp_path}/uwsgi_temp
    --http-scgi-temp-path=${_tmp_path}scgi_temp
    --http-log-path=${_log_path}/access.log
    --error-log-path=${_log_path}/error.log
    --user=${_user}
    --group=${_group}
    --with-http_ssl_module
    --with-http_v2_module
    --with-http_stub_status_module
    --with-http_dav_module
    --with-http_gzip_static_module
    --with-http_realip_module
    --with-http_sub_module
    --with-http_flv_module
    --with-http_mp4_module
    --with-http_secure_link_module
    --with-pcre-jit
    --with-file-aio
    --with-stream
    --with-stream_ssl_module
    --with-ipv6
    --add-module="${srcdir}/nchan")

  CFLAGS="$CFLAGS -ggdb" #make sure debug symbols are present
  
  ./configure ${CONFIGURE[@]} 
  make
}

package() {
  cd "${srcdir}/nginx-${_nginx_ver}"
  make DESTDIR="$pkgdir/" install >/dev/null
  
  sed -i -e "s/\<user\s\+\w\+;/user $_user;/g" $pkgdir/$_conf_path/conf/nginx.conf
  
  mkdir -p ${pkgdir}/$_conf_path/sites-enabled/
  mkdir -p ${pkgdir}/$_conf_path/sites-available/
  
  install -d "${pkgdir}/${_tmp_path}" 
  install -d "${pkgdir}/${_doc_root}" 
  
  mv "${pkgdir}/${_conf_path}/html/"* "${pkgdir}/${_doc_root}"
  rm -rf "${pkgdir}/${_conf_path}/html"
  
  install -D -m644 "${srcdir}/nginx.logrotate" "${pkgdir}/etc/logrotate.d/${_pkgname}"
  install -D -m644 "${srcdir}/nginx.conf" "${pkgdir}/etc/conf.d/${_pkgname}"
  install -D -m644 "${srcdir}/nginx.service" "${pkgdir}/usr/lib/systemd/system/nginx.service"
  install -D -m644 "LICENSE" "${pkgdir}/usr/share/licenses/nginx/LICENSE"

}