-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBuild.pm
34 lines (28 loc) · 1012 Bytes
/
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
#! /usr/bin/env perl6
#Note `zef build .` will run this script
use v6;
class Build {
need LibraryMake;
# adapted from deprecated Native::Resources
#| Sets up a C<Makefile> and runs C<make>. C<$folder> should be
#| C<"$folder/resources/lib"> and C<$libname> should be the name of the library
#| without any prefixes or extensions.
sub make(Str $folder, Str $destfolder, :$libname) {
my %vars = LibraryMake::get-vars($destfolder);
mkdir($destfolder);
LibraryMake::process-makefile($folder, %vars);
shell(%vars<MAKE>);
my @fake-lib-exts = <.so .dll .dylib>.grep(* ne %vars<SO>);
"$destfolder/$libname$_".IO.open(:w) for @fake-lib-exts;
}
method build($workdir) {
my $destdir = 'resources/lib';
mkdir $destdir;
make($workdir, "$destdir", :libname<libyamlwrap>);
}
}
# Build.pm can also be run standalone
sub MAIN(Str $working-directory = '.' ) {
Build.new.build($working-directory);
exit 0;
}