-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathBuild.pm
38 lines (33 loc) · 1.07 KB
/
Build.pm
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
use Shell::Command;
use LibraryMake;
class Build {
#| Call out to Ruby to figure out what compile flags we should use
sub ruby-cc-config {
my $rb-config-cmd = shell(q{
ruby -rmkmf -e '
print RbConfig::CONFIG["LIBS"]
print " " + RbConfig::CONFIG["LIBRUBYARG_SHARED"]
print " -Wl,-rpath," + RbConfig::CONFIG["archlibdir"]
print " -L" + RbConfig::CONFIG["libdir"]
print " -L" + RbConfig::CONFIG["archlibdir"]
print " -I" + RbConfig::CONFIG["rubyarchhdrdir"]
print " -I" + RbConfig::CONFIG["rubyhdrdir"]
'
}, :out);
my $rb-config = $rb-config-cmd.out.slurp;
$rb-config;
}
method build($dir) {
my %vars = get-vars($dir);
%vars<rbhelper> = $*VM.platform-library-name('rbhelper'.IO);
%vars<rb-gcc-args> = ruby-cc-config();
mkdir "$dir/resources" unless "$dir/resources".IO.e;
mkdir "$dir/resources/libraries" unless "$dir/resources/libraries".IO.e;
process-makefile($dir, %vars);
my $goback = $*CWD;
chdir($dir);
shell(%vars<MAKE>);
chdir($goback);
}
}
# vim: ft=raku