mirror of
https://github.com/anoma/juvix.git
synced 2024-12-02 10:47:32 +03:00
c50ad06976
* Closes #3077 * Closes #3100 * Adds a compilation-time configuration script that creates a `config/config.json` file which is then read by the `Makefile`/`justfile` and embedded into the Juvix binary.
36 lines
536 B
Bash
Executable File
36 lines
536 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
if [ ! -d "config" ]; then
|
|
printf "This script should be run from the root of the project.\n" 1>&2
|
|
exit 1
|
|
fi
|
|
|
|
if [ -z "$CC" ]; then
|
|
CC="clang"
|
|
fi
|
|
|
|
if [ -z "$CARGO" ]; then
|
|
CARGO="cargo"
|
|
fi
|
|
|
|
if $CC -target wasm32-wasi --print-supported-cpus >/dev/null 2>&1; then
|
|
WASM="true"
|
|
else
|
|
WASM="false"
|
|
fi
|
|
|
|
if $CARGO --version >/dev/null 2>&1; then
|
|
RUST="true"
|
|
else
|
|
RUST="false"
|
|
fi
|
|
|
|
cat <<EOF > config/config.json
|
|
{
|
|
"wasm": $WASM,
|
|
"rust": $RUST,
|
|
"clang": "$CC",
|
|
"cargo": "$CARGO"
|
|
}
|
|
EOF
|