mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2025-02-20 11:43:27 +08:00
run.sh: Improve compatibility with other systems (#1332)
* 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. * Update run.sh --------- Co-authored-by: Carter Li <CarterLi@users.noreply.github.com>
This commit is contained in:
parent
af09de319b
commit
99c0e9e719
28
run.sh
28
run.sh
@ -5,18 +5,22 @@ set -e
|
|||||||
mkdir -p build/
|
mkdir -p build/
|
||||||
cd build/
|
cd build/
|
||||||
|
|
||||||
if [ -z "${CMAKE_BUILD_TYPE}" ]; then
|
cmake ..
|
||||||
CMAKE_BUILD_TYPE=Release
|
|
||||||
fi
|
|
||||||
cmake "-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" ..
|
|
||||||
|
|
||||||
if [ -z "$OSTYPE" ] || [ "$OSTYPE" = "linux-gnu" ]; then
|
kernel_name="$(uname -s)"
|
||||||
cmake_build_args="-j$(nproc)"
|
|
||||||
elif [ "$OSTYPE" = "darwin" ]; then
|
case "${kernel_name}" in
|
||||||
cmake_build_args="-j$(sysctl -n hw.ncpu)"
|
"Linux" | "MINGW"*)
|
||||||
else
|
cmake_build_args="-j$(nproc)"
|
||||||
cmake_build_args=""
|
;;
|
||||||
fi
|
"Darwin" | *"BSD" | "DragonFly")
|
||||||
cmake --build . --target fastfetch ${cmake_build_args}
|
cmake_build_args="-j$(sysctl -n hw.ncpu)"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
cmake_build_args=""
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
cmake --build . --target fastfetch "${cmake_build_args}"
|
||||||
|
|
||||||
./fastfetch "$@"
|
./fastfetch "$@"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user