Desktop app packaging information

This commit is contained in:
Guangcong Luo 2013-09-01 14:04:58 -05:00
parent f5e4874cb6
commit 5741c920e8
8 changed files with 327 additions and 0 deletions

57
desktop/DESKTOP.md Normal file
View File

@ -0,0 +1,57 @@
Desktop apps
============
Pokémon Showdown for desktop is made with [node-webkit][1].
[1]: https://github.com/rogerwang/node-webkit
There's an `.ico` icon (for Windows) and an `.icns` icon (for Mac) in the
`graphics-src` directory of this repository. We use these pretty much
whenever we need icons.
Note that node-webkit doesn't support normal window icons in Windows,
so we have to use a PNG icon to get scaling not to look horribly ugly.
Packaging
---------
node-webkit's wiki contains packaging instructions, but they're strewn
across their wiki and don't really go into best practices, so I have
better packaging instructions here.
For performance, we don't zip up the package on either platform. In Windows,
the `index.html` and `package.json` files are dropped directly into the
node-webkit directory, and in OS X the files are dropped into
`Resources/app.nw`.
Packaging for Windows
---------------------
1. Put a copy of node-webkit (build or extract the prebuilt binary) into this
folder.
2. Rename `nw.exe` to `pokemonshowdown.exe`
3. Edit `pokemonshowdown.exe` with [Resource Hacker][2], and replace the
node-webkit icon with`icons/pokemonshowdown.ico`
3. Using [NSIS][2], build `pokemonshowdown.nsi`
[2]: http://www.angusj.com/resourcehacker/
[3]: http://nsis.sourceforge.net/
Packaging for OS X
------------------
1. Get a copy of node-webkit (build or extract the prebuilt binary)
2. Rename it to `Pokemon Showdown.app`
3. Replace `Pokemon Showdown.app/Contents/Info.plist` with the `Info.plist`
in this directory
4. Replace `Pokemon Showdown.app/Contents/Resources/nw.icns` with the
icns file in `graphics-src`.
5. Create a folder `Pokemon Showdown.app/Contents/Resources/app.nw` and put
`index.html` and `package.json` in it.

93
desktop/Info.plist Normal file
View File

@ -0,0 +1,93 @@
<?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>en</string>
<key>CFBundleDisplayName</key>
<string>Pokemon Showdown</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFile</key>
<string>nw.icns</string>
<key>CFBundleTypeName</key>
<string>node-webkit App</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>com.intel.nw.app</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Folder</string>
<key>CFBundleTypeOSTypes</key>
<array>
<string>fold</string>
</array>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>None</string>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>node-webkit</string>
<key>CFBundleIconFile</key>
<string>nw.icns</string>
<key>CFBundleIdentifier</key>
<string>com.intel.nw</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Pokemon Showdown</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>29.0.1547.31</string>
<key>CFBundleVersion</key>
<string>1547.31</string>
<key>LSFileQuarantineEnabled</key>
<true/>
<key>LSMinimumSystemVersion</key>
<string>10.6.0</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
<key>SCMRevision</key>
<string>213023</string>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>com.pkware.zip-archive</string>
</array>
<key>UTTypeDescription</key>
<string>node-webkit App</string>
<key>UTTypeIconFile</key>
<string>nw.icns</string>
<key>UTTypeIdentifier</key>
<string>com.intel.nw.app</string>
<key>UTTypeReferenceURL</key>
<string>https://github.com/rogerwang/node-webkit/wiki/How-to-package-and-distribute-your-apps</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>com.apple.ostype</key>
<string>node-webkit</string>
<key>public.filename-extension</key>
<array>
<string>nw</string>
</array>
<key>public.mime-type</key>
<string>application/x-node-webkit-app</string>
</dict>
</dict>
</array>
</dict>
</plist>

BIN
desktop/icons/icon_32x32.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

BIN
desktop/icons/installerbg.bmp Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
desktop/icons/pokemonshowdown.ico Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

8
desktop/index.html Executable file
View File

@ -0,0 +1,8 @@
<!DOCTYPE html>
<script>
var gui = require('nw.gui');
var win = gui.Window.get();
win.maximize();
win.show();
document.location.replace('http://play.pokemonshowdown.com/');
</script>

16
desktop/package.json Executable file
View File

