aboutsummaryrefslogtreecommitdiff
path: root/skel/tools/build/module-install.pl
diff options
context:
space:
mode:
authorpmichaud <pmichaud@pobox.com>2012-01-27 14:18:07 -0600
committerpmichaud <pmichaud@pobox.com>2012-01-27 14:18:07 -0600
commit4abcc075356072726c16b1ba1659061bf303f996 (patch)
tree6be3eb1091efbde80b4c0bc0b8b94811bc3d4a15 /skel/tools/build/module-install.pl
parentb5588c2c0f511effe3197794217308c55c7a1491 (diff)
Move module-install script into tools/build (where the rest of the build things go nowadays).
Diffstat (limited to 'skel/tools/build/module-install.pl')
-rw-r--r--skel/tools/build/module-install.pl38
1 files changed, 38 insertions, 0 deletions
diff --git a/skel/tools/build/module-install.pl b/skel/tools/build/module-install.pl
new file mode 100644
index 0000000..63a9412
--- /dev/null
+++ b/skel/tools/build/module-install.pl
@@ -0,0 +1,38 @@
+#! perl
+
+use warnings;
+use strict;
+use File::Find;
+use File::Copy;
+use File::Path;
+use File::Basename;
+
+my $perl6bin = shift @ARGV;
+my $perl6lib = shift @ARGV;
+
+my @pmfiles;
+while (@ARGV) {
+ my $module = shift @ARGV;
+ our $mlib = "$module/lib";
+
+ find({ no_chdir=>1, wanted => \&libcopy }, $mlib);
+
+ sub libcopy {
+ return unless /\.pm6?/;
+ 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 @pmfiles, $target;
+ }
+}
+
+chdir 'rakudo';
+foreach my $pm (@pmfiles) {
+ my $out = $pm; $out =~ s/\.pm6?$/.pir/;
+ my @cmd = ($perl6bin, '--target=pir', "--output=$out", $pm);
+ print join(' ', @cmd), "\n";
+ system(@cmd);
+}