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:        1.1
#
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
* Wed Jul 31 2013 dimstar@opensuse.org
- Update to version 1.5.1:
  + Update time_zone for Ontario, Canada.
  + geoiplookup and geoiplookup6 exit code is 0 when user asked for
    help.
  + Added -h option to geoiplookup6.
  + Do not load the database file if nodes and file size do not
    make sense.
  + Keep README and man pages in pure ascii.
  + It doesn't make sense to use GEOIP_INDEX_MODE with small
    databases like GEOIP_COUNTRY_EDITION. Instead of undefined
    behaviour we handle it silently as GEOIP_MEMORY_MODE.
  + Update FIPS codes for Greece.
- Changes from version 1.5.0:
  + Rename custom_directory to GeoIP_custom_directory.
  + Make sure the database match the requested type. This is
    helpful for Databases with the same default name and the
    general geoiplookup form (geoiplookup without a specific
    database).
  + apps/geoiplookup6.c use the ipnum instead of the hostname
    for lookups.
  + Use configure.ac instead of configure.in.
  + Region lookup is a bit faster.
  + Add pkg-config file.
  + Updates required to build a Windows DLL under MinGW.
  + Make API thread safe.
  + geoiplookup's default charset is UTF8 -l change the charset
    back to iso8859-1.
  + geoipupdate skips \r otherwise it might be part of the last
    product_id.
  + Update time zones.
  + Update Region codes.
  + Remove the unused CITYCONFIDENCE* database types.
  + bootstrap rebuilds ltmain.sh.
  + Update README.OSX for Lion.
  + Change Macedonia to Macedonia, The Former Yugoslav Republic of.
  + Add region_name to geoiplookup GEOIP_CITY_EDITION_REV1.
  + Add region_name to geoiplookup GEOIP_CITY_EDITION_REV0.
  + Add a --disable-data-files option.
  + Add GEOIP_ACCURACYRADIUS_EDITION and
    GEOIP_ACCURACYRADIUS_EDITION_V6.
  + Add more database types GEOIP_COUNTRYCONF_EDITION,
    GEOIP_CITYCONF_EDITION, GEOIP_REGIONCONF_EDITION and
    GEOIP_POSTALCONF_EDITION.
  + Fix default filenames for GEOIP_NETSPEED_EDITION_REV1 and
    GEOIP_NETSPEED_EDITION_REV1_V6.
- Add pkg-config BuildRequires: needed in order for the pkgconfig()
  provides to be automatically provided.
- Drop libtool BuildRequires and call to autoreconf: the tarball is
  in good condition now.
* Wed Feb  6 2013 cfarrell@suse.com
- license update: GPL-2.0+ and LGPL-2.1+
  Clean up
* Mon Feb  4 2013 coolo@suse.com
- update license to new format
* Tue May 29 2012 jengelh@inai.de
- Regenerate autotools files manually to resolve build failure
  stemming from automatic mode
* Wed Apr 11 2012 andreas.stieger@gmx.de
- add build requirement libtool
* Sat Mar 24 2012 poeml@cmdline.net
- run libtoolize -f, or make will fail
- fix filelist, which had a hardcoded version number
* Fri Mar 23 2012 poeml@cmdline.net
- update to 1.4.8
  * Fix GEOIP_DOMAIN_EDITION_V6
  * Add new Datatypes GEOIP_NETSPEED_EDITION_REV1_V6 and
    GEOIP_NETSPEED_EDITION_REV1
  * Fix possible directory traversal weakness in geoipupdate-pureperl.pl with
    malicious update server
  * Fix GEOIP_ORG_EDITION_V6 and GEOIP_ISP_EDITION_V6
* Sat Jan 28 2012 coolo@suse.com
- use original tar
* Thu Jan 12 2012 coolo@suse.com
- change license to be in spdx.org format
* Fri Dec 16 2011 lnussel@suse.de
- remove nonexistant libGeoIP requirement from libGeoIP-devel-32bit
* Fri Sep 16 2011 jengelh@medozas.de
- Add libGeoIP-devel to baselibs
- Remove redundant tags/sections
* Mon May 23 2011 lnussel@suse.de
- new version 1.4.7
  * better IPv6 support
  * various bug fixes
