nginx-module-brotli.spec 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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.0
  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.7.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. %description
  46. nginx Brotli dynamic modules.
  47. %if 0%{?suse_version} || 0%{?amzn}
  48. %debug_package
  49. %endif
  50. %define WITH_CC_OPT $(echo %{optflags} $(pcre-config --cflags))
  51. %define WITH_LD_OPT -Wl,-z,relro -Wl,-z,now
  52. %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")
  53. %define MODULE_CONFIGURE_ARGS $(echo "--add-dynamic-module=./ngx_brotli/")
  54. %prep
  55. %setup -qcTn %{name}-%{base_version}
  56. tar --strip-components=1 -zxf %{SOURCE0}
  57. tar -zxf %{SOURCE2}
  58. %build
  59. cd %{bdir}
  60. ./configure %{BASE_CONFIGURE_ARGS} %{MODULE_CONFIGURE_ARGS} \
  61. --with-cc-opt="%{WITH_CC_OPT} " \
  62. --with-ld-opt="%{WITH_LD_OPT} " \
  63. --with-debug
  64. make %{?_smp_mflags} modules
  65. for so in `find %{bdir}/objs/ -type f -name "*.so"`; do
  66. debugso=`echo $so | sed -e "s|.so|-debug.so|"`
  67. mv $so $debugso
  68. done
  69. ./configure %{BASE_CONFIGURE_ARGS} %{MODULE_CONFIGURE_ARGS} \
  70. --with-cc-opt="%{WITH_CC_OPT} " \
  71. --with-ld-opt="%{WITH_LD_OPT} "
  72. make %{?_smp_mflags} modules
  73. %install
  74. cd %{bdir}
  75. %{__rm} -rf $RPM_BUILD_ROOT
  76. %{__mkdir} -p $RPM_BUILD_ROOT%{_datadir}/doc/nginx-module-brotli
  77. %{__install} -m 644 -p %{SOURCE1} \
  78. $RPM_BUILD_ROOT%{_datadir}/doc/nginx-module-brotli/
  79. %{__mkdir} -p $RPM_BUILD_ROOT%{_libdir}/nginx/modules
  80. for so in `find %{bdir}/objs/ -maxdepth 1 -type f -name "*.so"`; do
  81. %{__install} -m755 $so \
  82. $RPM_BUILD_ROOT%{_libdir}/nginx/modules/
  83. done
  84. %check
  85. %{__rm} -rf $RPM_BUILD_ROOT/usr/src
  86. cd %{bdir}
  87. grep -v 'usr/src' debugfiles.list > debugfiles.list.new && mv debugfiles.list.new debugfiles.list
  88. cat /dev/null > debugsources.list
  89. %if 0%{?suse_version} >= 1500
  90. cat /dev/null > debugsourcefiles.list
  91. %endif
  92. %clean
  93. %{__rm} -rf $RPM_BUILD_ROOT
  94. %files
  95. %defattr(-,root,root)
  96. %{_libdir}/nginx/modules/*
  97. %dir %{_datadir}/doc/nginx-module-brotli
  98. %{_datadir}/doc/nginx-module-brotli/*
  99. %post
  100. if [ $1 -eq 1 ]; then
  101. cat <<BANNER
  102. ----------------------------------------------------------------------
  103. The Brotli dynamic module for nginx has been installed.
  104. To enable this module, add the following to /etc/nginx/nginx.conf
  105. and reload nginx:
  106. load_module modules/ngx_http_brotli_filter_module.so;
  107. load_module modules/ngx_http_brotli_static_module.so;
  108. Please refer to the module documentation for further details:
  109. https://github.com/google/ngx_brotli
  110. https://github.com/google/brotli
  111. ----------------------------------------------------------------------
  112. BANNER
  113. fi
  114. %changelog
  115. * Wed May 27 2020 Eugene Wu <kuretru@gmail.com>
  116. - base version updated to 1.19.0
  117. * Sat Apr 18 2020 Eugene Wu <kuretru@gmail.com>
  118. - base version updated to 1.17.10
  119. * Thu Mar 5 2020 Eugene Wu <kuretru@gmail.com>
  120. - base version updated to 1.17.9
  121. * Thu Jan 23 2020 Eugene Wu <kuretru@gmail.com>
  122. - base version updated to 1.17.8
  123. * Sat Dec 28 2019 Eugene Wu <kuretru@gmail.com>
  124. - base version updated to 1.17.7
  125. * Mon Nov 25 2019 Eugene Wu <kuretru@gmail.com>
  126. - base version updated to 1.17.6
  127. * Wed Oct 23 2019 Eugene Wu <kuretru@gmail.com>
  128. - base version updated to 1.17.5
  129. * Sun Oct 13 2019 Eugene Wu <kuretru@gmail.com>
  130. - base version updated to 1.17.4