From 144f49bdee2dd7d29748d2c3d2e3c0e5cfbfa34d Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Sat, 18 Feb 2017 19:59:30 +0100 Subject: make: git-receiver: fixes to build on OS X. patch by @blackgear --- src/blogc-git-receiver/pre-receive.c | 13 +++++++++---- src/blogc-make/ctx.h | 6 ++++++ src/blogc-make/exec.c | 3 ++- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/blogc-git-receiver/pre-receive.c b/src/blogc-git-receiver/pre-receive.c index 15db99a..7ba6982 100644 --- a/src/blogc-git-receiver/pre-receive.c +++ b/src/blogc-git-receiver/pre-receive.c @@ -196,7 +196,8 @@ bgr_pre_receive_hook(int argc, char *argv[]) // command. char *build_cmd = NULL; if (0 == access("blogcfile", F_OK)) { - if (127 == WEXITSTATUS(system("blogc-make -v 2> /dev/null > /dev/null"))) { + int status_bmake = system("blogc-make -v 2> /dev/null > /dev/null"); + if (127 == WEXITSTATUS(status_bmake)) { fprintf(stderr, "error: failed to find blogc-make binary\n"); rv = 3; goto cleanup; @@ -207,11 +208,15 @@ bgr_pre_receive_hook(int argc, char *argv[]) else if ((0 == access("Makefile", F_OK)) || (0 == access("GNUMakefile", F_OK))) { const char *make_impl = NULL; - if (127 != WEXITSTATUS(system("gmake -f /dev/null 2> /dev/null > /dev/null"))) { + int status_gmake = system("gmake -f /dev/null 2> /dev/null > /dev/null"); + if (127 != WEXITSTATUS(status_gmake)) { make_impl = "gmake"; } - else if (127 != WEXITSTATUS(system("make -f /dev/null 2> /dev/null > /dev/null"))) { - make_impl = "make"; + else { + int status_make = system("make -f /dev/null 2> /dev/null > /dev/null"); + if (127 != WEXITSTATUS(status_make)) { + make_impl = "make"; + } } if (make_impl == NULL) { diff --git a/src/blogc-make/ctx.h b/src/blogc-make/ctx.h index df640a3..fdb02b8 100644 --- a/src/blogc-make/ctx.h +++ b/src/blogc-make/ctx.h @@ -15,6 +15,12 @@ #include "../common/error.h" #include "../common/utils.h" +#ifdef __APPLE__ +#ifndef st_mtim +#define st_mtim st_mtimespec +#endif +#endif + typedef struct { char *path; char *short_path; diff --git a/src/blogc-make/exec.c b/src/blogc-make/exec.c index e1ff238..dafa6cb 100644 --- a/src/blogc-make/exec.c +++ b/src/blogc-make/exec.c @@ -352,7 +352,8 @@ bm_exec_blogc_runserver(const char *output_dir, bool verbose) fflush(stdout); // we don't need pipes to run blogc-runserver, because it is "interactive" - int rv = WEXITSTATUS(system(cmd->str)); + int status = system(cmd->str); + int rv = WEXITSTATUS(status); bc_string_free(cmd, true); if (rv != 0) { -- cgit v1.2.3-18-g5258