Permalink
Browse files

update bin/panda and bootstrap.pl to use %*CUSTOM_LIB

TODO: rebootstrap
  • Loading branch information...
1 parent c181c9a commit 6dfed958d69f6b0b392fea6f1f9333d021b9e9ef @moritz moritz committed Oct 22, 2012
Showing with 26 additions and 11 deletions.
  1. +12 −5 bin/panda
  2. +14 −6 bootstrap.pl
View
@@ -87,11 +87,18 @@ if %*ENV<PANDA_DEFAULT_OPTS> {
# initialize the Panda object
my $panda;
{
- my $pandadir = "$*CUSTOM-LIB/panda";
- mkpath $pandadir unless $pandadir.IO ~~ :d;
-
- my $destdir = %*ENV<DESTDIR> || $*CUSTOM-LIB;
- $destdir = "{cwd}/$destdir" if $*OS ne 'MSWin32' && $destdir !~~ /^ '/' /;
+ my $pandadir;
+ my $destdir = %*ENV<DESTDIR>;
+ $destdir = "{cwd}/$destdir" if defined($destdir) && $*OS ne 'MSWin32' && $destdir !~~ /^ '/' /;
+ for grep(*.defined, $destdir, %*CUSTOM_LIB<site home>) -> $prefix {
+ $destdir = $prefix;
+ $pandadir = "$prefix/panda";
+ try mkpath $pandadir unless $pandadir.IO ~~ :d;
+ last if $pandadir.path.w
+ }
+ unless $pandadir.path.w {
+ die "Found no writable directory into which panda could be installed";
+ }
$panda = Panda.new(
srcdir => "$pandadir/src",
View
@@ -4,9 +4,20 @@
say '==> Bootstrapping Panda';
my $is_win = $*OS eq 'MSWin32';
-my $panda-base = "$*CUSTOM-LIB/panda";
-mkdir $*CUSTOM-LIB unless $*CUSTOM-LIB.path.d;
-mkdir $panda-base unless $panda-base.path.d;
+
+my $panda-base;
+my $destdir = %*ENV<DESTDIR>;
+$destdir = "{cwd}/$destdir" if defined($destdir) && $*OS ne 'MSWin32' && $destdir !~~ /^ '/' /;
+for grep(*.defined, $destdir, %*CUSTOM_LIB<site home>) -> $prefix {
+ $destdir = $prefix;
+ $panda-base = "$prefix/panda";
+ try mkdir $destdir;
+ try mkdir $panda-base unless $panda-base.IO ~~ :d;
+ last if $panda-base.path.w
+}
+unless $panda-base.path.w {
+ die "Found no writable directory into which panda could be installed";
+}
my $projects = slurp 'projects.json.bootstrap';
$projects ~~ s:g/_BASEDIR_/{cwd}\/ext/;
@@ -18,9 +29,6 @@
}
my $env_sep = $is_win ?? ';' !! ':';
-my $destdir = %*ENV<DESTDIR> || $*CUSTOM-LIB;
- $destdir = "{cwd}/$destdir" unless $destdir ~~ /^ '/' /
- || $is_win && $destdir ~~ /^ [ '\\' | <[a..zA..Z]> ':' ] /;
%*ENV<PERL6LIB> ~= "{$env_sep}$destdir/lib";
%*ENV<PERL6LIB> ~= "{$env_sep}{cwd}/ext/File__Tools/lib";

0 comments on commit 6dfed95

Please sign in to comment.