changeset 60:855669ece914

start mac installer
author Franklin Schmidt <fschmidt@gmail.com>
date Wed, 04 Jun 2025 22:24:57 -0600
parents 824f6d74b1d4
children 2bad9a272edc
files build.sh scripts/install.sh scripts/mac/Info.plist scripts/mac/install.sh scripts/mac/launcher scripts/mac/uninstall.sh scripts/uninstall.sh
diffstat 7 files changed, 103 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/build.sh	Wed Jun 04 18:21:45 2025 -0600
+++ b/build.sh	Wed Jun 04 22:24:57 2025 -0600
@@ -29,4 +29,28 @@
 
 luan_editor/install.sh || sudo luan_editor/install.sh
 
+mkdir mac
+mkdir mac/Luan_Editor.app
+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 -r luan_editor/jars mac/Luan_Editor.app/Contents/Resources
+cp -r luan_editor/dictionaries mac/Luan_Editor.app/Contents/Resources
+
+create-dmg \
+	--volname "Luan Editor" \
+	--window-pos 200 120 \
+	--window-size 500 300 \
+	--icon-size 100 \
+	--icon "Luan_Editor.app" 100 100 \
+	--app-drop-link 380 100 \
+	"Luan_Editor.dmg" \
+	"mac/"
+
 echo done
--- a/scripts/install.sh	Wed Jun 04 18:21:45 2025 -0600
+++ b/scripts/install.sh	Wed Jun 04 22:24:57 2025 -0600
@@ -1,18 +1,18 @@
 #!/bin/bash
-
 set -e
 
-cd $(dirname $0)
+cd "$(dirname $0)"
 
 mkdir -p /usr/local/bin
 
 cat >/usr/local/bin/luan_editor <<End
 #!/bin/bash
-
-export DICTIONARIES=$(pwd)/dictionaries/
+set -e
 
-for i in $(pwd)/jars/* ; do CLASSPATH=\$CLASSPATH:\$i ; done
-CLASSPATH=\$(echo -n \$CLASSPATH | sed 's/^://')
+export DICTIONARIES="$(pwd)/dictionaries/"
+
+for i in "$(pwd)"/jars/* ; do CLASSPATH="\$CLASSPATH:\$i" ; done
+CLASSPATH="\$(echo -n \$CLASSPATH | sed 's/^://')"
 
 mkdir -p ~/.luan_editor
 
@@ -23,7 +23,7 @@
 	JAVA_OPTS='-Xdock:name=Luan Editor'
 fi
 
-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 &
+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 &
 End
 
 chmod +x /usr/local/bin/luan_editor
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/mac/Info.plist	Wed Jun 04 22:24:57 2025 -0600
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
+	"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+	<dict>
+		<key>CFBundleName</key>
+		<string>Luan Editor</string>
+
+		<key>CFBundleDisplayName</key>
+		<string>Luan Editor</string>
+
+		<key>CFBundleIdentifier</key>
+		<string>software.luan.editor</string>
+
+		<key>CFBundleVersion</key>
+		<string>1.0</string>
+
+		<key>CFBundleExecutable</key>
+		<string>launcher</string>
+
+		<key>CFBundlePackageType</key>
+		<string>APPL</string>
+
+		<key>NSHighResolutionCapable</key>
+		<true/>
+	</dict>
+</plist>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/mac/install.sh	Wed Jun 04 22:24:57 2025 -0600
@@ -0,0 +1,25 @@
+#!/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"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/mac/launcher	Wed Jun 04 22:24:57 2025 -0600
@@ -0,0 +1,14 @@
+#!/bin/bash
+set -e
+
+DIR="$(cd "$(dirname "$0")/../Resources" && pwd)"
+
+export DICTIONARIES="$DIR/dictionaries/"
+
+for i in "$DIR"/jars/* ; do CLASSPATH="$CLASSPATH:$i" ; done
+
+mkdir -p ~/.luan_editor
+
+java -Xdock:name="Luan Editor" -classpath "$CLASSPATH" luan.Luan classpath:luan_editor/editor.luan "$@" 2>&1 | grep --line-buffered -v 'NSRemoteView\|NSSavePanel' | tee ~/.luan_editor/error.log
+
+exit ${PIPESTATUS[0]}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/mac/uninstall.sh	Wed Jun 04 22:24:57 2025 -0600
@@ -0,0 +1,5 @@
+#!/bin/bash
+set -e
+
+rm -f /usr/local/bin/luan_editor
+echo "luan_editor has been uninstalled"
--- a/scripts/uninstall.sh	Wed Jun 04 18:21:45 2025 -0600
+++ b/scripts/uninstall.sh	Wed Jun 04 22:24:57 2025 -0600
@@ -1,6 +1,6 @@
 #!/bin/bash
+set -e
 
-set -e
 rm -f /usr/local/bin/luan_editor
 cd `dirname $0`
 echo "luan_editor has been uninstalled"