nginx-module-brotli.spec 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. #
  2. %define nginx_user nginx
  3. %define nginx_group nginx
  4. %if 0%{?rhel} || 0%{?amzn}
  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. %define main_version 1.17.6
  24. %define main_release 1%{?dist}.ngx
  25. %define bdir %{_builddir}/%{name}-%{main_version}
  26. Summary: nginx Brotli dynamic modules
  27. Name: nginx-module-brotli
  28. Version: 1.17.6
  29. Release: 1%{?dist}.ngx
  30. Vendor: Nginx, Inc.
  31. URL: http://nginx.org/
  32. Group: %{_group}
  33. Source0: https://nginx.org/download/nginx-%{main_version}.tar.gz
  34. Source1: COPYRIGHT
  35. Source2: ngx_brotli-1.0.7.tar.gz
  36. License: 2-clause BSD-like license
  37. BuildRoot: %{_tmppath}/%{name}-%{main_version}-%{main_release}-root
  38. BuildRequires: zlib-devel
  39. BuildRequires: pcre-devel
  40. Requires: nginx == %{?epoch:%{epoch}:}1.17.6-1%{?dist}.ngx
  41. %description
  42. nginx Brotli dynamic modules.
  43. %if 0%{?suse_version} || 0%{?amzn}
  44. %debug_package
  45. %endif
  46. %define WITH_CC_OPT $(echo %{optflags} $(pcre-config --cflags))
  47. %define WITH_LD_OPT -Wl,-z,relro -Wl,-z,now
  48. %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")
  49. %define MODULE_CONFIGURE_ARGS $(echo "--add-dynamic-module=./ngx_brotli/")
  50. %prep
  51. %setup -qcTn %{name}-%{main_version}
  52. tar --strip-components=1 -zxf %{SOURCE0}
  53. tar -zxf %{SOURCE2}
  54. %build
  55. cd %{bdir}
  56. ./configure %{BASE_CONFIGURE_ARGS} %{MODULE_CONFIGURE_ARGS} \
  57. --with-cc-opt="%{WITH_CC_OPT}" \
  58. --with-ld-opt="%{WITH_LD_OPT}" \
  59. --with-debug
  60. make %{?_smp_mflags} modules
  61. for so in `find %{bdir}/objs/ -type f -name "*.so"`; do
  62. debugso=`echo $so | sed -e "s|.so|-debug.so|"`
  63. mv $so $debugso
  64. done
  65. ./configure %{BASE_CONFIGURE_ARGS} %{MODULE_CONFIGURE_ARGS} \
  66. --with-cc-opt="%{WITH_CC_OPT}" \
  67. --with-ld-opt="%{WITH_LD_OPT}"
  68. make %{?_smp_mflags} modules
  69. %install
  70. cd %{bdir}
  71. %{__rm} -rf $RPM_BUILD_ROOT
  72. %{__mkdir} -p $RPM_BUILD_ROOT%{_datadir}/doc/nginx-module-brotli
  73. %{__install} -m 644 -p %{SOURCE1} \
  74. $RPM_BUILD_ROOT%{_datadir}/doc/nginx-module-brotli/
  75. %{__mkdir} -p $RPM_BUILD_ROOT%{_libdir}/nginx/modules
  76. for so in `find %{bdir}/objs/ -maxdepth 1 -type f -name "*.so"`; do
  77. %{__install} -m755 $so \
  78. $RPM_BUILD_ROOT%{_libdir}/nginx/modules/
  79. done
  80. %check
  81. %{__rm} -rf $RPM_BUILD_ROOT/usr/src
  82. cd %{bdir}
  83. grep -v 'usr/src' debugfiles.list > debugfiles.list.new && mv debugfiles.list.new debugfiles.list
  84. cat /dev/null > debugsources.list
  85. %if 0%{?suse_version} >= 1500
  86. cat /dev/null > debugsourcefiles.list
  87. %endif
  88. %clean
  89. %{__rm} -rf $RPM_BUILD_ROOT
  90. %files
  91. %defattr(-,root,root)
  92. %{_libdir}/nginx/modules/*
  93. %dir %{_datadir}/doc/nginx-module-brotli
  94. %{_datadir}/doc/nginx-module-brotli/*
  95. %post
  96. if [ $1 -eq 1 ]; then
  97. cat <<BANNER
  98. ----------------------------------------------------------------------
  99. The Brotli dynamic modules for nginx have been installed.
  100. To enable these modules, add the following to /etc/nginx/nginx.conf
  101. and reload nginx:
  102. load_module modules/ngx_http_brotli_filter_module.so;
  103. load_module modules/ngx_http_brotli_static_module.so;
  104. Please refer to the modules documentation for further details:
  105. https://github.com/google/ngx_brotli
  106. https://github.com/google/brotli
  107. ----------------------------------------------------------------------
  108. BANNER
  109. fi
  110. %changelog
  111. * Mon Nov 25 2019 Eugene Wu <kuretru@gmail.com>
  112. - base version updated to 1.17.6
  113. * Sun Oct 23 2019 Eugene Wu <kuretru@gmail.com>
  114. - base version updated to 1.17.5
  115. * Sun Oct 13 2019 Eugene Wu <kuretru@gmail.com>
  116. - base version updated to 1.17.4