aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2016-10-11 02:35:35 +0200
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2016-10-11 02:35:35 +0200
commitfd54e438f44a1841e1bf7fb858bb77821c78324a (patch)
treea6ad8937bda6223ea5d58cb7501b8abf863196a3
parent7f13a91e9c39dc70af12511443dceb6bf4dc80f4 (diff)
downloadblogc-fd54e438f44a1841e1bf7fb858bb77821c78324a.tar.gz
blogc-fd54e438f44a1841e1bf7fb858bb77821c78324a.tar.bz2
blogc-fd54e438f44a1841e1bf7fb858bb77821c78324a.zip
git-receiver: detect if make/gmake is available
-rw-r--r--src/blogc-git-receiver/pre-receive.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/blogc-git-receiver/pre-receive.c b/src/blogc-git-receiver/pre-receive.c
index 056ebf2..faa0c62 100644
--- a/src/blogc-git-receiver/pre-receive.c
+++ b/src/blogc-git-receiver/pre-receive.c
@@ -150,6 +150,21 @@ bgr_pre_receive_hook(int argc, char *argv[])
goto cleanup;
}
+ const char *make_impl = NULL;
+
+ if (127 != system("gmake -f /dev/null &> /dev/null")) {
+ make_impl = "gmake";
+ }
+ else if (127 != system("make -f /dev/null &> /dev/null")) {
+ make_impl = "make";
+ }
+
+ if (make_impl == NULL) {
+ fprintf(stderr, "error: no 'make' implementation found\n");
+ rv = 1;
+ goto cleanup;
+ }
+
unsigned long epoch = time(NULL);
output_dir = bc_strdup_printf("%s/builds/%s-%lu", home, master, epoch);
char *gmake_cmd = bc_strdup_printf(