ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/App-Staticperl/patch-postinstall.sh
Revision: 1.8
Committed: Fri Jan 17 18:06:43 2014 UTC (10 years, 4 months ago) by root
Content type: application/x-sh
Branch: MAIN
Changes since 1.7: +4 -2 lines
Log Message:
*** empty log message ***

File Contents

# Content
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 0+((stat shift)[7] == (stat shift)[7])' "$path" "$cache" ||
11 "$PERL_PREFIX/bin/perl" -e 'exit 0+((stat shift)[9] <= (stat shift)[9])' "$path" "$cache"
12 then
13 if [ -e "$path" ]; then
14 echo "patching $path for a better tomorrrow"
15
16 umask 022
17 if ! sed -e "$sed" <"$path" > "$cache~"; then
18 echo
19 echo "*** FATAL: error while patching $path"
20 echo
21 else
22 rm -f "$path"
23 mv "$cache~" "$path"
24 cp "$path" "$cache"
25 fi
26 fi
27 fi
28 }
29
30 # patch CPAN::HandleConfig.pm to always include _our_ MyConfig.pm,
31 # not the one in the users homedirectory, to avoid clobbering his.
32 patch CPAN/HandleConfig.pm cpan_handleconfig_pm '
33 1i\
34 use CPAN::MyConfig; # patched by staticperl
35 '
36
37 # patch ExtUtils::MM_Unix to always search blib for modules
38 # when building a perl - this works around Pango/Gtk2 being misdetected
39 # as not being an XS module.
40 patch ExtUtils/MM_Unix.pm mm_unix_pm '
41 /^sub staticmake/,/^}/ s/if (@{$self->{C}}) {/if (@{$self->{C}} or $self->{NAME} =~ m%^(Pango|Gtk2)$%) { # patched by staticperl/
42 '
43
44 # patch ExtUtils::Miniperl to always add DynaLoader
45 # this is required for dynamic loading in static perls,
46 # and static loading in dynamic perls, when rebuilding a new perl.
47 # Why this patch is necessray I don't understand. Yup.
48 patch ExtUtils/Miniperl.pm extutils_miniperl.pm '
49 /^sub writemain/ a\
50 push @_, canon("/","DynaLoader"); # patched by staticperl
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 hardwaire 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