Build installable versions of MicroPeak GUI
authorKeith Packard <keithp@keithp.com>
Wed, 2 Jan 2013 02:20:23 +0000 (18:20 -0800)
committerKeith Packard <keithp@keithp.com>
Wed, 2 Jan 2013 02:20:23 +0000 (18:20 -0800)
Makes windows/mac/linux versions. Windows version appears to work on
Wine at least.

Signed-off-by: Keith Packard <keithp@keithp.com>
configure.ac
icon/altus-metrum.ico
icon/micro-peak.ico [new file with mode: 0644]
micropeak/Info.plist.in [new file with mode: 0644]
micropeak/Makefile.am
micropeak/MicroPeak.app/Contents/MacOS/JavaApplicationStub [new file with mode: 0755]
micropeak/MicroPeak.app/Contents/PkgInfo [new file with mode: 0644]
micropeak/MicroPeak.app/Contents/Resources/AltosUIIcon.icns [new file with mode: 0644]
micropeak/micropeak-fat [new file with mode: 0755]
micropeak/micropeak-windows.nsi [new file with mode: 0644]

index 6ad2591..312f967 100644 (file)
@@ -153,6 +153,7 @@ altosui/AltosVersion.java
 altosui/Info.plist
 libaltos/Makefile
 micropeak/Makefile
+micropeak/Info.plist
 altosdroid/Makefile
 altosdroid/local.properties
 ao-tools/Makefile
index e32b4f1..bedf04e 100644 (file)
Binary files a/icon/altus-metrum.ico and b/icon/altus-metrum.ico differ
diff --git a/icon/micro-peak.ico b/icon/micro-peak.ico
new file mode 100644 (file)
index 0000000..b672aa0
Binary files /dev/null and b/icon/micro-peak.ico differ
diff --git a/micropeak/Info.plist.in b/micropeak/Info.plist.in
new file mode 100644 (file)
index 0000000..d3c17a4
--- /dev/null
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
+<plist version="0.9">
+<dict>
+       <key>CFBundleName</key>
+       <string>MicroPeak</string>
+       <key>CFBundleVersion</key>
+       <string>@VERSION@</string>
+       <key>CFBundleAllowMixedLocalizations</key>
+       <string>true</string>
+       <key>CFBundleExecutable</key>
+       <string>JavaApplicationStub</string>
+       <key>CFBundleDevelopmentRegion</key>
+       <string>English</string>
+       <key>CFBundlePackageType</key>
+       <string>APPL</string>
+       <key>CFBundleIdentifier</key>
+       <string>org.altusmetrum.altosui</string>
+       <key>CFBundleSignature</key>
+       <string>Altu</string>
+       <key>CFBundleGetInfoString</key>
+       <string>MicroPeak UI version @VERSION@</string>
+       <key>CFBundleInfoDictionaryVersion</key>
+       <string>6.0</string>
+       <key>CFBundleIconFile</key>
+       <string>MicroPeak.icns</string>
+       <key>Java</key>
+       <dict>
+               <key>MainClass</key>
+               <string>org.altusmetrum.micropeak.MicroPeak</string>
+               <key>JVMVersion</key>
+               <string>1.5+</string>
+               <key>ClassPath</key>
+               <array>
+                       <string>$JAVAROOT/micropeak.jar</string>
+               </array>
+               <key>VMOptions</key>
+               <array>
+                 <string>-Xms512M</string>
+                 <string>-Xmx512M</string>
+                 <string>-Dosgi.clean=true</string>
+               </array>
+       </dict>
+</dict>
+</plist>
index a54b78a..2dd9c69 100644 (file)
@@ -34,6 +34,7 @@ FATJAR=micropeak-fat.jar
 LIBALTOS= \
        libaltos.so \
        libaltos.dylib \
+       altos64.dll \
        altos.dll
 
 ALTOSLIB_CLASS=\
@@ -61,15 +62,58 @@ ICONJAR= -C $(ICONDIR) micropeak-16.png \
        -C $(ICONDIR) micropeak-128.png \
        -C $(ICONDIR) micropeak-256.png
 
