aboutsummaryrefslogtreecommitdiff
path: root/tools/build/module-install.pl
blob: eadb99e18eb9324496a5f7b6b8e770c082a4ea81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#! perl

use warnings;
use strict;

my $perl6bin = shift @ARGV;
my $zefbin   = shift @ARGV;
my $exit     = 0;
my $path_sep = $^O eq 'MSWin32' ? '\\' : '/';

while (<>) {
	# Skip comments
	next if /^\s*(#|$)/;

	# Extract only the module name from the current line
	my ($module) = /(\S+)/;

	# Create the command list
	my @cmd = (
		$perl6bin,
		$zefbin,
		'--/build-depends',
		'--/depends',
		'--/test',
		'--/test-depends',
		'--force',
		'install',
		"./modules$path_sep$module"
	);

	# Show the command that's going to be ran, for debugging purposes
	printf "@cmd\n";

	# Actually run the command
	$exit ||= system "@cmd";
}

exit $exit;