LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File GeoIP.spec of Package GeoIP (Project devel:libraries:c_c++)

#
# spec file for package GeoIP
#
# Copyright (c) 2015 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 http://bugs.opensuse.org/
#


Name:           GeoIP
Version:        1.6.4
Release:        0
Summary:        Library to find the country that any IP address originates from
License:        GPL-2.0+ and LGPL-2.1+ and CC-BY-SA-3.0
Group:          Development/Libraries/C and C++
Url:            http://www.maxmind.com/
Source0:        https://github.com/maxmind/geoip-api-c/releases/download/v%{version}/%{name}-%{version}.tar.gz
Source1:        LICENSE.txt
Source2:        GPL-2.0.txt
Source3:        README.SUSE
Source4:        geoip-fetch
Source5:        baselibs.conf
BuildRequires:  pkg-config
BuildRequires:  pkgconfig(zlib)
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%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 lib%{name}1
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 lib%{name}1
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 lib%{name}-devel
Summary:        Development Files for GeoIP
License:        LGPL-2.1+
Group:          Development/Libraries/C and C++
Requires:       lib%{name}1 = %{version}
Provides:       %{name}-devel = %{version}-%{release}
Obsoletes:      %{name}-devel < %{version}

%description -n lib%{name}-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),%{_localstatedir}/lib/GeoIP,' libGeoIP/Makefile{.am,.in,}
sed -i -e 's,\$(pkgdatadir),%{_localstatedir}/lib/GeoIP,' man/Makefile{.am,.in,}

make %{?_smp_mflags}

%install
make DESTDIR=%{buildroot} install %{?_smp_mflags}

install -d %{buildroot}%{_localstatedir}/lib/GeoIP
install data/* %{buildroot}%{_localstatedir}/lib/GeoIP/
# do not ship these
rm %{buildroot}%{_libdir}/libGeoIP.la
# install fetcher
install -D -m 0755 %{SOURCE4} %{buildroot}%{_sbindir}/geoip-fetch

%post   -n lib%{name}1 -p /sbin/ldconfig

%postun -n lib%{name}1 -p /sbin/ldconfig

%files
%defattr(-, root, root, -)
%doc AUTHORS ChangeLog COPYING README.md LICENSE.txt GPL-2.0.txt README.SUSE
%{_bindir}/geoiplookup
%{_bindir}/geoiplookup6
%{_mandir}/man1/geoiplookup6.1*
%{_mandir}/man1/geoiplookup.1*
%{_sbindir}/geoip-fetch
%dir %{_localstatedir}/lib/GeoIP
%verify(not md5 size mtime) %{_localstatedir}/lib/GeoIP/GeoIP.dat
%ghost %verify(not md5 size mtime) %{_localstatedir}/lib/GeoIP/GeoIPASNum.dat
%ghost %verify(not md5 size mtime) %{_localstatedir}/lib/GeoIP/GeoIPCity.dat
%ghost %verify(not md5 size mtime) %{_localstatedir}/lib/GeoIP/GeoIPv6.dat

%files -n lib%{name}1
%defattr(-, root, root, -)
%doc AUTHORS ChangeLog COPYING README.md LICENSE.txt GPL-2.0.txt README.SUSE
%{_libdir}/libGeoIP.so.1
%{_libdir}/libGeoIP.so.%{version}

%files -n lib%{name}-devel
%defattr(-, root, root, -)
%doc AUTHORS ChangeLog COPYING README.md LICENSE.txt GPL-2.0.txt README.SUSE
%{_includedir}/GeoIP.h
%{_includedir}/GeoIPCity.h
%{_libdir}/libGeoIP.so
%{_libdir}/pkgconfig/geoip.pc

%changelog