File nginx-module-modsecurity.spec of Package nginx-module-modsecurity

# spec file for package nginx-module-modsecurity
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

%define project_name ModSecurity-nginx
%define nginx_moduledir %{_libdir}/nginx/modules

Name:           nginx-module-modsecurity
Version:        1.0.0
Release:        0
Summary:        ModSecurity v3 Nginx Connector
License:        Apache-2.0
Group:          Productivity/Networking/Web/Proxy
Url:  {project_name}
BuildRequires:  modsecurity-devel
BuildRequires:  nginx-source
BuildRequires:  pcre-devel
Requires:       nginx = %(rpm -q nginx-source | rev | cut -d. --complement -f1 | cut -d"-" -f2 | rev)

The ModSecurity-nginx connector is the connection point between nginx and
libmodsecurity (ModSecurity v3). Said another way, this project provides a
communication channel between nginx and libmodsecurity. This connector is
required to use LibModSecurity with nginx.

The ModSecurity-nginx connector takes the form of an nginx module. The module
simply serves as a layer of communication between nginx and ModSecurity.

mkdir %{project_name}
tar -xzf %{SOURCE0} --strip-components=1 -C %{project_name}
cp -r /usr/src/nginx .

cd nginx
# configure macro cannot be used, because this configure script doesn't
# accept some options provided by the macro (like i.e. --host).
./configure                     \
  --with-compat                 \
  --with-pcre                   \
  --without-http_rewrite_module \
  --without-http_gzip_module    \
make modules

mkdir -p %{buildroot}%{nginx_moduledir}
install -D -m 0644 nginx/objs/ %{buildroot}%{nginx_moduledir}

%license %{project_name}/LICENSE
%dir %{_libdir}/nginx
%dir %{nginx_moduledir}