Skip to content

Commit

Permalink
bsys/meson: Installation
Browse files Browse the repository at this point in the history
  • Loading branch information
obiwac committed Jan 6, 2025
1 parent 2ed432e commit 84366ed
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion src/bsys/meson/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ static int build(void) {

LOG_INFO("Meson setup...");

char* STR_CLEANUP prefix = NULL;
asprintf(&prefix, "-Dprefix=%s", install_prefix);
assert(prefix != NULL);

cmd_t CMD_CLEANUP cmd = {0};
cmd_create(&cmd, "meson", "setup", meson_path);
cmd_create(&cmd, "meson", "setup", meson_path, prefix, NULL);
cmd_set_redirect(&cmd, false);

if (cmd_exec(&cmd) < 0) {
Expand Down Expand Up @@ -57,9 +61,33 @@ static int build(void) {
return 0;
}

static int install(void) {
char* STR_CLEANUP meson_path = NULL;
asprintf(&meson_path, "%s/meson", out_path);
assert(meson_path != NULL);

LOG_SUCCESS("Ninja install...");

cmd_t CMD_CLEANUP cmd = {0};
cmd_create(&cmd, "ninja", "-C", meson_path, "install", NULL);
cmd_set_redirect(&cmd, false);

if (cmd_exec(&cmd) < 0) {
LOG_FATAL("Ninja install failed.");
return -1;
}

else {
LOG_SUCCESS("Ninja install succeeded.");
}

return 0;
}

bsys_t const BSYS_MESON = {
.name = "Meson",
.key = "meson",
.identify = identify,
.build = build,
.install = install,
};

0 comments on commit 84366ed

Please sign in to comment.