File GeoIP.spec of Package GeoIP
#
# spec file for package GeoIP
#
# Copyright (c) 2013 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/
#
Name: GeoIP
%define lname libGeoIP1
Version: 1.5.1
Release: 0
#
Summary: Library to find the country that any IP address originates from
License: GPL-2.0+ and LGPL-2.1+
Group: Development/Libraries/C and C++
#
Url: http://www.maxmind.com/
Source: http://www.maxmind.com/download/geoip/api/c/%{name}-%{version}.tar.gz
Source1: LICENSE.txt
Source2: GPL-2.0.txt
Source3: README.SUSE
Source4: geoip-fetch
Source5: baselibs.conf
#
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: pkg-config
BuildRequires: zlib-devel
%if 0%{?suse_version}
Recommends: curl
%endif
%description
GeoIP is a C library that enables the user to find the country that any
IP address or hostname originates from. It uses a file based database.
This database simply contains IP blocks as keys, and countries as
values. This database should be more complete and accurate than using
reverse DNS lookups.
MaxMind offers a service where you can have your database updated
automically each month.
%package -n %lname
Summary: Shared libraries of the GeoIP C API
License: LGPL-2.1+
Group: Development/Libraries/C and C++
# for the data file
%if 0%{?suse_version}
Recommends: GeoIP
%endif
%description -n %lname
GeoIP is a C library that enables the user to find the country that any
IP address or hostname originates from. It uses a file based database.
This database simply contains IP blocks as keys, and countries as
values. This database should be more complete and accurate than using
reverse DNS lookups.
MaxMind offers a service where you can have your database updated
automically each month.
This package holds the shared libraries for GeoIP.
%package -n libGeoIP-devel
Summary: Development Files for GeoIP
License: LGPL-2.1+
Group: Development/Libraries/C and C++
#
Requires: %lname = %{version}
Provides: %{name}-devel = %{version}-%{release}
Obsoletes: %{name}-devel < %{version}
%description -n libGeoIP-devel
GeoIP is a C library that enables the user to find the country that any
IP address or hostname originates from. It uses a file based database.
This database simply contains IP blocks as keys, and countries as
values. This database should be more complete and accurate than using
reverse DNS lookups.
MaxMind offers a service where you can have your database updated
automically each month.
This package holds the development files for GeoIP.
%prep
%setup -q
cp %{SOURCE1} .
cp %{SOURCE2} .
cp %{SOURCE3} .
%build
%configure --disable-static --with-pic
sed -i -e '/-DGEOIPDATADIR/s,\$(pkgdatadir),/var/lib/GeoIP,' libGeoIP/Makefile{.am,.in,}
sed -i -e 's,\$(pkgdatadir),/var/lib/GeoIP,' man/Makefile{.am,.in,}
make %{?_smp_mflags}
%install
%makeinstall
install -d %{buildroot}/var/lib
mv %{buildroot}%{_datadir}/GeoIP %{buildroot}/var/lib
for i in GeoIPASNum.dat GeoIPCity.dat GeoIPv6.dat; do
touch %buildroot/var/lib/GeoIP/$i
done
# we don't need that, we use %config(noreplace) instead
%{__rm} %{buildroot}%{_sysconfdir}/GeoIP.conf.default
# no need for that
%{__rm} %{buildroot}%{_libdir}/*.la
# install fetcher
install -D -m 0755 %{SOURCE4} %{buildroot}%{_sbindir}/geoip-fetch
%post -n %lname -p /sbin/ldconfig
%postun -n %lname -p /sbin/ldconfig
%files
%defattr(-, root, root, -)
%doc AUTHORS ChangeLog COPYING README TODO LICENSE.txt GPL-2.0.txt README.SUSE
%config(noreplace) %{_sysconfdir}/GeoIP.conf
%{_bindir}/geoiplookup
%{_bindir}/geoiplookup6
%{_bindir}/geoipupdate
%{_mandir}/man1/geoiplookup6.1*
%{_mandir}/man1/geoiplookup.1*
%{_mandir}/man1/geoipupdate.1*
%{_sbindir}/geoip-fetch
%dir /var/lib/GeoIP
%verify(not md5 size mtime) /var/lib/GeoIP/GeoIP.dat
%ghost %verify(not md5 size mtime) /var/lib/GeoIP/GeoIPASNum.dat
%ghost %verify(not md5 size mtime) /var/lib/GeoIP/GeoIPCity.dat
%ghost %verify(not md5 size mtime) /var/lib/GeoIP/GeoIPv6.dat
%files -n %lname
%defattr(-, root, root, -)
%{_libdir}/libGeoIP.so.1
%{_libdir}/libGeoIP.so.%{version}
%{_libdir}/libGeoIPUpdate.so.0
%{_libdir}/libGeoIPUpdate.so.0.0.0
%files -n libGeoIP-devel
%defattr(-, root, root, -)
%{_includedir}/GeoIP.h
%{_includedir}/GeoIPCity.h
%{_includedir}/GeoIPUpdate.h
%{_libdir}/libGeoIP.so
%{_libdir}/libGeoIPUpdate.so
%{_libdir}/pkgconfig/geoip.pc
%changelog