nginx-module-brotli.spec 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. #
  2. %define nginx_user nginx
  3. %define nginx_group nginx
  4. %if 0%{?rhel} || 0%{?amzn} || 0%{?fedora}
  5. %define _group System Environment/Daemons
  6. %if 0%{?amzn} >= 2
  7. BuildRequires: openssl11-devel
  8. %else
  9. BuildRequires: openssl-devel
  10. %endif
  11. %endif
  12. %if 0%{?suse_version} >= 1315
  13. %define _group Productivity/Networking/Web/Servers
  14. BuildRequires: libopenssl-devel
  15. %define _debugsource_template %{nil}
  16. %endif
  17. %if (0%{?rhel} == 7) && (0%{?amzn} == 0)
  18. %define epoch 1
  19. Epoch: %{epoch}
  20. %define dist .el7
  21. %endif
  22. %if (0%{?rhel} == 7) && (0%{?amzn} == 2)
  23. %define epoch 1
  24. Epoch: %{epoch}
  25. %endif
  26. %if 0%{?rhel} == 8
  27. %define epoch 1
  28. Epoch: %{epoch}
  29. %define _debugsource_template %{nil}
  30. %endif
  31. %if 0%{?fedora}
  32. %define _debugsource_template %{nil}
  33. %global _hardened_build 1
  34. %endif
  35. %define base_version 1.21.2
  36. %define base_release 1%{?dist}.ngx
  37. %define bdir %{_builddir}/%{name}-%{base_version}
  38. Summary: nginx Brotli dynamic modules
  39. Name: nginx-module-brotli
  40. Version: %{base_version}
  41. Release: %{base_release}
  42. Vendor: Eugene Wu <kuretru@gmail.com>
  43. URL: https://github.com/kuretru/nginx-module-brotli
  44. Group: %{_group}
  45. Source0: https://nginx.org/download/nginx-%{base_version}.tar.gz
  46. Source1: COPYRIGHT
  47. Source2: ngx_brotli-1.0.9.tar.gz
  48. License: 2-clause BSD-like license
  49. BuildRoot: %{_tmppath}/%{name}-%{base_version}-%{base_release}-root
  50. BuildRequires: zlib-devel
  51. BuildRequires: pcre-devel
  52. Requires: nginx-r%{base_version}
  53. Provides: %{name}-r%{base_version}
  54. %description
  55. nginx Brotli dynamic modules.
  56. %if 0%{?suse_version}
  57. %debug_package
  58. %endif
  59. %define WITH_CC_OPT $(echo %{optflags} $(pcre-config --cflags))
  60. %define WITH_LD_OPT -Wl,-z,relro -Wl,-z,now
  61. %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 --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module")
  62. %define MODULE_CONFIGURE_ARGS $(echo "--add-dynamic-module=./ngx_brotli/")
  63. %prep
  64. %setup -qcTn %{name}-%{base_version}
  65. tar --strip-components=1 -zxf %{SOURCE0}
  66. tar -zxf %{SOURCE2}
  67. %build
  68. cd %{bdir}
  69. ./configure %{BASE_CONFIGURE_ARGS} %{MODULE_CONFIGURE_ARGS} \
  70. --with-cc-opt="%{WITH_CC_OPT} " \
  71. --with-ld-opt="%{WITH_LD_OPT} " \
  72. --with-debug
  73. make %{?_smp_mflags} modules
  74. for so in `find %{bdir}/objs/ -type f -name "*.so"`; do
  75. debugso=`echo $so | sed -e "s|.so|-debug.so|"`
  76. mv $so $debugso
  77. done
  78. ./configure %{BASE_CONFIGURE_ARGS} %{MODULE_CONFIGURE_ARGS} \
  79. --with-cc-opt="%{WITH_CC_OPT} " \
  80. --with-ld-opt="%{WITH_LD_OPT} "
  81. make %{?_smp_mflags} modules
  82. %install
  83. cd %{bdir}
  84. %{__rm} -rf $RPM_BUILD_ROOT
  85. %{__mkdir} -p $RPM_BUILD_ROOT%{_datadir}/doc/nginx-module-brotli
  86. %{__install} -m 644 -p %{SOURCE1} \
  87. $RPM_BUILD_ROOT%{_datadir}/doc/nginx-module-brotli/
  88. %{__mkdir} -p $RPM_BUILD_ROOT%{_libdir}/nginx/modules
  89. for so in `find %{bdir}/objs/ -maxdepth 1 -type f -name "*.so"`; do
  90. %{__install} -m755 $so \
  91. $RPM_BUILD_ROOT%{_libdir}/nginx/modules/
  92. done
  93. %check
  94. %{__rm} -rf $RPM_BUILD_ROOT/usr/src
  95. cd %{bdir}
  96. grep -v 'usr/src' debugfiles.list > debugfiles.list.new && mv debugfiles.list.new debugfiles.list
  97. cat /dev/null > debugsources.list
  98. %if 0%{?suse_version} >= 1500
  99. cat /dev/null > debugsourcefiles.list
  100. %endif
  101. %clean
  102. %{__rm} -rf $RPM_BUILD_ROOT
  103. %files
  104. %defattr(-,root,root)
  105. %{_libdir}/nginx/modules/*
  106. %dir %{_datadir}/doc/nginx-module-brotli
  107. %{_datadir}/doc/nginx-module-brotli/*
  108. %post
  109. if [ $1 -eq 1 ]; then
  110. cat <<BANNER
  111. ----------------------------------------------------------------------
  112. The Brotli dynamic module for nginx has been installed.
  113. To enable this module, add the following to /etc/nginx/nginx.conf
  114. and reload nginx:
  115. load_module modules/ngx_http_brotli_filter_module.so;
  116. load_module modules/ngx_http_brotli_static_module.so;
  117. Please refer to the module documentation for further details:
  118. https://github.com/google/ngx_brotli
  119. https://github.com/google/brotli
  120. ----------------------------------------------------------------------
  121. BANNER
  122. fi
  123. %changelog
  124. * Thu Sep 2 2021 Eugene Wu <kuretru@gmail.com>
  125. - base version updated to 1.21.2
  126. * Thu Jul 7 2021 Eugene Wu <kuretru@gmail.com>
  127. - base version updated to 1.21.1
  128. * Thu May 27 2021 Eugene Wu <kuretru@gmail.com>
  129. - base version updated to 1.21.0
  130. * Thu Apr 15 2021 Eugene Wu <kuretru@gmail.com>
  131. - base version updated to 1.19.10
  132. * Wed Mar 31 2021 Eugene Wu <kuretru@gmail.com>
  133. - base version updated to 1.19.9
  134. * Thu Mar 11 2021 Eugene Wu <kuretru@gmail.com>
  135. - base version updated to 1.19.8
  136. * Thu Feb 18 2021 Eugene Wu <kuretru@gmail.com>
  137. - base version updated to 1.19.7
  138. * Tue Dec 22 2020 Eugene Wu <kuretru@gmail.com>
  139. - base version updated to 1.19.6
  140. * Wed Nov 25 2020 Eugene Wu <kuretru@gmail.com>
  141. - base version updated to 1.19.5
  142. * Fri Oct 30 2020 Eugene Wu <kuretru@gmail.com>
  143. - base version updated to 1.19.4
  144. * Thu Oct 1 2020 Eugene Wu <kuretru@gmail.com>
  145. - base version updated to 1.19.3
  146. * Wed Aug 12 2020 Eugene Wu <kuretru@gmail.com>
  147. - base version updated to 1.19.2
  148. * Wed Jul 8 2020 Eugene Wu <kuretru@gmail.com>
  149. - base version updated to 1.19.1
  150. * Wed May 27 2020 Eugene Wu <kuretru@gmail.com>
  151. - base version updated to 1.19.0
  152. * Sat Apr 18 2020 Eugene Wu <kuretru@gmail.com>
  153. - base version updated to 1.17.10
  154. * Thu Mar 5 2020 Eugene Wu <kuretru@gmail.com>
  155. - base version updated to 1.17.9
  156. * Thu Jan 23 2020 Eugene Wu <kuretru@gmail.com>
  157. - base version updated to 1.17.8
  158. * Sat Dec 28 2019 Eugene Wu <kuretru@gmail.com>
  159. - base version updated to 1.17.7
  160. * Mon Nov 25 2019 Eugene Wu <kuretru@gmail.com>
  161. - base version updated to 1.17.6
  162. * Wed Oct 23 2019 Eugene Wu <kuretru@gmail.com>
  163. - base version updated to 1.17.5
  164. * Sun Oct 13 2019 Eugene Wu <kuretru@gmail.com>
  165. - base version updated to 1.17.4