From 080190eb5825532d29b2369112851ca43eeaa5ca Mon Sep 17 00:00:00 2001 From: Zephyr Lykos Date: Thu, 14 Nov 2024 16:15:49 +0800 Subject: [PATCH] build: autodetect cosmocc in path --- build | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/build b/build index 1ce17d4..09a84f9 100755 --- a/build +++ b/build @@ -1,7 +1,19 @@ #!/bin/sh -e -export COSMO="${COSMO:-/opt/cosmo}" -export COSMOS="${COSMOS:-/opt/cosmos}" +COSMOS="${COSMOS:-/opt/cosmos}" +if ! [ -d "${COSMOS}" ] && [ -f "${COSMOS}/bin/cosmocc" ] +then + if ! command -v cosmocc >/dev/null + then + echo "You need to add cosmopolitan toolchain to your environment variable:" + echo "export COSMOS=/opt/cosmos" + exit 1 + fi + + COSMOS="$(dirname "$(dirname "$(command -v cosmocc)")")" + export COSMOS +fi +export COSMOS FLAGS="-I deps/sokol \ -I deps/cimgui \