Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

install to any(%*CUSTOM_LIB<site home>)

This takes the easy and portable route by writing the prefix into
the Makefile, at the expense of having to re-run ufo whenever that
prefix changes -- which is quite often in the case of the home lib.
  • Loading branch information...
commit 0755ad0ddb9cf6900205acdc4670e1bb12ade1cf 1 parent 2f477c5
@moritz moritz authored
Showing with 27 additions and 2 deletions.
  1. +27 −2 bin/ufo
View
29 bin/ufo
@@ -6,7 +6,7 @@ sub makefile_template() {
.PHONY: all build test install clean distclean purge
PERL6 = $binary
-PREFIX = $(HOME)/.perl6
+PREFIX = $prefix
BLIB = blib
P6LIB = $(PWD)/$(BLIB)/lib:$(PWD)/lib:$(PERL6LIB)
CP = cp -p
@@ -72,7 +72,8 @@ sub MAIN($filename = 'Makefile', Bool :$alpha) {
.subst('$blib_pirs', $blib_pirs)\
.subst('$build_rules', $build_rules)\
.subst('$install_rules', $install_rules)\
- .subst('$scripts', $scripts)
+ .subst('$scripts', $scripts)\
+ .subst('$prefix', get_prefix())
);
$makefile.close;
}
@@ -128,6 +129,30 @@ sub get_modules() {
return @modules;
}
+sub get_prefix() {
+ my @tried;
+ for <site home> -> $loc {
+ my $path = %*CUSTOM_LIB{$loc};
+ push @tried, $path;
+ mkpath($path);
+ next unless $path.path.d;
+ say 'WARNING: You need to re-run ufo whenver you ',
+ $loc eq 'site' ?? 'update to a new Rakudo version'
+ !! 'recompile Rakudo';
+
+ return $path;
+ }
+ die "Could not find a writable installation location (tried @tried.join(' and'))";
+}
+
+# blatantly stolen from Shell::Command
+sub mkpath($path) {
+ for [\~] $path.split('/').map({"$_/"}) {
+ mkdir($_) unless .path.d
+ }
+}
+
+
sub dependencies($filename) {
my @deps;
my $fh = open($filename, :r);
Please sign in to comment.
Something went wrong with that request. Please try again.