]> git.ipfire.org Git - ipfire-2.x.git/blobdiff - make.sh
make.sh: Limit XZ memory to 2GB on 32 bit systems
[ipfire-2.x.git] / make.sh
diff --git a/make.sh b/make.sh
index 818d3aa09d8c692835a08046620b3af79893f9d0..84c8405e7dc2c41a7b1680b6af383927b427bc28 100755 (executable)
--- a/make.sh
+++ b/make.sh
@@ -862,19 +862,23 @@ fi
 HOST_MEM=$(system_memory)
 
 # Checking host memory, tuning XZ_OPT
+if [ ${HOST_MEM} -lt 1024 ]; then
+       exiterror "You will need more than 1GB or host memory to run the build"
+fi
 
-if [ $HOST_MEM -lt 1024 ]; then
-       print_build_stage "Host-Memory: $HOST_MEM MiB"
-       print_build_stage "Not enough host memory (less than 1024 MiB, please consider upgrading)"
-
-       exit 1
-
-else
+# We compress archives with "xz -8", using all cores and up to 70% of memory
+XZ_MEM=$(( HOST_MEM * 7 / 10 ))
 
-       XZ_MEM="$(( HOST_MEM * 7 / 10 ))MiB"
-       XZ_OPT="-T4 -8 --memory=$XZ_MEM"
+# XZ memory cannot be larger than 2GB on 32 bit systems
+case "${HOST_ARCH}" in
+       i*86|armv*)
+               if [ ${XZ_MEM} -gt 2048 ]; then
+                       XZ_MEM=2048
+               fi
+               ;;
+esac
 
-fi
+XZ_OPT="-T$(system_processors) -8 --memory=${XZ_MEM}MiB"
 
 if [ -n "${BUILD_ARCH}" ]; then
        configure_build "${BUILD_ARCH}"