1 |
#! sh |
2 |
|
3 |
# helper to apply patches after installation |
4 |
|
5 |
patch() { |
6 |
path="$PERL_PREFIX/lib/$1" |
7 |
cache="$STATICPERL/patched/$2" |
8 |
sed="$3" |
9 |
|
10 |
if "$PERL_PREFIX/bin/perl" -e 'exit ((stat shift)[9] <= (stat shift)[9])' "$path" "$cache"; then |
11 |
echo "patching $path for a better tomorrrow" |
12 |
|
13 |
if ! sed -e "$sed" <"$path" > "$cache~"; then |
14 |
echo |
15 |
echo "*** FATAL: error while patching $path" |
16 |
echo |
17 |
else |
18 |
rm -f "$cache" |
19 |
mv "$cache~" "$cache" |
20 |
rm -f "$path" |
21 |
cp "$cache" "$path" |
22 |
fi |
23 |
fi |
24 |
} |
25 |
|
26 |
# patch CPAN::HandleConfig.pm to always include _our_ MyConfig.pm, |
27 |
# not the one in the users homedirectory, to avoid clobbering his. |
28 |
patch CPAN/HandleConfig.pm cpan_handleconfig_pm ' |
29 |
1i\ |
30 |
use CPAN::MyConfig; # patched by staticperl |
31 |
' |
32 |
|
33 |
# patch ExtUtils::MM_Unix to always search blib for modules |
34 |
# when building a perl - this works around Pango/Gtk2 being misdetected |
35 |
# as not being an XS module. |
36 |
patch ExtUtils/MM_Unix.pm mm_unix_pm ' |
37 |
/^sub staticmake/,/^}/ s/if (@{$self->{C}}) {/if (@{$self->{C}} or $self->{NAME} =~ m%^(Pango|Gtk2)$%) { # patched by staticperl/ |
38 |
' |
39 |
|