Skip to content

Commit

Permalink
macosx: Create Mac OS X installer
Browse files Browse the repository at this point in the history
Install snekde, docs and firmware images

Signed-off-by: Keith Packard <keithp@keithp.com>
  • Loading branch information
keith-packard committed Mar 31, 2019
1 parent 10bf5da commit 0251f51
Show file tree
Hide file tree
Showing 7 changed files with 226 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Makefile
Expand Up @@ -19,7 +19,7 @@ include snek-install.defs

SNEK_OTHEROS?=1
ifeq ($(SNEK_OTHEROS),1)
SNEK_OTHEROS_DIR=linux windows
SNEK_OTHEROS_DIR=linux windows macosx
endif

SUBDIRS = posix snek-duino metro-snek snekde doc examples $(SNEK_OTHEROS_DIR)
Expand Down Expand Up @@ -63,6 +63,7 @@ upload:
+cd doc && make upload
+cd linux && make upload
+cd windows && make upload
+cd macosx && make upload

snek.pc: snek.pc.in
$(SNEK_SED) $^ > $@
36 changes: 36 additions & 0 deletions macosx/Info.plist.in
@@ -0,0 +1,36 @@
<?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>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDisplayName</key>
<string>SnekDE</string>
<key>CFBundleExecutable</key>
<string>snekde</string>
<key>CFBundleIconFile</key>
<string>snek.icns</string>
<key>CFBundleIdentifier</key>
<string>com.keithp.snekde</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>snekde</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>@SNEK_VERSION@</string>
<key>CFBundleSignature</key>
<string>Snek</string>
<key>CFBundleVersion</key>
<string>@SNEK_VERSION@</string>
<key>LSHasLocalizedDisplayName</key>
<false/>
<key>NSAppleScriptEnabled</key>
<false/>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2019 Keith Packard</string>
<key>CFBundleGetInfoString</key>
<string>Snek DE version @SNEK_VERSION@</string>
</dict>
</plist>
73 changes: 73 additions & 0 deletions macosx/Makefile
@@ -0,0 +1,73 @@
#
# Copyright © 2019 Keith Packard <keithp@keithp.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#

SNEK_NO_BUILD_TARGETS = 1
SNEK_ROOT=..

include $(SNEK_ROOT)/snek-install.defs

MACOSX_RES=16 32 128 256 512
MACOSX_ICON_PNGS = $(shell for i in $(MACOSX_RES); do echo snek-$$i.png; done)
MACOSX_ICON = snek.icns
MACOSX_DIST = snek-mac-$(SNEK_VERSION).dmg

MACOSX_SCRIPTS = runsnekde snekde

MACOSX_INSTALL = install-macosx

MACOSX_DOCS = ../doc/snek.pdf ../COPYING ReadMe-Mac.rtf

