File apache2-mod_geoip.spec of Package apache2-mod_geoip

#
# spec file for package apache2-mod_geoip
#
# Copyright (c) 2014 SUSE LINUX Products 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 http://bugs.opensuse.org/
#


%define modname mod_geoip
Name:           apache2-mod_geoip
Version:        1.2.8_git201307051243
Release:        0
Summary:        Loop up IP addresses in GeoIP database
License:        Apache-1.1
Group:          Productivity/Networking/Web/Servers
Url:            http://www.maxmind.com/app/mod_geoip
# git clone from https://github.com/maxmind/geoip-api-mod_geoip2
Source:         mod_geoip2-%{version}.tar.bz2
Patch0:         0001-use-AP_DECLARE_MODULE-if-possible-in-apache-2.4.patch
#
BuildRequires:  GeoIP-devel >= 1.4.3
BuildRequires:  apache2-devel
BuildRequires:  apache-rpm-macros
Requires:       %{apache_mmn}
Requires:       %{apache_suse_maintenance_mmn}
Requires:       apache2
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
mod_geoip looks up the IP address of the client end user in MaxMind's GeoIP
country database.

%prep
%setup -q -n %{modname}2-%{version}
%patch0 -p1

%build
%{apache_apxs} -c -lGeoIP mod_geoip.c

%install
mkdir -p %{buildroot}/%{apache_libexecdir}
cp -p .libs/mod_geoip.so %{buildroot}/%{apache_libexecdir}
mkdir -p %{buildroot}/%{apache_sysconfdir}/conf.d
cat <<-EOF > %{buildroot}/%{apache_sysconfdir}/conf.d/%{modname}.conf
<IfModule mod_geoip.c>
    GeoIPEnable On
    GeoIPEnableUTF8 On
    # GeoIPOutput [Notes|Env|All]
    GeoIPOutput All

    <IfModule prefork.c>
        GeoIPDBFile %{_localstatedir}/lib/GeoIP/GeoIP.dat
    </IfModule>
    <IfModule !prefork>
        GeoIPDBFile %{_localstatedir}/lib/GeoIP/GeoIP.dat MMapCache
    </IfModule>
</IfModule>
EOF

%files
%defattr(-,root,root)
%doc README
%doc README.php
%doc INSTALL
%doc Changes
%{apache_libexecdir}/%{modname}.so
%config(noreplace) %{apache_sysconfdir}/conf.d/%{modname}.conf

%changelog

openSUSE Build Service is sponsored by