-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
Build.rakumod
37 lines (31 loc) · 1.16 KB
/
Build.rakumod
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
use PathTools;
use JSON::Fast;
unit class Build;
method build($cwd --> Bool) {
my %libraries = ssl => 'ssl', crypto => 'crypto';
my $prefix;
if %*ENV<OPENSSL_PREFIX>:exists {
$prefix = %*ENV<OPENSSL_PREFIX>;
} elsif !$*DISTRO.is-win {
my $proc = run "brew", "--prefix", "--installed", "openssl", :out, :!err;
if ?$proc {
$prefix = $proc.out.slurp(:close).chomp;
}
}
if $prefix {
note "Using openssl prefix $prefix";
%libraries =
ssl => $prefix.IO.child('lib').child('ssl').Str,
crypto => $prefix.IO.child('lib').child('crypto').Str,
;
}
my $json = to-json(%libraries, :pretty, :sorted-keys);
"resources/libraries.json".IO.spurt: $json;
# DO NOT COPY THIS SOLUTION
# Delete precomp files when building in case the openssl libs have since been updated
# (ideally this type of stale precomp would get picked up by raku)
# see: https://github.com/sergot/openssl/issues/82#issuecomment-864523511
try rm($cwd.IO.child('.precomp').absolute, :r, :f, :d);
try rm($cwd.IO.child('lib/.precomp').absolute, :r, :f, :d);
return True;
}