e4264f
# Noarch subpackages available from Fedora 10, RHEL 6
e4264f
%global noarch_subpkgs 0%{?fedora} > 9 || 0%{?rhel} > 5
e4264f
e4264f
Name:		GeoIP
e4264f
Version:	1.5.0
e4264f
Release:	14%{?dist}
e4264f
Summary:	Library for country/city/organization to IP address or hostname mapping
e4264f
Group:		Development/Libraries
e4264f
License:	LGPLv2+ and GPLv2+ and CC-BY-SA
e4264f
URL:		http://www.maxmind.com/app/c
e4264f
Source0:	http://www.maxmind.com/download/geoip/api/c/GeoIP-%{version}.tar.gz
e4264f
Source1:	LICENSE.txt
e4264f
Source2:	fetch-geoipdata-city.pl
e4264f
Source3:	fetch-geoipdata.pl
e4264f
Source5:	geoipupdate.cron
e4264f
# Data sources indexed at http://dev.maxmind.com/geoip/legacy/geolite
e4264f
Source10:	http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
e4264f
Source11:	http://geolite.maxmind.com/download/geoip/database/GeoIPv6.dat.gz
e4264f
Source12:	http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
e4264f
Source13:	http://geolite.maxmind.com/download/geoip/database/GeoLiteCityv6-beta/GeoLiteCityv6.dat.gz
e4264f
Source14:	http://download.maxmind.com/download/geoip/database/asnum/GeoIPASNum.dat.gz
e4264f
Source15:	http://download.maxmind.com/download/geoip/database/asnum/GeoIPASNumv6.dat.gz
e4264f
Patch10:	GeoIP-1.5.0-UTF8.patch
e4264f
Patch11:	GeoIP-1.5.0-geoipupdate-message.patch
e4264f
e4264f
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(id -nu)
e4264f
BuildRequires:	zlib-devel
e4264f
Obsoletes:	geoip < %{version}-%{release}
e4264f
Provides:	geoip = %{version}-%{release}
e4264f
Requires:	geoipupdate
e4264f
e4264f
%description
e4264f
GeoIP is a C library that enables the user to find the country that any IP
e4264f
address or hostname originates from. It uses a file based database that is
e4264f
accurate as of June 2007 and can optionally be updated on a weekly
e4264f
basis by installing the GeoIP-update package. This database simply contains IP
e4264f
blocks as keys, and countries as values. This database should be more complete
e4264f
and accurate than using reverse DNS lookups.
e4264f
e4264f
This package includes GeoLite data created by MaxMind, available from
e4264f
http://www.maxmind.com/
e4264f
e4264f
%package data
e4264f
Summary:	Static snapshot of GeoIP databases
e4264f
Group:		Applications/Databases
e4264f
Requires:	%{name} = %{version}-%{release}
e4264f
%if %{noarch_subpkgs}
e4264f
BuildArch:	noarch
e4264f
%endif
e4264f
e4264f
%description data
e4264f
Snapshot of IPv4 and IPv6 databases for GeoIP. These databases are not
e4264f
regularly updated, use a cron job from GeoIP-update package to get fresh ones.
e4264f
e4264f
This package includes GeoLite data created by MaxMind, available from
e4264f
http://www.maxmind.com/
e4264f
e4264f
%package devel
e4264f
Summary:	Development headers and libraries for GeoIP
e4264f
Group:		Development/Libraries
e4264f
Requires:	%{name} = %{version}-%{release}
e4264f
Provides:	geoip-devel = %{version}-%{release}
e4264f
Obsoletes:	geoip-devel < %{version}-%{release}
e4264f
e4264f
%description devel
e4264f
Development headers and static libraries for building GeoIP-based applications.
e4264f
e4264f
%prep
e4264f
%setup -q
e4264f
e4264f
# Recode docs as UTF-8
e4264f
%patch10 -p1
e4264f
%patch11 -p1
e4264f
e4264f
install -D -m644 %{SOURCE1} LICENSE.txt
e4264f
install -D -m644 %{SOURCE2} fetch-geoipdata-city.pl
e4264f
install -D -m644 %{SOURCE3} fetch-geoipdata.pl
e4264f
e4264f
# Distribute all databases as *-inital.dat files in GeoIP packages.
e4264f
# User then can download real .dat files without replacing the ones from
e4264f
# package.
e4264f
install -p -m 644 %{SOURCE10} data/GeoIP-initial.dat.gz;        gunzip data/GeoIP-initial.dat
e4264f
install -p -m 644 %{SOURCE11} data/GeoIPv6-initial.dat.gz;      gunzip data/GeoIPv6-initial.dat
e4264f
# City and ASN databases will be in GeoIP-data subpackage as -initial files
e4264f
# and linked to non--initial on installation of the subpackage.
e4264f
install -p -m 644 %{SOURCE12} data/GeoIPCity-initial.dat.gz;    gunzip data/GeoIPCity-initial.dat
e4264f
install -p -m 644 %{SOURCE13} data/GeoIPCityv6-initial.dat.gz;  gunzip data/GeoIPCityv6-initial.dat
e4264f
install -p -m 644 %{SOURCE14} data/GeoIPASNum-initial.dat.gz;   gunzip data/GeoIPASNum-initial.dat
e4264f
install -p -m 644 %{SOURCE15} data/GeoIPASNumv6-initial.dat.gz; gunzip data/GeoIPASNumv6-initial.dat
e4264f
e4264f
%build
e4264f
# Fix timestamp order to avoid trying to re-run autotools and configure,
e4264f
# thus clobbering our hacked libtool later on
e4264f
touch aclocal.m4
e4264f
touch configure
e4264f
touch config.h.in
e4264f
touch config.status
e4264f
find . -name Makefile.in -exec touch {} \;
e4264f
e4264f
%configure --disable-static --disable-dependency-tracking
e4264f
e4264f
# Kill bogus rpaths
e4264f
sed -i -e 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' \
e4264f
	-e 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
