-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcross-compile.pl
More file actions
executable file
·108 lines (85 loc) · 2.9 KB
/
cross-compile.pl
File metadata and controls
executable file
·108 lines (85 loc) · 2.9 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/usr/bin/env perl
use strict;
use warnings;
use Cwd 'abs_path';
use File::Basename;
use File::Path qw(make_path);
my $root = dirname(abs_path($0));
my $parent = dirname($root);
my $aciddrop_dir = "$parent/AcidDrop";
my $aciddrop_repo = "https://github.com/lostjared/AcidDrop.git";
my $nproc = `nproc 2>/dev/null` || 4;
chomp $nproc;
sub run_cmd {
my ($label, $cmd) = @_;
print ">> [$label] $cmd\n";
my $rc = system($cmd);
if ($rc != 0) {
die "!! [$label] Command failed (exit code: " . ($rc >> 8) . ")\n";
}
}
sub clone_aciddrop {
print "=" x 60, "\n";
print " Cloning AcidDrop from GitHub\n";
print "=" x 60, "\n\n";
print ">> Target directory: $parent\n\n";
chdir($parent) or die "Cannot cd to $parent: $!\n";
if (-d "AcidDrop") {
print ">> Removing existing AcidDrop directory...\n";
run_cmd("rm", "rm -rf AcidDrop");
}
run_cmd("git", "git clone $aciddrop_repo");
run_cmd("git", "git config --global --add safe.directory $aciddrop_dir");
print "\n>> [AcidDrop] Repository cloned to: $aciddrop_dir\n\n";
}
sub build_libmx2 {
print "=" x 60, "\n";
print " Building libmx2 (Vulkan=ON, OpenGL=ON)\n";
print "=" x 60, "\n\n";
my $build = "$root/build";
my $source = "$root/libmx";
die "Error: libmx2 source not found at $source\n" unless -d $source;
if (-d $build) {
print ">> Removing existing build directory...";
run_cmd("rm", "rm -rf $build");
}
make_path($build);
chdir($build) or die "Cannot cd to $build: $!\n";
run_cmd("libmx2", "x86_64-w64-mingw32-cmake -B . -S $source -DVULKAN=ON -DOPENGL=ON");
run_cmd("libmx2", "make -j$nproc");
print "\n>> [libmx2] Installing...\n";
run_cmd("libmx2", "sudo make install");
print "\n>> [libmx2] Build and install complete.\n\n";
}
sub build_aciddrop {
print "=" x 60, "\n";
print " Building AcidDrop\n";
print "=" x 60, "\n\n";
# Clone if needed
unless (-d $aciddrop_dir && -f "$aciddrop_dir/CMakeLists.txt") {
print ">> AcidDrop not found or incomplete, cloning...\n\n";
clone_aciddrop();
}
die "Error: AcidDrop source not found at $aciddrop_dir\n" unless -d $aciddrop_dir;
my $build = "$aciddrop_dir/build";
if (-d $build) {
print ">> Removing existing build directory...";
run_cmd("rm", "rm -rf $build");
}
make_path($build);
chdir($build) or die "Cannot cd to $build: $!\n";
run_cmd("AcidDrop", "x86_64-w64-mingw32-cmake -B . -S $aciddrop_dir");
run_cmd("AcidDrop", "make -j$nproc");
print "\n>> [AcidDrop] Build complete.\n";
print ">> [AcidDrop] Executable: $build/AcidDrop\n\n";
}
# --- Main ---
print "\n";
print "=" x 60, "\n";
print " libmx2 + AcidDrop Build Script\n";
print "=" x 60, "\n\n";
build_libmx2();
build_aciddrop();
print "=" x 60, "\n";
print " All builds finished successfully!\n";
print "=" x 60, "\n";