openpkg/perl.patch

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 13
cb59d6afeb61
child 428
f880f219c566
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 By default, the "vendor" area is not used, so Perl's installation
     2 procedure forgot to create its top-level paths, too. In OpenPKG we use
     3 the "vendor" area, so make sure it is created the same way the "site"
     4 area is.
     6 Index: installperl
     7 --- installperl.orig	2006-08-15 14:37:41 +0200
     8 +++ installperl	2006-08-18 21:05:05 +0200
     9 @@ -211,6 +211,8 @@
    10  my $installarchlib = "$destdir$Config{installarchlib}";
    11  my $installsitelib = "$destdir$Config{installsitelib}";
    12  my $installsitearch = "$destdir$Config{installsitearch}";
    13 +my $installvendorlib = "$destdir$Config{installvendorlib}";
    14 +my $installvendorarch = "$destdir$Config{installvendorarch}";
    15  my $installman1dir = "$destdir$Config{installman1dir}";
    16  my $man1ext = $Config{man1ext};
    17  my $libperl = $Config{libperl};
    18 @@ -372,6 +374,8 @@
    19  mkpath($installarchlib, $verbose, 0777);
    20  mkpath($installsitelib, $verbose, 0777) if ($installsitelib);
    21  mkpath($installsitearch, $verbose, 0777) if ($installsitearch);
    22 +mkpath($installvendorlib, $verbose, 0777) if ($installvendorlib);
    23 +mkpath($installvendorarch, $verbose, 0777) if ($installvendorarch);
    25  if (chdir "lib") {
    26      $do_installarchlib = ! samepath($installarchlib, '.');
    28 -----------------------------------------------------------------------------
    30 By default, the Perl module search order is "use lib, -I, PERL[5]LIB,
    31 perl, site, vendor, other". This means that in OpenPKG both the modules
    32 installed via CPAN shell (in "site" area) and the "perl-xxx" packages
    33 (in "vendor" area) cannot override the (sometimes obsoleted) module
    34 versions distributed with Perl (in "perl" area). Hence, we change
    35 the search order to a more reasonable one for OpenPKG: "use lib, -I,
    36 PERL[5]LIB, site, vendor, perl, other".
    38 Index: perl.c
    39 --- perl.c.orig	2006-08-15 14:37:41 +0200
    40 +++ perl.c	2006-08-18 21:08:14 +0200
    41 @@ -4753,39 +4753,6 @@
    42      incpush(APPLLIB_EXP, TRUE, TRUE, TRUE, TRUE);
    43  #endif
    45 -#ifdef ARCHLIB_EXP
    46 -    incpush(ARCHLIB_EXP, FALSE, FALSE, TRUE, TRUE);
    47 -#endif
    48 -#ifdef MACOS_TRADITIONAL
    49 -    {
    50 -	Stat_t tmpstatbuf;
    51 -    	SV * privdir = newSV(0);
    52 -	char * macperl = PerlEnv_getenv("MACPERL");
    53 -	
    54 -	if (!macperl)
    55 -	    macperl = "";
    56 -	
    57 -	Perl_sv_setpvf(aTHX_ privdir, "%slib:", macperl);
    58 -	if (PerlLIO_stat(SvPVX(privdir), &tmpstatbuf) >= 0 && S_ISDIR(tmpstatbuf.st_mode))
    59 -	    incpush(SvPVX(privdir), TRUE, FALSE, TRUE, FALSE);
    60 -	Perl_sv_setpvf(aTHX_ privdir, "%ssite_perl:", macperl);
    61 -	if (PerlLIO_stat(SvPVX(privdir), &tmpstatbuf) >= 0 && S_ISDIR(tmpstatbuf.st_mode))
    62 -	    incpush(SvPVX(privdir), TRUE, FALSE, TRUE, FALSE);
    63 -	
    64 -   	SvREFCNT_dec(privdir);
    65 -    }
    66 -    if (!PL_tainting)
    67 -	incpush(":", FALSE, FALSE, TRUE, FALSE);
    68 -#else
    69 -#ifndef PRIVLIB_EXP
    70 -#  define PRIVLIB_EXP "/usr/local/lib/perl5:/usr/local/lib/perl"
    71 -#endif
    72 -#if defined(WIN32)
    73 -    incpush(PRIVLIB_EXP, TRUE, FALSE, TRUE, TRUE);
    74 -#else
    75 -    incpush(PRIVLIB_EXP, FALSE, FALSE, TRUE, TRUE);
    76 -#endif
    77 -
    78  #ifdef SITEARCH_EXP
    79      /* sitearch is always relative to sitelib on Windows for
    80       * DLL-based path intuition to work correctly */
    81 @@ -4828,6 +4795,39 @@
    82      incpush(PERL_VENDORLIB_STEM, FALSE, TRUE, TRUE, TRUE);
    83  #endif
    85 +#ifdef ARCHLIB_EXP
    86 +    incpush(ARCHLIB_EXP, FALSE, FALSE, TRUE, TRUE);
    87 +#endif
    88 +#ifdef MACOS_TRADITIONAL
    89 +    {
    90 +	Stat_t tmpstatbuf;
    91 +    	SV * privdir = newSV(0);
    92 +	char * macperl = PerlEnv_getenv("MACPERL");
    93 +	
    94 +	if (!macperl)
    95 +	    macperl = "";
    96 +	
    97 +	Perl_sv_setpvf(aTHX_ privdir, "%slib:", macperl);
    98 +	if (PerlLIO_stat(SvPVX(privdir), &tmpstatbuf) >= 0 && S_ISDIR(tmpstatbuf.st_mode))
    99 +	    incpush(SvPVX(privdir), TRUE, FALSE, TRUE, FALSE);
   100 +	Perl_sv_setpvf(aTHX_ privdir, "%ssite_perl:", macperl);
   101 +	if (PerlLIO_stat(SvPVX(privdir), &tmpstatbuf) >= 0 && S_ISDIR(tmpstatbuf.st_mode))
   102 +	    incpush(SvPVX(privdir), TRUE, FALSE, TRUE, FALSE);
   103 +	
   104 +   	SvREFCNT_dec(privdir);
   105 +    }
   106 +    if (!PL_tainting)
   107 +	incpush(":", FALSE, FALSE, TRUE, FALSE);
   108 +#else
   109 +#ifndef PRIVLIB_EXP
   110 +#  define PRIVLIB_EXP "/usr/local/lib/perl5:/usr/local/lib/perl"
   111 +#endif
   112 +#if defined(WIN32)
   113 +    incpush(PRIVLIB_EXP, TRUE, FALSE, TRUE, TRUE);
   114 +#else
   115 +    incpush(PRIVLIB_EXP, FALSE, FALSE, TRUE, TRUE);
   116 +#endif
   117 +
   118  #ifdef PERL_OTHERLIBDIRS
   119      incpush(PERL_OTHERLIBDIRS, TRUE, TRUE, TRUE, TRUE);
   120  #endif
   122 -----------------------------------------------------------------------------
   124 Port to [Open]Darwin 6.6.2:
   126 1. In OpenPKG, Perl does not use the vendor GCC and our GCC does not
   127    understand "-no-cpp-precomp", so remove this build option.
   129 2. The <sys/mman.h> indirectly includes system specific headers
   130    which in turn have fields named "environ" while Perl uses
   131    a define of "environ" internally. So wrap the inclusion.
   133 3. Darwin 6 no longer accepts the non-standard "#import" statements,
   134    so replace with "#include" and circumvent some header problem
   135    related to the non-standard "__private_extern__" attribute.
   137 Index: hints/darwin.sh
   138 --- hints/darwin.sh.orig	2006-08-15 14:37:41 +0200
   139 +++ hints/darwin.sh	2006-08-18 21:05:05 +0200
   140 @@ -120,9 +120,6 @@
   141    *-2147483648) ccflags="${ccflags} -DINT32_MIN_BROKEN -DINT64_MIN_BROKEN" ;;
   142  esac
   144 -# Avoid Apple's cpp precompiler, better for extensions
   145 -cppflags="${cppflags} -no-cpp-precomp"
   146 -
   147  # This is necessary because perl's build system doesn't
   148  # apply cppflags to cc compile lines as it should.
   149  ccflags="${ccflags} ${cppflags}"
   150 @@ -182,8 +179,7 @@
   151  esac
   152  ldlibpthname='DYLD_LIBRARY_PATH';
   154 -# useshrplib=true results in much slower startup times.
   155 -# 'false' is the default value.  Use Configure -Duseshrplib to override.
   156 +useshrplib='true'
   158  cat > UU/archname.cbu <<'EOCBU'
   159  # This script UU/archname.cbu will get 'called-back' by Configure 
   160 Index: perlio.c
   161 --- perlio.c.orig	2006-08-15 14:37:41 +0200
   162 +++ perlio.c	2006-08-18 21:05:05 +0200
   163 @@ -472,7 +472,14 @@
   164  #include <unistd.h>
   165  #endif
   166  #ifdef HAS_MMAP
   167 +#ifdef PERL_DARWIN
   168 +#define environ_safe environ
   169 +#undef environ
   170  #include <sys/mman.h>
   171 +#define environ environ_safe
   172 +#else
   173 +#include <sys/mman.h>
   174 +#endif
   175  #endif
   177  void
   179 -----------------------------------------------------------------------------
   181 Port to Tru64 5.1:
   183 Under Tru64 our gcc has to be built without binutils and the system
   184 ld(1) does not accept a "-O" option, so remove the whole passing of
   185 optimization flags to ld(1). Under a brain-dead platform like Tru64 we
   186 really don't need any more optimization because we are already happy if
   187 it works at all.
   189 Index: hints/dec_osf.sh
   190 --- hints/dec_osf.sh.orig	2007-12-18 11:47:07 +0100
   191 +++ hints/dec_osf.sh	2007-12-19 12:31:37 +0100
   192 @@ -73,15 +73,6 @@
   193  *)            if $test "X$optimize" = "X$undef"; then
   194                        lddlflags="$lddlflags -msym"
   195                else
   196 -		  case "$myosvers" in
   197 -		  *4.0D*)
   198 -		      # QAR 56761: -O4 + .so may produce broken code,
   199 -		      # fixed in 4.0E or better.
   200 -		      ;;
   201 -		  *)
   202 -                      lddlflags="$lddlflags $optimize"
   203 -		      ;;
   204 -		  esac
   205  		  # -msym: If using a sufficiently recent /sbin/loader,
   206  		  # keep the module symbols with the modules.
   207                    lddlflags="$lddlflags -msym $_lddlflags_strict_ansi"
   209 -----------------------------------------------------------------------------
   211 Index: Configure
   212 --- Configure.orig	2006-08-15 14:37:40 +0200
   213 +++ Configure	2006-08-18 21:05:05 +0200
   214 @@ -7871,7 +7871,7 @@
   215  			      ;;
   216  			linux|irix*|gnu*)  dflt="-shared $optimize" ;;
   217  			next)  dflt='none' ;;
   218 -			solaris) dflt='-G' ;;
   219 +			solaris) dflt='-shared' ;;
   220  			sunos) dflt='-assert nodefinitions' ;;
   221  			svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
   222  	        *)     dflt='none' ;;
   224 -----------------------------------------------------------------------------
   226 Security Fix (CVE-2005-3962, OpenPKG-SA-2005.025-perl)
   228 Index: sv.c
   229 --- sv.c.orig	2006-08-15 14:37:41 +0200
   230 +++ sv.c	2006-08-18 21:05:05 +0200
   231 @@ -8667,7 +8667,10 @@
   232  	if ( (width = expect_number(&q)) ) {
   233  	    if (*q == '$') {
   234  		++q;
   235 -		efix = width;
   236 +		if (width > PERL_INT_MAX)
   237 +		    efix = PERL_INT_MAX;
   238 +		else
   239 +		    efix = width;
   240  	    } else {
   241  		goto gotwidth;
   242  	    }
   244 -----------------------------------------------------------------------------
   246 Corrections for Solaris 11:
   248 Index: perl.h
   249 diff -Nau perl.h.orig perl.h
   250 --- perl.h.orig	2007-12-18 11:47:08.000000000 +0100
   251 +++ perl.h	2009-01-06 15:28:45.843276063 +0100
   252 @@ -1393,6 +1393,7 @@
   253   */
   255  #if defined(I_SYSMODE) && !defined(PERL_MICRO)
   256 +#include <sys/vnode.h>
   257  #include <sys/mode.h>
   258  #endif

mercurial