summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/includes/system.inc42
-rwxr-xr-xmltk23
2 files changed, 42 insertions, 23 deletions
diff --git a/core/includes/system.inc b/core/includes/system.inc
index 5428263c..048360c0 100644
--- a/core/includes/system.inc
+++ b/core/includes/system.inc
@@ -34,7 +34,7 @@ __init () {
ver=${ver%%.*}
if [ -n "$ver" ]; then
# Enable ccache?
- if which ccache &> /dev/null; then
+ if [ -n "$MLTK_CCACHE" ] && which ccache &> /dev/null; then
for cdir in "/usr/lib/ccache" "/lib/ccache" "/usr/local/ccache" ""; do
[ -d "$cdir" ] && break
done
@@ -49,28 +49,30 @@ __init () {
fi
fi
# Enable distcc?
- testfile="/tmp/test.$$.${RANDOM}.c"
- echo "int main() { return 0; }" > "$testfile"
- DISTCC_FALLBACK=0 distcc "gcc-${ver}" -o "${testfile}.bin" -c "$testfile" &>/dev/null
- ret=$?
- if [ "$ret" = 0 ] && [ -f "${testfile}.bin" ]; then
- if [[ "$CC$CXX" == */ccache* ]]; then
- # Both
- export CCACHE_PREFIX="distcc"
- pinfo "Using distcc + ccache"
- else
- for cdir in "/usr/lib/distcc" "/lib/distcc" "/usr/local/distcc" ""; do
- [ -d "$cdir" ] && break
- done
- if [ -n "$cdir" ]; then
- export CC="$cdir/gcc-${ver}"
- export CXX="$cdir/g++-${ver}"
+ if [ -n "$MLTK_DISTCC" ]; then
+ testfile="/tmp/test.$$.${RANDOM}.c"
+ echo "int main() { return 0; }" > "$testfile"
+ DISTCC_FALLBACK=0 distcc "gcc-${ver}" -o "${testfile}.bin" -c "$testfile" &>/dev/null
+ ret=$?
+ if [ "$ret" = 0 ] && [ -f "${testfile}.bin" ]; then
+ if [[ "$CC$CXX" == */ccache* ]]; then
+ # Both
+ export CCACHE_PREFIX="distcc"
+ pinfo "Using distcc + ccache"
+ else
+ for cdir in "/usr/lib/distcc" "/lib/distcc" "/usr/local/distcc" ""; do
+ [ -d "$cdir" ] && break
+ done
+ if [ -n "$cdir" ]; then
+ export CC="$cdir/gcc-${ver}"
+ export CXX="$cdir/g++-${ver}"
+ fi
+ pinfo "distcc detected"
fi
- pinfo "distcc detected"
+ export MAKEFLAGS="-j40"
fi
- export MAKEFLAGS="-j40"
+ rm -f -- "$testfile" "${testfile}.bin"
fi
- rm -f -- "$testfile" "${testfile}.bin"
fi
}
diff --git a/mltk b/mltk
index 061abe09..215b319e 100755
--- a/mltk
+++ b/mltk
@@ -37,6 +37,15 @@ qnd_exit() {
exit 1
}
+# Support sourcing a "config" where you can set up stuff like 'export http_proxy=...'
+if [ -e "$ROOT_DIR/config" ]; then
+ data1="$( mktemp )"
+ data2="$( mktemp )"
+ declare -p > "$data1"
+ . "$ROOT_DIR/config"
+ declare -p > "$data2"
+fi
+
# source all helper unit files that are found under helper/*.inc
# or core/includes/*.inc
# a helper unit may contain a function called "__init" which will be called
@@ -59,9 +68,6 @@ init_helpers () {
done
}
-# Support sourcing a "config" where you can set up stuff like 'export http_proxy=...'
-[ -e "$ROOT_DIR/config" ] && . "$ROOT_DIR/config"
-
banner () {
echo -e "\033[38;5;202m\t __ __ __ "
echo -e "\033[38;5;202m\t.--------.| | | |_| |--."
@@ -246,6 +252,8 @@ run() {
[[ $REMOTE_EXPORT == 1 ]] && export_builds
}
+MLTK_DISTCC=
+MLTK_CCACHE=
REMOTE_LOCAL_INSTALL=
REMOTE_DEBUG="0"
REMOTE_CLEAN="0"
@@ -259,6 +267,15 @@ initial_checks
read_params $@
init_helpers
+if [ -n "$data1" ] && [ -n "$data2" ]; then
+ pinfo "Applied local config:"
+ while read -r line; do
+ pinfo "$line"
+ done < <( diff -U0 "$data1" "$data2" | grep -v -e '^+++ ' -e '^--- ' -e '^@@ ' -e ' BASH_' -e ' _="' )
+ rm -f -- "$data1" "$data2"
+ unset data1 data2
+fi
+
check_devtools
run