From 25b97f5e44dd04ef4c0f65ca36f7dbe89698b0bd 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 | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/build b/build index 1ce17d4..33f68f1 100755 --- a/build +++ b/build @@ -1,7 +1,18 @@ #!/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)")")" +fi +export COSMOS FLAGS="-I deps/sokol \ -I deps/cimgui \