@ -0,0 +1,16 @@
{
"name": "Pokemon Showdown",
"version": "0.1.0",
"main": "index.html",
"node-remote": "play.pokemonshowdown.com",
"window": {
"icon": "icons/icon_32x32.png",
"title": "Loading...",
"toolbar": false,
"show": false
},
"webkit": {
"plugin": true
}
}

153
desktop/pokemonshowdown.nsi Executable file
View File

@ -0,0 +1,153 @@
;NSIS Modern User Interface
;Installer builder for Pokemon Showdown
;--------------------------------
;Include Modern UI
!include "MUI2.nsh"
;--------------------------------
;General
# MUI Symbol Definitions
!define MUI_ICON "icons\pokemonshowdown.ico"
!define APPNAME "Pokemon Showdown"
!define COMPANYNAME "Pokemon Showdown"
!define ABOUTURL "http://pokemonshowdown.com/" # "Publisher" link
!define INSTALLSIZE 48000
;Name and file
Name "Pokemon Showdown"
OutFile "setup.exe"
;Default installation folder
InstallDir "$PROGRAMFILES\Pokemon Showdown"
CRCCheck on
XPStyle on
ShowInstDetails show
;Get installation folder from registry if available
InstallDirRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "InstallLocation"
;Request application privileges for Windows Vista
# RequestExecutionLevel user
RequestExecutionLevel admin
;--------------------------------
;Interface Settings
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "icons\installerbg.bmp" ; optional
!define MUI_ABORTWARNING
;--------------------------------
;Pages
# !insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_TEXT "Play Pokemon Showdown"
!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchLink"
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
;Installer Sections
Section "Main" SecMain
setOutPath $INSTDIR
# Files added here should be removed by the uninstaller (see section "uninstall")
file "pokemonshowdown.exe"
file "package.json"
file "index.html"
file "nw.pak"
file "libEGL.dll"
file "libGLESv2.dll"
file "ffmpegsumo.dll"
file "icudt.dll"
CreateDirectory "$INSTDIR\icons"
setOutPath "$INSTDIR\icons"
file "icons\icon_32x32.png"
file "icons\pokemonshowdown.ico"
writeUninstaller "$INSTDIR\uninstall.exe"
createShortCut "$SMPROGRAMS\${APPNAME}.lnk" "$INSTDIR\pokemonshowdown.exe" "" "$INSTDIR\icons\pokemonshowdown.ico"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayName" "${APPNAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "InstallLocation" "$\"$INSTDIR$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "DisplayIcon" "$\"$INSTDIR\icons\pokemonshowdown.ico$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "Publisher" "$\"${COMPANYNAME}$\""
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "URLInfoAbout" "$\"${ABOUTURL}$\""
# There is no option for modifying or repairing the install
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "NoModify" 1
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "NoRepair" 1
# Set the INSTALLSIZE constant (!defined at the top of this script) so Add/Remove Programs can accurately report the size
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "EstimatedSize" ${INSTALLSIZE}
SectionEnd
;--------------------------------
;Descriptions
;Language strings
# LangString DESC_SecMain ${LANG_ENGLISH} "A test section."
;Assign language strings to sections
# !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
# !insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy)
# !insertmacro MUI_FUNCTION_DESCRIPTION_END
;--------------------------------
;Uninstaller Section
Section "Uninstall"
# Remove Start Menu launcher
delete "$SMPROGRAMS\${APPNAME}.lnk"
# Remove files
delete "$INSTDIR\pokemonshowdown.exe"
delete "$INSTDIR\package.json"
delete "$INSTDIR\index.html"
delete "$INSTDIR\nw.pak"
delete "$INSTDIR\libEGL.dll"
delete "$INSTDIR\libGLESv2.dll"
delete "$INSTDIR\ffmpegsumo.dll"
delete "$INSTDIR\icudt.dll"
delete "$INSTDIR\icons\icon_32x32.png"
delete "$INSTDIR\icons\pokemonshowdown.ico"
delete "$INSTDIR\data\icon_32x32.png"
delete "$INSTDIR\data\pokemonshowdown.ico"
rmDir "$INSTDIR\icons"
rmDir "$INSTDIR\data"
# Always delete uninstaller as the last action
delete $INSTDIR\uninstall.exe
# Try to remove the install directory - this will only happen if it is empty
rmDir $INSTDIR
# Remove uninstaller information from the registry
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"
SectionEnd
Function LaunchLink
ExecShell "" "$INSTDIR\pokemonshowdown.exe"
FunctionEnd