… | |
… | |
5 | patch() { |
5 | patch() { |
6 | path="$PERL_PREFIX/lib/$1" |
6 | path="$PERL_PREFIX/lib/$1" |
7 | cache="$STATICPERL/patched/$2" |
7 | cache="$STATICPERL/patched/$2" |
8 | sed="$3" |
8 | sed="$3" |
9 | |
9 | |
|
|
10 | if "$PERL_PREFIX/bin/perl" -e 'exit 0+((stat shift)[7] == (stat shift)[7])' "$path" "$cache" || |
10 | if "$PERL_PREFIX/bin/perl" -e 'exit ((stat shift)[9] <= (stat shift)[9])' "$path" "$cache"; then |
11 | "$PERL_PREFIX/bin/perl" -e 'exit 0+((stat shift)[9] <= (stat shift)[9])' "$path" "$cache" |
|
|
12 | then |
|
|
13 | if [ -e "$path" ]; then |
11 | echo "patching $path for a better tomorrrow" |
14 | echo "patching $path for a better tomorrrow" |
12 | |
15 | |
|
|
16 | umask 022 |
13 | if ! sed -e "$sed" <"$path" > "$cache~"; then |
17 | if ! sed -e "$sed" <"$path" > "$cache~"; then |
14 | echo |
18 | echo |
15 | echo "*** FATAL: error while patching $path" |
19 | echo "*** FATAL: error while patching $path" |
16 | echo |
20 | echo |
17 | else |
21 | else |
18 | rm -f "$cache" |
|
|
19 | mv "$cache~" "$cache" |
|
|
20 | rm -f "$path" |
22 | rm -f "$path" |
21 | cp "$cache" "$path" |
23 | mv "$cache~" "$path" |
|
|
24 | cp "$path" "$cache" |
|
|
25 | fi |
22 | fi |
26 | fi |
23 | fi |
27 | fi |
24 | } |
28 | } |
25 | |
29 | |
26 | # patch CPAN::HandleConfig.pm to always include _our_ MyConfig.pm, |
30 | # patch CPAN::HandleConfig.pm to always include _our_ MyConfig.pm, |
… | |
… | |
41 | # this is required for dynamic loading in static perls, |
45 | # this is required for dynamic loading in static perls, |
42 | # and static loading in dynamic perls, when rebuilding a new perl. |
46 | # and static loading in dynamic perls, when rebuilding a new perl. |
43 | # Why this patch is necessray I don't understand. Yup. |
47 | # Why this patch is necessray I don't understand. Yup. |
44 | patch ExtUtils/Miniperl.pm extutils_miniperl.pm ' |
48 | patch ExtUtils/Miniperl.pm extutils_miniperl.pm ' |
45 | /^sub writemain/ a\ |
49 | /^sub writemain/ a\ |
46 | push @_, canon("/","DynaLoader"); # patched by staticperl |
50 | push @_, "DynaLoader"; # patched by staticperl |
47 | ' |
51 | ' |
|
|
52 | |
|
|
53 | # ExtUtils::CBuilder always tries to link shared libraries |
|
|
54 | # even on systems without shared library support. From the same |
|
|
55 | # source as Module::Build, so no wonder it's broken beyond fixing. |
|
|
56 | # and since so many dependent modules are even worse, |
|
|
57 | # we hardwire to 0 to get their pure-perl versions. |
|
|
58 | patch ExtUtils/CBuilder/Base.pm extutils_cbuilder_base.pm ' |
|
|
59 | /^sub have_compiler/ a\ |
|
|
60 | return 0; # patched by staticperl |
|
|
61 | ' |
|
|
62 | |