Blob Blame History Raw
# Noarch subpackages available from Fedora 10, RHEL 6
%global noarch_subpkgs 0%{?fedora} > 9 || 0%{?rhel} > 5

Name:		GeoIP
Version:	1.5.0
Release:	6%{?dist}
Summary:	Library for country/city/organization to IP address or hostname mapping
Group:		Development/Libraries
License:	LGPLv2+ and GPLv2+
URL:		http://www.maxmind.com/app/c
Source0:	http://www.maxmind.com/download/geoip/api/c/GeoIP-%{version}.tar.gz
Source1:	LICENSE.txt
Source2:	fetch-geoipdata-city.pl
Source3:	fetch-geoipdata.pl
Source5:	geoipupdate.cron
Patch10:	GeoIP-1.5.0-UTF8.patch
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(id -nu)
BuildRequires:	zlib-devel
Obsoletes:	geoip < %{version}-%{release}
Provides:	geoip = %{version}-%{release}

%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 that is
updated at install time if possible, and can optionally be updated on a weekly
basis by installing the GeoIP-update package. 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.

%package update
Summary:	Crontab entry to facilitate automatic updates of databases
Group:		Applications/Databases
Requires:	crontabs
Requires:	%{name} = %{version}-%{release}
%if %{noarch_subpkgs}
BuildArch:	noarch
%endif

%description update
Crontab entry to provide weekly updates of the GeoIP free databases.

%package devel
Summary:	Development headers and libraries for GeoIP
Group:		Development/Libraries
Requires:	%{name} = %{version}-%{release}
Provides:	geoip-devel = %{version}-%{release}
Obsoletes:	geoip-devel < %{version}-%{release}

%description devel
Development headers and static libraries for building GeoIP-based applications.

%prep
%setup -q

# Recode docs as UTF-8
%patch10 -p1

install -D -m644 %{SOURCE1} LICENSE.txt
install -D -m644 %{SOURCE2} fetch-geoipdata-city.pl
install -D -m644 %{SOURCE3} fetch-geoipdata.pl
install -D -m644 %{SOURCE5} geoipupdate.cron

%build
# Fix timestamp order to avoid trying to re-run autotools and configure,
# thus clobbering our hacked libtool later on
touch aclocal.m4
touch configure
touch config.h.in
touch config.status
find . -name Makefile.in -exec touch {} \;

%configure --disable-static --disable-dependency-tracking

# Kill bogus rpaths
sed -i -e 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' \
	-e 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool

make %{?_smp_mflags}

%install
rm -rf %{buildroot}
make DESTDIR=%{buildroot} DEFAULT_DB_FILE="%{_datadir}/GeoIP/GeoIP-initial.dat" install

# fetch database updates weekly
install -D -m755 geoipupdate.cron %{buildroot}%{_sysconfdir}/cron.weekly/geoipupdate

