3 # This script installs an initial local::lib into your application directory
4 # named local-lib5, which automatically turns on local::lib support by default.
6 # Needs to be run as script/bootstrap.pl
8 # Will then install Module::Install, and all of your dependencies into
9 # the local lib directory created.
18 # Do not take no for an answer.
20 $ENV{CATALYST_LOCAL_LIB}=1;
22 # Get the base paths and setup your %ENV
25 if (-r "$FindBin::Bin/Makefile.PL") {
26 $basedir = $FindBin::Bin;
28 elsif (-r "$FindBin::Bin/../Makefile.PL") {
29 $basedir = "$FindBin::Bin/..";
33 my $target = "$basedir/local-lib5";
34 my $lib = "$target/lib/perl5";
36 # Start installing stuff in the target dir
37 $ENV{PERL_MM_OPT} = "INSTALL_BASE=$target";
38 $ENV{PERL_MM_USE_DEFAULT} = "1";
39 # And allow dependency checks to find it
40 lib->import("$target/lib/perl5");
42 # Deal with the weird case that cpan has never been run before and
43 # cpan wants to create a .cpan directory in /root or somewhere you
47 require CPAN::HandleConfig;
48 CPAN::HandleConfig->load();
49 $CPAN::Config->{prefs_dir} = "$ENV{HOME}/.cpan/prefs";
51 force(qw/install local::lib/);
53 require lib::core::only; # Turn lib::core:only on
54 require local::lib; # Turn local::lib on
55 lib::core::only->import();
56 local::lib->import( $target );
58 # Become fully self contained
59 $ENV{PERL5LIB} = ""; # If we used a local::lib to bootstrap, this kills it.
62 $ENV{PERL_AUTOINSTALL_PREFER_CPAN}=1;
63 $ENV{PERL_MM_OPT} .= " INSTALLMAN1DIR=none INSTALLMAN3DIR=none";
65 lib::core::only->import();
66 local::lib->import( $target );
68 # Force a re-install of local::lib here to get the dependencies for local::lib
69 # It requires things which ensure we have an unfucked toolchain :)
70 force(qw/install local::lib/);
72 # Install the base modules
73 install('Module::Install');
76 # For some reason this isn't installed along with M::I::Catalyst.
77 install('File::Copy::Recursive');
78 install('Module::Install::Catalyst');
80 print "local::lib setup, type perl Makefile.PL && make installdeps to install dependencies\n";