on master help sign in
Adopt important code from elm-platform repo
c807154Evan Czaplicki
installers/mac/Distribution.xmlnew file+31
@@ -0,0 +1,31 @@
1+<?xml version="1.0" encoding="utf-8" standalone="no"?>
2+<installer-script minSpecVersion="1.000000" authoringTool="com.apple.PackageMaker" authoringToolVersion="3.0.6" authoringToolBuild="201">
3+ <title>Elm Platform</title>
4+ <options customize="allow" allow-external-scripts="no"/>
5+ <domains enable_localSystem="true"/>
6+ <volume-check script="pm_volume_check();"/>
7+ <script>
8+
9+
10+function pm_volume_check() {
11+ if(!(my.target.systemVersion &amp;&amp; /* >= */ system.compareVersions(my.target.systemVersion.ProductVersion, '10.6.0') >= 0)) {
12+ my.result.title = 'Failure';
13+ my.result.message = 'This version of Elm Platform requires Mac OS X 10.6 or later.';
14+ my.result.type = 'Fatal';
15+ return false;
16+ }
17+ return true;
18+}
19+
20+</script>
21+ <background file="background.png" alignment="bottomleft" scaling="none" mime-type="image/png"/>
22+ <welcome mime-type="text/rtf" file="welcome.rtf" />
23+ <conclusion mime-type="text/rtf" file="conclusion.rtf" />
24+ <choices-outline>
25+ <line choice="choice2"/>
26+ </choices-outline>
27+ <choice id="choice2" title="Elm Platform ">
28+ <pkg-ref id="org.elm-lang.binaries.pkg"/>
29+ </choice>
30+ <pkg-ref id="org.elm-lang.binaries.pkg" installKBytes="19444" version="1" auth="Root">binaries.pkg</pkg-ref>
31+</installer-script>
installers/mac/Resources/en.lproj/background.pngnew file

Binary file not shown.

