nginx.spec 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. ##
  2. ## nginx.spec -- OpenPKG RPM Package Specification
  3. ## Copyright (c) 2000-2017 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.13.5
  25. %define V_nginx_headmore 0.32
  26. %define V_nginx_ajp 0.3.0
  27. %define V_nginx_lua 0.10.10
  28. %define V_nginx_redis 0.14
  29. %define V_nginx_echo 0.61rc1
  30. %define V_nginx_davext 0.1.0
  31. %define V_nginx_digest 20150331
  32. %define V_nginx_fancyindex 0.4.2
  33. %define V_nginx_geoip2 2.0
  34. %define V_nginx_njs c347ea0bbdd6
  35. %define V_nginx_brotli 20170902
  36. # package information
  37. Name: nginx
  38. Summary: Reverse Proxy Server
  39. URL: http://nginx.org/
  40. Vendor: Igor Sysoev
  41. Packager: OpenPKG Foundation e.V.
  42. Distribution: OpenPKG Community
  43. Class: PLUS
  44. Group: Web
  45. License: MIT-style
  46. Version: %{V_nginx}
  47. Release: 20170905
  48. # package options
  49. %option with_ajp no
  50. %option with_perl no
  51. %option with_lua no
  52. %option with_redis no
  53. %option with_echo no
  54. %option with_davext no
  55. %option with_digest no
  56. %option with_fancyindex no
  57. %option with_geoip2 no
  58. %option with_njs no
  59. %option with_stream no
  60. %option with_brotli no
  61. # list of sources
  62. Source0: http://nginx.org/download/nginx-%{V_nginx}.tar.gz
  63. Source1: https://github.com/openresty/headers-more-nginx-module/archive/v%{V_nginx_headmore}.tar.gz
  64. Source2: https://github.com/yaoweibin/nginx_ajp_module/archive/v%{V_nginx_ajp}.tar.gz
  65. Source3: https://github.com/openresty/lua-nginx-module/archive/v%{V_nginx_lua}.tar.gz
  66. Source4: https://github.com/openresty/redis2-nginx-module/archive/v%{V_nginx_redis}.tar.gz
  67. Source5: https://github.com/openresty/echo-nginx-module/archive/v%{V_nginx_echo}.tar.gz
  68. Source6: https://github.com/arut/nginx-dav-ext-module/archive/v%{V_nginx_davext}.tar.gz
  69. Source7: http://download.openpkg.org/components/versioned/nginx/nginx-http-auth-digest-%{V_nginx_digest}.tar.gz
  70. Source8: https://github.com/aperezdc/ngx-fancyindex/archive/v%{V_nginx_fancyindex}.tar.gz
  71. Source9: https://github.com/leev/ngx_http_geoip2_module/archive/%{V_nginx_geoip2}.tar.gz
  72. Source10: http://hg.nginx.org/njs/archive/%{V_nginx_njs}.tar.gz
  73. Source11: http://download.openpkg.org/components/versioned/nginx/ngx_brotli-%{V_nginx_brotli}.tar.xz
  74. Source12: nginx.conf
  75. Source13: rc.nginx
  76. Patch0: nginx.patch
  77. # build information
  78. BuildPreReq: OpenPKG, openpkg >= 20160101
  79. PreReq: OpenPKG, openpkg >= 20160101, x509
  80. BuildPreReq: zlib, pcre, openssl, geoip
  81. PreReq: zlib, pcre, openssl, geoip
  82. %if "%{with_perl}" == "yes"
  83. BuildPreReq: perl
  84. PreReq: perl
  85. %endif
  86. %if "%{with_davext}" == "yes"
  87. BuildPreReq: expat
  88. PreReq: expat
  89. %endif
  90. %if "%{with_geoip2}" == "yes"
  91. BuildPreReq: geoip2
  92. PreReq: geoip2
  93. %endif
  94. %if "%{with_lua}" == "yes"
  95. BuildPreReq: lua51
  96. PreReq: lua51
  97. %endif
  98. %description
  99. Nginx (pronounced "engine X" is a lightweight, event-driven
  100. high-performance Web server/reverse proxy and e-mail (IMAP/POP3)
  101. proxy. It provides the following HTTP features: Handling of static
  102. files, index files, and auto-indexing; Reverse proxy with caching;
  103. Load balancing; Fault tolerance; SSL support; FastCGI support with
  104. caching; Name- and IP-based virtual servers; FLV streaming; MP4
  105. streaming; Web page access authentication; gzip compression; and
  106. ability to handle more than 10.000 simultaneous connections.
  107. %track
  108. prog nginx:nginx = {
  109. version = %{V_nginx}
  110. url = http://nginx.org/en/download.html
  111. regex = nginx-(1\.\d+\.\d+)\.tar\.gz
  112. }
  113. prog nginx:nginx-headmore = {
  114. version = %{V_nginx_headmore}
  115. url = https://github.com/openresty/headers-more-nginx-module/releases
  116. regex = v(\d+\.\d\d)\.tar\.gz
  117. }
  118. prog nginx:nginx-ajp = {
  119. version = %{V_nginx_ajp}
  120. url = https://github.com/yaoweibin/nginx_ajp_module/releases
  121. regex = v(__VER__)\.tar\.gz
  122. }
  123. prog nginx:nginx-lua = {
  124. version = %{V_nginx_lua}
  125. url = https://github.com/openresty/lua-nginx-module/releases
  126. regex = v(__VER__)\.tar\.gz
  127. }
  128. prog nginx:nginx-redis = {
  129. version = %{V_nginx_redis}
  130. url = https://github.com/openresty/redis2-nginx-module/releases
  131. regex = v(__VER__)\.tar\.gz
  132. }
  133. prog nginx:nginx-echo = {
  134. version = %{V_nginx_echo}
  135. url = https://github.com/openresty/echo-nginx-module/releases
  136. regex = v(__VER__)\.tar\.gz
  137. }
  138. prog nginx:nginx-davext = {
  139. version = %{V_nginx_davext}
  140. url = https://github.com/arut/nginx-dav-ext-module/releases
  141. regex = v(__VER__)\.tar\.gz
  142. }
  143. prog nginx:nginx-digest = {
  144. version = %{V_nginx_digest}
  145. url = http://download.openpkg.org/components/versioned/nginx/
  146. regex = nginx-http-auth-digest-(__VER__)\.tar\.gz
  147. }
  148. prog nginx:nginx-fancyindex = {
  149. version = %{V_nginx_fancyindex}
  150. url = https://github.com/aperezdc/ngx-fancyindex/releases
  151. regex = v(__VER__)\.tar\.gz
  152. }
  153. prog nginx:nginx-geoip2 = {
  154. version = %{V_nginx_geoip2}
  155. url = https://github.com/leev/ngx_http_geoip2_module/releases
  156. regex = (__VER__)\.tar\.gz
  157. }
  158. prog nginx:nginx-njs = {
  159. version = %{V_nginx_njs}
  160. url = http://hg.nginx.org/njs/
  161. regex = rev/([\da-f]+)
  162. }
  163. prog nginx:nginx-brotli = {
  164. version = %{V_nginx_brotli}
  165. url = http://download.openpkg.org/components/versioned/nginx/
  166. regex = ngx_brotli-(__VER__)\.tar\.xz
  167. }
  168. %prep
  169. %setup -q
  170. %patch -p0
  171. %setup -q -T -D -a 1
  172. mv headers-more-nginx-module-* nginx_headers_more_module
  173. %if "%{with_ajp}" == "yes"
  174. %setup -q -T -D -a 2
  175. mv nginx_ajp_module-* nginx_ajp_module
  176. %endif
  177. %if "%{with_lua}" == "yes"
  178. %setup -q -T -D -a 3
  179. mv lua-nginx-module-* nginx_lua_module
  180. %endif
  181. %if "%{with_redis}" == "yes"
  182. %setup -q -T -D -a 4
  183. mv redis2-nginx-module-* nginx_redis_module
  184. %endif
  185. %if "%{with_echo}" == "yes"
  186. %setup -q -T -D -a 5
  187. mv echo-nginx-module-* nginx_echo_module
  188. %endif
  189. %if "%{with_davext}" == "yes"
  190. %setup -q -T -D -a 6
  191. mv nginx-dav-ext-module-* nginx_davext_module
  192. %endif
  193. %if "%{with_digest}" == "yes"
  194. %setup -q -T -D -a 7
  195. mv nginx-http-auth-digest nginx_http_auth_digest_module
  196. %endif
  197. %if "%{with_fancyindex}" == "yes"
  198. %setup -q -T -D -a 8
  199. mv ngx-fancyindex-* nginx_fancyindex_module
  200. %endif
  201. %if "%{with_geoip2}" == "yes"
  202. %setup -q -T -D -a 9
  203. mv ngx_http_geoip2_module-* ngx_http_geoip2_module
  204. %endif
  205. %if "%{with_njs}" == "yes"
  206. %setup -q -T -D -a 10
  207. mv njs-* ngx_njs_module
  208. %endif
  209. %if "%{with_brotli}" == "yes"
  210. %setup -q -T -D -a 11
  211. mv ngx_brotli nginx_brotli_module
  212. %endif
  213. %build
  214. # configure program
  215. %{l_shtool} subst \
  216. -e 's;/usr/local;%{l_prefix};g' \
  217. auto/lib/*/conf
  218. CC="%{l_cc}" \
  219. CFLAGS="%{l_cflags -O} %{l_cppflags openssl .}" \
  220. LDFLAGS="%{l_ldflags}" \
  221. %if "%{with_lua}" == "yes"
  222. LUA_INC=%{l_prefix}/include/lua51/lua \
  223. LUA_LIB=%{l_prefix}/lib/lua51 \
  224. %endif
  225. ./configure \
  226. --prefix=%{l_prefix} \
  227. --conf-path=%{l_prefix}/etc/nginx/nginx.conf \
  228. --error-log-path=%{l_prefix}/var/nginx/log/nginx.log \
  229. --pid-path=%{l_prefix}/var/nginx/var/nginx.pid \
  230. --lock-path=%{l_prefix}/var/nginx/var/nginx.lck \
  231. --http-log-path=%{l_prefix}/var/nginx/log/nginx.access.log \
  232. --http-client-body-temp-path=%{l_prefix}/var/nginx/tmp/cbody \
  233. --http-proxy-temp-path=%{l_prefix}/var/nginx/tmp/proxy \
  234. --http-fastcgi-temp-path=%{l_prefix}/var/nginx/tmp/fastcgi \
  235. --http-uwsgi-temp-path=%{l_prefix}/var/nginx/tmp/uwsgi \
  236. --http-scgi-temp-path=%{l_prefix}/var/nginx/tmp/scgi \
  237. --user=%{l_nusr} \
  238. --group=%{l_ngrp} \
  239. --add-module=`pwd`/nginx_headers_more_module \
  240. %if "%{with_ajp}" == "yes"
  241. --add-module=`pwd`/nginx_ajp_module \
  242. %endif
  243. %if "%{with_perl}" == "yes"
  244. --with-http_perl_module \
  245. --with-perl=%{l_prefix}/bin/perl \
  246. %endif
  247. %if "%{with_lua}" == "yes"
  248. --add-module=`pwd`/nginx_lua_module \
  249. %endif
  250. %if "%{with_redis}" == "yes"
  251. --add-module=`pwd`/nginx_redis_module \
  252. %endif
  253. %if "%{with_echo}" == "yes"
  254. --add-module=`pwd`/nginx_echo_module \
  255. %endif
  256. %if "%{with_davext}" == "yes"
  257. --add-module=`pwd`/nginx_davext_module \
  258. %endif
  259. %if "%{with_digest}" == "yes"
  260. --add-module=`pwd`/nginx_http_auth_digest_module \
  261. %endif
  262. %if "%{with_fancyindex}" == "yes"
  263. --add-module=`pwd`/nginx_fancyindex_module \
  264. %endif
  265. %if "%{with_geoip2}" == "yes"
  266. --add-module=`pwd`/ngx_http_geoip2_module \
  267. %endif
  268. %if "%{with_njs}" == "yes"
  269. --add-module=`pwd`/ngx_njs_module/nginx \
  270. %endif
  271. %if "%{with_brotli}" == "yes"
  272. --add-module=`pwd`/nginx_brotli_module \
  273. %endif
  274. %if "%{with_stream}" == "yes"
  275. --with-stream \
  276. --with-stream_ssl_module \
  277. --with-stream_realip_module \
  278. --with-stream_geoip_module \
  279. --with-stream_ssl_preread_module \
  280. %endif
  281. --with-http_addition_module \
  282. --with-http_auth_request_module \
  283. --with-http_dav_module \
  284. --with-http_degradation_module \
  285. --with-http_flv_module \
  286. --with-http_geoip_module \
  287. --with-http_gunzip_module \
  288. --with-http_gzip_static_module \
  289. --with-http_random_index_module \
  290. --with-http_realip_module \
  291. --with-http_secure_link_module \
  292. --with-http_ssl_module \
  293. --with-http_v2_module \
  294. --with-http_stub_status_module \
  295. --with-http_sub_module
  296. # build program
  297. %{l_make} %{l_mflags -O}
  298. %install
  299. # install program
  300. %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
  301. # strip down installation
  302. strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* >/dev/null 2>&1 || true
  303. # install default configuration
  304. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/nginx/*
  305. %{l_shtool} mkdir -f -p -m 755 \
  306. $RPM_BUILD_ROOT%{l_prefix}/etc/nginx \
  307. $RPM_BUILD_ROOT%{l_prefix}/etc/nginx/nginx.d
  308. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  309. %{SOURCE nginx.conf} $RPM_BUILD_ROOT%{l_prefix}/etc/nginx/
  310. %{l_shtool} install -c -m 644 \
  311. conf/mime.types $RPM_BUILD_ROOT%{l_prefix}/etc/nginx/
  312. # install run-command script
  313. %{l_shtool} mkdir -f -p -m 755 \
  314. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  315. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  316. %{SOURCE rc.nginx} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  317. # create run-time directories
  318. %{l_shtool} mkdir -f -p -m 755 \
  319. $RPM_BUILD_ROOT%{l_prefix}/var/nginx/tmp/cbody \
  320. $RPM_BUILD_ROOT%{l_prefix}/var/nginx/tmp/proxy \
  321. $RPM_BUILD_ROOT%{l_prefix}/var/nginx/tmp/fastcgi \
  322. $RPM_BUILD_ROOT%{l_prefix}/var/nginx/tmp/uwsgi \
  323. $RPM_BUILD_ROOT%{l_prefix}/var/nginx/tmp/scgi \
  324. $RPM_BUILD_ROOT%{l_prefix}/var/nginx/log \
  325. $RPM_BUILD_ROOT%{l_prefix}/var/nginx/run
  326. # determine installation files
  327. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  328. %{l_files_std} \
  329. '%config %{l_prefix}/etc/nginx/*' \
  330. '%attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/nginx/*' \
  331. '%attr(-,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/nginx/*/*'
  332. %files -f files
  333. %clean