File GeoIP.spec of Package GeoIP
%define srcext tar.gz
%define so_ver 1
%global debug_package %{nil}
# Common info
Name: GeoIP
Version: 1.6.12
Release: wiz%{?extraver:0.}1%{?dist}
License: GPL-2.0+ and LGPL-2.1+
Group: Development/Libraries/C and C++
URL: http://dev.maxmind.com/geoip/legacy/downloadable/
Summary: Utilities to find the location of an IP address
# Build-time parameters
BuildRequires: pkgconfig
BuildRequires: zlib-devel
BuildRoot: %{_tmppath}/%{name}-root
Source: https://github.com/maxmind/geoip-api-c/releases/download/v%{version}/%{name}-%{version}%{?extraver}.%{srcext}
%description
GeoIP is a C library that enables the user to find geographical and
network information of an IP address.
This package contains utilities to search geographic location of IP address
%package -n lib%{name}%{?so_ver}
Group: Development/Libraries/C and C++
Summary: GeoIP is a C library finds the location of an IP address
Provides: lib%{name} libmaxminddb%{?so_ver}
%description -n lib%{name}%{?so_ver}
GeoIP is a C library that enables the user to find geographical and
network information of an IP address.
Included is a free GeoLite Country database
that is updated at the beginning of every month.
To download the latest free GeoLite Country database, go to:
http://www.maxmind.com/app/geoip_country
There is also a free city-level geolocation database, GeoLite City,
available from:
http://www.maxmind.com/app/geolitecity
%package -n lib%{name}-devel
Group: Development/Languages/C and C++
Summary: Development files for lib%{name}%{?so_ver}
Requires: lib%{name}%{?so_ver} = %{version}
Provides: %{name}-devel
%description -n lib%{name}-devel
Development files for lib%{name}%{?so_ver}
# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{name}-%{version}
%build
_CFLAGS='-O2'
_LDFLAGS='-Wl,--as-needed -Wl,--strip-all -Wl,--no-undefined -Wl,-z,now -Wl,-z,relro'
%configure \
--datadir=%{_localstatedir}/lib \
--disable-static \
--disable-data-files \
CFLAGS="$_CFLAGS" \
LDFLAGS="$_LDFLAGS"
%{__make} %{?_smp_mflags}
%install
%{__make} install DESTDIR=%{buildroot}
%{__install} -d -m755 %{buildroot}%{_localstatedir}/lib/GeoIP
%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
%files
%defattr(-,root,root)
%doc AUTHORS COPYING NEWS.md README.md
%{_bindir}/*
%doc %{_mandir}/man1/*
# Library package
%files -n lib%{name}%{?so_ver}
%defattr(-,root,root)
%doc AUTHORS COPYING NEWS.md README.md
%dir %{_localstatedir}/lib/GeoIP
%{_libdir}/lib%{name}.so.%{?so_ver}*
# Development stuff
%files -n lib%{name}-devel
%defattr(-,root,root)
%{_libdir}/pkgconfig/geoip.pc
%{_includedir}/*.h
%{_libdir}/lib%{name}.so
%exclude %{_libdir}/*.la
%post -n lib%{name}%{?so_ver} -p /sbin/ldconfig
%postun -n lib%{name}%{?so_ver} -p /sbin/ldconfig
%changelog