Wed, 22 Jan 2014 18:52:02 +0100
Update version and integrate additional IPv4 and IPv6 country databases.
1 ##
2 ## geoip.spec -- OpenPKG RPM Package Specification
3 ## Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/>
4 ##
5 ## Permission to use, copy, modify, and distribute this software for
6 ## any purpose with or without fee is hereby granted, provided that
7 ## the above copyright notice and this permission notice appear in all
8 ## copies.
9 ##
10 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
21 ## SUCH DAMAGE.
22 ##
24 # package version
25 %define V_api_c 1.6.0
26 %define V_api_pl 1.40
28 # package information
29 Name: geoip
30 Summary: Geographic IP Resolution
31 URL: http://www.maxmind.com/app/ip-location
32 Vendor: MaxMind Incorporated
33 Packager: OpenPKG Foundation e.V.
34 Distribution: OpenPKG Community
35 Class: PLUS
36 Group: Mapping
37 License: GPL
38 Version: %{V_api_c}
39 Release: 20120208
41 # package options
42 %option with_perl no
44 # list of sources
45 Source0: http://geolite.maxmind.com/download/geoip/api/c/GeoIP-%{V_api_c}.tar.gz
46 Source1: http://www.cpan.org/modules/by-module/Geo/Geo-IP-%{V_api_pl}.tar.gz
47 Source2: http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
48 Source3: http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
49 Source4: http://geolite.maxmind.com/download/geoip/database/GeoIPv6.dat.gz
51 # build information
52 Prefix: %{l_prefix}
53 BuildRoot: %{l_buildroot}
54 BuildPreReq: OpenPKG, openpkg >= 20060823, gcc
55 PreReq: OpenPKG, openpkg >= 20060823
56 BuildPreReq: zlib
57 PreReq: zlib
58 %if "%{with_perl}" == "yes"
59 BuildPreReq: perl, perl-openpkg
60 PreReq: perl
61 %endif
62 AutoReq: no
63 AutoReqProv: no
65 %description
66 GeoIP is a C library that enables the user to find the country
67 that any IP address or hostname originates from. It uses a file
68 based database containing IP blocks as keys and countries as
69 values and claims to achieve over 99% accuracy. This database
70 should be more complete and accurate than using reverse DNS
71 lookups.
73 This module can be used to automatically select the geographically
74 closest mirror, to analyze your web server logs to determine the
75 countries of your visitors, for credit card fraud detection, and
76 for software export controls.
78 %track
79 prog geoip = {
80 version = %{version}
81 url = http://geolite.maxmind.com/download/geoip/api/c/
82 regex = GeoIP-(__VER__)\.tar\.gz
83 }
84 prog geoip:perl = {
85 version = %{V_api_pl}
86 url = http://www.cpan.org/modules/by-module/Geo/
87 regex = Geo-IP-(__VER__)\.tar\.gz
88 }
90 %prep
91 %setup -q -n GeoIP-%{V_api_c}
92 %{l_shtool} mkdir -f -p -m 755 data
93 ( cd data && \
94 %{l_gzip} -cd %{SOURCE2} >GeoLiteCityIPv4.dat
95 %{l_gzip} -cd %{SOURCE3} >GeoLiteCountryIPv4.dat
96 %{l_gzip} -cd %{SOURCE4} >GeoLiteCountryIPv6.dat
97 ) || exit $?
98 %if "%{with_perl}" == "yes"
99 %setup -q -T -D -a 1 -n GeoIP-%{V_api_c}
100 %endif
101 %{l_shtool} subst \
102 -e 's;-Wall;;g' \
103 -e 's;-ansi;;g' \
104 Makefile.in */Makefile.in
106 %build
107 echo "ac_cv_func_gethostbyname_r=no" >config.cache
108 CC="%{l_cc}" \
109 CFLAGS="%{l_cflags -O}" \
110 CPPFLAGS="%{l_cppflags}" \
111 LDFLAGS="%{l_ldflags}" \
112 LIBS="-lz" \
113 AUTOCONF="true" \
114 AUTOMAKE="true" \
115 AUTOHEADER="true" \
116 ACLOCAL="true" \
117 ./configure \
118 --cache-file=./config.cache \
119 --prefix=%{l_prefix} \
120 --sysconfdir=%{l_prefix}/etc/geoip \
121 --mandir=$RPM_BUILD_ROOT%{l_prefix}/man \
122 --disable-shared
123 %{l_make} %{l_mflags}
124 %if "%{with_perl}" == "yes"
125 %{l_prefix}/bin/perl-openpkg prepare
126 %{l_prefix}/bin/perl-openpkg -d Geo-IP-%{V_api_pl} --verbose \
127 --args LIBS="-L../libGeoIP/.libs" \
128 --args INC="-I../libGeoIP" \
129 configure build
130 %endif
132 %install
133 rm -rf $RPM_BUILD_ROOT
134 %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix} \
135 $RPM_BUILD_ROOT%{l_prefix}/man \
136 $RPM_BUILD_ROOT%{l_prefix}/man/man1 \
137 $RPM_BUILD_ROOT%{l_prefix}/share/GeoIP
138 %{l_make} %{l_mflags} install DESTDIR="$RPM_BUILD_ROOT"
139 %{l_shtool} install -c -m 644 \
140 data/*.dat $RPM_BUILD_ROOT%{l_prefix}/share/GeoIP/
141 %if "%{with_perl}" == "yes"
142 %{l_prefix}/bin/perl-openpkg -d Geo-IP-%{V_api_pl} install
143 %{l_prefix}/bin/perl-openpkg -F perl-openpkg-files fixate cleanup
144 %else
145 >perl-openpkg-files
146 %endif
147 strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
148 rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/geoip/GeoIP.conf.default
149 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} `cat perl-openpkg-files`
151 %files -f files
153 %clean
154 rm -rf $RPM_BUILD_ROOT