+WINDOWS_ICON=$(ICONDIR)/micro-peak.ico
+
 all-local: micropeak-test $(JAR)
 
 clean-local:
        -rm -rf classes $(JAR) $(FATJAR) \
+               $(LINUX_DIST) $(MACOSX_DIST) windows $(WINDOWS_DIST) \
                $(ALTOSLIB_CLASS) \
                $(ALTOSUILIB_CLASS) \
                $(JFREECHART_CLASS) $(JCOMMON_CLASS) $(LIBALTOS) Manifest.txt \
                micropeak micropeak-test macosx linux windows
 
+LINUX_DIST=MicroPeak-Linux-$(VERSION).tar.bz2
+MACOSX_DIST=MicroPeak-Mac-$(VERSION).zip
+WINDOWS_DIST=MicroPeak-Windows-$(VERSION_DASH).exe
+
+FAT_FILES=$(FATJAR) $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS) $(FREETTS_CLASS) $(JFREECHART_CLASS) $(JCOMMON_CLASS)
+
+LINUX_FILES=$(FAT_FILES) libaltos.so $(FIRMWARE) $(DOC)
+LINUX_EXTRA=micropeak-fat
+
+MACOSX_INFO_PLIST=Info.plist
+MACOSX_FILES=$(FAT_FILES) libaltos.dylib $(MACOSX_INFO_PLIST)
+
+WINDOWS_FILES=$(FAT_FILES) altos.dll altos64.dll $(top_srcdir)/telemetrum.inf $(WINDOWS_ICON)
+
+if FATINSTALL
+
+FATTARGET=$(FATDIR)/$(VERSION)
+
+LINUX_DIST_TARGET=$(FATTARGET)/$(LINUX_DIST)
+MACOSX_DIST_TARGET=$(FATTARGET)/$(MACOSX_DIST)
+WINDOWS_DIST_TARGET=$(FATTARGET)/$(WINDOWS_DIST)
+
+fat: $(LINUX_DIST_TARGET) $(MACOSX_DIST_TARGET) $(WINDOWS_DIST_TARGET)
+
+$(LINUX_DIST_TARGET): $(LINUX_DIST)
+       mkdir -p $(FATTARGET)
+       cp -p $< $@
+
+$(MACOSX_DIST_TARGET): $(MACOSX_DIST)
+       mkdir -p $(FATTARGET)
+       cp -p $< $@
+
+$(WINDOWS_DIST_TARGET): $(WINDOWS_DIST)
+       mkdir -p $(FATTARGET)
+       cp -p $< $@
+
+else
+fat: $(LINUX_DIST) $(MACOSX_DIST) $(WINDOWS_DIST)
+endif
+
 micropeak: Makefile
        echo "#!/bin/sh" > $@
        echo 'exec java  -cp "$(JCOMMON)/jcommon.jar:$(JFREECHART)/jfreechart.jar" -Djava.library.path="$(altoslibdir)" -jar "$(micropeakdir)/micropeak.jar" "$$@"' >> $@
@@ -80,6 +124,12 @@ micropeak-test: Makefile
        echo 'exec java -cp "./*:../libaltos/*:$(JCOMMON)/jcommon.jar:$(JFREECHART)/jfreechart.jar" -Djava.library.path="../libaltos/.libs" -jar micropeak.jar "$$@"' >> $@
        chmod +x $@
 
+install-micropeakJAVA: micropeak.jar
+       @$(NORMAL_INSTALL)
+       test -z "$(micropeakdir)" || $(MKDIR_P) "$(DESTDIR)$(micropeakdir)"
+       echo " $(INSTALL_DATA)" "$<" "'$(DESTDIR)$(micropeakdir)/micropeak.jar'"; \
+       $(INSTALL_DATA) "$<" "$(DESTDIR)$(micropeakdir)"
+
 $(JAR): classmicropeak.stamp Manifest.txt $(JAVA_ICONS) $(ALTOSLIB_CLASS) $(ALTOSUILIB_CLASS)
        jar cfm $@ Manifest.txt \
                $(ICONJAR) \
