summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2021-07-08 10:59:50 +0200
committerSimon Rettberg2021-07-08 10:59:50 +0200
commitdd0d0bfc34cb33c54c5968dd0f3cecda2966b1fe (patch)
treed00ea488b283543f312e81331e18a63abb4ba82a
parentsetup_target: Don't try to install packages already installed (diff)
downloadmltk-dd0d0bfc34cb33c54c5968dd0f3cecda2966b1fe.tar.gz
mltk-dd0d0bfc34cb33c54c5968dd0f3cecda2966b1fe.tar.xz
mltk-dd0d0bfc34cb33c54c5968dd0f3cecda2966b1fe.zip
Drop 32bit support, improve CPU detection
-rw-r--r--core/includes/packagemanager.inc2
-rw-r--r--core/includes/system.inc21
2 files changed, 8 insertions, 15 deletions
diff --git a/core/includes/packagemanager.inc b/core/includes/packagemanager.inc
index f50455a2..a40326e9 100644
--- a/core/includes/packagemanager.inc
+++ b/core/includes/packagemanager.inc
@@ -94,7 +94,7 @@ filter_installed_packages() {
existing["$i"]=1
done
for i in "$@"; do
- [ -n "${existing["${i}"]}" ] || [ -n "${existing["${i}:${AMD64_X86}"]}" ] || echo "$i"
+ [ -n "${existing["${i}"]}" ] || [ -n "${existing["${i}:${PLATFORM_DPKG}"]}" ] || echo "$i"
done
elif [ "$PACKET_HANDLER" == "rpm" ]; then
for i in "$@"; do
diff --git a/core/includes/system.inc b/core/includes/system.inc
index d852310e..5428263c 100644
--- a/core/includes/system.inc
+++ b/core/includes/system.inc
@@ -10,29 +10,22 @@ __init () {
ARCH_LIB_DIR=$(ldd $SHELL | grep "libc.so" | sed -r 's#^.*(/lib.*)/libc.so.*$#\1#g')
[ -z "$ARCH_LIB_DIR" -o ! -d "$ARCH_LIB_DIR" ] && perror "Could not determine arch dependent lib dir (where libc.so resides)"
- # determine number of CPU cores
- declare -rg CPU_CORES=$(cat /proc/cpuinfo | grep processor | wc -l)
+ # determine number of available CPU cores
+ declare -rg CPU_CORES="$( nproc || cat /proc/cpuinfo | grep processor | wc -l )"
# Determine if we have lib64
- if [ "$(uname -m)x" = "x86_64x" ]; then
+ if [ "$(uname -m)" = "x86_64" ]; then
# Setting LIB64, as openSuse differentiates but Ubuntu does not:
- case $SYS_DISTRIBUTION in
+ case "$SYS_DISTRIBUTION" in
ubuntu | debian) LIB64="lib" ;;
opensuse | fedora | centos) LIB64="lib64" ;;
*) perror "Cannot set LIB64, SYS_DISTRIBUTION: $SYS_DISTRIBUTION unknown!" ;;
esac
- AMD64_I386=amd64
X86_64_I386=x86_64
- X86_64_I586=x86_64
- AMD64_X86=amd64
+ PLATFORM_DPKG=amd64
ARCHREGEX="(amd64|x86[_-]64)"
else
- LIB64="lib"
- AMD64_I386=i386
- X86_64_I386=i386
- X86_64_I586=i586
- AMD64_X86=x86
- ARCHREGEX="(i[3456]86|x86[_-]32)"
+ perror "Unsupported architecture/platform."
fi
# Set up make args
@@ -45,7 +38,7 @@ __init () {
for cdir in "/usr/lib/ccache" "/lib/ccache" "/usr/local/ccache" ""; do
[ -d "$cdir" ] && break
done
- if [ -n "$cdir" ] && [ -d "/mnt/ccache" ] && grep -q /mnt/ccache /proc/mounts; then
+ if [ -n "$cdir" ] && mountpoint "/mnt/ccache"; then
export CCACHE_DIR="/mnt/ccache/gcc-${ver}"
export CCACHE_TEMPDIR="/tmp/ccache"
export CC="$cdir/gcc-${ver}"