Mercurial Hosting > editor
changeset 65:a4a97e8c204f
mac build
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 06 Jun 2025 00:29:38 -0600 |
parents | 1c68552e8ac2 |
children | d10058fd247d |
files | scripts/install.sh scripts/mac/build.sh scripts/mac/install.sh scripts/mac/launcher scripts/mac/uninstall.sh scripts/uninstall.sh |
diffstat | 6 files changed, 44 insertions(+), 41 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/install.sh Thu Jun 05 12:48:30 2025 -0600 +++ b/scripts/install.sh Fri Jun 06 00:29:38 2025 -0600 @@ -12,20 +12,40 @@ export DICTIONARIES="$(pwd)/dictionaries/" for i in "$(pwd)"/jars/* ; do CLASSPATH="\$CLASSPATH:\$i" ; done -CLASSPATH="\$(echo -n \$CLASSPATH | sed 's/^://')" +CLASSPATH="\$(echo -n "\$CLASSPATH" | sed 's/^://')" mkdir -p ~/.luan_editor set +m +End -JAVA_OPTS='-Dfoo' -if [[ "\$(uname)" == "Darwin" ]]; then - JAVA_OPTS='-Xdock:name=Luan Editor' +if [[ "$(uname)" == "Darwin" ]]; then + +cat >>/usr/local/bin/luan_editor <<End + +function runJava() { + java -Xdock:name="Luan Editor" -Duser.home="\$HOME" -classpath "\$CLASSPATH" luan.Luan classpath:luan_editor/editor.luan "\$@" 2>&1 | grep --line-buffered -v 'NSRemoteView\|NSSavePanel' | tee ~/.luan_editor/error.log & +} + +if [[ \$# == 0 ]]; then + runJava +else + for file in "\$@"; do + runJava "\$file" + sleep 0.1 + done fi +End -java "\$JAVA_OPTS" -Duser.home="\$HOME" -classpath "\$CLASSPATH" luan.Luan classpath:luan_editor/editor.luan "\$@" 2>&1 | grep --line-buffered -v 'NSRemoteView\|NSSavePanel' | tee ~/.luan_editor/error.log & +else + +cat >>/usr/local/bin/luan_editor <<End + +java -Duser.home="\$HOME" -classpath "\$CLASSPATH" luan.Luan classpath:luan_editor/editor.luan "\$@" 2>&1 | tee ~/.luan_editor/error.log & End +fi + chmod +x /usr/local/bin/luan_editor -echo "the command 'luan_editor' has been installed" +echo "The command 'luan_editor' has been installed"
--- a/scripts/mac/build.sh Thu Jun 05 12:48:30 2025 -0600 +++ b/scripts/mac/build.sh Fri Jun 06 00:29:38 2025 -0600 @@ -12,12 +12,11 @@ mkdir mac/Luan_Editor.app/Contents mkdir mac/Luan_Editor.app/Contents/MacOS mkdir mac/Luan_Editor.app/Contents/Resources -mkdir mac/Luan_Editor.app/Contents/Resources/CLI cp ../scripts/mac/Info.plist mac/Luan_Editor.app/Contents cp ../scripts/mac/launcher mac/Luan_Editor.app/Contents/MacOS -cp ../scripts/mac/install.sh mac/Luan_Editor.app/Contents/Resources/CLI -cp ../scripts/mac/uninstall.sh mac/Luan_Editor.app/Contents/Resources/CLI +cp ../scripts/install.sh mac/Luan_Editor.app/Contents/Resources +cp ../scripts/uninstall.sh mac/Luan_Editor.app/Contents/Resources cp -r luan_editor/jars mac/Luan_Editor.app/Contents/Resources cp -r luan_editor/dictionaries mac/Luan_Editor.app/Contents/Resources
--- a/scripts/mac/install.sh Thu Jun 05 12:48:30 2025 -0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -#!/bin/bash -set -e - -cd "$(dirname $0)/.." - -mkdir -p /usr/local/bin - -cat >/usr/local/bin/luan_editor <<End -#!/bin/bash -set -e - -export DICTIONARIES="$(pwd)/dictionaries/" - -for i in "$(pwd)"/jars/* ; do CLASSPATH="\$CLASSPATH:\$i" ; done - -mkdir -p ~/.luan_editor - -set +m - -java -Xdock:name="Luan Editor" -Duser.home="\$HOME" -classpath "\$CLASSPATH" luan.Luan classpath:luan_editor/editor.luan "\$@" 2>&1 | grep --line-buffered -v 'NSRemoteView\|NSSavePanel' | tee ~/.luan_editor/error.log & -End - -chmod +x /usr/local/bin/luan_editor - -echo "the command 'luan_editor' has been installed"
--- a/scripts/mac/launcher Thu Jun 05 12:48:30 2025 -0600 +++ b/scripts/mac/launcher Fri Jun 06 00:29:38 2025 -0600 @@ -1,6 +1,22 @@ #!/bin/bash set -e + +JDK_PATH="/Library/Java/JavaVirtualMachines/zulu-8.jdk/Contents/Home" +JAVA_BIN="$JDK_PATH/bin/java" + +if [ ! -x "$JAVA_BIN" ]; then + if [[ $(uname -m) == "arm64" ]]; then + URL='https://www.azul.com/downloads/?version=java-8-lts&os=macos&architecture=arm-64-bit&package=jdk#zulu' + else + URL='https://www.azul.com/downloads/?version=java-8-lts&os=macos&architecture=x86-64-bit&package=jdk#zulu' + fi + /usr/bin/osascript -e "display dialog \"Luan Editor requires Zulu JDK 8.\n\nPlease install it from:\n$URL\" buttons {\"OK\"} default button \"OK\"" + open "$URL" + exit 1 +fi + + DIR="$(cd "$(dirname "$0")/../Resources" && pwd)" export DICTIONARIES="$DIR/dictionaries/"