This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "IPFire 2.x development tree".
The branch, next has been updated
via 682a6b2dc8fb3e917e1d8927cd4caa022f4f23d8 (commit)
via a98ab1d7fdba5d18d42faab43bf03662ca4d4261 (commit)
via 4f1cce84fb8217589b67dd3244fd3f8ccbe14e3d (commit)
via 1445a5ac436b4e29f227059ad8a1a1ceda327a2e (commit)
via 7e1639a4810e5e70db94fdb0a0a98593d50d4290 (commit)
via 5190eea24f9822a63dc5d06d214b48f973b14f29 (commit)
from ad1204e4eb397b4f7d10c3bdfa9214aa8c0a0575 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 682a6b2dc8fb3e917e1d8927cd4caa022f4f23d8
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date: Tue Nov 7 16:02:28 2017 +0100
unbound: Silence error when upstream name servers cannot be read
Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>
commit a98ab1d7fdba5d18d42faab43bf03662ca4d4261
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date: Tue Nov 7 15:43:14 2017 +0100
make.sh: Calculate MAKETUNING depending on available memory
Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>
commit 4f1cce84fb8217589b67dd3244fd3f8ccbe14e3d
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date: Tue Nov 7 15:27:31 2017 +0100
make.sh: Remove setting the EDITOR variable which we don't use
Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>
commit 1445a5ac436b4e29f227059ad8a1a1ceda327a2e
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date: Tue Nov 7 15:25:11 2017 +0100
make.sh: Add function to determine how many CPU cores the build host has
Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>
commit 7e1639a4810e5e70db94fdb0a0a98593d50d4290
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date: Tue Nov 7 15:26:25 2017 +0100
make.sh: Use -pipe in CFLAGS when host has >1GB of memory
Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>
commit 5190eea24f9822a63dc5d06d214b48f973b14f29
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date: Tue Nov 7 15:23:59 2017 +0100
make.sh: Determine how much memory the build host has
Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org>
-----------------------------------------------------------------------
Summary of changes:
make.sh | 30 +++++++--------------------
src/initscripts/system/unbound | 2 +-
tools/make-functions | 46 +++++++++++++++++++++++++++++++++++++++++-
3 files changed, 53 insertions(+), 25 deletions(-)
Difference in files:
diff --git a/make.sh b/make.sh
index 11be846..f4d474d 100755
--- a/make.sh
+++ b/make.sh
@@ -62,13 +62,17 @@ export BASEDIR LOGFILE
DIR_CHK=$BASEDIR/cache/check
mkdir $BASEDIR/log/ 2>/dev/null
-# Include funtions
-. tools/make-functions
-
+# Load configuration file
if [ -f .config ]; then
. .config
fi
+# Include funtions
+. tools/make-functions
+
+# Get the amount of memory in this build system
+HOST_MEM=$(system_memory)
+
if [ -n "${BUILD_ARCH}" ]; then
configure_build "${BUILD_ARCH}"
elif [ -n "${TARGET_ARCH}" ]; then
@@ -78,18 +82,6 @@ else
configure_build "default"
fi
-if [ -z $EDITOR ]; then
- for i in nano emacs vi; do
- EDITOR=$(which $i 2>/dev/null)
- if ! [ -z $EDITOR ]; then
- export EDITOR=$EDITOR
- break
- fi
- done
- [ -z $EDITOR ] && exiterror "You should have installed an editor."
-fi
-
-
prepareenv() {
############################################################################
# #
@@ -185,14 +177,6 @@ prepareenv() {
# Setup environment
set +h
LC_ALL=POSIX
- if [ -z $MAKETUNING ]; then
- CPU_COUNT="$(getconf _NPROCESSORS_ONLN 2>/dev/null)"
- if [ -z "${CPU_COUNT}" ]; then
- CPU_COUNT=1
- fi
-
- MAKETUNING="-j$(( ${CPU_COUNT} * 2 + 1 ))"
- fi
export LFS LC_ALL CFLAGS CXXFLAGS MAKETUNING
unset CC CXX CPP LD_LIBRARY_PATH LD_PRELOAD
diff --git a/src/initscripts/system/unbound b/src/initscripts/system/unbound
index e5554d7..4e7e63e 100644
--- a/src/initscripts/system/unbound
+++ b/src/initscripts/system/unbound
@@ -61,7 +61,7 @@ read_name_servers() {
local i
for i in 1 2; do
echo "$(</var/ipfire/red/dns${i})"
- done | xargs echo
+ done 2>/dev/null | xargs echo
}
config_header() {
diff --git a/tools/make-functions b/tools/make-functions
index b419253..9cf2fcf 100644
--- a/tools/make-functions
+++ b/tools/make-functions
@@ -60,6 +60,24 @@ WARN="\\033[1;35m"
FAIL="\\033[1;31m"
NORMAL="\\033[0;39m"
+system_processors() {
+ getconf _NPROCESSORS_ONLN 2>/dev/null || echo "1"
+}
+
+system_memory() {
+ local key val unit
+
+ while read -r key val unit; do
+ case "${key}" in
+ MemTotal:*)
+ # Convert to MB
+ echo "$(( ${val} / 1024 ))"
+ break
+ ;;
+ esac
+ done < /proc/meminfo
+}
+
configure_build() {
local build_arch="${1}"
@@ -124,8 +142,34 @@ configure_build() {
# Enables hardening
HARDENING_CFLAGS="-Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong --param=ssp-buffer-size=4"
- CFLAGS="-O2 -pipe -Wall -fexceptions -fPIC ${CFLAGS_ARCH}"
+ CFLAGS="-O2 -Wall -fexceptions -fPIC ${CFLAGS_ARCH}"
+
+ # Run compiler and assembler simultaneously on systems that have enough memory
+ if [ ${HOST_MEM} -ge 1024 ]; then
+ CFLAGS="${CFLAGS} -pipe"
+ fi
+
CXXFLAGS="${CFLAGS}"
+
+ # Determine parallelism
+ if [ -z "${MAKETUNING}" ]; then
+ # We assume that each process consumes about
+ # 192MB of memory. Therefore we find out how
+ # many processes fit into memory.
+ local mem_max=$(( ${HOST_MEM} / 192 ))
+
+ local processors="$(system_processors)"
+ local cpu_max=$(( ${processors} * 2 ))
+
+ local parallelism
+ if [ ${mem_max} -lt ${cpu_max} ]; then
+ parallelism=${mem_max}
+ else
+ parallelism=${cpu_max}
+ fi
+
+ MAKETUNING="-j${parallelism}"
+ fi
}
configure_build_guess() {
hooks/post-receive
--
IPFire 2.x development tree