make.sh: Pass number of processors and total memory so that we can adjust MAKETUNING
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 4 Mar 2019 11:33:50 +0000 (11:33 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 4 Mar 2019 11:33:50 +0000 (11:33 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
lfs/boost
make.sh

index 3ce49a0..e0b550c 100644 (file)
--- a/lfs/boost
+++ b/lfs/boost
@@ -35,6 +35,11 @@ TARGET     = $(DIR_INFO)/$(THISAPP)
 CFLAGS    += -O3 -fno-strict-aliasing
 CXXFLAGS  += -O3 -fno-strict-aliasing
 
+# The compiler uses a lot of memory to compile boost, hence we reduce
+# the total number of processes a little bit to be able to build on
+# smaller machines
+override MAKETUNING = -j$(shell echo $$(( $(SYSTEM_MEMORY) / 512)))
+
 CONFIGURE_OPTIONS = \
        --prefix=/usr \
        --layout=tagged \
diff --git a/make.sh b/make.sh
index 1b5cac4..d821fed 100755 (executable)
--- a/make.sh
+++ b/make.sh
@@ -554,6 +554,8 @@ enterchroot() {
                CCACHE_COMPILERCHECK="${CCACHE_COMPILERCHECK}" \
                KVER="${KVER}" \
                XZ_OPT="${XZ_OPT}" \
+               SYSTEM_PROCESSORS="${SYSTEM_PROCESSORS}" \
+               SYSTEM_MEMORY="${SYSTEM_MEMORY}" \
                $(fake_environ) \
                $(qemu_environ) \
                "$@"
@@ -634,6 +636,8 @@ lfsmake1() {
                CFLAGS="${CFLAGS}" \
                CXXFLAGS="${CXXFLAGS}" \
                MAKETUNING="${MAKETUNING}" \
+               SYSTEM_PROCESSORS="${SYSTEM_PROCESSORS}" \
+               SYSTEM_MEMORY="${SYSTEM_MEMORY}" \
                make -f $* \
                        TOOLCHAIN=1 \
                        TOOLS_DIR="${TOOLS_DIR}" \
@@ -907,6 +911,10 @@ if [ -n "${TARGET_ARCH}" ]; then
        unset TARGET_ARCH
 fi
 
+# Get some information about the host system
+SYSTEM_PROCESSORS="$(system_processors)"
+SYSTEM_MEMORY="$(system_memory)"
+
 # Get the amount of memory in this build system
 HOST_MEM=$(system_memory)