nginx.spec 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. ##
  2. ## nginx.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2016 OpenPKG Foundation e.V. <http://openpkg.net/>
  4. ##
  5. ## Permission to use, copy, modify, and distribute this software for
  6. ## any purpose with or without fee is hereby granted, provided that
  7. ## the above copyright notice and this permission notice appear in all
  8. ## copies.
  9. ##
  10. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  11. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  12. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  13. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  14. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  15. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  16. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  17. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  18. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  19. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  20. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  21. ## SUCH DAMAGE.
  22. ##
  23. # package version
  24. %define V_nginx 1.11.0
  25. %define V_nginx_headmore 0.30
  26. %define V_nginx_ajp 0.3.0
  27. %define V_nginx_lua 0.10.4rc1
  28. %define V_nginx_redis 0.13
  29. %define V_nginx_echo 0.59rc1
  30. %define V_nginx_davext 0.0.3
  31. %define V_nginx_digest 20150331
  32. %define V_nginx_fancyindex 0.3.6
  33. %define V_nginx_geoip2 1.1
  34. %define V_nginx_njs 1c50334fbea6
  35. # package information
  36. Name: nginx
  37. Summary: Reverse Proxy Server
  38. URL: http://nginx.org/
  39. Vendor: Igor Sysoev
  40. Packager: OpenPKG Foundation e.V.
  41. Distribution: OpenPKG Community
  42. Class: PLUS
  43. Group: Web
  44. License: MIT-style
  45. Version: %{V_nginx}
  46. Release: 20160524
  47. # package options
  48. %option with_ajp no
  49. %option with_perl no
  50. %option with_lua no
  51. %option with_redis no
  52. %option with_echo no
  53. %option with_davext no
  54. %option with_digest no
  55. %option with_fancyindex no
  56. %option with_geoip2 no
  57. %option with_njs no
  58. # list of sources
  59. Source0: http://nginx.org/download/nginx-%{V_nginx}.tar.gz
  60. Source1: https://github.com/openresty/headers-more-nginx-module/archive/v%{V_nginx_headmore}.tar.gz
  61. Source2: https://github.com/yaoweibin/nginx_ajp_module/archive/v%{V_nginx_ajp}.tar.gz
  62. Source3: https://github.com/openresty/lua-nginx-module/archive/v%{V_nginx_lua}.tar.gz
  63. Source4: https://github.com/openresty/redis2-nginx-module/archive/v%{V_nginx_redis}.tar.gz
  64. Source5: https://github.com/openresty/echo-nginx-module/archive/v%{V_nginx_echo}.tar.gz
  65. Source6: https://github.com/arut/nginx-dav-ext-module/archive/v%{V_nginx_davext}.tar.gz
  66. Source7: http://download.openpkg.org/components/versioned/nginx/nginx-http-auth-digest-%{V_nginx_digest}.tar.gz
  67. Source8: https://github.com/aperezdc/ngx-fancyindex/archive/v%{V_nginx_fancyindex}.tar.gz
  68. Source9: https://github.com/leev/ngx_http_geoip2_module/archive/%{V_nginx_geoip2}.tar.gz
  69. Source10: http://hg.nginx.org/njs/archive/%{V_nginx_njs}.tar.gz
  70. Source11: nginx.conf
  71. Source12: rc.nginx
  72. Patch0: nginx.patch
  73. # build information
  74. BuildPreReq: OpenPKG, openpkg >= 20120101
  75. PreReq: OpenPKG, openpkg >= 20120101, x509
  76. BuildPreReq: zlib, pcre, openssl, geoip
  77. PreReq: zlib, pcre, openssl, geoip
  78. %if "%{with_perl}" == "yes"
  79. BuildPreReq: perl
  80. PreReq: perl
  81. %endif
  82. %if "%{with_davext}" == "yes"
  83. BuildPreReq: expat
  84. PreReq: expat
  85. %endif
  86. %if "%{with_geoip2}" == "yes"
  87. BuildPreReq: geoip2
  88. PreReq: geoip2
  89. %endif
  90. %if "%{with_lua}" == "yes"
  91. BuildPreReq: lua51
  92. PreReq: lua51
  93. %endif
  94. %description
  95. Nginx (pronounced "engine X" is a lightweight, event-driven
  96. high-performance Web server/reverse proxy and e-mail (IMAP/POP3)
  97. proxy. It provides the following HTTP features: Handling of static
  98. files, index files, and auto-indexing; Reverse proxy with caching;
  99. Load balancing; Fault tolerance; SSL support; FastCGI support with
  100. caching; Name- and IP-based virtual servers; FLV streaming; MP4
  101. streaming; Web page access authentication; gzip compression; and
  102. ability to handle more than 10.000 simultaneous connections.
  103. %track
  104. prog nginx:nginx = {
  105. version = %{V_nginx}
  106. url = http://nginx.org/en/download.html
  107. regex = nginx-(1\.\d+\.\d+)\.tar\.gz
  108. }
  109. prog nginx:nginx-headmore = {
  110. version = %{V_nginx_headmore}
  111. url = https://github.com/openresty/headers-more-nginx-module/releases
  112. regex = v(\d+\.\d\d)\.tar\.gz
  113. }
  114. prog nginx:nginx-ajp = {
  115. version = %{V_nginx_ajp}
  116. url = https://github.com/yaoweibin/nginx_ajp_module/releases
  117. regex = v(__VER__)\.tar\.gz
  118. }
  119. prog nginx:nginx-lua = {
  120. version = %{V_nginx_lua}
  121. url = https://github.com/openresty/lua-nginx-module/releases
  122. regex = v(__VER__)\.tar\.gz
  123. }
  124. prog nginx:nginx-redis = {
  125. version = %{V_nginx_redis}
  126. url = https://github.com/openresty/redis2-nginx-module/releases
  127. regex = v(__VER__)\.tar\.gz
  128. }
  129. prog nginx:nginx-echo = {
  130. version = %{V_nginx_echo}
  131. url = https://github.com/openresty/echo-nginx-module/releases
  132. regex = v(__VER__)\.tar\.gz
  133. }
  134. prog nginx:nginx-davext = {
  135. version = %{V_nginx_davext}
  136. url = https://github.com/arut/nginx-dav-ext-module/releases
  137. regex = v(__VER__)\.tar\.gz
  138. }
  139. prog nginx:nginx-digest = {
  140. version = %{V_nginx_digest}
  141. url = http://download.openpkg.org/components/versioned/nginx/
  142. regex = nginx-http-auth-digest-(__VER__)\.tar\.gz
  143. }
  144. prog nginx:nginx-fancyindex = {
  145. version = %{V_nginx_fancyindex}
  146. url = https://github.com/aperezdc/ngx-fancyindex/releases
  147. regex = v(__VER__)\.tar\.gz
  148. }
  149. prog nginx:nginx-geoip2 = {
  150. version = %{V_nginx_geoip2}
  151. url = https://github.com/leev/ngx_http_geoip2_module/releases
  152. regex = (__VER__)\.tar\.gz
  153. }
  154. prog nginx:nginx-njs = {
  155. version = %{V_nginx_njs}
  156. url = http://hg.nginx.org/njs/
  157. regex = rev/([\da-f]+)
  158. }
  159. %prep
  160. %setup -q
  161. %patch -p0
  162. %setup -q -T -D -a 1
  163. mv headers-more-nginx-module-* nginx_headers_more_module
  164. %if "%{with_ajp}" == "yes"
  165. %setup -q -T -D -a 2
  166. mv nginx_ajp_module-* nginx_ajp_module
  167. %endif
  168. %if "%{with_lua}" == "yes"
  169. %setup -q -T -D -a 3
  170. mv lua-nginx-module-* nginx_lua_module
  171. %endif
  172. %if "%{with_redis}" == "yes"
  173. %setup -q -T -D -a 4
  174. mv redis2-nginx-module-* nginx_redis_module
  175. %endif
  176. %if "%{with_echo}" == "yes"
  177. %setup -q -T -D -a 5
  178. mv echo-nginx-module-* nginx_echo_module
  179. %endif
  180. %if "%{with_davext}" == "yes"
  181. %setup -q -T -D -a 6
  182. mv nginx-dav-ext-module-* nginx_davext_module
  183. %endif
  184. %if "%{with_digest}" == "yes"
  185. %setup -q -T -D -a 7
  186. mv nginx-http-auth-digest nginx_http_auth_digest_module
  187. %endif
  188. %if "%{with_fancyindex}" == "yes"
  189. %setup -q -T -D -a 8
  190. mv ngx-fancyindex-* nginx_fancyindex_module
  191. %endif
  192. %if "%{with_geoip2}" == "yes"
  193. %setup -q -T -D -a 9
  194. mv ngx_http_geoip2_module-* ngx_http_geoip2_module
  195. %endif
  196. %if "%{with_njs}" == "yes"
  197. %setup -q -T -D -a 10
  198. mv njs-* ngx_njs_module
  199. %endif
  200. %build
  201. # configure program
  202. %{l_shtool} subst \
  203. -e 's;/usr/local;%{l_prefix};g' \
  204. auto/lib/*/conf
  205. CC="%{l_cc}" \
  206. CFLAGS="%{l_cflags -O} %{l_cppflags openssl .}" \
  207. LDFLAGS="%{l_ldflags}" \
  208. %if "%{with_lua}" == "yes"
  209. LUA_INC=%{l_prefix}/include/lua51/lua \
  210. LUA_LIB=%{l_prefix}/lib/lua51 \
  211. %endif
  212. ./configure \
  213. --prefix=%{l_prefix} \
  214. --conf-path=%{l_prefix}/etc/nginx/nginx.conf \
  215. --error-log-path=%{l_prefix}/var/nginx/log/nginx.log \
  216. --pid-path=%{l_prefix}/var/nginx/var/nginx.pid \
  217. --lock-path=%{l_prefix}/var/nginx/var/nginx.lck \
  218. --http-log-path=%{l_prefix}/var/nginx/log/nginx.access.log \
  219. --http-client-body-temp-path=%{l_prefix}/var/nginx/tmp/cbody \
  220. --http-proxy-temp-path=%{l_prefix}/var/nginx/tmp/proxy \
  221. --http-fastcgi-temp-path=%{l_prefix}/var/nginx/tmp/fastcgi \
  222. --http-uwsgi-temp-path=%{l_prefix}/var/nginx/tmp/uwsgi \
  223. --http-scgi-temp-path=%{l_prefix}/var/nginx/tmp/scgi \
  224. --user=%{l_nusr} \
  225. --group=%{l_ngrp} \
  226. --add-module=`pwd`/nginx_headers_more_module \
  227. %if "%{with_ajp}" == "yes"
  228. --add-module=`pwd`/nginx_ajp_module \
  229. %endif
  230. %if "%{with_perl}" == "yes"
  231. --with-http_perl_module \
  232. --with-perl=%{l_prefix}/bin/perl \
  233. %endif
  234. %if "%{with_lua}" == "yes"
  235. --add-module=`pwd`/nginx_lua_module \
  236. %endif
  237. %if "%{with_redis}" == "yes"
  238. --add-module=`pwd`/nginx_redis_module \
  239. %endif
  240. %if "%{with_echo}" == "yes"
  241. --add-module=`pwd`/nginx_echo_module \
  242. %endif
  243. %if "%{with_davext}" == "yes"
  244. --add-module=`pwd`/nginx_davext_module \
  245. %endif
  246. %if "%{with_digest}" == "yes"
  247. --add-module=`pwd`/nginx_http_auth_digest_module \
  248. %endif
  249. %if "%{with_fancyindex}" == "yes"
  250. --add-module=`pwd`/nginx_fancyindex_module \
  251. %endif
  252. %if "%{with_geoip2}" == "yes"
  253. --add-module=`pwd`/ngx_http_geoip2_module \
  254. %endif
  255. %if "%{with_njs}" == "yes"
  256. --add-module=`pwd`/ngx_njs_module/nginx \
  257. %endif
  258. --with-http_addition_module \
  259. --with-http_auth_request_module \
  260. --with-http_dav_module \
  261. --with-http_degradation_module \
  262. --with-http_flv_module \
  263. --with-http_geoip_module \
  264. --with-http_gunzip_module \
  265. --with-http_gzip_static_module \
  266. --with-http_random_index_module \
  267. --with-http_realip_module \
  268. --with-http_secure_link_module \
  269. --with-http_ssl_module \
  270. --with-http_v2_module \
  271. --with-http_stub_status_module \
  272. --with-http_sub_module
  273. # build program
  274. %{l_make} %{l_mflags -O}
  275. %install
  276. # install program
  277. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  278. # strip down installation
  279. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
  280. # install default configuration
  281. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/nginx/*
  282. %{l_shtool} mkdir -f -p -m 755 \
  283. $RPM_BUILD_ROOT%{l_prefix}/etc/nginx \
  284. $RPM_BUILD_ROOT%{l_prefix}/etc/nginx/nginx.d
  285. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  286. %{SOURCE nginx.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/nginx/
  287. %{l_shtool} install -c -m 644 \
  288. conf/mime.types $RPM_BUILD_ROOT%{l_prefix}/etc/nginx/
  289. # install run-command script
  290. %{l_shtool} mkdir -f -p -m 755 \
  291. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  292. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  293. %{SOURCE rc.nginx} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  294. # create run-time directories
  295. %{l_shtool} mkdir -f -p -m 755 \
  296. $RPM_BUILD_ROOT%{l_prefix}/var/nginx/tmp/cbody \
  297. $RPM_BUILD_ROOT%{l_prefix}/var/nginx/tmp/proxy \
  298. $RPM_BUILD_ROOT%{l_prefix}/var/nginx/tmp/fastcgi \
  299. $RPM_BUILD_ROOT%{l_prefix}/var/nginx/tmp/uwsgi \
  300. $RPM_BUILD_ROOT%{l_prefix}/var/nginx/tmp/scgi \
  301. $RPM_BUILD_ROOT%{l_prefix}/var/nginx/log \
  302. $RPM_BUILD_ROOT%{l_prefix}/var/nginx/run
  303. # determine installation files
  304. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  305. %{l_files_std} \
  306. '%config %{l_prefix}/etc/nginx/*' \
  307. '%attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/nginx/*' \
  308. '%attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/nginx/*/*'
  309. %files -f files
  310. %clean