From cc1491be821a3435eb9543ad03f9230590a14b91 Mon Sep 17 00:00:00 2001 From: red-magic <34750463+red-magic@users.noreply.github.com> Date: Thu, 10 Oct 2024 21:08:06 +0600 Subject: [PATCH 1/2] run.sh: Improve compatibility with other systems For example $OSTYPE is empty in OpenBSD and the script fallsback to Linux option, with nproc isn't present it fails to build. --- run.sh | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/run.sh b/run.sh index aebcfc9d9c..e77053492d 100755 --- a/run.sh +++ b/run.sh @@ -8,15 +8,23 @@ cd build/ if [ -z "${CMAKE_BUILD_TYPE}" ]; then CMAKE_BUILD_TYPE=Release fi + cmake "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" .. -if [ -z "$OSTYPE" ] || [ "$OSTYPE" = "linux-gnu" ]; then - cmake_build_args="-j$(nproc)" -elif [ "$OSTYPE" = "darwin" ]; then - cmake_build_args="-j$(sysctl -n hw.ncpu)" -else - cmake_build_args="" -fi -cmake --build . --target fastfetch ${cmake_build_args} +kernel_name="$(uname -s)" + +case "${kernel_name}" in + "Linux") + cmake_build_args="-j$(nproc)" + ;; + "Darwin" | *"BSD" | "DragonFly") + cmake_build_args="-j$(sysctl -n hw.ncpu)" + ;; + *) + cmake_build_args="" + ;; +esac + +cmake --build . --target fastfetch "${cmake_build_args}" ./fastfetch "$@" From 0480594535b5a86e2ea45f43f3c3cf3e5f01c52e Mon Sep 17 00:00:00 2001 From: Carter Li Date: Thu, 10 Oct 2024 23:38:16 +0800 Subject: [PATCH 2/2] Update run.sh --- run.sh | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/run.sh b/run.sh index e77053492d..55071e4003 100755 --- a/run.sh +++ b/run.sh @@ -5,16 +5,12 @@ set -e mkdir -p build/ cd build/ -if [ -z "${CMAKE_BUILD_TYPE}" ]; then - CMAKE_BUILD_TYPE=Release -fi - -cmake "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" .. +cmake .. kernel_name="$(uname -s)" case "${kernel_name}" in - "Linux") + "Linux" | "MINGW"*) cmake_build_args="-j$(nproc)" ;; "Darwin" | *"BSD" | "DragonFly")