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.

michael@22 1 ##
michael@22 2 ## perl.spec -- OpenPKG RPM Package Specification
michael@22 3 ## Copyright (c) 2000-2008 OpenPKG Foundation e.V. <http://openpkg.net/>
michael@22 4 ##
michael@22 5 ## Permission to use, copy, modify, and distribute this software for
michael@22 6 ## any purpose with or without fee is hereby granted, provided that
michael@22 7 ## the above copyright notice and this permission notice appear in all
michael@22 8 ## copies.
michael@22 9 ##
michael@22 10 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
michael@22 11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
michael@22 12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
michael@22 13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
michael@22 14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
michael@22 15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
michael@22 16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
michael@22 17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
michael@22 18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
michael@22 19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
michael@22 20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
michael@22 21 ## SUCH DAMAGE.
michael@22 22 ##
michael@22 23
michael@22 24 # package information
michael@22 25 Name: perl
michael@22 26 Summary: Practical Extraction and Reporting Language
michael@22 27 URL: http://www.perl.com/
michael@22 28 Vendor: The Perl Project
michael@22 29 Packager: OpenPKG Foundation e.V.
michael@22 30 Distribution: OpenPKG Community
michael@22 31 Class: CORE
michael@22 32 Group: Perl
michael@22 33 License: GPL/Artistic
michael@22 34 Version: 5.10.0
michael@23 35 Release: 20090106
michael@22 36
michael@22 37 # list of sources
michael@22 38 Source0: ftp://ftp.cpan.org/pub/CPAN/src/perl-%{version}.tar.gz
michael@22 39 Patch0: perl.patch
michael@22 40
michael@22 41 # build information
michael@22 42 Prefix: %{l_prefix}
michael@22 43 BuildRoot: %{l_buildroot}
michael@22 44 BuildPreReq: OpenPKG, openpkg >= 20040130, gcc
michael@22 45 PreReq: OpenPKG, openpkg >= 20040130
michael@22 46 AutoReq: no
michael@22 47 AutoReqProv: no
michael@22 48
michael@22 49 %description
michael@22 50 Perl ("Practical Reporting and Extraction Language") is a very
michael@22 51 sophisticated and flexible (but this way also complex) programming
michael@22 52 language. This is the original implementation of the Perl 5
michael@22 53 interpreter from Larry Wall and his community.
michael@22 54
michael@22 55 %track
michael@22 56 prog perl = {
michael@22 57 version = %{version}
michael@22 58 url = ftp://ftp.cpan.org/pub/CPAN/src/
michael@22 59 regex = perl-(5\.10\.\d+)\.tar\.gz
michael@22 60 }
michael@22 61
michael@22 62 %prep
michael@22 63 %setup -q
michael@22 64 %patch -p0
michael@22 65 chmod -R u+w .
michael@22 66
michael@22 67 %build
michael@22 68 # configure the Perl package
michael@22 69 %{l_shtool} subst \
michael@22 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;' \
michael@22 71 -e 's;package=perl5;package=perl;' \
michael@22 72 Configure
michael@22 73 %{l_shtool} subst \
michael@22 74 -e 's; */usr/local/lib;;' \
michael@22 75 hints/freebsd.sh hints/netbsd.sh
michael@22 76 optimize=""
michael@22 77 case "%{l_platform -t}" in
michael@22 78 amd64-* ) optimize="%{l_cflags}" ;;
michael@22 79 *-aix* ) optimize="%{l_cflags}" ;;
michael@22 80 *-* ) optimize="%{l_cflags -O}" ;;
michael@22 81 esac
michael@22 82 if [ ".$optimize" = . ]; then
michael@22 83 optimize="-Uoptimize"
michael@22 84 else
michael@22 85 optimize="-Doptimize=$optimize"
michael@22 86 fi
michael@22 87 libdirs=""
michael@22 88 for dir in %{l_prefix}/lib /lib64 /usr/lib64 /lib /usr/lib /usr/ccs/lib; do
michael@22 89 if [ -d $dir ]; then
michael@22 90 if [ ".$libdirs" = . ]; then
michael@22 91 libdirs="$dir"
michael@22 92 else
michael@22 93 libdirs="$libdirs $dir"
michael@22 94 fi
michael@22 95 fi
michael@22 96 done
michael@22 97 ./Configure \
michael@22 98 -d -e -s \
michael@22 99 -Dcf_by="%{l_openpkg_release}" \
michael@22 100 -Dcf_email="http://www.openpkg.org/" \
michael@22 101 -Dprefix=%{l_prefix} \
michael@22 102 -Dvendorprefix=%{l_prefix} \
michael@22 103 -Dinstallprefix=%{l_prefix} \
michael@22 104 -Dinstallstyle="lib/perl5" \
michael@22 105 -Dman1dir=%{l_prefix}/man/man1 \
michael@22 106 -Dman3dir=%{l_prefix}/man/man3 \
michael@22 107 -Dcc="%{l_prefix}/bin/gcc" "$optimize" \
michael@22 108 -Dlocincpth="%{l_prefix}/include" \
michael@22 109 -Dloclibpth="%{l_prefix}/lib" \
michael@22 110 -Dldflags="%{l_ldflags}" \
michael@22 111 -Dlibpth="$libdirs" \
michael@22 112 -Dglibpth="$libdirs" \
michael@22 113 -Dscriptdir="%{l_prefix}/bin" \
michael@22 114 -Uinstallusrbinperl \
michael@22 115 -Ui_malloc -Ui_iconv -Ui_db \
michael@22 116 -Uusedevel
michael@22 117
michael@22 118 # build the Perl package
michael@22 119 %{l_make} %{l_mflags} -f Makefile
michael@22 120
michael@22 121 %install
michael@22 122 rm -rf $RPM_BUILD_ROOT
michael@22 123
michael@22 124 # install the Perl package via standard procedure
michael@22 125 %{l_make} %{l_mflags} -f Makefile install DESTDIR=$RPM_BUILD_ROOT
michael@22 126
michael@22 127 # allow us to already use the temporary install perl(1)
michael@22 128 PERL5LIB=$RPM_BUILD_ROOT%{l_prefix}/lib/perl
michael@22 129 export PERL5LIB
michael@22 130
michael@22 131 # install Perl versions of system header files
michael@22 132 ( case "%{l_platform -t}" in
michael@22 133 *-darwin* ) export DYLD_LIBRARY_PATH="`pwd`" ;;
michael@22 134 esac
michael@22 135 cd /usr/include
michael@22 136 eval `$RPM_BUILD_ROOT%{l_prefix}/bin/perl -V:installarchlib`
michael@22 137 echo *.h sys/*.h |\
michael@22 138 xargs $RPM_BUILD_ROOT%{l_prefix}/bin/perl \
michael@22 139 $RPM_BUILD_ROOT%{l_prefix}/bin/h2ph -h -d $RPM_BUILD_ROOT$installarchlib
michael@22 140 ) || exit $?
michael@22 141
michael@22 142 # post-adjustments to installation tree
michael@22 143 rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/perl%{version}
michael@22 144 rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man3
michael@22 145 for name in \
michael@22 146 libnetcfg perlaix perlamiga perlapollo \
michael@22 147 perlbeos perlbs2000 perlcygwin perldgux perlepoc perlfreebsd perlhpux \
michael@22 148 perlhurd perlirix perlmachten perlmacos perlmacosx perlmint perlmpeix \
michael@22 149 perlnetware perlos2 perlos390 perlos400 perlplan9 perlqnx perlsolaris \
michael@22 150 perlvmesa perlvms perlvos perlwin32; do
michael@22 151 rm -f $RPM_BUILD_ROOT%{l_prefix}/man/man1/$name.1
michael@22 152 done
michael@22 153
michael@22 154 # re-adjust configuration as mentioned in Perl's INSTALL document
michael@22 155 ( case "%{l_platform -t}" in
michael@22 156 *-darwin* ) export DYLD_LIBRARY_PATH="`pwd`" ;;
michael@22 157 esac
michael@22 158 $RPM_BUILD_ROOT%{l_prefix}/bin/perl -pi.orig \
michael@22 159 -e "s:$RPM_BUILD_ROOT%{l_prefix}:%{l_prefix}:g" \
michael@22 160 $RPM_BUILD_ROOT%{l_prefix}/lib/perl/%{version}/*/Config.pm \
michael@22 161 `find $RPM_BUILD_ROOT%{l_prefix}/lib/perl/%{version}/ \
michael@22 162 -type f -name ".packlist" -print`
michael@22 163 find $RPM_BUILD_ROOT%{l_prefix}/lib/perl/ \
michael@22 164 -name "*.orig" -print | xargs rm -f
michael@22 165 ) || exit $?
michael@22 166
michael@22 167 # assume ownership for various arch/site/vendor install dirs
michael@22 168 ( eval "`$RPM_BUILD_ROOT%{l_prefix}/bin/perl -V:installarchlib`"
michael@22 169 eval "`$RPM_BUILD_ROOT%{l_prefix}/bin/perl -V:installprivlib`"
michael@22 170 eval "`$RPM_BUILD_ROOT%{l_prefix}/bin/perl -V:installsitearch`"
michael@22 171 eval "`$RPM_BUILD_ROOT%{l_prefix}/bin/perl -V:installsitelib`"
michael@22 172 eval "`$RPM_BUILD_ROOT%{l_prefix}/bin/perl -V:installvendorarch`"
michael@22 173 eval "`$RPM_BUILD_ROOT%{l_prefix}/bin/perl -V:installvendorlib`"
michael@22 174 %{l_shtool} mkdir -f -p -m 755 \
michael@22 175 $RPM_BUILD_ROOT$installarchlib/auto \
michael@22 176 $RPM_BUILD_ROOT$installprivlib/auto \
michael@22 177 $RPM_BUILD_ROOT$installsitearch/auto \
michael@22 178 $RPM_BUILD_ROOT$installsitelib/auto \
michael@22 179 $RPM_BUILD_ROOT$installvendorarch/auto \
michael@22 180 $RPM_BUILD_ROOT$installvendorlib/auto
michael@22 181 ) || exit $?
michael@22 182
michael@22 183 # strip binary files
michael@22 184 strip $RPM_BUILD_ROOT%{l_prefix}/bin/* 2>/dev/null || true
michael@22 185
michael@22 186 # resolve file conflicts (with perl-locale)
michael@22 187 rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/enc2xs \
michael@22 188 $RPM_BUILD_ROOT%{l_prefix}/bin/piconv
michael@22 189
michael@22 190 # resolve file conflicts (with perl-module)
michael@22 191 rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/corelist \
michael@22 192 $RPM_BUILD_ROOT%{l_prefix}/bin/config_data \
michael@22 193 $RPM_BUILD_ROOT%{l_prefix}/man/man1/config_data.1
michael@22 194
michael@22 195 # resolve file conflicts (with perl-sys)
michael@22 196 rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/ptar \
michael@22 197 $RPM_BUILD_ROOT%{l_prefix}/bin/ptardiff \
michael@22 198 $RPM_BUILD_ROOT%{l_prefix}/man/man1/ptar.1 \
michael@22 199 $RPM_BUILD_ROOT%{l_prefix}/man/man1/ptardiff.1
michael@22 200
michael@22 201 # resolve file conflicts (with perl-crypto)
michael@22 202 rm -f $RPM_BUILD_ROOT%{l_prefix}/bin/shasum \
michael@22 203 $RPM_BUILD_ROOT%{l_prefix}/man/man1/shasum.1
michael@22 204
michael@22 205 # determine installed files
michael@22 206 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}
michael@22 207
michael@22 208 %files -f files
michael@22 209
michael@22 210 %clean
michael@22 211 rm -rf $RPM_BUILD_ROOT
michael@22 212

mercurial