installers/mac/Resources/en.lproj/conclusion.rtfnew file+9
@@ -0,0 +1,9 @@
1+{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
2+{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
3+{\colortbl;\red255\green255\blue255;}
4+\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0
5+\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural
6+
7+\f0\fs26 \cf0 A bunch of useful programs were just placed in /usr/local/bin/\
8+\
9+Check out {\field{\*\fldinst HYPERLINK "http://elm-lang.org/Get-Started.elm"}{\fldrslt this tutorial}} to learn how to use them!}
installers/mac/Resources/en.lproj/welcome.rtfnew file+7
@@ -0,0 +1,7 @@
1+{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf400
2+{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
3+{\colortbl;\red255\green255\blue255;}
4+\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0
5+\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural
6+
7+\f0\fs28 \cf0 This package will install Elm on your machine.}
installers/mac/helper-scripts/elm-startup.shnew file+3
@@ -0,0 +1,3 @@
1+#!/bin/sh
2+
3+open 'http://elm-lang.org'
installers/mac/helper-scripts/uninstall.shnew file+21
@@ -0,0 +1,21 @@
1+#!/bin/sh
2+
3+set -e
4+
5+echo "Warning: You are about to remove all Elm executables!"
6+
7+installdir=/usr/local/bin
8+
9+for bin in elm elm-compiler elm-get elm-reactor elm-repl elm-doc elm-server elm-package elm-make
10+do
11+ if [ -f $installdir/$bin ]; then
12+ sudo rm -f $installdir/$bin
13+ fi
14+ if [ -f $installdir/$bin-unwrapped ]; then
15+ sudo rm -f $installdir/$bin-unwrapped
16+ fi
17+
18+done
19+
20+sharedir=/usr/local/share/elm
21+sudo rm -rf $sharedir
installers/mac/make-installer.shnew file+67
@@ -0,0 +1,67 @@
1+#!/bin/sh
2+# Run the following command to create an installer:
3+#
4+# bash make-installer.sh 0.13
5+#
6+# This will work iff the version you give is defined in BuildFromSource.hs
7+
8+
9+#### SETUP ####
10+
11+set -e
12+
13+version=$1
14+
15+# Create directory structure for new pkgs
16+pkg_root=$(mktemp -d -t package-artifacts)
17+pkg_binaries=$pkg_root
18+pkg_scripts=$pkg_root/Scripts
19+
20+mkdir -p $pkg_binaries
21+mkdir -p $pkg_scripts
22+
23+usr_binaries=/usr/local/bin
24+
25+
26+#### BUILD ELM PLATFORM ####
27+
28+runhaskell ../BuildFromSource.hs $version
29+
30+platform=Elm-Platform/$version
31+
32+
33+#### COPY BINARIES ####
34+
35+# Copy executables into pkg_binaries directory
36+for exe in elm elm-package elm-make elm-repl elm-reactor
37+do
38+ cp $platform/.cabal-sandbox/bin/$exe $pkg_binaries/$exe
39+done
40+
41+cp $(pwd)/preinstall $pkg_scripts
42+cp $(pwd)/postinstall $pkg_scripts
43+
44+pkgbuild \
45+ --identifier org.elm-lang.binaries.pkg \
46+ --install-location $usr_binaries \
47+ --scripts $pkg_scripts \
48+ --filter 'Scripts.*' \
49+ --root $pkg_root \
50+ binaries.pkg
51+
52+
53+#### CREATE PACKAGE ####
54+
55+rm -f Elm-Platform-$version.pkg
56+
57+productbuild \
58+ --distribution Distribution.xml \
59+ --package-path . \
60+ --resources Resources \
61+ Elm-Platform-$version.pkg
62+
63+
64+#### CLEAN UP ####
65+
66+rm binaries.pkg
67+rm -rf $pkg_root
installers/mac/postinstallnew file+5
@@ -0,0 +1,5 @@
1+#!/bin/sh
2+
3+set -ex
4+
5+echo "$(date)" > /tmp/elm-installer.log
installers/mac/preinstallnew file+18
@@ -0,0 +1,18 @@
1+#!/bin/sh
2+
3+set -e
4+
5+installdir=/usr/local/bin
6+
7+for bin in elm elm-compiler elm-package elm-reactor elm-repl
8+do
9+ if [ -f $installdir/$bin ]; then
10+ sudo rm -f $installdir/$bin
11+ fi
12+ if [ -f $installdir/$bin-unwrapped ]; then
13+ sudo rm -f $installdir/$bin-unwrapped
14+ fi
15+done
16+
17+sharedir=/usr/local/share/elm
18+sudo rm -rf $sharedir
installers/npm/.gitignorenew file+1
@@ -0,0 +1 @@
1+node_modules/
installers/npm/.npmignorenew file+3
@@ -0,0 +1,3 @@
1+README.md
2+.gitignore
3+.git
installers/npm/README.mdnew file+38
@@ -0,0 +1,38 @@
1+npm install elm [![Travis build Status](https://travis-ci.org/elm-lang/elm-platform.svg?branch=master)](http://travis-ci.org/elm-lang/elm-platform) [![AppVeyor build status](https://ci.appveyor.com/api/projects/status/6mcub79i04ianpm9/branch/master?svg=true)](https://ci.appveyor.com/project/rtfeldman/elm-platform/branch/master)
2+===============
3+
4+Install the [Elm Platform](https://github.com/elm-lang/elm-platform) via [`npm`](https://www.npmjs.com).
5+
6+## Installing
7+
8+Run this to get the binaries:
9+
10+```
11+$ npm install -g elm
12+```
13+
14+## Installing behind a proxy server
15+
16+If you are behind a proxy server, set the environment variable "HTTPS_PROXY".
17+
18+```
19+$ export HTTPS_PROXY=$YourProxyServer$
20+$ npm install -g elm
21+```
22+
23+Or on Windows:
24+
25+```
26+$ set HTTPS_PROXY=$YourProxyServer$
27+$ npm install -g elm
28+```
29+
30+## Troubleshooting
31+
32+1. [Troubleshooting npm](https://github.com/npm/npm/wiki/Troubleshooting)
33+2. On Debian/Ubuntu systems, you may have to install the nodejs-legacy package: `apt-get install nodejs-legacy`.
34+3. If the installer says that it cannot find any usable binaries for your operating system and architecture, check the [Build from Source](https://github.com/elm-lang/elm-platform/blob/master/README.md#build-from-source) documentation.
35+
36+## Getting Started
37+
38+Once everything has installed successfully, head over to the [Get Started](http://elm-lang.org/Get-Started.elm) page!
installers/npm/UPLOADING.mdnew file+8
@@ -0,0 +1,8 @@
1+## Uploading new binaries
2+
3+1. Assemble a `.tar.gz` file for each desired operating system/architecture combination desired. Each tarball should contain a directory (e.g. `Elm-Platform-0.15`, although the directory name does not matter) whose contents are the binaries like `elm-make` for the appropriate environment. The tarballs must benamed according to this format: `(`[`process.platform`](https://nodejs.org/api/process.html#process_process_platform)` + "-" + `[`process.arch`](https://nodejs.org/api/process.html#process_process_arch)` + ".tar.gz")` - e.g. for 64-bit OS X, `darwin-x64.tar.gz`.
4+2. Sign into [the elm-platform npm binaries repo](https://bintray.com/elmlang/elm-platform/npm), select the appropriate version, and click Upload
5+3. Enter the version number (e.g. `0.15.1`) under **Target Repository Path**.
6+4. Click **Upload Files** and select the `.tar.gz` files from earlier. (You can multi-select in the dialog.)
7+5. Once everything is done uploading, hit **Save Changes**. You should now see each of the files listed at the bottom of the page, along with an auto-generated `.asc` file which contains a PGP signature so people can verify the files were downloaded correctly.
8+6. If everything looks right, hit **Publish** to make them available for download.
installers/npm/binaries/elmnew file+1
@@ -0,0 +1 @@
1+echo "The npm installation of Elm did not complete successfully! Please try reinstalling Elm through npm. If you still see this message even after reinstalling, please file a bug at https://github.com/elm-lang/elm-platform/issues to let us know. You can find manual installers at http://elm-lang.org/install"
installers/npm/binaries/elm-makenew file+1
@@ -0,0 +1 @@
1+echo "The npm installation of Elm did not complete successfully! Please try reinstalling Elm through npm. If you still see this message even after reinstalling, please file a bug at https://github.com/elm-lang/elm-platform/issues to let us know. You can find manual installers at http://elm-lang.org/install"
installers/npm/binaries/elm-packagenew file+1
@@ -0,0 +1 @@
1+echo "The npm installation of Elm did not complete successfully! Please try reinstalling Elm through npm. If you still see this message even after reinstalling, please file a bug at https://github.com/elm-lang/elm-platform/issues to let us know. You can find manual installers at http://elm-lang.org/install"
installers/npm/binaries/elm-reactornew file+1
@@ -0,0 +1 @@
1+echo "The npm installation of Elm did not complete successfully! Please try reinstalling Elm through npm. If you still see this message even after reinstalling, please file a bug at https://github.com/elm-lang/elm-platform/issues to let us know. You can find manual installers at http://elm-lang.org/install"
installers/npm/binaries/elm-replnew file+1
@@ -0,0 +1 @@
1+echo "The npm installation of Elm did not complete successfully! Please try reinstalling Elm through npm. If you still see this message even after reinstalling, please file a bug at https://github.com/elm-lang/elm-platform/issues to let us know. You can find manual installers at http://elm-lang.org/install"
installers/npm/install.jsnew file+34
@@ -0,0 +1,34 @@
1+var binstall = require("binstall");
2+var path = require("path");
3+var fs = require("fs");
4+var packageInfo = require(path.join(__dirname, "package.json"));
5+
6+// Use major.minor.patch from version string - e.g. "1.2.3" from "1.2.3-alpha"
7+var binVersion = packageInfo.version.replace(/^(\d+\.\d+\.\d+).*$/, "$1");
8+
9+// 'arm', 'ia32', or 'x64'.
10+var arch = process.arch;
11+
12+// 'darwin', 'freebsd', 'linux', 'sunos' or 'win32'
13+var operatingSystem = process.platform;
14+
15+var filename = operatingSystem + "-" + arch + ".tar.gz";
16+var url = "https://dl.bintray.com/elmlang/elm-platform/"
17+ + binVersion + "/" + filename;
18+
19+var binariesDir = path.join(__dirname, "binaries");
20+var packageInfo = require(path.join(__dirname, "package.json"));
21+var binaryExtension = process.platform === "win32" ? ".exe" : "";
22+var executablePaths = Object.keys(packageInfo.bin).map(function(executable) {
23+ return path.join(binariesDir, executable + binaryExtension);
24+});
25+var errorMessage = "Unfortunately, there are no Elm Platform " + binVersion + " binaries available for your operating system and architecture.\n\nIf you would like to build Elm from source, there are instructions at https://github.com/elm-lang/elm-platform#build-from-source\n";
26+
27+binstall(url, {path: binariesDir, strip: 1},
28+ {verbose: true, verify: executablePaths, errorMessage: errorMessage}
29+).then(function(successMessage) {
30+ console.log(successMessage);
31+ }, function(errorMessage) {
32+ console.error(errorMessage);
33+ process.exit(1);
34+ });
installers/npm/package.jsonnew file+50
@@ -0,0 +1,50 @@
1+{
2+ "name": "elm",
3+ "version": "0.18.0",
4+ "description": "The Elm Platform: Binaries for the Elm programming language.",
5+ "preferGlobal": true,
6+ "license": "BSD-3-Clause",
7+ "repository": {
8+ "type": "git",
9+ "url": "https://github.com/elm-lang/elm-platform.git"
10+ },
11+ "homepage": "https://github.com/elm-lang/elm-platform/tree/master/installers/npm",
12+ "bugs": "https://github.com/elm-lang/elm-platform/issues",
13+ "author": {
14+ "name": "Richard Feldman",
15+ "email": "richard.t.feldman@gmail.com",
16+ "url": "https://github.com/rtfeldman"
17+ },
18+ "engines": {
19+ "node": ">=4.0.0"
20+ },
21+ "scripts": {
22+ "install": "node install.js"
23+ },
24+ "files": [
25+ "install.js",
26+ "binaries"
27+ ],
28+ "keywords": [
29+ "bin",
30+ "binary",
31+ "binaries",
32+ "elm",
33+ "elm-make",
34+ "elm-package",
35+ "elm-platform",
36+ "elm-reactor",
37+ "elm-repl",
38+ "platform"
39+ ],
40+ "bin": {
41+ "elm": "binaries/elm",
42+ "elm-make": "binaries/elm-make",
43+ "elm-package": "binaries/elm-package",
44+ "elm-reactor": "binaries/elm-reactor",
45+ "elm-repl": "binaries/elm-repl"
46+ },
47+ "dependencies": {
48+ "binstall": "1.2.0"
49+ }
50+}
installers/win/CreateInternetShortcut.nshnew file+5
@@ -0,0 +1,5 @@
1+!macro CreateInternetShortcut FILENAME URL ICONFILE ICONINDEX
2+WriteINIStr "${FILENAME}.url" "InternetShortcut" "URL" "${URL}"
3+WriteINIStr "${FILENAME}.url" "InternetShortcut" "IconFile" "${ICONFILE}"
4+WriteINIStr "${FILENAME}.url" "InternetShortcut" "IconIndex" "${ICONINDEX}"
5+!macroend
installers/win/Nsisfile.nsinew file+264
@@ -0,0 +1,264 @@
1+; Elm Platform Installer
2+
3+;--------------------------------
4+;Includes
5+
6+ !Include "FileFunc.nsh"
7+ !Include "LogicLib.nsh"
8+ !Include "MUI2.nsh"
9+ !Include "WordFunc.nsh"
10+ !Include "CreateInternetShortcut.nsh"
11+
12+;--------------------------------
13+;Defines
14+
15+ !Define PRODUCT_DIR_REG_KEY "Software\Elm\Elm Platform\${PLATFORM_VERSION}"
16+ !Define FILES_SOURCE_PATH "files"
17+ !Define INST_DAT "inst.dat"
18+ !Define UNINST_DAT "uninst.dat"
19+
20+;--------------------------------
21+;Variables
22+
23+ Var START_MENU_FOLDER
24+
25+;--------------------------------
26+;General settings
27+
28+ ;Name and file
29+ Name "Elm Platform ${PLATFORM_VERSION}"
30+ OutFile "ElmPlatform-${PLATFORM_VERSION}-setup.exe"
31+
32+ ;Default install dir
33+ InstallDir "$PROGRAMFILES\Elm Platform\${PLATFORM_VERSION}"
34+ InstallDirRegKey HKLM "${PRODUCT_DIR_REG_KEY}" ""
35+
36+ ;Icon
37+ !Define MUI_ICON "logo.ico"
38+ !Define MUI_UNICON "logo.ico"
39+
40+ ;Request application privileges for Windows Vista
41+ RequestExecutionLevel highest
42+
43+ ;Best available compression
44+ SetCompressor /SOLID lzma
45+
46+ ;Install types
47+ InstType "Standard"
48+ InstType "Portable (just unpack the files)"
49+
50+;--------------------------------
51+;Macros
52+
53+!macro CheckAdmin thing
54+UserInfo::GetAccountType
55+pop $0
56+${If} $0 != "admin" ;Require admin rights on NT4+
57+ MessageBox MB_YESNO "It is recommended to run this ${thing} as administrator. Do you want to quit and restart the ${thing} manually with elevated privileges?" IDNO CheckAdminDone
58+ SetErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
59+ Quit
60+${EndIf}
61+CheckAdminDone:
62+!macroend
63+
64+;--------------------------------
65+;Callbacks
66+
67+Function .onInit
68+ !insertmacro CheckAdmin "installer"
69+ SetShellVarContext all
70+FunctionEnd
71+
72+Function un.onInit
73+ !insertmacro CheckAdmin "uninstaller"
74+ SetShellVarContext all
75+FunctionEnd
76+
77+Function LaunchLink
78+ ExecShell "open" "http://elm-lang.org/get-started"
79+FunctionEnd
80+
81+;--------------------------------
82+;Interface Settings
83+
84+ !define MUI_ABORTWARNING
85+
86+;--------------------------------
87+;Pages
88+
89+ !Define MUI_WELCOMEFINISHPAGE_BITMAP "welcome.bmp"
90+ !insertmacro MUI_PAGE_WELCOME
91+ ;!insertmacro MUI_PAGE_LICENSE "LICENSE"
92+ !insertmacro MUI_PAGE_DIRECTORY
93+
94+ !Define MUI_COMPONENTSPAGE_NODESC
95+ !insertmacro MUI_PAGE_COMPONENTS
96+
97+ ;Start Menu Folder Page Configuration
98+ !Define MUI_PAGE_HEADER_SUBTEXT \
99+ "Choose a Start Menu folder for the Elm Platform ${PLATFORM_VERSION} shortcuts."
100+ !Define MUI_STARTMENUPAGE_TEXT_TOP \
101+ "Select the Start Menu folder in which you would like to create Elm Platform shortcuts. You can also enter a name to create a new folder."
102+ !Define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
103+ !Define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_DIR_REG_KEY}"
104+ !Define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
105+ !Define MUI_STARTMENUPAGE_DEFAULTFOLDER "Elm Platform ${PLATFORM_VERSION}"
106+ !insertmacro MUI_PAGE_STARTMENU StartMenuPage $START_MENU_FOLDER
107+ !insertmacro MUI_PAGE_INSTFILES
108+ !define MUI_FINISHPAGE_RUN
109+ !define MUI_FINISHPAGE_RUN_FUNCTION "LaunchLink"
110+ !define MUI_FINISHPAGE_RUN_TEXT "Open tutorial on how to use Elm Platform"
111+ !insertmacro MUI_PAGE_FINISH
112+
113+ !insertmacro MUI_UNPAGE_WELCOME
114+ !insertmacro MUI_UNPAGE_CONFIRM
115+ !insertmacro MUI_UNPAGE_INSTFILES
116+ !insertmacro MUI_UNPAGE_FINISH
117+
118+;--------------------------------
119+;Languages
120+
121+ !insertmacro MUI_LANGUAGE "English"
122+
123+;--------------------------------
124+;Installer Sections
125+
126+Section "Base components" SecMain
127+
128+ SectionIn 1 2
129+ ; Make this section mandatory
130+ SectionIn RO
131+
132+ !Include ${INST_DAT}
133+
134+SectionEnd
135+
136+SectionGroup "Update system settings" SecGr
137+
138+Section "Associate with .elm files" SecAssoc
139+
140+ SectionIn 1
141+
142+ ; File associations
143+ WriteRegStr HKCR ".elm" "" "elm"
144+ WriteRegStr HKCR "elm" "" "Elm Source File"
145+ WriteRegStr HKCR "elm\DefaultIcon" "" "$INSTDIR\file.ico"
146+ ;WriteRegStr HKCR "elm\shell\open\command" "" '"$INSTDIR\bin\elm.exe" "%1"'
147+
148+ ;Remember that we registered associations
149+ WriteRegDWORD HKLM "${PRODUCT_DIR_REG_KEY}" Assocs 0x1
150+
151+SectionEnd
152+
153+Section "Update the PATH environment variable" SecPath
154+
155+ SectionIn 1
156+
157+ ; Update PATH
158+ ; First, remove any older version
159+ ExecWait '"$SYSDIR\wscript.exe" //E:vbscript "$INSTDIR\removefrompath.vbs" "$PROGRAMFILES\Elm Platform"'
160+ ; Then add to the PATH
161+ ExecWait '"$SYSDIR\wscript.exe" //E:vbscript "$INSTDIR\updatepath.vbs" "$INSTDIR\bin"'
162+ SetShellVarContext current
163+
164+ ; Update environment variables
165+ SendMessage ${HWND_BROADCAST} ${WM_SETTINGCHANGE} 0 "STR:Environment" /TIMEOUT=5000
166+
167+SectionEnd
168+
169+Section "Store Elm's location in registry" SecElmLoc
170+
171+ SectionIn 1
172+
173+ ; (copied from the GHC installer).
174+ ;WriteRegStr HKCU "Software\Elm\ghc-${GHC_VERSION}" "InstallDir" "$INSTDIR"
175+ WriteRegStr HKCU "Software\Elm" "InstallDir" "$INSTDIR"
176+
177+SectionEnd
178+
179+Section "Create uninstaller" SecAddRem
180+
181+ SectionIn 1
182+ SectionIn RO
183+
184+ ; Add uninstall information to Add/Remove Programs
185+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ElmPlatform-${PLATFORM_VERSION}" \
186+ "DisplayName" "Elm Platform ${PLATFORM_VERSION}"
187+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ElmPlatform-${PLATFORM_VERSION}" \
188+ "UninstallString" "$\"$INSTDIR\Uninstall.exe$\""
189+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ElmPlatform-${PLATFORM_VERSION}" \
190+ "DisplayIcon" "$INSTDIR\logo.ico"
191+ WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ElmPlatform-${PLATFORM_VERSION}" \
192+ "Publisher" "elm-lang.org"
193+
194+ ;Create uninstaller
195+ WriteUninstaller "$INSTDIR\Uninstall.exe"
196+
197+ ; This is needed for uninstaller to work
198+ WriteRegStr HKLM "${PRODUCT_DIR_REG_KEY}" "" "$INSTDIR\Uninstall.exe"
199+ WriteRegStr HKLM "${PRODUCT_DIR_REG_KEY}" "InstallDir" "$INSTDIR"
200+
201+SectionEnd
202+
203+SectionGroupEnd
204+
205+;Section "-StartMenu" StartMenu
206+; SectionIn 1 2
207+;
208+; ; Add start menu shortcuts
209+;
210+; !insertmacro MUI_STARTMENU_WRITE_BEGIN StartMenuPage
211+;
212+; ;Create shortcuts
213+; CreateDirectory "$SMPROGRAMS\$START_MENU_FOLDER"
214+; !insertmacro CreateInternetShortcut \
215+; "$SMPROGRAMS\$START_MENU_FOLDER\${HACKAGE_SHORTCUT_TEXT}" \
216+; "http://hackage.haskell.org" \
217+; "$INSTDIR\icons\hackage.ico" "0"
218+; !insertmacro MUI_STARTMENU_WRITE_END
219+;
220+;SectionEnd
221+
222+;--------------------------------
223+;Uninstaller Section
224+
225+Section "Uninstall"
226+
227+ ; Update PATH
228+ ExecWait '"$SYSDIR\wscript.exe" //E:vbscript "$INSTDIR\removefrompath.vbs" "$PROGRAMFILES\Elm Platform"'
229+ SetShellVarContext current
230+
231+ !Include ${UNINST_DAT}
232+
233+ Delete "$INSTDIR\Uninstall.exe"
234+ RMDir $INSTDIR
235+
236+ ;Since we install to '$PF\Elm Platform\$PLATFORM_VERSION', we
237+ ;should also try to delete '$PF\Elm Platform' if it is empty.
238+ ${GetParent} $INSTDIR $R0
239+ RMDir $R0
240+
241+ ; Delete start menu shortcuts
242+ ;!insertmacro MUI_STARTMENU_GETFOLDER StartMenuPage $START_MENU_FOLDER
243+
244+ ;Delete "$SMPROGRAMS\$START_MENU_FOLDER\${HACKAGE_SHORTCUT_TEXT}.url"
245+ ;RMDir "$SMPROGRAMS\$START_MENU_FOLDER\"
246+
247+ ; Delete registry keys
248+
249+ ReadRegDWORD $0 HKLM "${PRODUCT_DIR_REG_KEY}" Assocs
250+
251+ ${If} $0 = 0x1
252+ DeleteRegValue HKCR ".elm" ""
253+ DeleteRegKey HKCR "elm\DefaultIcon"
254+ ${EndIf}
255+
256+ DeleteRegKey HKCU "Software\Elm"
257+ DeleteRegKey HKLM "${PRODUCT_DIR_REG_KEY}"
258+ DeleteRegKey /IfEmpty HKCU Software\Elm
259+ DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\ElmPlatform-${PLATFORM_VERSION}"
260+
261+ ; Update environment variables
262+ SendMessage ${HWND_BROADCAST} ${WM_SETTINGCHANGE} 0 "STR:Environment" /TIMEOUT=5000
263+
264+SectionEnd
installers/win/README.mdnew file+11
@@ -0,0 +1,11 @@
1+# Building Windows installer
2+
3+You will need the [NSIS installer](http://nsis.sourceforge.net/Download) to be installed.
4+
5+Once everything is installed, run something like this command:
6+
7+ make_installer.cmd 0.17
8+
9+It will build an installer called `ElmPlatform-0.17-setup.exe`. You can read
10+more about what arguments can be given to this command in the comments in
11+`BuildFromSource.hs`.
installers/win/file.iconew file

Binary file not shown.

installers/win/inst.datnew file+11
@@ -0,0 +1,11 @@
1+SetOutPath "$INSTDIR\bin"
2+File "${FILES_SOURCE_PATH}\bin\elm.exe"
3+File "${FILES_SOURCE_PATH}\bin\elm-make.exe"
4+File "${FILES_SOURCE_PATH}\bin\elm-package.exe"
5+File "${FILES_SOURCE_PATH}\bin\elm-repl.exe"
6+File "${FILES_SOURCE_PATH}\bin\elm-reactor.exe"
7+
8+SetOutPath "$INSTDIR"
9+File "file.ico"
10+File "updatepath.vbs"
11+File "removefrompath.vbs"
installers/win/logo.iconew file

Binary file not shown.

installers/win/make_installer.cmdnew file+23
@@ -0,0 +1,23 @@
1+
2+set version=%1
3+
4+runhaskell ..\BuildFromSource.hs %version%
5+if %errorlevel% neq 0 exit /b %errorlevel%
6+
7+mkdir files
8+mkdir files\bin
9+
10+set platform=Elm-Platform\%version%
11+
12+xcopy %platform%\.cabal-sandbox\bin\elm*.exe files\bin /s /e
13+xcopy updatepath.vbs files
14+
15+if EXIST "%ProgramFiles%" (
16+ set nsis=%ProgramFiles%\NSIS
17+) else (
18+ set nsis=%ProgramFiles(x86)%\NSIS
19+)
20+
21+"%nsis%\makensis.exe" /DPLATFORM_VERSION=%version% Nsisfile.nsi
22+
23+rd /s /q files
installers/win/removefrompath.vbsnew file+17
@@ -0,0 +1,17 @@
1+Set WshShell = CreateObject("WScript.Shell")
2+' Make sure there is no trailing slash at the end of elmBasePath
3+elmBasePath = WScript.Arguments(0)
4+'const PathRegKey = "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\Path"
5+const PathRegKey = "HKCU\Environment\Path"
6+
7+on error resume next
8+path = WshShell.RegRead(PathRegKey)
9+if err.number = 0 then
10+ Set regEx = New RegExp
11+ elmBasePath = Replace(Replace(Replace(elmBasePath, "\", "\\"), "(", "\("), ")", "\)")
12+ regEx.Pattern = elmBasePath & "\\\d+\.\d+(\.\d+|)\\bin(;|)"
13+ regEx.Global = True
14+ newPath = regEx.Replace(path, "")
15+ Call WshShell.RegWrite(PathRegKey, newPath, "REG_EXPAND_SZ")
16+end if
17+on error goto 0
installers/win/uninst.datnew file+11
@@ -0,0 +1,11 @@
1+Delete "$INSTDIR\bin\elm.exe"
2+Delete "$INSTDIR\bin\elm-make.exe"
3+Delete "$INSTDIR\bin\elm-package.exe"
4+Delete "$INSTDIR\bin\elm-repl.exe"
5+Delete "$INSTDIR\bin\elm-reactor.exe"
6+RmDir "$INSTDIR\bin"
7+
8+Delete "$INSTDIR\file.ico"
9+Delete "$INSTDIR\updatepath.vbs"
10+Delete "$INSTDIR\removefrompath.vbs"
11+RmDir "$INSTDIR"
installers/win/updatepath.vbsnew file+14
@@ -0,0 +1,14 @@
1+Set WshShell = CreateObject("WScript.Shell")
2+elmPath = WScript.Arguments(0)
3+'const PathRegKey = "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\Path"
4+const PathRegKey = "HKCU\Environment\Path"
5+
6+on error resume next
7+path = WshShell.RegRead(PathRegKey)
8+if err.number <> 0 then
9+ path = ""
10+end if
11+on error goto 0
12+
13+newPath = elmPath & ";" & path
14+Call WshShell.RegWrite(PathRegKey, newPath, "REG_EXPAND_SZ")
installers/win/welcome.bmpnew file

Binary file not shown.