- add baselibs.conf
* Thu Jun 18 2009 lnussel@novell.com
- move database files to /var/lib/GeoIP
* Wed Jun 17 2009 prusnak@suse.cz
- added tool which fetches the current GeoIP data (geoip-fetch)
* Thu May 28 2009 lnussel@suse.de
- new version 1.4.6 (bugfix release)
* Thu Dec  4 2008 lnussel@suse.de
- add GPL file (bnc#449068)
* Wed Sep 17 2008 lnussel@suse.de
- new version 1.4.5
  * new functions GeoIP_range_by_ip_delete, GeoIP_range_by_ip, array access functions
  * ipv6 support
  * http proxy support
  * more time zones
* Sun Sep 14 2008 lnussel@suse.de
- recommends main package due to data file
* Tue Jan 22 2008 lnussel@suse.de
- new version 1.4.4, breaks ABI wrt GeoIP_country_code!
  * Updated original geoipupdate to return "Invalid product ID or
    subscription expired"
  * Added BL/Saint Barthelemy, MF/Saint Martin (ISO-3166-1
    additions)
  * Check for illegal IP strings, return 0 if IP is not well formed
    IPv4 e.g. 1.2.3.4.5 and 1.2.3
  * Clarified that while core GeoIP library is LGPL, libGeoIPUpdate
    depends on md5.c and types.h which are GPL.
  * speedup the conversion from ipstring to ipnum in
    _GeoIP_addr_to_num. Doubles the speed of GEOIP_MEMORY_CACHE and
    GEOIP_MMAP_CACHE
  * Added new mmap shared memory caching option, GEOIP_MMAP_CACHE
* Tue Oct  9 2007 mrueckert@suse.de
- move the ldconfig calls to the correct package
* Sun Oct  7 2007 mrueckert@suse.de
- new version 1.4.3
  ! CHANGE with geoiplookup facility: -v flag now returns database
    info for all databases, not just GeoIP Country
  * Added ability to get netmask of network block from last lookup
    using GeoIP_last_netmask
  * Fixed GeoIP_database_info bug with GeoLite City
  * Replaced 4 with sizeof(char*) to fix issues with geoipupdate on
    64 Bit machines
  * Added GeoIP_set_charset function - enables UTF8 output of city
    name if GEOIP_CHARSET_UTF8 flag is passed to GeoIP_set_charset
  * Fixed segfault issue if calling GeoIP_db_avail before opening
    a database
  * Added continent_code to GeoIP City's record struct
    (Frank Mather)
- changes to the package layout:
  - splitted out library package (libGeoIP1)
  - renamed devel package GeoIP-devel to libGeoIP-devel
* Wed Aug 29 2007 mrueckert@suse.de
- we dont need zlib-devel to link against libGeoIP
* Wed Aug 29 2007 mrueckert@suse.de
- spec file cleanup
- fix rpmlint warnings
* Wed Aug 29 2007 crrodriguez@suse.de
- run ldconfig
- fix devel package dependencies
* Thu Apr  5 2007 mrueckert@suse.de
- submit the splitted package from the buildservice
* Thu Mar 29 2007 lnussel@suse.de
- new version 1.4.2
  * Replaced CS/Serbia and Montenegro with RS/Serbia, removed
    ZR/Zaire, added ME/Montenegro
  * Added AX/Aland Islands, GG/Guernsey, IM/Isle of Man, JE/Jersey
    (ISO-3166-1 changes)
  * Added GeoIP_time_zone_by_country_and_region(),
    GeoIP_region_name_by_code()
  * Added -d flag to enable custom path for geoipupdate
- don't package *.a and *.la
- add zlib-devel to BuildRequires
* Fri Jan 26 2007 mrueckert@suse.de
- update to version 1.4.1
  * Replaced CS/Serbia and Montenegro with RS/Serbia, removed
    ZR/Zaire, added ME/Montenegro
  * Added AX/Aland Islands, GG/Guernsey, IM/Isle of Man, JE/Jersey
    (ISO-3166-1 changes)
  * Added GeoIP_time_zone_by_country_and_region, to lookup zoneinfo
    timezone by country and region (Frank Mather)
  * Added GeoIP_region_name_by_code, to lookup region name from
    region code (Frank Mather)
  * added -f and -d flags to enable custom paths for geoiplookup
    utility program (Frank Mather)
  * Added benchmarks for GeoIP Region and City in test/benchmark.c
    (Frank Mather)
  * Fixed build issue when using --as-needed flag
    (Diego 'Flameeyes' Pettenò)
  * Add sanity checking for filename returned by MaxMind.com server
    for geoipupdate filename (Dean Gaudet, arctic.org)
  * Fixed memory leaks under error conditions, buffer overflow
    using sprintf, and issue where a corrupted cache file could
    core dump the file (Nick Galbreath, Right Media Inc)
* Fri Dec  8 2006 mrueckert@suse.de
- spec file clean up
- split out the devel files
* Sat Oct 28 2006 lnussel@suse.de
- update to version 1.4.0
  * license change to LGPL
  * various fixes
* Mon May 15 2006 cthiel@suse.de
- update to version 1.3.17
  * Fixed headers for Windows/Netware compliation
  * Updated README documentation
  * Updated geoipupdate so that it writes file as it is uncompressed inst
    of storing entire GeoIP.dat file in memory
  * Updated geoiplookup so that it returns GeoIP Domain Name if available
  * Updated geoipupdate so that it reports whether databases are updated
    in non-verbose mode
  * Fixed compliation error in GeoIPUpdate.c
* Wed Jan 25 2006 mls@suse.de
- converted neededforbuild to BuildRequires
* Thu Sep 15 2005 lnussel@suse.de
- new version 1.3.14
* Mon Jul  4 2005 lnussel@suse.de
- fix gcc warnings (#95085)
* Thu Nov 25 2004 lnussel@suse.de
- new version 1.3.8
* Thu Nov 18 2004 ro@suse.de
- fixed file list
* Thu Jul 15 2004 lnussel@suse.de
- new version 1.3.5
- fix missing prototype and a memleak
* Fri Apr 16 2004 lnussel@suse.de
- fix missing return value in main() of some test programs
* Mon Nov 24 2003 lnussel@suse.de
- initial package, version 1.3.1