nginx-module-brotli.spec 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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: http://nginx.org/download/nginx-%{main_version}.tar.gz
  34. Source1: ngx_brotli-1.0.7-1.tar.gz
  35. Source2: COPYRIGHT
  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. mkdir ngx_brotli
  54. cd ngx_brotli
  55. tar --strip-components=1 -zxf %{SOURCE1}
  56. %build
  57. cd %{bdir}
  58. ./configure %{BASE_CONFIGURE_ARGS} %{MODULE_CONFIGURE_ARGS} \
  59. --with-cc-opt="%{WITH_CC_OPT}" \
  60. --with-ld-opt="%{WITH_LD_OPT}" \
  61. --with-debug
  62. make %{?_smp_mflags} modules
  63. for so in `find %{bdir}/objs/ -type f -name "*.so"`; do
  64. debugso=`echo $so | sed -e "s|.so|-debug.so|"`
  65. mv $so $debugso
  66. done
  67. ./configure %{BASE_CONFIGURE_ARGS} %{MODULE_CONFIGURE_ARGS} \
  68. --with-cc-opt="%{WITH_CC_OPT}" \
  69. --with-ld-opt="%{WITH_LD_OPT}"
  70. make %{?_smp_mflags} modules
  71. %install
  72. cd %{bdir}
  73. %{__rm} -rf $RPM_BUILD_ROOT
  74. %{__mkdir} -p $RPM_BUILD_ROOT%{_datadir}/doc/nginx-module-brotli
  75. %{__install} -m 644 -p %{SOURCE2} \
  76. $RPM_BUILD_ROOT%{_datadir}/doc/nginx-module-brotli/
  77. %{__mkdir} -p $RPM_BUILD_ROOT%{_libdir}/nginx/modules
  78. for so in `find %{bdir}/objs/ -maxdepth 1 -type f -name "*.so"`; do
  79. %{__install} -m755 $so \
  80. $RPM_BUILD_ROOT%{_libdir}/nginx/modules/
  81. done
  82. %check
  83. %{__rm} -rf $RPM_BUILD_ROOT/usr/src
  84. cd %{bdir}
  85. grep -v 'usr/src' debugfiles.list > debugfiles.list.new && mv debugfiles.list.new debugfiles.list
  86. cat /dev/null > debugsources.list
  87. %if 0%{?suse_version} >= 1500
  88. cat /dev/null > debugsourcefiles.list
  89. %endif
  90. %clean
  91. %{__rm} -rf $RPM_BUILD_ROOT
  92. %files
  93. %defattr(-,root,root)
  94. %{_libdir}/nginx/modules/*
  95. %dir %{_datadir}/doc/nginx-module-brotli
  96. %{_datadir}/doc/nginx-module-brotli/*
  97. %post
  98. if [ $1 -eq 1 ]; then
  99. cat <<BANNER
  100. ----------------------------------------------------------------------
  101. The Brotli dynamic modules for nginx have been installed.
  102. To enable these modules, add the following to /etc/nginx/nginx.conf
  103. and reload nginx:
  104. load_module modules/ngx_http_brotli_filter_module.so;
  105. load_module modules/ngx_http_brotli_static_module.so;
  106. Please refer to the modules documentation for further details:
  107. https://github.com/google/ngx_brotli
  108. https://github.com/google/brotli
  109. ----------------------------------------------------------------------
  110. BANNER
  111. fi
  112. %changelog
  113. * Mon Nov 25 2019 Eugene Wu <kuretru@gmail.com>
  114. - base version updated to 1.17.6
  115. * Sun Oct 23 2019 Eugene Wu <kuretru@gmail.com>
  116. - base version updated to 1.17.5
  117. * Sun Oct 13 2019 Eugene Wu <kuretru@gmail.com>
  118. - base version updated to 1.17.4