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