# prepare Mac OSX package root directory in ../Package_contents

VERSION=10.7.0

datadir=Package_contents/usr/local/share
bindir=Package_contents/usr/local/bin
mandir=Package_contents/usr/local/share/man
appdir=Package_contents/Applications

GUISERVER = ../Package_contents/usr/local/share/newlisp/guiserver

darwin-package:
	-mkdir Package_contents
	-mkdir Package_contents/usr/
	-mkdir Package_contents/usr/local
	-mkdir Package_contents/usr/local/bin
	-mkdir Package_contents/usr/local/share
	-mkdir Package_contents/usr/local/share/man
	-mkdir Package_contents/usr/local/share/man/man1
	-mkdir Package_contents/Applications
	# identical from install section in main Makefile except for $(bindir)/newlisp
	# which installed versioned and linked when installing with 'make install'
	-install -d $(datadir)/newlisp
	-install -d $(datadir)/newlisp/modules
	-install -d $(datadir)/newlisp/util
	-install -d $(datadir)/doc/newlisp
	-install -m 755 newlisp $(bindir)/newlisp
	-install -m 755 util/newlispdoc $(bindir)/newlispdoc
	-install -m 644 util/syntax.cgi $(datadir)/newlisp/util/syntax.cgi
	-install -m 644 util/newlisp.vim $(datadir)/newlisp/util/newlisp.vim
	-install -m 644 doc/COPYING $(datadir)/doc/newlisp/COPYING
	-install -m 644 doc/CREDITS $(datadir)/doc/newlisp/CREDITS
	-install -m 644 doc/newlisp_manual.html $(datadir)/doc/newlisp/newlisp_manual.html
	-install -m 644 doc/newlisp_index.html $(datadir)/doc/newlisp/newlisp_index.html
	-install -m 644 doc/manual_frame.html $(datadir)/doc/newlisp/manual_frame.html
	-install -m 644 doc/CodePatterns.html $(datadir)/doc/newlisp/CodePatterns.html
	-install -m 644 doc/newLISPdoc.html $(datadir)/doc/newlisp/newLISPdoc.html
	-install -m 644 doc/newLISP-$(VERSION)-Release.html $(datadir)/doc/newlisp/newLISP-$(VERSION)-Release.html
	-install -m 644 doc/newlisp.1 $(mandir)/man1/newlisp.1
	-install -m 644 doc/newlispdoc.1 $(mandir)/man1/newlispdoc.1
	-install -m 644 modules/canvas.lsp $(datadir)/newlisp/modules/canvas.lsp
	-install -m 644 modules/cgi.lsp $(datadir)/newlisp/modules/cgi.lsp
	-install -m 644 modules/crypto.lsp $(datadir)/newlisp/modules/crypto.lsp
	-install -m 644 modules/ftp.lsp $(datadir)/newlisp/modules/ftp.lsp
	-install -m 644 modules/getopts.lsp $(datadir)/newlisp/modules/getopts.lsp
	-install -m 644 modules/gsl.lsp $(datadir)/newlisp/modules/gsl.lsp
	-install -m 644 modules/infix.lsp $(datadir)/newlisp/modules/infix.lsp
	-install -m 644 modules/mysql.lsp $(datadir)/newlisp/modules/mysql.lsp
	-install -m 644 modules/odbc.lsp $(datadir)/newlisp/modules/odbc.lsp
	-install -m 644 modules/plot.lsp $(datadir)/newlisp/modules/plot.lsp
	-install -m 644 modules/pop3.lsp $(datadir)/newlisp/modules/pop3.lsp
	-install -m 644 modules/postgres.lsp $(datadir)/newlisp/modules/postgres.lsp
	-install -m 644 modules/postscript.lsp $(datadir)/newlisp/modules/postscript.lsp
	-install -m 644 modules/smtp.lsp $(datadir)/newlisp/modules/smtp.lsp
	-install -m 644 modules/smtpx.lsp $(datadir)/newlisp/modules/smtpx.lsp
	-install -m 644 modules/sqlite3.lsp $(datadir)/newlisp/modules/sqlite3.lsp
	-install -m 644 modules/stat.lsp $(datadir)/newlisp/modules/stat.lsp
	-install -m 644 modules/unix.lsp $(datadir)/newlisp/modules/unix.lsp
	-install -m 644 modules/xmlrpc-client.lsp $(datadir)/newlisp/modules/xmlrpc-client.lsp
	-install -m 644 modules/zlib.lsp $(datadir)/newlisp/modules/zlib.lsp
	# GUI-Server install
	-install -d $(datadir)/newlisp/guiserver
	-install -d $(datadir)/doc/newlisp/guiserver
	-install -m 755 guiserver/newlisp-edit.lsp $(bindir)/newlisp-edit
	-install -m 644 guiserver/guiserver.jar $(datadir)/newlisp/guiserver.jar
	-install -m 644 guiserver/guiserver.lsp $(datadir)/newlisp/guiserver.lsp
	-install -m 644 guiserver/images/newLISP128.png $(datadir)/newlisp/newLISP128.png
	-install -m 644 guiserver/COPYING $(datadir)/doc/newlisp/guiserver/COPYING
	-install -m 644 guiserver/index-gs.html $(datadir)/doc/newlisp/guiserver/index-gs.html
	-install -m 644 guiserver/guiserver.lsp.html $(datadir)/doc/newlisp/guiserver/guiserver.lsp.html
	-install -m 644 util/newlispdoc.css $(datadir)/doc/newlisp/guiserver/newlispdoc.css
	-install -m 644 guiserver/allfonts-demo.lsp $(datadir)/newlisp/guiserver/allfonts-demo.lsp
	-install -m 644 guiserver/animation-demo.lsp $(datadir)/newlisp/guiserver/animation-demo.lsp
	-install -m 644 guiserver/border-layout-demo.lsp $(datadir)/newlisp/guiserver/border-layout-demo.lsp
	-install -m 644 guiserver/button-demo.lsp $(datadir)/newlisp/guiserver/button-demo.lsp
	-install -m 644 guiserver/clipboard-demo.lsp $(datadir)/newlisp/guiserver/clipboard-demo.lsp
	-install -m 644 guiserver/cursor-demo.lsp $(datadir)/newlisp/guiserver/cursor-demo.lsp
	-install -m 644 guiserver/drag-demo.lsp $(datadir)/newlisp/guiserver/drag-demo.lsp
	-install -m 644 guiserver/font-demo.lsp $(datadir)/newlisp/guiserver/font-demo.lsp
	-install -m 644 guiserver/frameless-demo.lsp $(datadir)/newlisp/guiserver/frameless-demo.lsp
	-install -m 644 guiserver/html-demo.lsp $(datadir)/newlisp/guiserver/html-demo.lsp
	-install -m 644 guiserver/image-demo.lsp $(datadir)/newlisp/guiserver/image-demo.lsp
	-install -m 644 guiserver/midi-demo.lsp $(datadir)/newlisp/guiserver/midi-demo.lsp
	-install -m 644 guiserver/midi2-demo.lsp $(datadir)/newlisp/guiserver/midi2-demo.lsp
	-install -m 644 guiserver/mouse-demo.lsp $(datadir)/newlisp/guiserver/mouse-demo.lsp
	-install -m 644 guiserver/move-resize-demo.lsp $(datadir)/newlisp/guiserver/move-resize-demo.lsp
	-install -m 644 guiserver/pinballs-demo.lsp $(datadir)/newlisp/guiserver/pinballs-demo.lsp
	-install -m 644 guiserver/properties-demo.lsp $(datadir)/newlisp/guiserver/properties-demo.lsp
	-install -m 644 guiserver/rotation-demo.lsp $(datadir)/newlisp/guiserver/rotation-demo.lsp
	-install -m 644 guiserver/scroll-pane-demo.lsp $(datadir)/newlisp/guiserver/scroll-pane-demo.lsp
	-install -m 644 guiserver/shapes-demo.lsp $(datadir)/newlisp/guiserver/shapes-demo.lsp
	-install -m 644 guiserver/sound-demo.lsp $(datadir)/newlisp/guiserver/sound-demo.lsp
	-install -m 644 guiserver/stroke-demo.lsp $(datadir)/newlisp/guiserver/stroke-demo.lsp
	-install -m 644 guiserver/tabs-demo.lsp $(datadir)/newlisp/guiserver/tabs-demo.lsp
	-install -m 644 guiserver/table-demo.lsp $(datadir)/newlisp/guiserver/table-demo.lsp
	-install -m 644 guiserver/textrot-demo.lsp $(datadir)/newlisp/guiserver/textrot-demo.lsp
	-install -m 644 guiserver/widgets-demo.lsp $(datadir)/newlisp/guiserver/widgets-demo.lsp
	-install -m 644 guiserver/word-count.lsp $(datadir)/newlisp/guiserver/word-count.lsp
	-install -m 644 guiserver/uppercase.lsp $(datadir)/newlisp/guiserver/uppercase.lsp

	# get OS X applications package
	sudo cp -R /Applications/newLISP-GS.app/ $(appdir)/newLISP-GS.app
	# make and fill image directory
	-mkdir newLISP-image
	cp doc/newLISP-$(VERSION)-Release.html newLISP-image/
	cp util/newLISP-OSX-README.rtf newLISP-image/
	cp util/uninstall.command newLISP-image/
	pkgbuild --identifier com.nuevatec.newlisp.newlisp.pkg --version $(VERSION) \
		--root Package_contents newLISP-image/newLISPpackage.pkg

# eof

