# %if 0%{?rhel} || 0%{?amzn} || 0%{?fedora} %define _group System Environment/Daemons BuildRequires: openssl-devel %endif %if 0%{?suse_version} >= 1315 %define _group Productivity/Networking/Web/Servers BuildRequires: libopenssl-devel %define _debugsource_template %{nil} %endif %if 0%{?rhel} == 7 %define epoch 1 Epoch: %{epoch} %define dist .el7 %endif %if 0%{?rhel} == 8 %define epoch 1 Epoch: %{epoch} %define _debugsource_template %{nil} %define dist .el8 %endif %if 0%{?fedora} %define _debugsource_template %{nil} %global _hardened_build 1 %endif %define base_version 1.22.0 %define base_release 1%{?dist}.ngx %define devkit_version 0.3.1 %define bdir %{_builddir}/%{name}-%{base_version}_%{devkit_version} Summary: Nginx Development Kit (NDK) Name: nginx-module-development-kit Version: %{base_version}_%{devkit_version} Release: 1.1%{?dist}.stremki Vendor: Marcus Clyne. URL: https://github.com/vision5/ngx_devel_kit Group: %{_group} Source0: http://nginx.org/download/nginx-%{base_version}.tar.gz Source1: https://github.com/vision5/ngx_devel_kit/archive/v%{devkit_version}.tar.gz Source2: COPYRIGHT_ngx_devel_kit License: 3-clause BSD-like license BuildRoot: %{_tmppath}/%{name}-%{base_version}-%{base_release}-root BuildRequires: zlib-devel BuildRequires: pcre-devel BuildRequires: nginx == %{?epoch:%{epoch}:}%{base_version}-%{base_release} Requires: nginx == %{?epoch:%{epoch}:}%{base_version}-%{base_release} %description The NDK is an Nginx module that is designed to extend the core functionality of the excellent Nginx webserver in a way that can be used as a basis of other Nginx modules. It has functions and macros to deal with generic tasks that don't currently have generic code as part of the core distribution. The NDK itself adds few features that are seen from a user's point of view - it's just designed to help reduce the code that Nginx module developers need to write. %if 0%{?suse_version} || 0%{?amzn} %debug_package %endif %define NGINX_COMPILED_FLAGS $(nginx -V 2>&1 | grep ^config | cut -c22-) %define BASE_CONFIGURE_ARGS $(echo "%{NGINX_COMPILED_FLAGS}" | sed 's/--with-cc-opt=.*//; s/--with-ld-opt=.*//') %define WITH_CC_OPT $(echo "%{NGINX_COMPILED_FLAGS}" | grep -Eo \"\\\--with-cc-opt='[^']+'\" | tr -d "'" | cut -c15-) %define WITH_LD_OPT $(echo "%{NGINX_COMPILED_FLAGS}" | grep -Eo \"\\\--with-ld-opt='[^']+'\" | tr -d "'" | cut -c15-) %define MODULE_CONFIGURE_ARGS $(echo "--add-dynamic-module=modules/nginx-module-development-kit ") %prep %setup -qcTn %{name}-%{base_version}_%{devkit_version} tar --strip-components=1 -zxf %{SOURCE0} mkdir -p modules/%{name} cd modules/%{name} tar --strip-components=1 -zxf %{SOURCE1} sed -i "s|^have=NDK.*|have=NDK . auto/have\nhave=NDK_SET_VAR . auto/have|" config cd ../../ %build cd %{bdir} echo "BASE_CONFIGURE_ARGS: %{BASE_CONFIGURE_ARGS}" echo "MODULE_CONFIGURE_ARGS: %{MODULE_CONFIGURE_ARGS}" echo "WITH_CC_OPT: %{WITH_CC_OPT}" echo "WITH_LD_OPT: %{WITH_LD_OPT}" ./configure %{BASE_CONFIGURE_ARGS} %{MODULE_CONFIGURE_ARGS} \ --with-cc-opt="%{WITH_CC_OPT} " \ --with-ld-opt="%{WITH_LD_OPT} " \ --with-debug CFLAGS="$CFLAGS -DNDK_ALL" make -f objs/Makefile %{?_smp_mflags} modules for so in `find %{bdir}/objs/ -type f -name "*.so"`; do debugso=`echo $so | sed -e "s|.so|-debug.so|"` mv $so $debugso done ./configure %{BASE_CONFIGURE_ARGS} %{MODULE_CONFIGURE_ARGS} \ --with-cc-opt="%{WITH_CC_OPT} " \ --with-ld-opt="%{WITH_LD_OPT} " CFLAGS="$CFLAGS -DNDK_ALL" make -f objs/Makefile %{?_smp_mflags} modules %install cd %{bdir} %{__rm} -rf $RPM_BUILD_ROOT %{__mkdir} -p $RPM_BUILD_ROOT%{_datadir}/doc/nginx-module-development-kit %{__install} -m 644 -p %{SOURCE2} \ $RPM_BUILD_ROOT%{_datadir}/doc/nginx-module-development-kit/COPYRIGHT %{__mkdir} -p $RPM_BUILD_ROOT%{_libdir}/nginx/modules find %{bdir}/objs/ -type f -name "*-debug.so" -delete for so in `find %{bdir}/objs/ -maxdepth 1 -type f -name "*.so"`; do %{__install} -m755 $so $RPM_BUILD_ROOT%{_libdir}/nginx/modules/ done %check %{__rm} -rf $RPM_BUILD_ROOT/usr/src cd %{bdir} grep -v 'usr/src' debugfiles.list > debugfiles.list.new && mv debugfiles.list.new debugfiles.list cat /dev/null > debugsources.list %if 0%{?suse_version} >= 1500 cat /dev/null > debugsourcefiles.list %endif %clean %{__rm} -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) %{_libdir}/nginx/modules/* %dir %{_datadir}/doc/nginx-module-development-kit %{_datadir}/doc/nginx-module-development-kit/* %post if [ $1 -eq 1 ]; then cat < - 0.3.1-1.1 - Removing debug libs from main package * Fri Jun 19 2020 Dzmitry Stremkouski - 0.3.1-1 - Compiled for nginx base version 1.18.0, module version 0.3.1