mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2026-12-01 06:28:02 -06:00
By default FreeBSD does not have the Bourne-again shell (Bash) installed. Therefore, the system fails to execute two ``find'' scripts (etc/scripts/find-node and etc/scripts/find-yarn) running by the Makefile within the `.node-bin` and `.yarn-bin` targets. I see nothing Bash-specific in those scripts. Also I believe that `[[ expression ]]` commands in those particular cases can be safely replaced with the `test` built-in commands. With these changes I can now run a local ``Compiler explorer'' instance on FreeBSD. Signed-off-by: Ruslan Garipov <ruslanngaripov@gmail.com>
44 lines
1.3 KiB
Bash
Executable File
44 lines
1.3 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
set -e
|
|
OUT="$1"
|
|
|
|
find_node() {
|
|
local NODE="${NODE_DIR}/bin/node"
|
|
local CE_NODE="/opt/compiler-explorer/node/bin/node"
|
|
local SYS_NODE="$(which node 2>/dev/null)"
|
|
local SYS_NODEJS="$(which nodejs 2>/dev/null)"
|
|
|
|
if test -x "${NODE}"; then
|
|
echo "${NODE}"
|
|
elif test -x "${CE_NODE}"; then
|
|
echo "${CE_NODE}"
|
|
elif test -x "${SYS_NODE}"; then
|
|
echo "${SYS_NODE}"
|
|
elif test -x "${SYS_NODEJS}"; then
|
|
echo "${SYS_NODEJS}"
|
|
else
|
|
>&2 echo "Unable to find a node"
|
|
fi
|
|
}
|
|
|
|
NODE=$(find_node)
|
|
|
|
NODE_VERSION_USED=8
|
|
NODE_VERSION=$(${NODE} --version)
|
|
NODE_MAJOR_VERSION=$(echo ${NODE_VERSION} | cut -f1 -d. | sed 's/^v//g')
|
|
|
|
if test ${NODE_MAJOR_VERSION} -lt ${NODE_VERSION_USED}; then
|
|
>&2 echo Compiler Explorer needs node v${NODE_VERSION_USED}.x, but ${NODE_VERSION} was found.
|
|
>&2 echo Visit https://nodejs.org/ for installation instructions
|
|
>&2 echo To configure where we look for node, set NODE_DIR to its installation base
|
|
exit 1
|
|
fi
|
|
|
|
if test ${NODE_MAJOR_VERSION} -gt ${NODE_VERSION_USED}; then
|
|
>&2 echo Compiler Explorer needs node v${NODE_VERSION_USED}.x, but ${NODE_VERSION} was found.
|
|
>&2 echo The higher node version might work but it has not been tested.
|
|
fi
|
|
|
|
echo ${NODE} > ${OUT}
|