perl/perl.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 22
0d4f475bfc81
child 358
832ab278201b
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 ##  perl.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 information
    25 Name:         perl
    26 Summary:      Practical Extraction and Reporting Language
    27 URL:          http://www.perl.com/
    28 Vendor:       The Perl Project
    29 Packager:     OpenPKG Foundation e.V.
    30 Distribution: OpenPKG Community
    31 Class:        CORE
    32 Group:        Perl
    33 License:      GPL/Artistic
    34 Version:      5.10.0
    35 Release:      20090106
    37 #   list of sources
    38 Source0:      ftp://ftp.cpan.org/pub/CPAN/src/perl-%{version}.tar.gz
    39 Patch0:       perl.patch
    41 #   build information
    42 Prefix:       %{l_prefix}
    43 BuildRoot:    %{l_buildroot}
    44 BuildPreReq:  OpenPKG, openpkg >= 20040130, gcc
    45 PreReq:       OpenPKG, openpkg >= 20040130
    46 AutoReq:      no
    47 AutoReqProv:  no
    49 %description
    50     Perl ("Practical Reporting and Extraction Language") is a very
    51     sophisticated and flexible (but this way also complex) programming
    52     language. This is the original implementation of the Perl 5
    53     interpreter from Larry Wall and his community.
    55 %track
    56     prog perl = {
    57         version   = %{version}
    58         url       = ftp://ftp.cpan.org/pub/CPAN/src/
    59         regex     = perl-(5\.10\.\d+)\.tar\.gz
    60     }
    62 %prep
    63     %setup -q
    64     %patch -p0
    65     chmod -R u+w .
    67 %build
    68     #   configure the Perl package
    69     %{l_shtool} subst \
    70         -e 's;\(.*for thislib in $libswanted.*\);libswanted=`echo " $libswanted " | sed -e "s/ bind / /g" -e "s/ db / /g" -e "s/ gdbm / /g" -e "s/ iconv / /g"`\; \1;' \
    71         -e 's;package=perl5;package=perl;' \
    72         Configure
    73     %{l_shtool} subst \
    74         -e 's; */usr/local/lib;;' \
    75         hints/freebsd.sh hints/netbsd.sh
    76     optimize=""
    77     case "%{l_platform -t}" in
    78         amd64-* ) optimize="%{l_cflags}"    ;;
    79         *-aix*  ) optimize="%{l_cflags}"    ;;
    80         *-*     ) optimize="%{l_cflags -O}" ;;
    81     esac
    82     if [ ".$optimize" = . ]; then
    83         optimize="-Uoptimize"
    84     else
    85         optimize="-Doptimize=$optimize"
    86     fi
    87     libdirs=""
    88     for dir in %{l_prefix}/lib /lib64 /usr/lib64 /lib /usr/lib /usr/ccs/lib; do
    89         if [ -d $dir ]; then
    90             if [ ".$libdirs" = . ]; then
    91                 libdirs="$dir"
    92             else
    93                 libdirs="$libdirs $dir"
    94             fi
    95         fi
    96     done
    97     ./Configure \
    98         -d -e -s \
    99         -Dcf_by="%{l_openpkg_release}" \
   100         -Dcf_email="http://www.openpkg.org/" \
   101         -Dprefix=%{l_prefix} \
   102         -Dvendorprefix=%{l_prefix} \
   103         -Dinstallprefix=%{l_prefix} \
   104         -Dinstallstyle="lib/perl5" \
   105         -Dman1dir=%{l_prefix}/man/man1 \
   106         -Dman3dir=%{l_prefix}/man/man3 \
   107         -Dcc="%{l_prefix}/bin/gcc" "$optimize" \
   108         -Dlocincpth="%{l_prefix}/include" \
   109         -Dloclibpth="%{l_prefix}/lib" \
   110         -Dldflags="%{l_ldflags}" \
   111         -Dlibpth="$libdirs" \
   112         -Dglibpth="$libdirs" \
   113         -Dscriptdir="%{l_prefix}/bin" \
   114         -Uinstallusrbinperl \
   115         -Ui_malloc -Ui_iconv -Ui_db \
   116         -Uusedevel
   118     #   build the Perl package
   119     %{l_make} %{l_mflags} -f Makefile
   121 %install
   122     rm -rf $RPM_BUILD_ROOT
   124     #   install the Perl package via standard procedure
   125     %{l_make} %{l_mflags} -f Makefile install DESTDIR=$RPM_BUILD_ROOT
   127     #   allow us to already use the temporary install perl(1)
   128     PERL5LIB=$RPM_BUILD_ROOT%{l_prefix}/lib/perl
   129     export PERL5LIB
   131     #   install Perl versions of system header files
   132     ( case "%{l_platform -t}" in
   133           *-darwin* ) export DYLD_LIBRARY_PATH="`pwd`" ;;
   134       esac
   135       cd /usr/include
   136       eval `$RPM_BUILD_ROOT%{l_prefix}/bin/perl -V:installarchlib`
   137       echo *.h sys/*.h |\
   138       xargs $RPM_BUILD_ROOT%{l_prefix}/bin/perl \
   139           $RPM_BUILD_ROOT%{l_prefix}/bin/h2ph -h -d $RPM_BUILD_ROOT$installarchlib
   140     ) || exit $?
   142     #   post-adjustments to installation tree
   143     rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/perl%{version}
   144     rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man3
   145     for name in \
   146         libnetcfg perlaix perlamiga perlapollo \
   147         perlbeos perlbs2000 perlcygwin perldgux perlepoc perlfreebsd perlhpux \
   148         perlhurd perlirix perlmachten perlmacos perlmacosx perlmint perlmpeix \
   149         perlnetware perlos2 perlos390 perlos400 perlplan9 perlqnx perlsolaris \
   150         perlvmesa perlvms perlvos perlwin32; do
   151         rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/$name.1
   152     done
   154     #   re-adjust configuration as mentioned in Perl's INSTALL document
   155     ( case "%{l_platform -t}" in
   156           *-darwin* ) export DYLD_LIBRARY_PATH="`pwd`" ;;
   157       esac
   158       $RPM_BUILD_ROOT%{l_prefix}/bin/perl -pi.orig \
   159           -e "s:$RPM_BUILD_ROOT%{l_prefix}:%{l_prefix}:g" \
   160           $RPM_BUILD_ROOT%{l_prefix}/lib/perl/%{version}/*/Config.pm \
   161           `find $RPM_BUILD_ROOT%{l_prefix}/lib/perl/%{version}/ \
   162                 -type f -name ".packlist" -print`
   163       find $RPM_BUILD_ROOT%{l_prefix}/lib/perl/ \
   164            -name "*.orig" -print | xargs rm -f
   165     ) || exit $?
   167     #   assume ownership for various arch/site/vendor install dirs
   168     ( eval "`$RPM_BUILD_ROOT%{l_prefix}/bin/perl -V:installarchlib`"
   169       eval "`$RPM_BUILD_ROOT%{l_prefix}/bin/perl -V:installprivlib`"
   170       eval "`$RPM_BUILD_ROOT%{l_prefix}/bin/perl -V:installsitearch`"
   171       eval "`$RPM_BUILD_ROOT%{l_prefix}/bin/perl -V:installsitelib`"
   172       eval "`$RPM_BUILD_ROOT%{l_prefix}/bin/perl -V:installvendorarch`"
   173       eval "`$RPM_BUILD_ROOT%{l_prefix}/bin/perl -V:installvendorlib`"
   174       %{l_shtool} mkdir -f -p -m 755 \
   175           $RPM_BUILD_ROOT$installarchlib/auto \
   176           $RPM_BUILD_ROOT$installprivlib/auto \
   177           $RPM_BUILD_ROOT$installsitearch/auto \
   178           $RPM_BUILD_ROOT$installsitelib/auto \
   179           $RPM_BUILD_ROOT$installvendorarch/auto \
   180           $RPM_BUILD_ROOT$installvendorlib/auto
   181     ) || exit $?
   183     #   strip binary files
   184     strip $RPM_BUILD_ROOT%{l_prefix}/bin/* 2>/dev/null || true
   186     #   resolve file conflicts (with perl-locale)
   187     rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/enc2xs \
   188           $RPM_BUILD_ROOT%{l_prefix}/bin/piconv
   190     #   resolve file conflicts (with perl-module)
   191     rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/corelist \
   192           $RPM_BUILD_ROOT%{l_prefix}/bin/config_data \
   193           $RPM_BUILD_ROOT%{l_prefix}/man/man1/config_data.1
   195     #   resolve file conflicts (with perl-sys)
   196     rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/ptar \
   197           $RPM_BUILD_ROOT%{l_prefix}/bin/ptardiff \
   198           $RPM_BUILD_ROOT%{l_prefix}/man/man1/ptar.1 \
   199           $RPM_BUILD_ROOT%{l_prefix}/man/man1/ptardiff.1
   201     #   resolve file conflicts (with perl-crypto)
   202     rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/shasum \
   203           $RPM_BUILD_ROOT%{l_prefix}/man/man1/shasum.1
   205     #   determine installed files
   206     %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
   208 %files -f files
   210 %clean
   211     rm -rf $RPM_BUILD_ROOT

mercurial