ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/App-Staticperl/patch-postinstall.sh
Revision: 1.6
Committed: Wed Apr 18 12:42:09 2012 UTC (12 years, 1 month ago) by root
Content type: application/x-sh
Branch: MAIN
CVS Tags: rel-1_43
Changes since 1.5: +0 -6 lines
Log Message:
1.43

File Contents

# User Rev Content
1 root 1.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 root 1.2 # when building a perl - this works around Pango/Gtk2 being misdetected
35 root 1.1 # 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    
40 root 1.3 # patch ExtUtils::Miniperl to always add DynaLoader
41     # this is required for dynamic loading in static perls,
42     # and static loading in dynamic perls, when rebuilding a new perl.
43     # Why this patch is necessray I don't understand. Yup.
44     patch ExtUtils/Miniperl.pm extutils_miniperl.pm '
45     /^sub writemain/ a\
46     push @_, canon("/","DynaLoader"); # patched by staticperl
47     '