ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/App-Staticperl/patch-postinstall.sh
Revision: 1.10
Committed: Mon Jul 6 23:22:17 2015 UTC (8 years, 10 months ago) by root
Content type: application/x-sh
Branch: MAIN
CVS Tags: rel-1_46, rel-1_44, rel-1_45, HEAD
Changes since 1.9: +1 -1 lines
Log Message:
*** empty log message ***

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 root 1.7 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 root 1.1
16 root 1.7 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 root 1.1 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 root 1.2 # when building a perl - this works around Pango/Gtk2 being misdetected
39 root 1.1 # 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 root 1.3 # 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 root 1.10 push @_, "DynaLoader"; # patched by staticperl
51 root 1.3 '
52 root 1.7
53     # ExtUtils::CBuilder always tries to link shared libraries
54 root 1.8 # even on systems without shared library support. From the same
55 root 1.7 # source as Module::Build, so no wonder it's broken beyond fixing.
56 root 1.8 # and since so many dependent modules are even worse,
57 root 1.9 # we hardwire to 0 to get their pure-perl versions.
58 root 1.7 patch ExtUtils/CBuilder/Base.pm extutils_cbuilder_base.pm '
59     /^sub have_compiler/ a\
60 root 1.8 return 0; # patched by staticperl
61 root 1.7 '
62