# nix the stuff we don't need like .la files.
rm -f %{buildroot}%{_libdir}/*.la

# fix up the config file to use the free products by default
sed -i \
	-e 's/YOUR_LICENSE_KEY_HERE$/000000000000/' \
	-e 's/YOUR_USER_ID_HERE$/999999/' \
	-e 's/106$/506 533 517/' \
	%{buildroot}%{_sysconfdir}/GeoIP.conf

# make the default GeoIP.dat a symlink to GeoIP-initial.dat,
# at least until %%post has run
ln -sf GeoIP-initial.dat %{buildroot}%{_datadir}/GeoIP/GeoIP.dat

# create empty files for initial %%ghost databases
touch %{buildroot}%{_datadir}/GeoIP/GeoLite{ASNum,City,Country}.dat
chmod 644 %{buildroot}%{_datadir}/GeoIP/GeoLite{ASNum,City,Country}.dat

%clean
rm -rf %{buildroot}

%post
/sbin/ldconfig
geoipupdate > /dev/null && \
	ln -sf GeoLiteCountry.dat %{_datadir}/GeoIP/GeoIP.dat

%postun -p /sbin/ldconfig

%files
# LGPLv2+
%doc AUTHORS COPYING ChangeLog README TODO LICENSE* fetch-*
%config(noreplace) %{_sysconfdir}/GeoIP.conf
%config(noreplace) %{_sysconfdir}/GeoIP.conf.default
%{_bindir}/geoiplookup
%{_bindir}/geoiplookup6
%dir %{_datadir}/GeoIP/
%{_datadir}/GeoIP/GeoIP-initial.dat
%verify(not md5 size link mtime) %{_datadir}/GeoIP/GeoIP.dat
%ghost %{_datadir}/GeoIP/GeoLiteASNum.dat
%ghost %{_datadir}/GeoIP/GeoLiteCity.dat
%ghost %{_datadir}/GeoIP/GeoLiteCountry.dat
%{_libdir}/libGeoIP.so.1
%{_libdir}/libGeoIP.so.1.*
%{_mandir}/man1/geoiplookup.1*
%{_mandir}/man1/geoiplookup6.1*
# GPLv2+
%{_bindir}/geoipupdate
%{_libdir}/libGeoIPUpdate.so.0
%{_libdir}/libGeoIPUpdate.so.0.*
%{_mandir}/man1/geoipupdate.1*

%files update
%{_sysconfdir}/cron.weekly/geoipupdate

%files devel
# LGPLv2+
%{_includedir}/GeoIP.h
%{_includedir}/GeoIPCity.h
%{_includedir}/GeoIPUpdate.h
%{_libdir}/libGeoIP.so
%{_libdir}/pkgconfig/geoip.pc
# GPLv2+
%{_libdir}/libGeoIPUpdate.so

%changelog
* Mon Jun 10 2013 Paul Howarth <paul@city-fan.org> - 1.5.0-6
- Update sub-package requires main package for geoipupdate script

* Sat Jun  8 2013 Paul Howarth <paul@city-fan.org> - 1.5.0-5
- Make GeoIP.dat -> GeoIP-initial.dat symlink in %%install, not %%post,
  and don't %%ghost it
- Run geoipupdate silently in %%post and cron job
- Create empty database files for %%ghost to work with old rpm versions
- Don't try to use noarch subpackages on old rpm versions
- Update %%description to mention database updates
- Drop outdated README.Fedora

* Sat Jun 08 2013 Philip Prindeville <philipp@fedoraproject.org> - 1.5.0-4
- Revert ability to replace 3rd-party package

* Fri Jun 07 2013 Philip Prindeville <philipp@fedoraproject.org> - 1.5.0-3
- Add attributes for %%ghost files

* Fri Jun 07 2013 Philip Prindeville <philipp@fedoraproject.org> - 1.5.0-2
- Make update subpackage be noarch.

* Fri Jun 07 2013 Philip Prindeville <philipp@fedoraproject.org> - 1.5.0-1
- Version bump to 1.5.0
- Have GeoIP.dat be a symlink to the real data, and install the canned
  GeoIP.dat as GeoIP-initial.dat
- Change config as per Boris' instructions to use 'lite' databases which are
  regularly updated.
- Add pkgconfig (.pc) file into devel subpackage
- Add cron support for refreshing the lite databases and make a separate
  subpackage.

* Sun Mar 24 2013 Paul Howarth <paul@city-fan.org> - 1.4.8-6
- Fix config.guess and config.sub to add aarch64 support (#925403)

* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.8-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Mon Oct 22 2012 Paul Howarth <paul@city-fan.org> - 1.4.8-4
- libGeoIPUpdate and geoipupdate (which is linked against it) are GPL-licensed
  rather than LGPL-licensed (#840896)
- Don't package generic INSTALL file (#661625)
- Kill bogus rpaths on x86_64
- Hardcode library sonames in %%files list to avoid nasty surprises in the
  future
- Drop %%defattr, redundant since rpm 4.4
- Recode docs as UTF-8
- Don't use macros for commands
- Use tabs

* Wed Jul 18 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.8-3.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Thu Jan 12 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.8-2.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Tue Sep 6 2011 Michael Fleming <mfleming+rpm@thatfleminggent.com> - 1.4.8-1.1
- Remove -ipv6 patch
- Bump to 1.4.8 release

* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.7-0.2.20090931cvs
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Mon Aug 31 2009 Matt Domsch <mdomsch@fedoraproject.org> - 1.4.7.0.1.20090931
- apply CVS HEAD 20090931 which includes IPv6 functions

* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Sun Mar 08 2009 Michael Fleming <mfleming+rpm@enlartenment.com> - 1.4.6-1
- Add geoiplookup6 man page
- Update to 1.4.6

* Mon Feb 23 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.4.5-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Sat Nov 29 2008 Michael Fleming <mfleming+rpm@enlartenment.com> 1.4.5-2
- Update to 1.4.5
- Fix database URL locations in Perl helper scripts

* Tue Feb 19 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 1.4.4-2
- Autorebuild for GCC 4.3

* Mon Jan 28 2008 Michael Fleming <mfleming+rpm@enlartenment.com> 1.4.4-1
- New upstream release.

* Wed Sep 5 2007 Michael Fleming <mfleming+rpm@enlartenment.com> 1.4.3-1
- New upstream release.
- Fix GeoIPCity fetcher script
- Update License tag

* Mon Feb 12 2007 Michael Fleming <mfleming+rpm@enlartenment.com> 1.4.2-1
- New upstream release.

* Mon Jan 8 2007 Michael Fleming <mfleming+rpm@enlartenment.com> 1.4.1-2
- License is actually LGPL now.

* Sun Jan 7 2007 Michael Fleming <mfleming+rpm@enlartenment.com> 1.4.1-1
- New upstream release
- Add fetch-geoipdata* scripts to pull free databases automatically if
  desired (bz #198137)
- README.fedora added to briefly explain above.

* Mon Nov 27 2006 Michael Fleming <mfleming+rpm@enlartenment.com> 1.4.0-4
- Fix %%install scripts to satisfy newer mock builds

* Sun Sep 3 2006 Michael Fleming <mfleming+rpm@enlartenment.com> 1.4.0-3
- Upstream upgrade
- Added LICENSE.txt file to %%doc, covering GeoIP country/city data license
  (bz #198137)

* Mon May 15 2006 Michael Fleming <mfleming+rpm@enlartenment.com> 1.3.17-1
- New upstream release (minor fixes)

* Mon May 1 2006 Michael Fleming <mfleming+rpm@enlartenment.com> 1.3.16-1
- New upstream release 
- Add INSTALL document to package.

* Sat Feb 18 2006 Michael Fleming <mfleming+rpm@enlartenment.com> 1.3.14-3
- Fix Obsoletes/Provides for old "geoip"-convention packages
- Move .so symlinks to -devel where they should be

* Fri Feb 10 2006 Michael Fleming <mfleming+rpm@enlartenment.com> 1.3.14-2
- Remamed to match upstream tarball name
- Removed static libraries
- Added symlinks to packages
- Mark config file noreplace

* Sun Feb 5 2006 Michael Fleming <mfleming+rpm@enlartenment.com> 1.3.14-1
- Initial review package for Extras