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