e4264f
e4264f
make %{?_smp_mflags}
e4264f
e4264f
%install
e4264f
rm -rf %{buildroot}
e4264f
make DESTDIR=%{buildroot} install
e4264f
e4264f
# nix the stuff we don't need like .la files.
e4264f
rm -f %{buildroot}%{_libdir}/*.la
e4264f
e4264f
# install downloaded GeoLite databases
e4264f
for db in \
e4264f
        GeoIP-initial.dat \
e4264f
        GeoIPv6-initial.dat \
e4264f
        GeoIPCity-initial.dat \
e4264f
        GeoIPCityv6-initial.dat \
e4264f
        GeoIPASNum-initial.dat \
e4264f
        GeoIPASNumv6-initial.dat
e4264f
do
e4264f
        install -p -m 644 data/$db %{buildroot}%{_datadir}/GeoIP/
e4264f
done
e4264f
e4264f
# create empty files for initial %%ghost databases
e4264f
touch %{buildroot}%{_datadir}/GeoIP/GeoIP{ASNum,City,Country}{,v6}.dat
e4264f
chmod 644 %{buildroot}%{_datadir}/GeoIP/GeoIP{ASNum,City,Country}{,v6}.dat
e4264f
e4264f
# make the default GeoIP.dat a symlink to our -initial data file.
e4264f
ln -sf GeoIP-initial.dat %{buildroot}%{_datadir}/GeoIP/GeoIP.dat
e4264f
ln -sf GeoIPv6-initial.dat %{buildroot}%{_datadir}/GeoIP/GeoIPv6.dat
e4264f
e4264f
#links used when invoking geoiplookup -v
e4264f
ln -sf GeoIPCity-initial.dat %{buildroot}%{_datadir}/GeoIP/GeoIPCity.dat
e4264f
ln -sf GeoIPCityv6-initial.dat %{buildroot}%{_datadir}/GeoIP/GeoIPCityv6.dat
e4264f
e4264f
# Add compat symlinks for GeoIPASNum.dat and GeoLiteASNumv6.dat
e4264f
# ([upstream] database names used in the old geoip-geolite package)
e4264f
ln -sf GeoIPASNum.dat %{buildroot}%{_datadir}/GeoIP/GeoIPASNum.dat
e4264f
ln -sf GeoIPASNumv6.dat %{buildroot}%{_datadir}/GeoIP/GeoIPASNumv6.dat
e4264f
e4264f
#Remove files used by geoipupdate - it has its own package
e4264f
rm %{buildroot}%{_bindir}/geoipupdate
e4264f
rm %{buildroot}%{_includedir}/GeoIPUpdate.h
e4264f
rm %{buildroot}%{_libdir}/libGeoIPUpdate.so*
e4264f
rm %{buildroot}%{_mandir}/man1/geoipupdate.1*
e4264f
rm %{buildroot}/etc/GeoIP.conf*
e4264f
e4264f
%post -p /sbin/ldconfig
e4264f
e4264f
%postun -p /sbin/ldconfig
e4264f
e4264f
%post data
e4264f
# Link *-initial.dat files as official GeoIP database files. Make sure not to
e4264f
# overwrite any user databases!
e4264f
for db in GeoIPCity.dat GeoIPCityv6.dat GeoIPASNum.dat GeoIPASNumv6.dat ; do
e4264f
    db_initial=${db%.dat}-initial.dat
e4264f
    if [ ! -e "/usr/share/GeoIP/$db" ]; then
e4264f
        ln -s "/usr/share/GeoIP/$db_initial" "/usr/share/GeoIP/$db" &>/dev/null || :
e4264f
    fi
e4264f
done
e4264f
e4264f
%postun data
e4264f
if [ "$1" == "0" ]; then
e4264f
    for db in GeoIPCity.dat GeoIPCityv6.dat GeoIPASNum.dat GeoIPASNumv6.dat ; do
e4264f
        db_initial=${db%.dat}-initial.dat
e4264f
        # Remove links to -initial files, ignoring links anywhere else
e4264f
        if [ -h "/usr/share/GeoIP/$db" -a $(readlink /usr/share/GeoIP/$db) = "/usr/share/GeoIP/$db_initial" ]; then
e4264f
            rm "/usr/share/GeoIP/$db" &>/dev/null || :
e4264f
        fi
e4264f
    done
e4264f
fi
e4264f
e4264f
e4264f
%files
e4264f
# LGPLv2+
e4264f
%doc AUTHORS COPYING ChangeLog README TODO LICENSE* fetch-*
e4264f
%{_bindir}/geoiplookup
e4264f
%{_bindir}/geoiplookup6
e4264f
%dir %{_datadir}/GeoIP/
e4264f
%{_datadir}/GeoIP/GeoIP-initial.dat
e4264f
%{_datadir}/GeoIP/GeoIPv6-initial.dat
e4264f
# The other databases are %%verify(not md5 size mtime) so that they can be updated via the cron scripts
e4264f
# and rpm will not moan about the files having changed
e4264f
%verify(not md5 size link mtime) %{_datadir}/GeoIP/GeoIP.dat
e4264f
%verify(not md5 size link mtime) %{_datadir}/GeoIP/GeoIPv6.dat
e4264f
%ghost %{_datadir}/GeoIP/GeoIPASNum.dat
e4264f
%ghost %{_datadir}/GeoIP/GeoIPCity.dat
e4264f
%ghost %{_datadir}/GeoIP/GeoIPCountry.dat
e4264f
%ghost %{_datadir}/GeoIP/GeoIPASNumv6.dat
e4264f
%ghost %{_datadir}/GeoIP/GeoIPCityv6.dat
e4264f
%ghost %{_datadir}/GeoIP/GeoIPCountryv6.dat
e4264f
%{_libdir}/libGeoIP.so.1
e4264f
%{_libdir}/libGeoIP.so.1.*
e4264f
%{_mandir}/man1/geoiplookup.1*
e4264f
%{_mandir}/man1/geoiplookup6.1*
e4264f
e4264f
%files data
e4264f
%{_datadir}/GeoIP/GeoIPCity-initial.dat
e4264f
%{_datadir}/GeoIP/GeoIPCityv6-initial.dat
e4264f
%{_datadir}/GeoIP/GeoIPASNum-initial.dat
e4264f
%{_datadir}/GeoIP/GeoIPASNumv6-initial.dat
e4264f
e4264f
%files devel
e4264f
# LGPLv2+
e4264f
%{_includedir}/GeoIP.h
e4264f
%{_includedir}/GeoIPCity.h
e4264f
%{_libdir}/libGeoIP.so
e4264f
%{_libdir}/pkgconfig/geoip.pc
e4264f
e4264f
%changelog
e4264f
* Mon Feb 18 2019 Michal Ruprich <mruprich@redhat.com> - 1.5.0-14
e4264f
- Resolves: #1666767 - Remove geoipupdate binary from GeoIP
e4264f
e4264f
* Tue Jul 31 2018 Michal Ruprich <mruprich@redhat.com> - 1.5.0-13
e4264f
- Related: #1409060 -  Missing symlink at the GeoIP-update package
e4264f
e4264f
* Tue Jun 19 2018 Michal Ruprich <mruprich@redhat.com> - 1.5.0-12
e4264f
- Removed clean section
e4264f
- Resolves: #1589860 - Update GeoIP legacy databases
e4264f
- Resolves: #1409060 -  Missing symlink at the GeoIP-update package
e4264f
e4264f
* Wed Jun 29 2016 Jan Safranek <jsafrane@redhat.com> - 1.5.0-11
e4264f
- Fixed rpmlint errors
e4264f
e4264f
* Wed Jun 29 2016 Jan Safranek <jsafrane@redhat.com> - 1.5.0-10
e4264f
- Added base IPv6 database to GeoIP package
e4264f
- Added GeoIP-data subpackage with all other databases (#1201857)
e4264f
e4264f
* Fri Jan 24 2014 Daniel Mach <dmach@redhat.com> - 1.5.0-9
e4264f
- Mass rebuild 2014-01-24
e4264f
e4264f
* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 1.5.0-8
e4264f
- Mass rebuild 2013-12-27
e4264f
e4264f
* Wed Nov 13 2013 Jan Safranek <jsafrane@redhat.com> - 1.5.0-7
e4264f
- Don't download the database in %post (#1029807)
e4264f
- Don't download GeoLiteASNum as it's no longer provided.
e4264f
e4264f
* Mon Jun 10 2013 Paul Howarth <paul@city-fan.org> - 1.5.0-6
e4264f
- Update sub-package requires main package for geoipupdate script
e4264f
e4264f
* Sat Jun  8 2013 Paul Howarth <paul@city-fan.org> - 1.5.0-5
e4264f
- Make GeoIP.dat -> GeoIP-initial.dat symlink in %%install, not %%post,
e4264f
  and don't %%ghost it
e4264f
- Run geoipupdate silently in %%post and cron job
e4264f
- Create empty database files for %%ghost to work with old rpm versions
e4264f
- Don't try to use noarch subpackages on old rpm versions
e4264f
- Update %%description to mention database updates
e4264f
- Drop outdated README.Fedora
e4264f
e4264f
* Sat Jun 08 2013 Philip Prindeville <philipp@fedoraproject.org> - 1.5.0-4
e4264f
- Revert ability to replace 3rd-party package
e4264f
e4264f
* Fri Jun 07 2013 Philip Prindeville <philipp@fedoraproject.org> - 1.5.0-3
e4264f
- Add attributes for %%ghost files
e4264f
e4264f
* Fri Jun 07 2013 Philip Prindeville <philipp@fedoraproject.org> - 1.5.0-2
e4264f
- Make update subpackage be noarch.
e4264f
e4264f
* Fri Jun 07 2013 Philip Prindeville <philipp@fedoraproject.org> - 1.5.0-1
e4264f
- Version bump to 1.5.0
e4264f
- Have GeoIP.dat be a symlink to the real data, and install the canned
e4264f
  GeoIP.dat as GeoIP-initial.dat
e4264f
- Change config as per Boris' instructions to use 'lite' databases which are
e4264f
  regularly updated.
e4264f
- Add pkgconfig (.pc) file into devel subpackage
e4264f
- Add cron support for refreshing the lite databases and make a separate
e4264f
  subpackage.
e4264f
e4264f
* Sun Mar 24 2013 Paul Howarth <paul@city-fan.org> - 1.4.8-6
e4264f
- Fix config.guess and config.sub to add aarch64 support (#925403)
e4264f
e4264f
* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.8-5
e4264f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
e4264f
e4264f
* Mon Oct 22 2012 Paul Howarth <paul@city-fan.org> - 1.4.8-4
e4264f
- libGeoIPUpdate and geoipupdate (which is linked against it) are GPL-licensed
e4264f
  rather than LGPL-licensed (#840896)
e4264f
- Don't package generic INSTALL file (#661625)
e4264f
- Kill bogus rpaths on x86_64
e4264f
- Hardcode library sonames in %%files list to avoid nasty surprises in the
e4264f
  future
e4264f
- Drop %%defattr, redundant since rpm 4.4
e4264f
- Recode docs as UTF-8
e4264f
- Don't use macros for commands
e4264f
- Use tabs
e4264f
e4264f
* Wed Jul 18 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.8-3.1
e4264f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
e4264f
e4264f
* Thu Jan 12 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.8-2.1
e4264f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
e4264f
e4264f
* Tue Sep 6 2011 Michael Fleming <mfleming+rpm@thatfleminggent.com> - 1.4.8-1.1
e4264f
- Remove -ipv6 patch
e4264f
- Bump to 1.4.8 release
e4264f
e4264f
* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.7-0.2.20090931cvs
e4264f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
e4264f
e4264f
* Mon Aug 31 2009 Matt Domsch <mdomsch@fedoraproject.org> - 1.4.7.0.1.20090931
e4264f
- apply CVS HEAD 20090931 which includes IPv6 functions
e4264f
e4264f
* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.6-2
e4264f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
e4264f
e4264f
* Sun Mar 08 2009 Michael Fleming <mfleming+rpm@enlartenment.com> - 1.4.6-1
e4264f
- Add geoiplookup6 man page
e4264f
- Update to 1.4.6
e4264f
e4264f
* Mon Feb 23 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.5-3
e4264f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
e4264f
e4264f
* Sat Nov 29 2008 Michael Fleming <mfleming+rpm@enlartenment.com> 1.4.5-2
e4264f
- Update to 1.4.5
e4264f
- Fix database URL locations in Perl helper scripts
e4264f
e4264f
* Tue Feb 19 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 1.4.4-2
e4264f
- Autorebuild for GCC 4.3
e4264f
e4264f
* Mon Jan 28 2008 Michael Fleming <mfleming+rpm@enlartenment.com> 1.4.4-1
e4264f
- New upstream release.
e4264f
e4264f
* Wed Sep 5 2007 Michael Fleming <mfleming+rpm@enlartenment.com> 1.4.3-1
e4264f
- New upstream release.
e4264f
- Fix GeoIPCity fetcher script
e4264f
- Update License tag
e4264f
e4264f
* Mon Feb 12 2007 Michael Fleming <mfleming+rpm@enlartenment.com> 1.4.2-1
e4264f
- New upstream release.
e4264f
e4264f
* Mon Jan 8 2007 Michael Fleming <mfleming+rpm@enlartenment.com> 1.4.1-2
e4264f
- License is actually LGPL now.
e4264f
e4264f
* Sun Jan 7 2007 Michael Fleming <mfleming+rpm@enlartenment.com> 1.4.1-1
e4264f
- New upstream release
e4264f
- Add fetch-geoipdata* scripts to pull free databases automatically if
e4264f
  desired (bz #198137)
e4264f
- README.fedora added to briefly explain above.
e4264f
e4264f
* Mon Nov 27 2006 Michael Fleming <mfleming+rpm@enlartenment.com> 1.4.0-4
e4264f
- Fix %%install scripts to satisfy newer mock builds
e4264f
e4264f
* Sun Sep 3 2006 Michael Fleming <mfleming+rpm@enlartenment.com> 1.4.0-3
e4264f
- Upstream upgrade
e4264f
- Added LICENSE.txt file to %%doc, covering GeoIP country/city data license
e4264f
  (bz #198137)
e4264f
e4264f
* Mon May 15 2006 Michael Fleming <mfleming+rpm@enlartenment.com> 1.3.17-1
e4264f
- New upstream release (minor fixes)
e4264f
e4264f
* Mon May 1 2006 Michael Fleming <mfleming+rpm@enlartenment.com> 1.3.16-1
e4264f
- New upstream release 
e4264f
- Add INSTALL document to package.
e4264f
e4264f
* Sat Feb 18 2006 Michael Fleming <mfleming+rpm@enlartenment.com> 1.3.14-3
e4264f
- Fix Obsoletes/Provides for old "geoip"-convention packages
e4264f
- Move .so symlinks to -devel where they should be
e4264f
e4264f
* Fri Feb 10 2006 Michael Fleming <mfleming+rpm@enlartenment.com> 1.3.14-2
e4264f
- Remamed to match upstream tarball name
e4264f
- Removed static libraries
e4264f
- Added symlinks to packages
e4264f
- Mark config file noreplace
e4264f
e4264f
* Sun Feb 5 2006 Michael Fleming <mfleming+rpm@enlartenment.com> 1.3.14-1
e4264f
- Initial review package for Extras