MACOSX_FILES=../snekde/snekde.py serial Info.plist $(MACOSX_ICON) $(MACOSX_SCRIPTS) $(MACOSX_INSTALL) $(MACOSX_DOCS) ../examples/*.py

all: $(MACOSX_ICON) serial $(MACOSX_DIST)

$(MACOSX_ICON): ../snek.svg
for i in $(MACOSX_RES); do rsvg-convert -w $$i -h $$i -o snek-$$i.png $^; done
png2icns $@ $(MACOSX_ICON_PNGS)

$(MACOSX_DIST): $(MACOSX_FILES)
rm -f $@
rm -rf macosx
mkdir -p macosx/snekde.app/Contents/Resources macosx/snekde.app/Contents/MacOS macosx/examples
echo 'APPLSN.O' > macosx/snekde.app/Contents/PkgInfo
cp -a $(MACOSX_DOCS) macosx
cp -a $(MACOSX_INSTALL) macosx
cp -a ../examples/* macosx/examples
cp -p Info.plist macosx/snekde.app/Contents
cp -p $(MACOSX_ICON) macosx/snekde.app/Contents/Resources
cp -a ../snekde/snekde.py macosx/snekde.app/Contents/Resources
cp -a serial macosx/snekde.app/Contents/Resources
cp -p $(MACOSX_SCRIPTS) macosx/snekde.app/Contents/MacOS/
genisoimage -D -V Snek-$(SNEK_VERSION) -no-pad -r -apple -o $@ macosx

serial: always
rsync -a --delete --delete-excluded --exclude '__pycache__' --exclude '*.pyc' /usr/lib/python3/dist-packages/serial/ serial

always:

Info.plist: Info.plist.in
$(SNEK_SED) $^ > $@

install:
echo install done

upload: $(MACOSX_DIST)
rsync -avz $(MACOSX_DIST) $(SNEKDIST)

clean:
rm -rf serial
rm -f $(MACOSX_ICON) $(MACOSX_ICON_PNGS)
rm -f Info.plist
rm -rf macosx $(MACOSX_DIST)

68 changes: 68 additions & 0 deletions macosx/ReadMe-Mac.rtf
@@ -0,0 +1,68 @@
{\rtf1\ansi\deff3\adeflang1025
{\fonttbl{\f0\froman\fprq2\fcharset0 Times New Roman;}{\f1\froman\fprq2\fcharset2 Symbol;}{\f2\fswiss\fprq2\fcharset0 Arial;}{\f3\froman\fprq2\fcharset0 Liberation Serif{\*\falt Times New Roman};}{\f4\froman\fprq2\fcharset0 Arial;}{\f5\froman\fprq2\fcharset0 Helvetica LT Std;}{\f6\froman\fprq2\fcharset0 Helvetica{\*\falt Arial};}{\f7\fnil\fprq2\fcharset0 Helvetica LT Std;}{\f8\fnil\fprq2\fcharset0 Liberation Serif{\*\falt Times New Roman};}{\f9\fnil\fprq2\fcharset0 Helvetica{\*\falt Arial};}}
{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}
{\stylesheet{\s0\snext0\ql\nowidctlpar\hyphpar0\ltrpar\cf0\kerning1\dbch\af8\langfe1081\dbch\af8\afs24\alang1081\loch\f3\fs24\lang1033 Normal;}
{\*\cs15\snext15 Numbering Symbols;}
{\s16\sbasedon0\snext17\ql\nowidctlpar\hyphpar0\sb240\sa120\keepn\ltrpar\cf0\kerning1\dbch\af8\langfe1081\dbch\af8\afs24\loch\f4\fs28\lang1033 Heading;}
{\s17\sbasedon0\snext17\sl276\slmult1\ql\nowidctlpar\hyphpar0\sb0\sa140\ltrpar\cf0\kerning1\dbch\af8\langfe1081\dbch\af8\afs24\loch\f3\fs24\lang1033 Text Body;}
{\s18\sbasedon17\snext18\sl276\slmult1\ql\nowidctlpar\hyphpar0\sb0\sa120\ltrpar\cf0\kerning1\dbch\af8\langfe1081\dbch\af8\afs24\loch\f3\fs24\lang1033 List;}
{\s19\sbasedon0\snext19\ql\nowidctlpar\hyphpar0\sb120\sa120\ltrpar\cf0\i\kerning1\dbch\af8\langfe1081\dbch\af8\afs24\loch\f3\fs24\lang1033 Caption;}
{\s20\sbasedon0\snext20\ql\nowidctlpar\hyphpar0\ltrpar\cf0\kerning1\dbch\af8\langfe1081\dbch\af8\afs24\loch\f3\fs24\lang1033 Index;}
{\s21\sbasedon0\snext21\ql\nowidctlpar\hyphpar0\sb0\sa120\ltrpar\cf0\kerning1\dbch\af8\langfe1081\dbch\af8\afs24\loch\f3\fs24\lang1033 Text body;}
}{\*\listtable{\list\listtemplateid1
{\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow0{\leveltext \'02\'00);}{\levelnumbers\'01;}\fi-360\li720}
{\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow0{\leveltext \'02\'01.;}{\levelnumbers\'01;}\fi-360\li1080}
{\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow0{\leveltext \'02\'02.;}{\levelnumbers\'01;}\fi-360\li1440}
{\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow0{\leveltext \'02\'03.;}{\levelnumbers\'01;}\fi-360\li1800}
{\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow0{\leveltext \'02\'04.;}{\levelnumbers\'01;}\fi-360\li2160}
{\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow0{\leveltext \'02\'05.;}{\levelnumbers\'01;}\fi-360\li2520}
{\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow0{\leveltext \'02\'06.;}{\levelnumbers\'01;}\fi-360\li2880}
{\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow0{\leveltext \'02\'07.;}{\levelnumbers\'01;}\fi-360\li3240}
{\listlevel\levelnfc0\leveljc0\levelstartat1\levelfollow0{\leveltext \'02\'08.;}{\levelnumbers\'01;}\fi-360\li3600}\listid1}
{\list\listtemplateid2
{\listlevel\levelnfc255\leveljc0\levelstartat1\levelfollow2{\leveltext \'00;}{\levelnumbers;}\fi0\li0}
{\listlevel\levelnfc255\leveljc0\levelstartat1\levelfollow2{\leveltext \'00;}{\levelnumbers;}\fi0\li0}
{\listlevel\levelnfc255\leveljc0\levelstartat1\levelfollow2{\leveltext \'00;}{\levelnumbers;}\fi0\li0}
{\listlevel\levelnfc255\leveljc0\levelstartat1\levelfollow2{\leveltext \'00;}{\levelnumbers;}\fi0\li0}
{\listlevel\levelnfc255\leveljc0\levelstartat1\levelfollow2{\leveltext \'00;}{\levelnumbers;}\fi0\li0}
{\listlevel\levelnfc255\leveljc0\levelstartat1\levelfollow2{\leveltext \'00;}{\levelnumbers;}\fi0\li0}
{\listlevel\levelnfc255\leveljc0\levelstartat1\levelfollow2{\leveltext \'00;}{\levelnumbers;}\fi0\li0}
{\listlevel\levelnfc255\leveljc0\levelstartat1\levelfollow2{\leveltext \'00;}{\levelnumbers;}\fi0\li0}
{\listlevel\levelnfc255\leveljc0\levelstartat1\levelfollow2{\leveltext \'00;}{\levelnumbers;}\fi0\li0}\listid2}
}{\listoverridetable{\listoverride\listid1\listoverridecount0\ls1}{\listoverride\listid2\listoverridecount0\ls2}}{\*\generator LibreOffice/6.1.5.2$Linux_X86_64 LibreOffice_project/10$Build-2}{\info{\creatim\yr2013\mo1\dy6\hr13\min7}{\revtim\yr2019\mo3\dy30\hr17\min56}{\printim\yr0\mo0\dy0\hr0\min0}}{\*\userprops}\deftab709
\hyphauto0\viewscale150
{\*\pgdsctbl
{\pgdsc0\pgdscuse451\pgwsxn12240\pghsxn15840\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\pgdscnxt0 Default Style;}}
\formshade{\*\pgdscno0}\paperh15840\paperw12240\margl1134\margr1134\margt1134\margb1134\sectd\sbknone\sectunlocked1\pgndec\pgwsxn12240\pghsxn15840\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\ftnbj\ftnstart1\ftnrstcont\ftnnar\aenddoc\aftnrstcont\aftnstart1\aftnnrlc
{\*\ftnsep\chftnsep}\pgndec\pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf0\kerning1\dbch\af8\langfe1081\dbch\af8\afs24\alang1081\loch\f3\fs24\lang1033{\dbch\af7\dbch\af7\rtlch \ltrch\loch\loch\f5\hich\af5
Installing }{\dbch\af7\dbch\af7\rtlch \ltrch\loch\loch\f5\hich\af5
Snek}{\dbch\af7\dbch\af7\rtlch \ltrch\loch\loch\f5\hich\af5
software for Mac OS X Computers}
\par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf0\kerning1\dbch\af8\langfe1081\dbch\af8\afs24\alang1081\loch\f3\fs24\lang1033\dbch\af9\dbch\af9\rtlch \ltrch\loch\loch\f6\hich\af6

\par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf0\kerning1\dbch\af8\langfe1081\dbch\af8\afs24\alang1081\loch\f3\fs24\lang1033{\dbch\af7\dbch\af7\rtlch \ltrch\loch\loch\f5\hich\af5
The }{\dbch\af7\dbch\af7\rtlch \ltrch\loch\loch\f5\hich\af5
Snek}{\dbch\af7\dbch\af7\rtlch \ltrch\loch\loch\f5\hich\af5
distribution for Mac OS X consists of:}
\par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf0\kerning1\dbch\af8\langfe1081\dbch\af8\afs24\alang1081\loch\f3\fs24\lang1033\dbch\af7\dbch\af7\rtlch \ltrch\loch\loch\f5\hich\af5

\par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf0\kerning1\dbch\af8\langfe1081\dbch\af8\afs24\alang1081\loch\f3\fs24\lang1033{\listtext\pard\plain 1)\tab}\ilvl0\ls1 \li1440\ri0\lin1440\rin0\fi-360\li720\ri0\lin720\rin0\fi-360{\dbch\af7\dbch\af7\rtlch \ltrch\loch\loch\f5\hich\af5
The }{\dbch\af7\dbch\af7\rtlch \ltrch\loch\loch\f5\hich\af5
SnekDE}{\dbch\af7\dbch\af7\rtlch \ltrch\loch\loch\f5\hich\af5
application}
\par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf0\kerning1\dbch\af8\langfe1081\dbch\af8\afs24\alang1081\loch\f3\fs24\lang1033{\listtext\pard\plain 2)\tab}\ilvl0\ls1 \li1440\ri0\lin1440\rin0\fi-360\li720\ri0\lin720\rin0\fi-360{\dbch\af7\dbch\af7\rtlch \ltrch\loch\loch\f5\hich\af5
Snek}{\dbch\af7\dbch\af7\rtlch \ltrch\loch\loch\f5\hich\af5
firmware for }{\dbch\af7\dbch\af7\rtlch \ltrch\loch\loch\f5\hich\af5
embedded computers}
\par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf0\kerning1\dbch\af8\langfe1081\dbch\af8\afs24\alang1081\loch\f3\fs24\lang1033\dbch\af7\dbch\af7\rtlch \ltrch\loch\loch\f5\hich\af5

\par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf0\kerning1\dbch\af8\langfe1081\dbch\af8\afs24\alang1081\loch\f3\fs24\lang1033{\dbch\af7\dbch\af7\rtlch \ltrch\loch\loch\f5\hich\af5
Install the }{\dbch\af7\dbch\af7\rtlch \ltrch\loch\loch\f5\hich\af5
SnekDE}{\dbch\af7\dbch\af7\rtlch \ltrch\loch\loch\f5\hich\af5
application by control-clicking the install-macosx script and selecting \u8220\'93Open\u8221\'94 from the menu. This will display a dialog asking if you are sure you want to open it. Select \u8220\'93Open\u8221\'94 from the dialog to execute the script. This will install the software, documentation and firmware in your home Applications folder. You can move it afterwards if you choose.}
\par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf0\kerning1\dbch\af8\langfe1081\dbch\af8\afs24\alang1081\loch\f3\fs24\lang1033\dbch\af7\dbch\af7\rtlch \ltrch\loch\loch\f5\hich\af5

\par \pard\plain \s0\ql\nowidctlpar\hyphpar0\ltrpar\cf0\kerning1\dbch\af8\langfe1081\dbch\af8\afs24\alang1081\loch\f3\fs24\lang1033\sl240\slmult1\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640{\dbch\af9\dbch\af9\rtlch \ltrch\loch\loch\f6\hich\af6
Have fun with Snek}{\dbch\af9\dbch\af9\rtlch \ltrch\loch\loch\f6\hich\af6
!}
\par }
37 changes: 37 additions & 0 deletions macosx/install-macosx
@@ -0,0 +1,37 @@
#!/bin/bash
echo -e '\033[34mInstalling Snek\033[39m'
dir=`dirname "$0"`
cd "$dir"
echo -e '\033[34mPreparing Snek directory\033[39m'
mkdir -p ~/Applications/Snek
find ~/Applications/Snek -type d -print0 | xargs -0 chmod +w
echo -n -e '\033[34mCopying Snek files ... \033[39m'
cp -f -a * ~/Applications/Snek
case $? in
0)
echo -e '\033[32mSuccess\033[39m'
;;
*)
echo -e '\033[31mFailed\033[39m'
;;
esac
echo -n -e '\033[34mAdjusting installed files ... \033[39m'
find ~/Applications/Snek -print0 | xargs -0 chmod +w
case $? in
0)
echo -n -e '\033[32mchmod success ... \033[39m'
;;
*)
echo -n -e '\033[31mchmod failed ... \033[39m'
;;
esac
find ~/Applications/Snek -print0 | xargs -0 xattr -c
case $? in
0)
echo -e '\033[32mxattr -c success\033[39m'
;;
*)
echo -e '\033[31mxattr -c failed\033[39m'
;;
esac
echo -e '\033[34All done\033[39m'
7 changes: 7 additions & 0 deletions macosx/runsnekde
@@ -0,0 +1,7 @@
#!/bin/bash
echo -n -e "\033]0;SnekDE\007"
ME=`dirname $0`
export PYTHONPATH="$ME"/../Resources/lib/python3.7
python3 "$ME"/../Resources/snekde.py
osascript -e 'tell application "Terminal" to close front window' &
exit 0
3 changes: 3 additions & 0 deletions macosx/snekde
@@ -0,0 +1,3 @@
#!/bin/bash
ME=`dirname $0`
open -a Terminal $ME/runsnekde

0 comments on commit 0251f51

Please sign in to comment.