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.

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

mercurial