Blame SPECS/GeoIP.spec

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