-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.raku
executable file
·67 lines (57 loc) · 1.91 KB
/
configure.raku
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!usr/bin/env raku
use lib 'lib';
use Raygui::Generator;
constant $url = "https://raw.githubusercontent.com/raysan5/raygui/master/src/raygui.h";
sub check-if-installed {
my $library_name = 'raylib';
my $exitcode = shell("pkg-config --exists $library_name").exitcode;
my $failed = $exitcode == 1;
die "raylib is isn't installed, please install it" if $failed;
}
sub configure{
my $raylib-h-file = "resources/raygui.h";
my $library_name = 'raygui';
if $*DISTRO.name ~~ /window/ {
die "Windows is unsupported for now";
}
elsif $*DISTRO.name ~~ /macos/ {
say "Is using macOS";
check-if-installed;
}
else {
say "Is using Linux";
check-if-installed;
}
say "Downloading raygui from repository...";
my $result = shell("curl $url > resources/raygui.h");
shell("cp resources/raygui.h resources/raygui_modified.c");
say $raylib-h-file;
my $srcdir = $*CWD;
my $output-dir="$srcdir/resources";
mkdir($output-dir);
generate-bindings($raylib-h-file, $output-dir);
}
sub install {
say "Installing Raygui::Bindings";
my $repo = %*ENV<DESTREPO>
?? CompUnit::RepositoryRegistry.repository-for-name(%*ENV<DESTREPO>)
!! (
CompUnit::RepositoryRegistry.repository-for-name('site'),
|$*REPO.repo-chain.grep(CompUnit::Repository::Installable)
).first(*.can-install)
or die "Cannot find a repository to install to";
say "Installing into $repo";
my $dist = Distribution::Path.new($*CWD);
# workaround for missing proper handling of libraries in Distribution::Path
my $libraygui;
$dist.meta<files> = (
|$dist.meta<files>.grep(* ne $libraygui.Str),
{'resources/libraries/libraygui' => $libraygui},
);
$repo.install($dist);
say "Installed successfully.";
}
sub MAIN(:$install is copy) {
configure if !$install;
install if $install;
}