@@ -92,7 +142,6 @@ $(FATJAR): classmicropeak.stamp Manifest-fat.txt $(ALTOSLIB_CLASS) $(ALTOSUILIB_
                -C classes org \
                -C ../libaltos libaltosJNI
 
-
 libaltos.so: build-libaltos
        -rm -f "$@"
        $(LN_S) ../libaltos/.libs/"$@" .
@@ -139,6 +188,34 @@ $(JCOMMON_CLASS):
        -rm -f "$@"
        $(LN_S) "$(JCOMMON)"/"$@" .
 
+$(LINUX_DIST): $(LINUX_FILES) $(LINUX_EXTRA)
+       -rm -f $@
+       -rm -rf linux
+       mkdir -p linux/MicroPeak
+       cp -p $(LINUX_FILES) linux/MicroPeak
+       cp -p micropeak-fat linux/MicroPeak/micropeak
+       chmod +x linux/MicroPeak/micropeak
+       tar cjf $@ -C linux MicroPeak
+
+$(MACOSX_DIST): $(MACOSX_FILES)
+       -rm -f $@
+       -rm -rf macosx
+       mkdir macosx
+       cp -a MicroPeak.app macosx/
+       cp -p Info.plist macosx/MicroPeak.app/Contents
+       mkdir -p macosx/MicroPeak macosx/MicroPeak.app/Contents/Resources/Java
+       cp -p $(FATJAR) macosx/MicroPeak.app/Contents/Resources/Java/micropeak.jar
+       cp -p libaltos.dylib macosx/MicroPeak.app/Contents/Resources/Java
+       cp -p $(ALTOSLIB_CLASS) macosx/MicroPeak.app/Contents/Resources/Java
+       cp -p $(ALTOSUILIB_CLASS) macosx/MicroPeak.app/Contents/Resources/Java
+       cp -p $(JFREECHART_CLASS) macosx/MicroPeak.app/Contents/Resources/Java
+       cp -p $(JCOMMON_CLASS) macosx/MicroPeak.app/Contents/Resources/Java
+       cd macosx && zip -r ../$@ MicroPeak.app MicroPeak
+
+$(WINDOWS_DIST): $(WINDOWS_FILES) micropeak-windows.nsi
+       -rm -f $@
+       makensis -Omicropeak-windows.log "-XOutFile $@" "-DVERSION=$(VERSION)" micropeak-windows.nsi
+
 Manifest.txt: Makefile
        echo 'Main-Class: org.altusmetrum.micropeak.MicroPeak' > $@
        echo "Class-Path: AltosLib.jar AltosUILib.jar $(JCOMMON)/jcommon.jar $(JFREECHART)/jfreechart.jar" >> $@
diff --git a/micropeak/MicroPeak.app/Contents/MacOS/JavaApplicationStub b/micropeak/MicroPeak.app/Contents/MacOS/JavaApplicationStub
new file mode 100755 (executable)
index 0000000..c661d3e
Binary files /dev/null and b/micropeak/MicroPeak.app/Contents/MacOS/JavaApplicationStub differ
diff --git a/micropeak/MicroPeak.app/Contents/PkgInfo b/micropeak/MicroPeak.app/Contents/PkgInfo
new file mode 100644 (file)
index 0000000..8a43480
--- /dev/null
@@ -0,0 +1 @@
+APPLAM.O
diff --git a/micropeak/MicroPeak.app/Contents/Resources/AltosUIIcon.icns b/micropeak/MicroPeak.app/Contents/Resources/AltosUIIcon.icns
new file mode 100644 (file)
index 0000000..fe49f36
Binary files /dev/null and b/micropeak/MicroPeak.app/Contents/Resources/AltosUIIcon.icns differ
diff --git a/micropeak/micropeak-fat b/micropeak/micropeak-fat
new file mode 100755 (executable)
index 0000000..ace7548
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+me=`which "$0"`
+dir=`dirname "$me"`
+exec java -cp "$dir/*" -Djava.library.path="$dir" -jar "$dir"/micropeak-fat.jar  "$@"
diff --git a/micropeak/micropeak-windows.nsi b/micropeak/micropeak-windows.nsi
new file mode 100644 (file)
index 0000000..425048b
--- /dev/null
@@ -0,0 +1,123 @@
+!addplugindir Instdrv/NSIS/Plugins
+; Definitions for Java 1.6 Detection
+!define JRE_VERSION "1.6"
+!define JRE_ALTERNATE "1.7"
+!define JRE_URL "http://javadl.sun.com/webapps/download/AutoDL?BundleId=52247&/jre-6u27-windows-i586-p.exe"
+!define PRODUCT_NAME "Altus Metrum Windows Software"
+
+Name "Altus Metrum MicroPeak Installer"
+
+; Default install directory
+InstallDir "$PROGRAMFILES\AltusMetrum"
+
+; Tell the installer where to re-install a new version
+InstallDirRegKey HKLM "Software\AltusMetrum" "Install_Dir"
+
+LicenseText "GNU General Public License Version 2"
+LicenseData "../COPYING"
+
+; Need admin privs for Vista or Win7
+RequestExecutionLevel admin
+
+ShowInstDetails Show
+
+ComponentText "Altus Metrum MicroPeak Software Installer"
+
+Function GetJRE
+        MessageBox MB_OK "${PRODUCT_NAME} uses Java ${JRE_VERSION} 32-bit, it will now \
+                         be downloaded and installed"
+
+        StrCpy $2 "$TEMP\Java Runtime Environment.exe"
+        nsisdl::download /TIMEOUT=30000 ${JRE_URL} $2
+        Pop $R0 ;Get the return value
+                StrCmp $R0 "success" +3
+                MessageBox MB_OK "Download failed: $R0"
+                Quit
+        ExecWait $2
+        Delete $2
+FunctionEnd
+
+
+Function DetectJRE
+  ReadRegStr $2 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" \
+             "CurrentVersion"
+  StrCmp $2 ${JRE_VERSION} done
+
+  StrCmp $2 ${JRE_ALTERNATE} done
+
+  Call GetJRE
+
+  done:
+FunctionEnd
+
+; Pages to present
+
+Page license
+Page components
+Page directory
+Page instfiles
+
+UninstPage uninstConfirm
+UninstPage instfiles
+
+; And the stuff to install
+
+Section "MicroPeak Application"
+       Call DetectJRE
+
+       SetOutPath $INSTDIR
+
+       File "micropeak-fat.jar"
+       File "AltosLib.jar"
+       File "AltosUILib.jar"
+       File "jfreechart.jar"
+       File "jcommon.jar"
+
+       File "*.dll"
+
+       File "../icon/*.ico"
+
+       CreateShortCut "$SMPROGRAMS\MicroPeak.lnk" "$SYSDIR\javaw.exe" "-jar micropeak-fat.jar" "$INSTDIR\micro-peak.ico"
+SectionEnd
+
+Section "MicroPeak Desktop Shortcut"
+       CreateShortCut "$DESKTOP\MicroPeak.lnk" "$INSTDIR\micropeak-fat.jar"  "" "$INSTDIR\micro-peak.ico"
+SectionEnd
+
+Section "Documentation"
+
+       SetOutPath $INSTDIR
+
+       File "../doc/micropeak.pdf"
+SectionEnd
+
+Section "Uninstaller"
+
+       ; Deal with the uninstaller
+
+       SetOutPath $INSTDIR
+
+       ; Write the install path to the registry
+       WriteRegStr HKLM SOFTWARE\AltusMetrum "Install_Dir" "$INSTDIR"
+
+       ; Write the uninstall keys for windows
+       WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "DisplayName" "Altus Metrum"
+       WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "UninstallString" '"$INSTDIR\uninstall.exe"'
+       WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "NoModify" "1"
+       WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum" "NoRepair" "1"
+
+       WriteUninstaller "uninstall.exe"
+SectionEnd
+
+Section "Uninstall"
+       DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\AltusMetrum"
+       DeleteRegKey HKLM "Software\AltusMetrum"
+
+       Delete "$INSTDIR\*.*"
+       RMDir "$INSTDIR"
+
+       ; Remove shortcuts, if any
+       Delete "$SMPROGRAMS\MicroPeak.lnk"
+       Delete "$DESKTOP\MicroPeak.lnk"
+       
+SectionEnd