nginx-module-brotli.spec 6.2 KB

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