geoip/geoip.spec

Mon, 28 Jan 2013 17:37:18 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Mon, 28 Jan 2013 17:37:18 +0100
changeset 758
a2c6460cfb16
parent 153
b9de35d46e4e
child 787
f0da6998c61a
permissions
-rw-r--r--

Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.

     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.4.8
    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
    49 #   build information
    50 Prefix:       %{l_prefix}
    51 BuildRoot:    %{l_buildroot}
    52 BuildPreReq:  OpenPKG, openpkg >= 20060823, gcc
    53 PreReq:       OpenPKG, openpkg >= 20060823
    54 BuildPreReq:  zlib
    55 PreReq:       zlib
    56 %if "%{with_perl}" == "yes"
    57 BuildPreReq:  perl, perl-openpkg
    58 PreReq:       perl
    59 %endif
    60 AutoReq:      no
    61 AutoReqProv:  no
    63 %description
    64     GeoIP is a C library that enables the user to find the country
    65     that any IP address or hostname originates from. It uses a file
    66     based database containing IP blocks as keys and countries as
    67     values and claims to achieve over 99% accuracy. This database
    68     should be more complete and accurate than using reverse DNS
    69     lookups.
    71     This module can be used to automatically select the geographically
    72     closest mirror, to analyze your web server logs to determine the
    73     countries of your visitors, for credit card fraud detection, and
    74     for software export controls.
    76 %track
    77     prog geoip = {
    78         version   = %{version}
    79         url       = http://geolite.maxmind.com/download/geoip/api/c/
    80         regex     = GeoIP-(__VER__)\.tar\.gz
    81     }
    82     prog geoip:perl = {
    83         version   = %{V_api_pl}
    84         url       = http://www.cpan.org/modules/by-module/Geo/
    85         regex     = Geo-IP-(__VER__)\.tar\.gz
    86     }
    88 %prep
    89     %setup -q -n GeoIP-%{V_api_c}
    90     ( cd data && %{l_gzip} -cd %{SOURCE2} >GeoLiteCity.dat) || exit $?
    91 %if "%{with_perl}" == "yes"
    92     %setup -q -T -D -a 1 -n GeoIP-%{V_api_c}
    93 %endif
    94     %{l_shtool} subst \
    95         -e 's;-Wall;;g' \
    96         -e 's;-ansi;;g' \
    97         Makefile.in */Makefile.in
    99 %build
   100     echo "ac_cv_func_gethostbyname_r=no" >config.cache
   101     CC="%{l_cc}" \
   102     CFLAGS="%{l_cflags -O}" \
   103     CPPFLAGS="%{l_cppflags}" \
   104     LDFLAGS="%{l_ldflags}" \
   105     LIBS="-lz" \
   106     AUTOCONF="true" \
   107     AUTOMAKE="true" \
   108     AUTOHEADER="true" \
   109     ACLOCAL="true" \
   110     ./configure \
   111         --cache-file=./config.cache \
   112         --prefix=%{l_prefix} \
   113         --sysconfdir=%{l_prefix}/etc/geoip \
   114         --mandir=$RPM_BUILD_ROOT%{l_prefix}/man \
   115         --disable-shared
   116     %{l_make} %{l_mflags}
   117 %if "%{with_perl}" == "yes"
   118     %{l_prefix}/bin/perl-openpkg prepare
   119     %{l_prefix}/bin/perl-openpkg -d Geo-IP-%{V_api_pl} --verbose \
   120         --args LIBS="-L../libGeoIP/.libs" \
   121         --args INC="-I../libGeoIP" \
   122         configure build
   123 %endif
   125 %install
   126     rm -rf $RPM_BUILD_ROOT
   127     %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix} \
   128         $RPM_BUILD_ROOT%{l_prefix}/man \
   129         $RPM_BUILD_ROOT%{l_prefix}/man/man1
   130     %{l_make} %{l_mflags} install DESTDIR="$RPM_BUILD_ROOT"
   131     %{l_shtool} install -c -m 644 \
   132         data/GeoLiteCity.dat $RPM_BUILD_ROOT%{l_prefix}/share/GeoIP
   133 %if "%{with_perl}" == "yes"
   134     %{l_prefix}/bin/perl-openpkg -d Geo-IP-%{V_api_pl} install
   135     %{l_prefix}/bin/perl-openpkg -F perl-openpkg-files fixate cleanup
   136 %else
   137     >perl-openpkg-files
   138 %endif
   139     strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
   140     rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/geoip/GeoIP.conf.default
   141     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} `cat perl-openpkg-files`
   143 %files -f files
   145 %clean
   146     rm -rf $RPM_BUILD_ROOT

mercurial