geoip/geoip.spec

Tue, 29 Mar 2011 20:04:34 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 29 Mar 2011 20:04:34 +0200
changeset 334
4a34d7a82eab
parent 152
7b468483efb4
child 603
72fb5257eb82
permissions
-rw-r--r--

Rework package yet again, correcting and introducing new buildconf logic:
Conditionally disable bootstrap stage comparison correctly, correct
english grammar, better find system as(1) and ld(1), indotruce detailed
optimization option messages, more completely guess cpu types, allow
profiled bootstrapping without a preinstalled GCC because many other
compilers have long since implemented 64-bit arithmetic, instruct make
to build sequentially (not in sparallel) when building a profiled
bootstrap as GCC online documents recommend, and generally improve
comment blocks.

The single most important correction in this changeset relates to the
GCC changed optimization policy since at least GCC 4.5, in which -march
is always passed and not always correctly guessed. In the case of this
package, allowing GCC to guess the architecture leads to wild build
errors at various subcomponents (zlib, libgcc, libiberty...) and
bootstrap stages. It seems quite platform specific, and the safest
approach to correcting this seems to be explicitly always specifying the
-march argument when bootstrapping GCC. Because the best choice 'native'
is not available when bootstrapping using a foreign (non GCC) compiler,
a guess is made according to rpmmacros l_platform in that case.

It is questionable as to whether these recent optimization changes
on the part of GCC or this package are compatible with each other,
or if either are complete or correct at all. At least applying these
corrections allows this package to build again in most cases test.

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

mercurial