blob: 2e402e7e29f08017924ad229925b07195adcbba5 (
plain)
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
109
110
111
|
#include <filesystem>
#include "toml.hh"
#include "vars.cc"
void autogen_build() {
system("./autogen.sh");
system("make");
}
void autotools_build() {
system("./configure");
for (auto const& dir_entry : fs::directory_iterator(fs::current_path().string())) {
if (dir_entry.path().filename() == "CMakeLists.txt") {
fs::create_directories("build");
fs::current_path("build");
system("cmake ..");
}
}
for (auto const& dir_entry : fs::directory_iterator(fs::current_path().string())) {
if (dir_entry.path().filename() == "Makefile") {
system("make");
}
}
}
void bldit_build() {
system("./bldit");
}
void buildsh_build() {
system("./build.sh");
}
void compilesh_build() {
system("./compile.sh");
}
void cargo_build() {
system("cargo build --release");
}
void cmake_build() {
fs::create_directories("build");
fs::current_path("build");
system("cmake ..");
system("make");
}
void go_build() {
for (auto const& dir_entry : fs::directory_iterator(fs::current_path().string())) {
if (dir_entry.path().filename() == "main.go") {
system("go build main.go");
}
}
}
void gradle_build() {
system("gradle build");
}
void make_build() {
for (auto const& dir_entry : fs::directory_iterator(fs::current_path().string())) {
if (dir_entry.path().filename() == "autogen.sh") {
autogen_build();
return;
}
}
for (auto const& dir_entry : fs::directory_iterator(fs::current_path().string())) {
if (dir_entry.path().filename() == "configure.ac") {
autotools_build();
return;
}
}
system("make");
}
void meson_build() {
system("meson setup --wipe build");
system("meson compile -C build");
}
void ninja_build() {
system("ninja");
}
void nim_build() {
system("nimble build");
}
void pnpm_build() {
system("pnpm install");
system("pnpm run build");
}
void python_build() {
toml::parse_result pyproject_toml = toml::parse_file("pyproject.toml");
std::string pypkg = pyproject_toml["project"]["name"].ref<std::string>();
std::string commands[] = {
"export PIPX_BIN_DIR=" + bin,
"pipx install " + pypkg
};
for (int i = 0; i < sizeof(commands)/sizeof(commands[0]); i++) {
system(commands[i].c_str());
}
}
void zig_build() {
system("zig build");
}
|