App-Staticperl
view release on metacpan or search on metacpan
bin/staticperl view on Meta::CPAN
echo
else
rm -f "$path"
mv "$cache~" "$path"
cp "$path" "$cache"
fi
fi
fi
}
# patch CPAN::HandleConfig.pm to always include _our_ MyConfig.pm,
# not the one in the users homedirectory, to avoid clobbering his.
patch CPAN/HandleConfig.pm cpan_handleconfig_pm '
1i\
use CPAN::MyConfig; # patched by staticperl
'
# patch ExtUtils::MM_Unix to always search blib for modules
# when building a perl - this works around Pango/Gtk2 being misdetected
# as not being an XS module.
patch ExtUtils/MM_Unix.pm mm_unix_pm '
/^sub staticmake/,/^}/ s/if (@{$self->{C}}) {/if (@{$self->{C}} or $self->{NAME} =~ m%^(Pango|Gtk2)$%) { # patched by staticperl/
'
# patch ExtUtils::Miniperl to always add DynaLoader
# this is required for dynamic loading in static perls,
# and static loading in dynamic perls, when rebuilding a new perl.
# Why this patch is necessray I don't understand. Yup.
patch ExtUtils/Miniperl.pm extutils_miniperl.pm '
/^sub writemain/ a\
push @_, "DynaLoader"; # patched by staticperl
'
# ExtUtils::CBuilder always tries to link shared libraries
# even on systems without shared library support. From the same
# source as Module::Build, so no wonder it's broken beyond fixing.
# and since so many dependent modules are even worse,
# we hardwire to 0 to get their pure-perl versions.
patch ExtUtils/CBuilder/Base.pm extutils_cbuilder_base.pm '
/^sub have_compiler/ a\
return 0; # patched by staticperl
'
end_of_patch_postinstall
# immediately use it
"$PERL_PREFIX/bin/SP-patch-postinstall"
# help to trick CPAN into avoiding ~/.cpan completely
echo 1 >"$PERL_PREFIX/lib/CPAN/MyConfig.pm"
# we call cpan with -MCPAN::MyConfig in this script, which
# is strictly unnecssary as we have to patch CPAN anyway,
# so consider it "for good measure".
"$PERL_PREFIX"/bin/perl -MCPAN::MyConfig -MCPAN -e '
CPAN::Shell->o (conf => urllist => push => "'"$CPAN"'");
CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan");
CPAN::Shell->o (conf => q<init>);
CPAN::Shell->o (conf => q<cpan_home>, "'"$STATICPERL"'/cpan");
CPAN::Shell->o (conf => q<build_dir>, "'"$STATICPERL"'/cpan/build");
CPAN::Shell->o (conf => q<prefs_dir>, "'"$STATICPERL"'/cpan/prefs");
CPAN::Shell->o (conf => q<histfile> , "'"$STATICPERL"'/cpan/histfile");
CPAN::Shell->o (conf => q<keep_source_where>, "'"$STATICPERL"'/cpan/sources");
CPAN::Shell->o (conf => q<makepl_arg>, "MAP_TARGET=perl");
CPAN::Shell->o (conf => q<make>, "'"$PERL_PREFIX"'/bin/SP-make-make");
CPAN::Shell->o (conf => q<make_install_make_command>, "'"$PERL_PREFIX"'/bin/SP-make-install-make");
CPAN::Shell->o (conf => q<prerequisites_policy>, q<follow>);
CPAN::Shell->o (conf => q<build_requires_install_policy>, q<yes>);
CPAN::Shell->o (conf => q<recommends_policy>, q<0>);
CPAN::Shell->o (conf => q<suggests_policy>, q<0>);
CPAN::Shell->o (conf => q<prefer_installer>, q<EUMM>);
CPAN::Shell->o (conf => q<commit>);
' || fatal "error while initialising CPAN"
: > "$PERL_PREFIX/staticstamp.install"
fi
_postinstall
) || exit
}
import() {
(
IMPORT="$1"
rcd "$STATICPERL"
if ! [ -e "$PERL_PREFIX/staticstamp.install" ]; then
verblock <<EOF
import perl from $IMPORT to $STATICPERL
EOF
rm -rf bin cpan lib patched perl src
mkdir -m 755 perl perl/bin
ln -s perl/bin/ bin
ln -s "$IMPORT" perl/bin/
echo "$IMPORT" > "$PERL_PREFIX/.import"
: > "$PERL_PREFIX/staticstamp.install"
fi
_postinstall
) || exit
}
#############################################################################
# install a module from CPAN
instcpan() {
[ $NOCHECK_INSTALL ] || install
verblock <<EOF
installing modules from CPAN
$*
EOF
MYCONFIG=
[ -e "$PERL_PREFIX/.import" ] || MYCONFIG=-MCPAN::MyConfig
"$PERL_PREFIX"/bin/perl $MYCONFIG -MCPAN -e 'notest (install => $_) for @ARGV' -- "$@" | tee "$STATICPERL/instcpan.log"
( run in 1.520 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )