nginx-module-brotli.spec 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. %define commit0 a71f931
  2. %define commit1 ed738e8
  3. #
  4. %define nginx_user nginx
  5. %define nginx_group nginx
  6. %define __arch_install_post /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot
  7. %if 0%{?rhel} || 0%{?amzn} || 0%{?fedora}
  8. %define _group System Environment/Daemons
  9. %if 0%{?amzn} == 2
  10. BuildRequires: openssl11-devel
  11. %else
  12. BuildRequires: openssl-devel
  13. %endif
  14. %endif
  15. %if 0%{?suse_version} >= 1315
  16. %define _group Productivity/Networking/Web/Servers
  17. BuildRequires: libopenssl-devel
  18. %define _debugsource_template %{nil}
  19. %endif
  20. %if (0%{?rhel} == 7) && (0%{?amzn} == 0)
  21. %define epoch 1
  22. Epoch: %{epoch}
  23. %define dist .el7
  24. %endif
  25. %if (0%{?rhel} == 7) && (0%{?amzn} == 2)
  26. %define epoch 1
  27. Epoch: %{epoch}
  28. %endif
  29. %if 0%{?rhel} == 8
  30. %define epoch 1
  31. Epoch: %{epoch}
  32. %define _debugsource_template %{nil}
  33. %endif
  34. %if 0%{?rhel} == 9
  35. %define epoch 1
  36. Epoch: %{epoch}
  37. BuildRequires: gcc
  38. %define _debugsource_template %{nil}
  39. %endif
  40. %if 0%{?fedora}
  41. %define _debugsource_template %{nil}
  42. %global _hardened_build 1
  43. %endif
  44. BuildRequires: git
  45. BuildRequires: cmake
  46. %define mod_version 1.0.0rc+git9.g%{commit0}
  47. %define base_version 1.25.3
  48. %define base_release 1%{?dist}.ngx
  49. %define bdir %{_builddir}/%{name}-%{base_version}
  50. Summary: nginx Brotli dynamic modules
  51. Name: nginx-module-brotli
  52. Version: %{mod_version}
  53. Release: %{base_release}
  54. Vendor: Eugene Wu <kuretru@gmail.com>
  55. URL: https://github.com/kuretru/nginx-module-brotli
  56. Group: %{_group}
  57. #!RemoteAsset: sha256:64c5b975ca287939e828303fa857d22f142b251f17808dfe41733512d9cded86
  58. Source0: https://nginx.org/download/nginx-%{base_version}.tar.gz
  59. Source1: COPYRIGHT
  60. #!RemoteAsset: sha256:1d21be34f3b7b6d05a8142945e59b3a47665edcdfe0f3ee3d3dbef121f90c08c
  61. Source2: https://github.com/google/ngx_brotli/archive/%{commit0}.tar.gz
  62. #!RemoteAsset: sha256:aaa739962a45b508b2e783b915e6b2b57ed3b12bd4b0feac73acfb144dffa54f
  63. Source3: https://github.com/google/brotli/archive/%{commit1}.tar.gz
  64. License: 2-clause BSD-like license
  65. BuildRoot: %{_tmppath}/%{name}-%{base_version}-%{base_release}-root
  66. BuildRequires: zlib-devel
  67. BuildRequires: pcre2-devel
  68. BuildRequires: nginx-r%{base_version}
  69. Requires: nginx-r%{base_version}
  70. Provides: %{name}-r%{base_version}
  71. %description
  72. nginx Brotli dynamic modules.
  73. %if 0%{?suse_version}
  74. %debug_package
  75. %endif
  76. %define WITH_CC_OPT $(echo %{optflags} $(pcre2-config --cflags))
  77. %define WITH_LD_OPT -Wl,-z,relro -Wl,-z,now
  78. %define BASE_CONFIGURE_ARGS $(echo "--prefix=%{_sysconfdir}/nginx --sbin-path=%{_sbindir}/nginx --modules-path=%{_libdir}/nginx/modules --conf-path=%{_sysconfdir}/nginx/nginx.conf --error-log-path=%{_localstatedir}/log/nginx/error.log --http-log-path=%{_localstatedir}/log/nginx/access.log --pid-path=%{_localstatedir}/run/nginx.pid --lock-path=%{_localstatedir}/run/nginx.lock --http-client-body-temp-path=%{_localstatedir}/cache/nginx/client_temp --http-proxy-temp-path=%{_localstatedir}/cache/nginx/proxy_temp --http-fastcgi-temp-path=%{_localstatedir}/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=%{_localstatedir}/cache/nginx/uwsgi_temp --http-scgi-temp-path=%{_localstatedir}/cache/nginx/scgi_temp --user=%{nginx_user} --group=%{nginx_group} --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module $( if [ 0%{?rhel} -eq 7 ] || [ 0%{?suse_version} -eq 1315 ]; then continue; else echo "--with-http_v3_module"; fi; ) --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module")
  79. %define MODULE_CONFIGURE_ARGS $(echo "--add-dynamic-module=./ngx_brotli/")
  80. %prep
  81. %setup -qcTn %{name}-%{base_version}
  82. tar --strip-components=1 -zxf %{SOURCE0}
  83. mkdir ngx_brotli
  84. tar --strip-components=1 -zxf %{SOURCE2} -C ngx_brotli
  85. cd ngx_brotli/deps/brotli/
  86. tar --strip-components=1 -zxf %{SOURCE3}
  87. mkdir out && cd out/
  88. cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DCMAKE_C_FLAGS="-Ofast -m64 -march=native -mtune=native -flto -funroll-loops -ffunction-sections -fdata-sections -Wl,--gc-sections" -DCMAKE_CXX_FLAGS="-Ofast -m64 -march=native -mtune=native -flto -funroll-loops -ffunction-sections -fdata-sections -Wl,--gc-sections" -DCMAKE_C_COMPILER_WORKS=ON -DCMAKE_INSTALL_PREFIX=./installed ..
  89. cmake --build . --config Release --target brotlienc
  90. cd ../../../../
  91. %build
  92. cd %{bdir}
  93. ./configure %{BASE_CONFIGURE_ARGS} %{MODULE_CONFIGURE_ARGS} \
  94. --with-cc-opt="%{WITH_CC_OPT} " \
  95. --with-ld-opt="%{WITH_LD_OPT} " \
  96. --with-debug
  97. make %{?_smp_mflags} modules
  98. for so in `find %{bdir}/objs/ -type f -name "*.so"`; do
  99. debugso=`echo $so | sed -e 's|\.so$|-debug.so|'`
  100. mv $so $debugso
  101. done
  102. ./configure %{BASE_CONFIGURE_ARGS} %{MODULE_CONFIGURE_ARGS} \
  103. --with-cc-opt="%{WITH_CC_OPT} " \
  104. --with-ld-opt="%{WITH_LD_OPT} "
  105. make %{?_smp_mflags} modules
  106. %install
  107. cd %{bdir}
  108. %{__rm} -rf $RPM_BUILD_ROOT
  109. %{__mkdir} -p $RPM_BUILD_ROOT%{_datadir}/doc/nginx-module-brotli
  110. %{__install} -m 644 -p %{SOURCE1} \
  111. $RPM_BUILD_ROOT%{_datadir}/doc/nginx-module-brotli/
  112. %{__mkdir} -p $RPM_BUILD_ROOT%{_libdir}/nginx/modules
  113. for so in `find %{bdir}/objs/ -maxdepth 1 -type f -name "*.so"`; do
  114. %{__install} -m755 $so \
  115. $RPM_BUILD_ROOT%{_libdir}/nginx/modules/
  116. done
  117. %check
  118. %{__rm} -rf $RPM_BUILD_ROOT/usr/src
  119. cd %{bdir}
  120. grep -v 'usr/src' debugfiles.list > debugfiles.list.new && mv debugfiles.list.new debugfiles.list
  121. cat /dev/null > debugsources.list
  122. %if 0%{?suse_version} >= 1500
  123. cat /dev/null > debugsourcefiles.list
  124. %endif
  125. %clean
  126. %{__rm} -rf $RPM_BUILD_ROOT
  127. %files
  128. %defattr(-,root,root)
  129. %{_libdir}/nginx/modules/*
  130. %dir %{_datadir}/doc/nginx-module-brotli
  131. %{_datadir}/doc/nginx-module-brotli/*
  132. %post
  133. if [ $1 -eq 1 ]; then
  134. cat <<BANNER
  135. ----------------------------------------------------------------------
  136. The Brotli dynamic module for nginx has been installed.
  137. To enable this module, add the following to /etc/nginx/nginx.conf
  138. and reload nginx:
  139. load_module modules/ngx_http_brotli_filter_module.so;
  140. load_module modules/ngx_http_brotli_static_module.so;
  141. Please refer to the module documentation for further details:
  142. https://github.com/google/ngx_brotli
  143. https://github.com/google/brotli
  144. ----------------------------------------------------------------------
  145. BANNER
  146. fi
  147. %changelog
  148. * Sun Oct 29 2023 Eugene Wu <kuretru@gmail.com>
  149. - base version updated to 1.25.3
  150. * Mon Aug 7 2023 Eugene Wu <kuretru@gmail.com>
  151. - base version updated to 1.25.2
  152. * Thu Jul 13 2023 Eugene Wu <kuretru@gmail.com>
  153. - base version updated to 1.25.1
  154. * Fri May 26 2023 Eugene Wu <kuretru@gmail.com>
  155. - base version updated to 1.25.0
  156. * Wed Mar 29 2023 Eugene Wu <kuretru@gmail.com>
  157. - base version updated to 1.23.4
  158. * Sun Jan 1 2023 Eugene Wu <kuretru@gmail.com>
  159. - base version updated to 1.23.3
  160. * Fri Oct 21 2022 Eugene Wu <kuretru@gmail.com>
  161. - base version updated to 1.23.2
  162. * Sat Jul 23 2022 Eugene Wu <kuretru@gmail.com>
  163. - base version updated to 1.23.1
  164. * Wed Jun 22 2022 Eugene Wu <kuretru@gmail.com>
  165. - base version updated to 1.23.0
  166. * Thu Jan 27 2022 Eugene Wu <kuretru@gmail.com>
  167. - base version updated to 1.21.6
  168. * Mon Jan 3 2022 Eugene Wu <kuretru@gmail.com>
  169. - base version updated to 1.21.5
  170. * Tue Nov 9 2021 Eugene Wu <kuretru@gmail.com>
  171. - base version updated to 1.21.4
  172. * Fri Sep 10 2021 Eugene Wu <kuretru@gmail.com>
  173. - base version updated to 1.21.3
  174. * Thu Sep 2 2021 Eugene Wu <kuretru@gmail.com>
  175. - base version updated to 1.21.2
  176. * Wed Jul 7 2021 Eugene Wu <kuretru@gmail.com>
  177. - base version updated to 1.21.1
  178. * Thu May 27 2021 Eugene Wu <kuretru@gmail.com>
  179. - base version updated to 1.21.0
  180. * Thu Apr 15 2021 Eugene Wu <kuretru@gmail.com>
  181. - base version updated to 1.19.10
  182. * Wed Mar 31 2021 Eugene Wu <kuretru@gmail.com>
  183. - base version updated to 1.19.9
  184. * Thu Mar 11 2021 Eugene Wu <kuretru@gmail.com>
  185. - base version updated to 1.19.8
  186. * Thu Feb 18 2021 Eugene Wu <kuretru@gmail.com>
  187. - base version updated to 1.19.7
  188. * Tue Dec 22 2020 Eugene Wu <kuretru@gmail.com>
  189. - base version updated to 1.19.6
  190. * Wed Nov 25 2020 Eugene Wu <kuretru@gmail.com>
  191. - base version updated to 1.19.5
  192. * Fri Oct 30 2020 Eugene Wu <kuretru@gmail.com>
  193. - base version updated to 1.19.4
  194. * Thu Oct 1 2020 Eugene Wu <kuretru@gmail.com>
  195. - base version updated to 1.19.3
  196. * Wed Aug 12 2020 Eugene Wu <kuretru@gmail.com>
  197. - base version updated to 1.19.2
  198. * Wed Jul 8 2020 Eugene Wu <kuretru@gmail.com>
  199. - base version updated to 1.19.1
  200. * Wed May 27 2020 Eugene Wu <kuretru@gmail.com>
  201. - base version updated to 1.19.0
  202. * Sat Apr 18 2020 Eugene Wu <kuretru@gmail.com>
  203. - base version updated to 1.17.10
  204. * Thu Mar 5 2020 Eugene Wu <kuretru@gmail.com>
  205. - base version updated to 1.17.9
  206. * Thu Jan 23 2020 Eugene Wu <kuretru@gmail.com>
  207. - base version updated to 1.17.8
  208. * Sat Dec 28 2019 Eugene Wu <kuretru@gmail.com>
  209. - base version updated to 1.17.7
  210. * Mon Nov 25 2019 Eugene Wu <kuretru@gmail.com>
  211. - base version updated to 1.17.6
  212. * Wed Oct 23 2019 Eugene Wu <kuretru@gmail.com>
  213. - base version updated to 1.17.5
  214. * Sun Oct 13 2019 Eugene Wu <kuretru@gmail.com>
  215. - base version updated to 1.17.4