diff --git a/build-scripts/compile b/build-scripts/compile index b1dd7a029..d09a78ac9 100755 --- a/build-scripts/compile +++ b/build-scripts/compile @@ -1,34 +1,55 @@ -#!/bin/sh -x +#!/bin/sh -. `dirname "$0"`/functions +# Usage: PROJECT=[nova|community] ROLE=[hub|agent] ./buildscripts/build-scripts/compile +# +# This script compiles and installs the CFEngine repositories into +# '$BASEDIR/cfengine/dist'. You should first run the 'autogen' script, then +# 'configure' script before running this script. +# +# The script expects the following repositories to exist side by side: +# . +# ├── buildscripts +# ├── core +# ├── enterprise +# ├── nova +# └── masterfiles + +. "$(dirname "$0")"/functions . detect-environment . compile-options case "$PROJECT" in - community) - NOVA=no - ;; - nova) - NOVA=yes - ;; - *) - echo "Unknown project: $PROJECT" - exit 42;; + community) + NOVA=no + ;; + nova) + NOVA=yes + ;; + *) + echo "$(basename "$0"): Error: Unknown project: $PROJECT" + exit 42 + ;; esac -$MAKE -C $BASEDIR/core -k -$MAKE -C $BASEDIR/core install DESTDIR=$BASEDIR/cfengine/dist +echo "$(basename "$0"): Debug: Running make in core repo..." +run_and_print_on_failure $MAKE -C "$BASEDIR"/core -k +echo "$(basename "$0"): Debug: Running make install in core repo..." +run_and_print_on_failure $MAKE -C "$BASEDIR"/core install DESTDIR="$BASEDIR"/cfengine/dist -if test "x$NOVA" = "xyes"; then - $MAKE -C $BASEDIR/enterprise -k - $MAKE -C $BASEDIR/enterprise install DESTDIR=$BASEDIR/cfengine/dist - if test "x$ROLE" = "xhub"; then - $MAKE -C $BASEDIR/nova -k - $MAKE -C $BASEDIR/nova install DESTDIR=$BASEDIR/cfengine/dist - $MAKE -C $BASEDIR/masterfiles install DESTDIR=$BASEDIR/cfengine/dist +if [ "$NOVA" = yes ]; then + echo "$(basename "$0"): Debug: Running make in enterprise repo..." + run_and_print_on_failure $MAKE -C "$BASEDIR"/enterprise -k + echo "$(basename "$0"): Debug: Running make install in enterprise repo..." + run_and_print_on_failure $MAKE -C "$BASEDIR"/enterprise install DESTDIR="$BASEDIR"/cfengine/dist + if [ "$ROLE" = hub ]; then + echo "$(basename "$0"): Debug: Running make in nova repo..." + run_and_print_on_failure $MAKE -C "$BASEDIR"/nova -k + echo "$(basename "$0"): Debug: Running make install in nova repo..." + run_and_print_on_failure $MAKE -C "$BASEDIR"/nova install DESTDIR="$BASEDIR"/cfengine/dist + echo "$(basename "$0"): Debug: Running make install in masterfiles repo..." + run_and_print_on_failure $MAKE -C "$BASEDIR"/masterfiles install DESTDIR="$BASEDIR"/cfengine/dist fi else - $MAKE -C $BASEDIR/masterfiles install DESTDIR=$BASEDIR/cfengine/dist + echo "$(basename "$0"): Debug: Running make install in masterfiles repo..." + run_and_print_on_failure $MAKE -C "$BASEDIR"/masterfiles install DESTDIR="$BASEDIR"/cfengine/dist fi - -