mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-23 19:54:50 +03:00
[ install ] Check if 'realpath' exists for Chez and Racket backends (#1210)
This commit is contained in:
parent
178f26ec17
commit
2ac4bea220
@ -9,12 +9,12 @@ trim_trailing_whitespace = true
|
||||
charset = utf-8
|
||||
|
||||
# Idris source files
|
||||
[{*.idr,*.ipkg,*.tex,*.yaff,*.lidr}]
|
||||
[*.{idr,ipkg,tex,yaff,lidr}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
# Various configuration files
|
||||
[*.yml,.ecrc]
|
||||
[{*.yml,.ecrc}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
@ -22,7 +22,7 @@ indent_size = 2
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[{*.c,*.h}]
|
||||
[*.{c,h}]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
@ -30,7 +30,13 @@ indent_size = 4
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[{*.sh,*.bat}]
|
||||
[*.sh]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
shell_variant = posix
|
||||
switch_case_indent = true
|
||||
|
||||
[*.bat]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
|
31
.gitignore
vendored
31
.gitignore
vendored
@ -1,6 +1,3 @@
|
||||
idris2docs_venv
|
||||
result
|
||||
*~
|
||||
*.ibc
|
||||
*.ttc
|
||||
*.ttm
|
||||
@ -10,14 +7,9 @@ result
|
||||
*.dll
|
||||
*.dylib
|
||||
|
||||
# Editor/IDE Related
|
||||
.\#* # Emacs swap file
|
||||
*~ # Vim swap file
|
||||
# VS Code
|
||||
.vscode/*
|
||||
|
||||
/build
|
||||
|
||||
idris2docs_venv
|
||||
/docs/build
|
||||
|
||||
/libs/**/build
|
||||
@ -27,22 +19,27 @@ result
|
||||
/tests/**/*.so
|
||||
/tests/**/*.dylib
|
||||
/tests/**/*.dll
|
||||
/tests/build/exec
|
||||
|
||||
/benchmark/**/build
|
||||
/benchmark/*.csv
|
||||
|
||||
/src/IdrisPaths.idr
|
||||
|
||||
/bootstrap/bin/
|
||||
/bootstrap/lib/
|
||||
/bootstrap/idris2-0*/
|
||||
/bootstrap/idris2_app/idris2-boot*
|
||||
/bootstrap/idris2-[0-9]*/
|
||||
/bootstrap/idris2_app/idris2-boot.*
|
||||
/bootstrap/idris2_app/libidris2_support.*
|
||||
/bootstrap/idris2-boot
|
||||
/bootstrap/idris2-boot.rkt
|
||||
|
||||
/src/IdrisPaths.idr
|
||||
|
||||
/custom.mk
|
||||
|
||||
#Mac OS
|
||||
# NixOS
|
||||
/result
|
||||
|
||||
# Editor/IDE Related
|
||||
*~ # Vim swap file
|
||||
.\#* # Emacs swap file
|
||||
.vscode/* # VS Code
|
||||
|
||||
# macOS
|
||||
.DS_Store
|
||||
|
8
bootstrap-stage1-chez.sh
Normal file → Executable file
8
bootstrap-stage1-chez.sh
Normal file → Executable file
@ -1,15 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e # Exit on any error
|
||||
set -e # exit on any error
|
||||
|
||||
echo "bootstrapping SCHEME=$SCHEME IDRIS2_VERSION=$IDRIS2_VERSION"
|
||||
if [ -z "$SCHEME" ] || [ -z "$IDRIS2_VERSION" ]; then
|
||||
echo "Required ENV not set."
|
||||
echo "Required SCHEME or IDRIS2_VERSION env is not set."
|
||||
if [ -z "$SCHEME" ]; then
|
||||
echo "Invoke with SCHEME=[name of chez scheme executable]"
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
echo "Bootstrapping SCHEME=$SCHEME IDRIS2_VERSION=$IDRIS2_VERSION"
|
||||
|
||||
# Compile the bootstrap scheme
|
||||
# TODO: Move boot-build to Makefile in bootstrap/Makefile
|
||||
@ -20,5 +20,5 @@ ${SCHEME} --script compile.ss
|
||||
# Put the result in the usual place where the target goes
|
||||
mkdir -p ../build/exec
|
||||
mkdir -p ../build/exec/idris2_app
|
||||
install idris2-boot ../build/exec/idris2
|
||||
install idris2-boot.sh ../build/exec/idris2
|
||||
install idris2_app/* ../build/exec/idris2_app
|
||||
|
8
bootstrap-stage1-racket.sh
Normal file → Executable file
8
bootstrap-stage1-racket.sh
Normal file → Executable file
@ -1,12 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e # Exit on any error
|
||||
set -e # exit on any error
|
||||
|
||||
echo "bootstrapping IDRIS2_VERSION=$IDRIS2_VERSION"
|
||||
if [ -z "$IDRIS2_VERSION" ]; then
|
||||
echo "Required ENV not set."
|
||||
echo "Required IDRIS2_VERSION env is not set."
|
||||
exit 1
|
||||
fi
|
||||
echo "Bootstrapping IDRIS2_VERSION=$IDRIS2_VERSION"
|
||||
|
||||
# Compile the bootstrap scheme
|
||||
cd bootstrap
|
||||
@ -16,5 +16,5 @@ raco exe idris2_app/idris2-boot.rkt
|
||||
# Put the result in the usual place where the target goes
|
||||
mkdir -p ../build/exec
|
||||
mkdir -p ../build/exec/idris2_app
|
||||
install idris2-rktboot ../build/exec/idris2
|
||||
install idris2-rktboot.sh ../build/exec/idris2
|
||||
install idris2_app/* ../build/exec/idris2_app
|
||||
|
2
bootstrap-stage2.sh
Normal file → Executable file
2
bootstrap-stage2.sh
Normal file → Executable file
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e # Exit on any error
|
||||
set -e # exit on any error
|
||||
|
||||
PREFIX=$PWD/bootstrap
|
||||
|
||||
|
20
bootstrap/idris2-boot
vendored
20
bootstrap/idris2-boot
vendored
@ -1,20 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
case `uname -s` in
|
||||
OpenBSD|FreeBSD|NetBSD)
|
||||
DIR="`grealpath $0`"
|
||||
;;
|
||||
|
||||
*)
|
||||
DIR="`realpath $0`"
|
||||
;;
|
||||
esac
|
||||
|
||||
if test -z "${SCHEME}"; then
|
||||
echo "SCHEME env var is not set" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:`dirname "$DIR"`/"idris2_app""
|
||||
export PATH="`dirname "$DIR"`/"idris2_app":$PATH"
|
||||
${SCHEME} --script "`dirname $DIR`"/"idris2_app/idris2-boot.so" "$@"
|
30
bootstrap/idris2-boot.sh
vendored
Executable file
30
bootstrap/idris2-boot.sh
vendored
Executable file
@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e # exit on any error
|
||||
|
||||
if [ -z "$SCHEME" ]; then
|
||||
echo "Required SCHEME env is not set."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case $(uname -s) in
|
||||
OpenBSD | FreeBSD | NetBSD)
|
||||
REALPATH="grealpath"
|
||||
;;
|
||||
|
||||
*)
|
||||
REALPATH="realpath"
|
||||
;;
|
||||
esac
|
||||
|
||||
if ! command -v "$REALPATH" >/dev/null; then
|
||||
echo "$REALPATH is required for Chez code generator."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DIR=$(dirname "$($REALPATH "$0")")
|
||||
LD_LIBRARY_PATH="$DIR/idris2_app":$LD_LIBRARY_PATH
|
||||
PATH="$DIR/idris2_app":$PATH
|
||||
export LD_LIBRARY_PATH PATH
|
||||
|
||||
${SCHEME} --script "$DIR/idris2_app/idris2-boot.so" "$@"
|
15
bootstrap/idris2-rktboot
vendored
15
bootstrap/idris2-rktboot
vendored
@ -1,15 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
case `uname -s` in
|
||||
OpenBSD|FreeBSD|NetBSD)
|
||||
DIR="`grealpath $0`"
|
||||
;;
|
||||
|
||||
*)
|
||||
DIR="`realpath $0`"
|
||||
;;
|
||||
esac
|
||||
|
||||
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:`dirname "$DIR"`/"idris2_app""
|
||||
export PATH="`dirname "$DIR"`/"idris2_app":$PATH"
|
||||
"`dirname $DIR`"/"idris2_app/idris2-boot" "$@"
|
31
bootstrap/idris2-rktboot.sh
vendored
Executable file
31
bootstrap/idris2-rktboot.sh
vendored
Executable file
@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e # exit on any error
|
||||
|
||||
if [ -z "$IDRIS2_VERSION" ]; then
|
||||
echo "Required IDRIS2_VERSION env is not set."
|
||||
exit 1
|
||||
fi
|
||||
echo "Bootstrapping IDRIS2_VERSION=$IDRIS2_VERSION"
|
||||
|
||||
case $(uname -s) in
|
||||
OpenBSD | FreeBSD | NetBSD)
|
||||
REALPATH="grealpath"
|
||||
;;
|
||||
|
||||
*)
|
||||
REALPATH="realpath"
|
||||
;;
|
||||
esac
|
||||
|
||||
if ! command -v "$REALPATH" >/dev/null; then
|
||||
echo "$REALPATH is required for Racket code generator."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DIR=$(dirname "$($REALPATH "$0")")
|
||||
LD_LIBRARY_PATH="$DIR/idris2_app":$LD_LIBRARY_PATH
|
||||
PATH="$DIR/idris2_app":$PATH
|
||||
export LD_LIBRARY_PATH PATH
|
||||
|
||||
"$DIR/idris2_app/idris2-boot" "$@"
|
@ -342,18 +342,26 @@ startChez : String -> String -> String
|
||||
startChez appdir target = unlines
|
||||
[ "#!/bin/sh"
|
||||
, ""
|
||||
, "case `uname -s` in "
|
||||
, " OpenBSD|FreeBSD|NetBSD) "
|
||||
, " DIR=\"`grealpath $0`\""
|
||||
, "set -e # exit on any error"
|
||||
, ""
|
||||
, "case $(uname -s) in "
|
||||
, " OpenBSD | FreeBSD | NetBSD)"
|
||||
, " REALPATH=\"grealpath\" "
|
||||
, " ;; "
|
||||
, " "
|
||||
, " *) "
|
||||
, " DIR=\"`realpath $0`\" "
|
||||
, " REALPATH=\"realpath\" "
|
||||
, " ;; "
|
||||
, "esac "
|
||||
, ""
|
||||
, "export LD_LIBRARY_PATH=\"`dirname \"$DIR\"`/\"" ++ appdir ++ "\":$LD_LIBRARY_PATH\""
|
||||
, "\"`dirname \"$DIR\"`\"/\"" ++ target ++ "\" \"$@\""
|
||||
, "if ! command -v \"$REALPATH\" >/dev/null; then "
|
||||
, " echo \"$REALPATH is required for Chez code generator.\""
|
||||
, " exit 1 "
|
||||
, "fi "
|
||||
, ""
|
||||
, "DIR=$(dirname \"$($REALPATH \"$0\")\")"
|
||||
, "export LD_LIBRARY_PATH=\"$DIR/" ++ appdir ++ "\":$LD_LIBRARY_PATH"
|
||||
, "\"$DIR/" ++ target ++ "\" \"$@\""
|
||||
]
|
||||
|
||||
startChezCmd : String -> String -> String -> String
|
||||
@ -367,10 +375,13 @@ startChezCmd chez appdir target = unlines
|
||||
startChezWinSh : String -> String -> String -> String
|
||||
startChezWinSh chez appdir target = unlines
|
||||
[ "#!/bin/sh"
|
||||
, "DIR=\"`realpath \"$0\"`\""
|
||||
, ""
|
||||
, "set -e # exit on any error"
|
||||
, ""
|
||||
, "DIR=$(dirname \"$(realpath \"$0\")\")"
|
||||
, "CHEZ=$(cygpath \"" ++ chez ++"\")"
|
||||
, "export PATH=\"`dirname \"$DIR\"`/\"" ++ appdir ++ "\":$PATH\""
|
||||
, "\"$CHEZ\" --script \"$(dirname \"$DIR\")/" ++ target ++ "\" \"$@\""
|
||||
, "export PATH=\"$DIR/" ++ appdir ++ "\":$PATH"
|
||||
, "\"$CHEZ\" --script \"$DIR/" ++ target ++ "\" \"$@\""
|
||||
]
|
||||
|
||||
||| Compile a TT expression to Chez Scheme
|
||||
|
@ -327,18 +327,26 @@ startRacket : String -> String -> String -> String
|
||||
startRacket racket appdir target = unlines
|
||||
[ "#!/bin/sh"
|
||||
, ""
|
||||
, "case `uname -s` in "
|
||||
, " OpenBSD|FreeBSD|NetBSD) "
|
||||
, " DIR=\"`grealpath $0`\""
|
||||
, "set -e # exit on any error"
|
||||
, ""
|
||||
, "case $(uname -s) in "
|
||||
, " OpenBSD | FreeBSD | NetBSD)"
|
||||
, " REALPATH=\"grealpath\" "
|
||||
, " ;; "
|
||||
, " "
|
||||
, " *) "
|
||||
, " DIR=\"`realpath $0`\" "
|
||||
, " REALPATH=\"realpath\" "
|
||||
, " ;; "
|
||||
, "esac "
|
||||
, ""
|
||||
, "export LD_LIBRARY_PATH=\"$LD_LIBRARY_PATH:`dirname \"$DIR\"`/\"" ++ appdir ++ "\"\""
|
||||
, racket ++ "\"`dirname \"$DIR\"`\"/\"" ++ target ++ "\" \"$@\""
|
||||
, "if ! command -v \"$REALPATH\" >/dev/null; then "
|
||||
, " echo \"$REALPATH is required for Racket code generator.\""
|
||||
, " exit 1 "
|
||||
, "fi "
|
||||
, ""
|
||||
, "DIR=$(dirname \"$($REALPATH \"$0\")\")"
|
||||
, "export LD_LIBRARY_PATH=\"$DIR/" ++ appdir ++ "\":$LD_LIBRARY_PATH"
|
||||
, racket ++ "\"$DIR/" ++ target ++ "\" \"$@\""
|
||||
]
|
||||
|
||||
startRacketCmd : String -> String -> String -> String
|
||||
@ -353,17 +361,10 @@ startRacketWinSh : String -> String -> String -> String
|
||||
startRacketWinSh racket appdir target = unlines
|
||||
[ "#!/bin/sh"
|
||||
, ""
|
||||
, "case `uname -s` in "
|
||||
, " OpenBSD|FreeBSD|NetBSD) "
|
||||
, " DIR=\"`grealpath $0`\""
|
||||
, " ;; "
|
||||
, " "
|
||||
, " *) "
|
||||
, " DIR=\"`realpath $0`\" "
|
||||
, " ;; "
|
||||
, "esac "
|
||||
, "set -e # exit on any error"
|
||||
, ""
|
||||
, "export PATH=\"`dirname \"$DIR\"`/\"" ++ appdir ++ "\":$PATH\""
|
||||
, "DIR=$(dirname \"$(realpath \"$0\")\")"
|
||||
, "export PATH=\"$DIR/" ++ appdir ++ "\":$PATH"
|
||||
, racket ++ "\"" ++ target ++ "\" \"$@\""
|
||||
]
|
||||
|
||||
|
@ -11,6 +11,7 @@ testbin:
|
||||
|
||||
clean:
|
||||
$(RM) -r build
|
||||
$(RM) -r **/**/build
|
||||
@find . -type f -name 'output' -exec rm -rf {} \;
|
||||
@find . -type f -name '*.ttc' -exec rm -f {} \;
|
||||
@find . -type f -name '*.ttm' -exec rm -f {} \;
|
||||
|
@ -1,5 +1,5 @@
|
||||
case `uname -s` in
|
||||
OpenBSD|FreeBSD|NetBSD)
|
||||
case $(uname -s) in
|
||||
OpenBSD | FreeBSD | NetBSD)
|
||||
MAKE=gmake
|
||||
;;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
case `uname -s` in
|
||||
OpenBSD|FreeBSD|NetBSD)
|
||||
case $(uname -s) in
|
||||
OpenBSD | FreeBSD | NetBSD)
|
||||
MAKE=gmake
|
||||
;;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
case `uname -s` in
|
||||
OpenBSD|FreeBSD|NetBSD)
|
||||
case $(uname -s) in
|
||||
OpenBSD | FreeBSD | NetBSD)
|
||||
MAKE=gmake
|
||||
;;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user