aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Leich <email@froggs.de>2016-01-05 21:40:28 +0100
committerTobias Leich <email@froggs.de>2016-01-27 21:23:32 +0100
commitac288f000957d00c26e742df0756d63350046193 (patch)
tree77358c2f9dd867c74092c8d2c5f3aa0543e4f970
parentfd22c79be3905cece4c977b97787fc52364737b5 (diff)
first working post 6.c star
-rw-r--r--modules/MODULES.txt8
-rw-r--r--panda-bindir.patch173
-rw-r--r--rakudo-cur-bindir.patch83
-rw-r--r--tools/build/Makefile.in11
-rw-r--r--tools/build/module-install.pl113
5 files changed, 269 insertions, 119 deletions
diff --git a/modules/MODULES.txt b/modules/MODULES.txt
index fe6ec00..cd367ea 100644
--- a/modules/MODULES.txt
+++ b/modules/MODULES.txt
@@ -12,10 +12,10 @@ uri
perl6-lwp-simple # uses MIME::Base64, URI
json
perl6-digest-md5
-file-find
-shell-command
-json_fast
-panda # uses JSON::Fast
+#file-find
+#shell-command
+#json_fast
+#panda # uses JSON::Fast
perl6-http-status
p6-Template-Mustache
PSGI
diff --git a/panda-bindir.patch b/panda-bindir.patch
new file mode 100644
index 0000000..756e2f2
--- /dev/null
+++ b/panda-bindir.patch
@@ -0,0 +1,173 @@
+diff --git a/bin/panda b/bin/panda
+index 8747f77..3fa5915 100755
+--- a/bin/panda
++++ b/bin/panda
+@@ -12,17 +12,17 @@ my %failed;
+
+ #| Install the specified modules
+ multi MAIN ('install', *@modules, Bool :$notests, Bool :$nodeps, Bool :$force = False,
+- Str :$prefix) {
++ Str :$prefix, Str :$bin-prefix) {
+ my $panda = Panda.new(:ecosystem(make-default-ecosystem($prefix)));
+ for @modules -> $x {
+ $panda.resolve($x, :$notests, :$nodeps, :action<install>, :$force,
+- :$prefix);
++ :$prefix, :$bin-prefix);
+ CATCH { when X::Panda { %failed{$x}.push($_) && say $_ } };
+ }
+ }
+
+ #| Install dependencies, but don't build the modules themselves
+-multi MAIN ('installdeps', *@modules, Bool :$notests, Bool :$force = False, Str :$prefix) {
++multi MAIN ('installdeps', *@modules, Bool :$notests, Bool :$force = False, Str :$prefix, Str :$bin-prefix) {
+ my $panda = Panda.new(:ecosystem(make-default-ecosystem($prefix)));
+ for @modules -> $x {
+ $panda.resolve($x, :$notests, :action<install-deps-only>, :$force,
+@@ -32,25 +32,25 @@ multi MAIN ('installdeps', *@modules, Bool :$notests, Bool :$force = False, Str
+ }
+
+ #| List all available modules
+-multi MAIN ('list', Bool :$installed, Bool :$verbose, Str :$prefix) {
++multi MAIN ('list', Bool :$installed, Bool :$verbose, Str :$prefix, Str :$bin-prefix) {
+ my $panda = Panda.new(:ecosystem(make-default-ecosystem($prefix)));
+ listprojects($panda, :$installed, :$verbose);
+ }
+
+ #| Update the module database
+-multi MAIN ('update', Str :$prefix) {
++multi MAIN ('update', Str :$prefix, Str :$bin-prefix) {
+ my $panda = Panda.new(:ecosystem(make-default-ecosystem($prefix)));
+ $panda.ecosystem.update;
+ }
+
+ #| Display information about specified modules
+-multi MAIN ('info', *@modules, Str :$prefix) {
++multi MAIN ('info', *@modules, Str :$prefix, Str :$bin-prefix) {
+ my $panda = Panda.new(:ecosystem(make-default-ecosystem($prefix)));
+ projectinfo($panda, @modules);
+ }
+
+ #| Search the name/description
+-multi MAIN ('search', $pattern = '', Str :$prefix) {
++multi MAIN ('search', $pattern = '', Str :$prefix, Str :$bin-prefix) {
+ my $panda = Panda.new(:ecosystem(make-default-ecosystem($prefix)));
+ search-projects($panda, $pattern);
+ }
+@@ -63,7 +63,7 @@ multi MAIN ('gen-meta', Bool :$notests, Str :$name, Str :$auth,
+ }
+
+ #| Test and install all known distributions
+-multi MAIN ('smoke', :$exclude = 'panda', Str :$prefix) {
++multi MAIN ('smoke', :$exclude = 'panda', Str :$prefix, Str :$bin-prefix) {
+ my @exclude = $exclude.split(',');
+ my $panda = Panda.new(:ecosystem(make-default-ecosystem($prefix)));
+ my @projects = $panda.ecosystem.project-list;
+@@ -80,7 +80,7 @@ multi MAIN ('smoke', :$exclude = 'panda', Str :$prefix) {
+ }
+
+ #| Download and unpack the distribution and then open the directory with your shell.
+-multi MAIN ('look', *@modules, Str :$prefix) {
++multi MAIN ('look', *@modules, Str :$prefix, Str :$bin-prefix) {
+ my $panda = Panda.new(:ecosystem(make-default-ecosystem($prefix)));
+ for @modules -> $x {
+ $panda.resolve($x, :notests, :nodeps, :action<look>);
+diff --git a/bootstrap.pl b/bootstrap.pl
+index 295ac0d..d1ada4b 100755
+--- a/bootstrap.pl
++++ b/bootstrap.pl
+@@ -4,7 +4,7 @@ use lib 'ext/File__Find/lib/';
+ use lib 'ext/Shell__Command/lib/';
+ use Shell::Command;
+
+-sub MAIN(Str :$prefix is copy) {
++sub MAIN(Str :$prefix is copy, Str :$bin-prefix) {
+ say '==> Bootstrapping Panda';
+
+ # prevent a lot of expensive dynamic lookups
+@@ -62,9 +62,10 @@ sub MAIN(Str :$prefix is copy) {
+ );
+
+ my $prefix_str = $prefix ?? "--prefix=$prefix" !! '';
++ $prefix_str ~= " --bin-prefix={$bin-prefix // "$prefix/bin"}";
+ shell "$*EXECUTABLE --ll-exception bin/panda --force $prefix_str install $*CWD";
+ $prefix = $prefix.substr(5) if $prefix.starts-with("inst#");
+- say "==> Please make sure that $prefix/bin is in your PATH";
++ say "==> Please make sure that $bin-prefix is in your PATH";
+
+ unlink "$panda-base/projects.json";
+ }
+diff --git a/lib/Panda.pm b/lib/Panda.pm
+index aafc42f..7a9afa4 100644
+--- a/lib/Panda.pm
++++ b/lib/Panda.pm
+@@ -116,7 +116,7 @@ class Panda {
+ }
+
+ method install(Panda::Project $bone, $nodeps, $notests,
+- Bool() $isdep, :$rebuild = True, :$prefix, Bool :$force) {
++ Bool() $isdep, :$rebuild = True, :$prefix, :$bin-prefix, Bool :$force) {
+ my $cwd = $*CWD;
+ my $dir = tmpdir();
+ my $reports-file = ($.ecosystem.statefile.IO.dirname ~ '/reports.' ~ $*PERL.compiler.version).IO;
+@@ -143,7 +143,7 @@ class Panda {
+ }
+ }
+ self.announce('installing', $bone);
+- $.installer.install($dir, $prefix, :$bone, :$force);
++ $.installer.install($dir, $prefix, :$bone, :$force, :$bin-prefix);
+ my $s = $isdep ?? Panda::Project::State::installed-dep
+ !! Panda::Project::State::installed;
+ $.ecosystem.project-set-state($bone, $s);
+@@ -179,7 +179,7 @@ class Panda {
+ }
+
+ method resolve(Str() $proj is copy, Bool :$nodeps, Bool :$notests, Bool :$force,
+- :$action = 'install', Str :$prefix) {
++ :$action = 'install', Str :$prefix, Str :$bin-prefix) {
+ my $tmpdir = tmpdir();
+ LEAVE { rm_rf $tmpdir if $tmpdir.IO.e }
+ mkpath $tmpdir;
+@@ -211,12 +211,12 @@ class Panda {
+ $.ecosystem.project-get-state($_)
+ == Panda::Project::absent
+ };
+- self.install($_, $nodeps, $notests, 1, :$force) for @deps;
++ self.install($_, $nodeps, $notests, 1, :$bin-prefix, :$force) for @deps;
+ }
+
+ given $action {
+ when 'install' {
+- self.install($bone, $nodeps, $notests, 0, :$prefix, :$force);
++ self.install($bone, $nodeps, $notests, 0, :$prefix, :$bin-prefix, :$force);
+ }
+ when 'install-deps-only' { }
+ when 'look' { self.look($bone) };
+diff --git a/lib/Panda/Installer.pm b/lib/Panda/Installer.pm
+index c07449f..c5ea41e 100644
+--- a/lib/Panda/Installer.pm
++++ b/lib/Panda/Installer.pm
+@@ -31,7 +31,7 @@ sub copy($src, $dest) {
+ $src.copy($dest);
+ }
+
+-method install($from, $to? is copy, Panda::Project :$bone, Bool :$force) {
++method install($from, $to? is copy, Panda::Project :$bone, Bool :$force, :$bin-prefix) {
+ unless $to {
+ $to = $.prefix;
+ }
+@@ -58,6 +58,7 @@ method install($from, $to? is copy, Panda::Project :$bone, Bool :$force) {
+ ?? ~"resources/libraries".IO.child($*VM.platform-library-name($0.Str.IO))
+ !! ~"resources/$_".IO
+ });
++ $to.bindir = $bin-prefix.IO if $bin-prefix;
+ $to.install(
+ Distribution.new(|$bone.metainfo),
+ %sources,
+@@ -76,6 +77,7 @@ method install($from, $to? is copy, Panda::Project :$bone, Bool :$force) {
+ }
+ }
+ if 'bin'.IO ~~ :d {
++ $to = $bin-prefix if $bin-prefix; # XXX
+ for find(dir => 'bin', type => 'file').list -> $bin {
+ next if $bin.basename.substr(0, 1) eq '.';
+ next if !$*DISTRO.is-win and $bin.basename ~~ /\.bat$/;
diff --git a/rakudo-cur-bindir.patch b/rakudo-cur-bindir.patch
new file mode 100644
index 0000000..537a061
--- /dev/null
+++ b/rakudo-cur-bindir.patch
@@ -0,0 +1,83 @@
+diff --git a/src/core/CompUnit/Repository/Installation.pm b/src/core/CompUnit/Repository/Installation.pm
+index 0ece1df..12011fd 100644
+--- a/src/core/CompUnit/Repository/Installation.pm
++++ b/src/core/CompUnit/Repository/Installation.pm
+@@ -6,7 +6,7 @@ class CompUnit::Repository::Installation does CompUnit::Repository::Locally does
+
+ my $verbose := nqp::getenvhash<RAKUDO_LOG_PRECOMP>;
+
+- submethod BUILD(:$!prefix, :$!lock, :$!WHICH, :$!next-repo) { }
++ submethod BUILD(:$!prefix, :$!bindir, :$!lock, :$!WHICH, :$!next-repo) { }
+
+ method writeable-path {
+ $.prefix.w ?? $.prefix !! IO::Path;
+@@ -68,7 +68,7 @@ sub MAIN(:$name is copy, :$auth, :$ver, *@, *%) {
+ exit 1;
+ }
+
+- exit run($*EXECUTABLE-NAME, @binaries[0].hash.<files><bin/#name#>, @*ARGS).exitcode
++ exit run($*EXECUTABLE, @binaries[0].hash.<files><bin/#name#>, @*ARGS).exitcode
+ }';
+
+ method !sources-dir() {
+@@ -90,7 +90,7 @@ sub MAIN(:$name is copy, :$auth, :$ver, *@, *%) {
+ }
+
+ method !bin-dir() {
+- my $bin = $.prefix.child('bin');
++ my $bin = $!bindir || $.prefix.child('bin');
+ $bin.mkdir unless $bin.e;
+ $bin
+ }
+@@ -154,14 +154,14 @@ sub MAIN(:$name is copy, :$auth, :$ver, *@, *%) {
+ my $destination = $resources-dir.child($id);
+ my $withoutext = $basename.subst(/\.[exe|bat]$/, '');
+ for '', '-j', '-m' -> $be {
+- "$path/bin/$withoutext$be".IO.spurt:
++ "$bin-dir/$withoutext$be".IO.spurt:
+ $perl_wrapper.subst('#name#', $basename, :g).subst('#perl#', "perl6$be").subst('#dist-name#', $dist.name);
+ if $is-win {
+- "$path/bin/$withoutext$be.bat".IO.spurt:
++ "$bin-dir/$withoutext$be.bat".IO.spurt:
+ $windows_wrapper.subst('#perl#', "perl6$be", :g);
+ }
+ else {
+- "$path/bin/$withoutext$be".IO.chmod(0o755);
++ "$bin-dir/$withoutext$be".IO.chmod(0o755);
+ }
+ }
+ self!add-short-name($basename, $dist);
+diff --git a/src/core/CompUnit/Repository/Locally.pm b/src/core/CompUnit/Repository/Locally.pm
+index bab6b34..78c1395 100644
+--- a/src/core/CompUnit/Repository/Locally.pm
++++ b/src/core/CompUnit/Repository/Locally.pm
+@@ -1,16 +1,18 @@
+ role CompUnit::Repository::Locally {
+ has Lock $!lock;
+ has IO::Path $.prefix is required;
++ has IO::Path $.bindir is rw;
+ has Str $.WHICH;
+
+ my %instances;
+
+- method new(CompUnit::Repository::Locally: Str:D :$prefix, CompUnit::Repository :$next-repo) {
+- my $abspath := $*SPEC.rel2abs($prefix);
+- my $IO := IO::Path.new-from-absolute-path($abspath);
++ method new(CompUnit::Repository::Locally: Str:D :$prefix, :$bindir, CompUnit::Repository :$next-repo) {
++ my $abspath := $*SPEC.rel2abs($prefix);
++ my $IO-prefix := IO::Path.new-from-absolute-path($abspath);
++ my $IO-bindir := $bindir ?? IO::Path.new-from-absolute-path($bindir) !! IO::Path;
+
+ %instances{$abspath} //=
+- self.bless(:prefix($IO), :lock(Lock.new), :WHICH(self.^name ~ '|' ~ $abspath), :$next-repo);
++ self.bless(:prefix($IO-prefix), :bindir($IO-bindir), :lock(Lock.new), :WHICH(self.^name ~ '|' ~ $abspath), :$next-repo);
+ }
+
+ multi method Str(CompUnit::Repository::Locally:D:) { $!prefix.abspath }
+diff --git a/tools/build/NQP_REVISION b/tools/build/NQP_REVISION
+index eb54c28..add78a9 100644
+--- a/tools/build/NQP_REVISION
++++ b/tools/build/NQP_REVISION
+@@ -1 +1 @@
+-2015.12-11-gd86a422
++2015.12
diff --git a/tools/build/Makefile.in b/tools/build/Makefile.in
index b2cc03f..df6e19c 100644
--- a/tools/build/Makefile.in
+++ b/tools/build/Makefile.in
@@ -3,7 +3,7 @@
MOAR_DIR = moarvm
NQP_DIR = nqp
RAKUDO_DIR = rakudo
-STAR_VERSION = 2015.11
+STAR_VERSION = 2015.12
# install location
PREFIX_DIR = @prefix@
@@ -69,13 +69,8 @@ modules-install-j:
modules-install-m:
@echo "== Installing modules for MoarVM"
- $(PERL) tools/build/module-install.pl $(DESTDIR)$(PERL6_M_INSTALL) $(DESTDIR)$(PERL6_M_LANG_DIR)/lib moarvm mbc $(MODULES)
- @echo "== Installing binaries for MoarVM"
- $(PERL) tools/build/bin-install.pl $(PERL6_M_INSTALL) $(DESTDIR)$(MOAR_BIN_DIR) m modules/ufo/bin/ufo modules/panda/bin/panda modules/doc/bin/p6doc
- $(PERL) tools/build/bin-install.pl $(PERL6_M_INSTALL) $(DESTDIR)$(MOAR_BIN_DIR) m modules/ufo/bin/ufo modules/panda/bin/panda modules/doc/bin/p6doc-index
- $(MKPATH) $(DESTDIR)$(PERL6_M_LANG_DIR)/site/panda/
- $(CP) install/share/perl6/site/panda/projects.json $(DESTDIR)$(PERL6_M_LANG_DIR)/site/panda/
- $(CP) install/share/perl6/site/panda/state $(DESTDIR)$(PERL6_M_LANG_DIR)/site/panda/
+ cd modules/panda && $(DESTDIR)$(PERL6_M_INSTALL) bootstrap.pl --bin-prefix=$(DESTDIR)$(MOAR_BIN_DIR)
+ $(PERL) tools/build/module-install.pl $(PERL6_M_INSTALL) $(DESTDIR)$(MOAR_BIN_DIR)/panda-m$(BAT) $(DESTDIR)$(MOAR_BIN_DIR) $(MODULES)
modules-test: @backend_modules_test@
verbose-modules-test: @backend_modules_test@
diff --git a/tools/build/module-install.pl b/tools/build/module-install.pl
index 0766398..4caacb7 100644
--- a/tools/build/module-install.pl
+++ b/tools/build/module-install.pl
@@ -2,117 +2,16 @@
use warnings;
use strict;
-use File::Find;
-use File::Copy;
-use File::Path;
-use File::Basename;
+my $perl6bin = shift @ARGV;
+my $pandabin = shift @ARGV;
+my $bindir = shift @ARGV;
-my $perl6bin = shift @ARGV;
-my $perl6lib = shift @ARGV;
-my $compext = shift @ARGV;
-my $comptarget = shift @ARGV;
+my $exit = 0;
-my @pmfiles;
-my @mod_pms;
while (<>) {
next if /^\s*(#|$)/;
my ($module) = /(\S+)/;
- print "== Installing modules/$module\n";
- our $mlib = "modules/$module/lib";
-
- @mod_pms = ();
- find({ no_chdir=>1, wanted => \&libcopy }, $mlib);
-
- sub libcopy {
- return unless /\.pm6?$|\.pod$/;
- my $source = $File::Find::name;
- my $target = $source;
- $target =~ s/\Q$mlib\E/$perl6lib/;
- print "$source => $target\n";
- mkpath dirname($target);
- copy($source, $target) or die "copy failed: $!\n";
- push @mod_pms, $target if $target =~ /\.pm6?$/;
- }
-
- my %usages_of;
- my @modules;
- my %module_to_path;
- for my $module_file (@mod_pms) {
- open(my $fh, '<', $module_file) or die $!;
- my $module = path_to_module_name($module_file);
- push @modules, $module;
- $module_to_path{$module} = $module_file;
- $usages_of{$module} = [];
- while (<$fh>) {
- if (/^\s* (?:use|need|require) \s+ (\w+ (?: :: \w+)*)/x and my $used = $1) {
- next if $used eq 'v6';
- next if $used eq 'MONKEY_TYPING';
-
- push @{$usages_of{$module}}, $used;
- }
- }
- }
-
- my @order = topo_sort(\@modules, \%usages_of);
- my @sources = map { $module_to_path{$_} } @order;
- push @pmfiles, @sources;
+ $exit ||= system $perl6bin, $pandabin, '--force', "--bin-prefix=$bindir", "install", "modules/$module";
}
-# Internally, we treat the module names as module names, '::' and all.
-# But since they're really files externally, they have to be converted
-# from paths to module names, and back again.
-
-sub path_to_module_name {
- $_ = shift;
- s/^.+\blib\///;
- s/^.+\blib6\///;
- s/\.pm6?$//;
- s/\//::/g;
- $_;
-}
-
-do {
- local $ENV{'PERL6LIB'} = $perl6lib;
-
- print "== Precompiling modules\n";
- chdir 'rakudo';
- foreach my $pm (@pmfiles) {
- my @cmd = ($perl6bin, "--target=$comptarget", "--output=$pm.$compext", $pm);
- print join(' ', @cmd), "\n";
- system(@cmd);
- }
-};
-
-
-# According to "Introduction to Algorithms" by Cormen et al., topological
-# sort is just a depth-first search of a graph where you pay attention to
-# the order in which you get done with a dfs-visit() for each node.
-
-sub topo_sort {
- my ($modules, $dependencies) = @_;
- my @modules = @$modules;
- my @order;
- my %color_of = map { $_ => 'not yet visited' } @modules;
-
- for my $module (@modules) {
- if ($color_of{$module} eq 'not yet visited') {
- dfs_visit($module, \%color_of, $dependencies, \@order);
- }
- }
- return @order;
-}
-
-sub dfs_visit {
- my $module = shift;
- my $color_of = shift;
- my $dependencies = shift;
- my $order = shift;
- $color_of->{$module} = 'visited';
- for my $used (@{$dependencies->{$module}}) {
- $color_of->{$used} ||= '';
- if ($color_of->{$used} eq 'not yet visited') {
- dfs_visit($used, $color_of, $dependencies, $order);
- }
- }
- push @$order, $module;
-}
+exit $exit;