]> 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 f83b90e966c9a0f1987292eb3d9ca5754ab59b44..84c8405e7dc2c41a7b1680b6af383927b427bc28 100755 (executable)
--- a/make.sh
+++ b/make.sh
@@ -26,7 +26,7 @@ NAME="IPFire"                                                 # Software name
 SNAME="ipfire"                                                 # Short name
 VERSION="2.19"                                                 # Version number
 CORE="121"                                                     # Core Level (Filename)
-PAKFIRE_CORE="121"                                             # Core Level (PAKFIRE)
+PAKFIRE_CORE="120"                                             # Core Level (PAKFIRE)
 GIT_BRANCH=`git rev-parse --abbrev-ref HEAD`                   # Git Branch
 SLOGAN="www.ipfire.org"                                                # Software slogan
 CONFIG_ROOT=/var/ipfire                                                # Configuration rootdir
@@ -526,6 +526,7 @@ enterchroot() {
                CCACHE_COMPRESS="${CCACHE_COMPRESS}" \
                CCACHE_COMPILERCHECK="${CCACHE_COMPILERCHECK}" \
                KVER="${KVER}" \
+               XZ_OPT="${XZ_OPT}" \
                $(fake_environ) \
                $(qemu_environ) \
                "$@"
@@ -860,6 +861,25 @@ fi
 # Get the amount of memory in this build system
 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
+
+# We compress archives with "xz -8", using all cores and up to 70% of memory
+XZ_MEM=$(( HOST_MEM * 7 / 10 ))
+
+# 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
+
+XZ_OPT="-T$(system_processors) -8 --memory=${XZ_MEM}MiB"
+
 if [ -n "${BUILD_ARCH}" ]; then
        configure_build "${BUILD_ARCH}"
 else
@@ -1557,7 +1577,7 @@ buildpackages() {
        lfsmake2 flash-images
   fi
 
-  mv $LFS/install/images/{*.iso,*.tgz,*.img.gz,*.bz2} $BASEDIR >> $LOGFILE 2>&1
+  mv $LFS/install/images/{*.iso,*.tgz,*.img.xz,*.bz2} $BASEDIR >> $LOGFILE 2>&1
 
   ipfirepackages
 
@@ -1760,7 +1780,7 @@ toolchain)
        buildtoolchain
        echo "`date -u '+%b %e %T'`: Create toolchain image for ${BUILD_ARCH}" | tee -a $LOGFILE
        test -d $BASEDIR/cache/toolchains || mkdir -p $BASEDIR/cache/toolchains
-       cd $BASEDIR && XZ_OPT="-T0 -8" tar -Jc --exclude='log/_build.*.log' -f cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.tar.xz \
+       cd $BASEDIR && XZ_OPT="$(XZ_OPT)" tar -Jc --exclude='log/_build.*.log' -f cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.tar.xz --xz \
                build/${TOOLS_DIR} build/bin/sh log >> $LOGFILE
        md5sum cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.tar.xz \
                > cache/toolchains/$SNAME-$VERSION-toolchain-$TOOLCHAINVER-${BUILD_ARCH}.md5