2019-05-29 21:48:46 +00:00
|
|
|
# Version
|
2019-12-10 00:03:07 +00:00
|
|
|
!define VERSION "1.6.0"
|
2019-10-15 01:35:13 +00:00
|
|
|
!define PRODUCT_VERSION "${VERSION}.0"
|
2019-05-29 21:48:46 +00:00
|
|
|
VIProductVersion "${PRODUCT_VERSION}"
|
|
|
|
VIFileVersion "${PRODUCT_VERSION}"
|
|
|
|
|
2019-05-29 00:45:39 +00:00
|
|
|
# Use the modern UI
|
2018-12-11 03:20:04 +00:00
|
|
|
!define MULTIUSER_EXECUTIONLEVEL Highest
|
|
|
|
!define MULTIUSER_MUI
|
|
|
|
!define MULTIUSER_INSTALLMODE_COMMANDLINE
|
2019-05-29 21:48:46 +00:00
|
|
|
!define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY "Software\Janet\${VERSION}"
|
|
|
|
!define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME ""
|
|
|
|
!define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_KEY "Software\Janet\${VERSION}"
|
|
|
|
!define MULTIUSER_INSTALLMODE_INSTDIR_REGISTRY_VALUENAME ""
|
2019-05-29 23:01:12 +00:00
|
|
|
!define MULTIUSER_INSTALLMODE_INSTDIR "Janet-${VERSION}"
|
2019-06-01 15:34:28 +00:00
|
|
|
|
2019-08-08 02:51:16 +00:00
|
|
|
# For now, use 32 bit folder as build is 32 bit
|
|
|
|
# !define MULTIUSER_USE_PROGRAMFILES64
|
|
|
|
|
2019-06-01 15:34:28 +00:00
|
|
|
# Includes
|
2018-12-11 03:20:04 +00:00
|
|
|
!include "MultiUser.nsh"
|
|
|
|
!include "MUI2.nsh"
|
2019-05-29 00:45:39 +00:00
|
|
|
!include ".\tools\EnvVarUpdate.nsh"
|
2019-06-01 15:34:28 +00:00
|
|
|
!include "LogicLib.nsh"
|
2019-05-29 00:45:39 +00:00
|
|
|
|
|
|
|
# Basics
|
2018-12-11 03:20:04 +00:00
|
|
|
Name "Janet"
|
2019-08-18 23:16:15 +00:00
|
|
|
|
|
|
|
# Do some NSIS-fu to figure out at compile time if we are in appveyor
|
|
|
|
!define OUTNAME $%APPVEYOR_REPO_TAG_NAME%
|
|
|
|
!define "CHECK_${OUTNAME}"
|
|
|
|
!define DOLLAR "$"
|
|
|
|
!ifdef CHECK_${DOLLAR}%APPVEYOR_REPO_TAG_NAME%
|
|
|
|
# We are not in the appveyor environment, use version name
|
2019-08-19 01:01:47 +00:00
|
|
|
!define OUTNAME_PART v${VERSION}
|
2019-08-18 23:16:15 +00:00
|
|
|
!else
|
|
|
|
# We are in appveyor, use git tag name for installer
|
|
|
|
!define OUTNAME_PART ${OUTNAME}
|
|
|
|
!endif
|
|
|
|
OutFile "janet-${OUTNAME_PART}-windows-installer.exe"
|
2019-05-29 00:45:39 +00:00
|
|
|
|
|
|
|
# Some Configuration
|
|
|
|
!define APPNAME "Janet"
|
|
|
|
!define DESCRIPTION "The Janet Programming Language"
|
|
|
|
!define HELPURL "http://janet-lang.org"
|
2019-05-29 17:02:15 +00:00
|
|
|
BrandingText "The Janet Programming Language"
|
2019-05-29 00:45:39 +00:00
|
|
|
|
2019-06-01 15:34:28 +00:00
|
|
|
# Macros for setting registry values
|
|
|
|
!define UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\Janet-${VERSION}"
|
|
|
|
!macro WriteEnv key value
|
|
|
|
${If} $MultiUser.InstallMode == "AllUsers"
|
|
|
|
WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "${key}" "${value}"
|
|
|
|
${Else}
|
|
|
|
WriteRegExpandStr HKCU "Environment" "${key}" "${value}"
|
|
|
|
${EndIf}
|
|
|
|
!macroend
|
|
|
|
!macro DelEnv key
|
|
|
|
${If} $MultiUser.InstallMode == "AllUsers"
|
|
|
|
DeleteRegValue HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "${key}"
|
|
|
|
${Else}
|
|
|
|
DeleteRegValue HKCU "Environment" "${key}"
|
|
|
|
${EndIf}
|
|
|
|
!macroend
|
|
|
|
|
2019-05-29 00:45:39 +00:00
|
|
|
# MUI Configuration
|
|
|
|
!define MUI_ICON "assets\icon.ico"
|
|
|
|
!define MUI_UNICON "assets\icon.ico"
|
|
|
|
!define MUI_HEADERIMAGE
|
|
|
|
!define MUI_HEADERIMAGE_BITMAP "assets\janet-w200.png"
|
|
|
|
!define MUI_HEADERIMAGE_RIGHT
|
2019-05-29 21:48:46 +00:00
|
|
|
!define MUI_ABORTWARNING
|
2019-05-29 00:45:39 +00:00
|
|
|
|
|
|
|
# Show a welcome page first
|
2018-12-11 03:20:04 +00:00
|
|
|
!insertmacro MUI_PAGE_WELCOME
|
|
|
|
!insertmacro MUI_PAGE_LICENSE "LICENSE"
|
2019-05-29 00:45:39 +00:00
|
|
|
|
|
|
|
# Pick Install Directory
|
2018-12-11 03:20:04 +00:00
|
|
|
!insertmacro MULTIUSER_PAGE_INSTALLMODE
|
|
|
|
!insertmacro MUI_PAGE_DIRECTORY
|
2019-05-29 23:01:12 +00:00
|
|
|
!insertmacro MUI_PAGE_INSTFILES
|
2018-12-11 03:20:04 +00:00
|
|
|
|
2019-05-29 21:48:46 +00:00
|
|
|
# Done
|
|
|
|
!insertmacro MUI_PAGE_FINISH
|
2018-12-11 03:20:04 +00:00
|
|
|
|
2019-05-29 00:45:39 +00:00
|
|
|
# Need to set a language.
|
|
|
|
!insertmacro MUI_LANGUAGE "English"
|
2019-06-01 14:38:28 +00:00
|
|
|
|
2019-05-29 00:45:39 +00:00
|
|
|
function .onInit
|
2019-05-29 21:48:46 +00:00
|
|
|
!insertmacro MULTIUSER_INIT
|
2019-05-29 00:45:39 +00:00
|
|
|
functionEnd
|
2018-12-11 03:20:04 +00:00
|
|
|
|
2019-05-29 21:48:46 +00:00
|
|
|
section "Janet" BfWSection
|
2019-07-27 20:16:28 +00:00
|
|
|
|
2019-05-29 00:45:39 +00:00
|
|
|
createDirectory "$INSTDIR\Library"
|
|
|
|
createDirectory "$INSTDIR\C"
|
|
|
|
createDirectory "$INSTDIR\bin"
|
2019-06-01 14:38:28 +00:00
|
|
|
createDirectory "$INSTDIR\docs"
|
2019-07-28 05:05:15 +00:00
|
|
|
setOutPath "$INSTDIR"
|
2019-06-01 14:38:28 +00:00
|
|
|
|
|
|
|
# Bin files
|
2019-05-29 00:45:39 +00:00
|
|
|
file /oname=bin\janet.exe dist\janet.exe
|
|
|
|
file /oname=logo.ico assets\icon.ico
|
2019-06-01 14:38:28 +00:00
|
|
|
file /oname=bin\jpm.janet auxbin\jpm
|
2019-06-01 14:43:40 +00:00
|
|
|
file /oname=bin\jpm.bat tools\jpm.bat
|
2019-06-01 14:38:28 +00:00
|
|
|
|
2019-07-27 20:16:28 +00:00
|
|
|
# C headers and library files
|
2019-05-29 00:45:39 +00:00
|
|
|
file /oname=C\janet.h dist\janet.h
|
|
|
|
file /oname=C\janetconf.h dist\janetconf.h
|
|
|
|
file /oname=C\janet.lib dist\janet.lib
|
|
|
|
file /oname=C\janet.exp dist\janet.exp
|
|
|
|
file /oname=C\janet.c dist\janet.c
|
2019-07-28 01:44:44 +00:00
|
|
|
file /oname=C\libjanet.lib dist\libjanet.lib
|
2019-06-01 14:38:28 +00:00
|
|
|
|
|
|
|
# Documentation
|
2019-06-01 15:34:28 +00:00
|
|
|
file /oname=docs\docs.html dist\doc.html
|
2019-06-01 14:38:28 +00:00
|
|
|
|
|
|
|
# Other
|
|
|
|
file README.md
|
|
|
|
file LICENSE
|
|
|
|
|
2019-07-28 05:05:15 +00:00
|
|
|
# Uninstaller - See function un.onInit and section "uninstall" for configuration
|
|
|
|
writeUninstaller "$INSTDIR\uninstall.exe"
|
2019-06-01 14:38:28 +00:00
|
|
|
|
2019-07-28 05:05:15 +00:00
|
|
|
# Start Menu
|
|
|
|
createShortCut "$SMPROGRAMS\Janet.lnk" "$INSTDIR\bin\janet.exe" "" "$INSTDIR\logo.ico"
|
2019-06-01 14:38:28 +00:00
|
|
|
|
2019-06-01 15:34:28 +00:00
|
|
|
# Set up Environment variables
|
|
|
|
!insertmacro WriteEnv JANET_PATH "$INSTDIR\Library"
|
|
|
|
!insertmacro WriteEnv JANET_HEADERPATH "$INSTDIR\C"
|
2019-07-27 03:43:54 +00:00
|
|
|
!insertmacro WriteEnv JANET_LIBPATH "$INSTDIR\C"
|
2019-06-01 15:34:28 +00:00
|
|
|
!insertmacro WriteEnv JANET_BINPATH "$INSTDIR\bin"
|
2019-05-29 00:45:39 +00:00
|
|
|
|
|
|
|
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
|
2019-06-01 14:38:28 +00:00
|
|
|
|
2019-05-29 00:45:39 +00:00
|
|
|
# Update path
|
2019-07-28 05:05:15 +00:00
|
|
|
${If} $MultiUser.InstallMode == "AllUsers"
|
|
|
|
${EnvVarUpdate} $0 "PATH" "A" "HKLM" "$INSTDIR\bin" ; Append
|
|
|
|
${Else}
|
|
|
|
${EnvVarUpdate} $0 "PATH" "A" "HKCU" "$INSTDIR\bin" ; Append
|
|
|
|
${EndIf}
|
|
|
|
|
|
|
|
# Registry information for add/remove programs
|
|
|
|
WriteRegStr SHCTX "${UNINST_KEY}" "DisplayName" "Janet"
|
|
|
|
WriteRegStr SHCTX "${UNINST_KEY}" "InstallLocation" "$INSTDIR"
|
|
|
|
WriteRegStr SHCTX "${UNINST_KEY}" "DisplayIcon" "$INSTDIR\logo.ico"
|
|
|
|
WriteRegStr SHCTX "${UNINST_KEY}" "Publisher" "Janet-Lang.org"
|
|
|
|
WriteRegStr SHCTX "${UNINST_KEY}" "HelpLink" "${HELPURL}"
|
|
|
|
WriteRegStr SHCTX "${UNINST_KEY}" "URLUpdateInfo" "${HELPURL}"
|
|
|
|
WriteRegStr SHCTX "${UNINST_KEY}" "URLInfoAbout" "${HELPURL}"
|
|
|
|
WriteRegStr SHCTX "${UNINST_KEY}" "DisplayVersion" "${VERSION}"
|
|
|
|
WriteRegDWORD SHCTX "${UNINST_KEY}" "NoModify" 1
|
|
|
|
WriteRegDWORD SHCTX "${UNINST_KEY}" "NoRepair" 1
|
|
|
|
WriteRegDWORD SHCTX "${UNINST_KEY}" "EstimatedSize" 1000
|
2019-06-01 15:34:28 +00:00
|
|
|
# Add uninstall
|
|
|
|
WriteRegStr SHCTX "${UNINST_KEY}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\" /$MultiUser.InstallMode"
|
|
|
|
WriteRegStr SHCTX "${UNINST_KEY}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /$MultiUser.InstallMode /S"
|
2019-07-28 05:05:15 +00:00
|
|
|
|
2019-05-29 00:45:39 +00:00
|
|
|
sectionEnd
|
2019-06-01 14:38:28 +00:00
|
|
|
|
2019-05-29 00:45:39 +00:00
|
|
|
# Uninstaller
|
2019-06-01 14:38:28 +00:00
|
|
|
|
2019-05-29 00:45:39 +00:00
|
|
|
function un.onInit
|
2019-05-29 21:48:46 +00:00
|
|
|
!insertmacro MULTIUSER_UNINIT
|
2019-05-29 00:45:39 +00:00
|
|
|
functionEnd
|
2019-06-01 14:38:28 +00:00
|
|
|
|
2019-05-29 00:45:39 +00:00
|
|
|
section "uninstall"
|
2019-06-01 14:38:28 +00:00
|
|
|
|
2019-07-28 05:05:15 +00:00
|
|
|
# Remove Start Menu launcher
|
|
|
|
delete "$SMPROGRAMS\Janet.lnk"
|
2019-06-01 14:38:28 +00:00
|
|
|
|
2019-07-28 05:05:15 +00:00
|
|
|
# Remove files
|
2019-05-29 23:01:12 +00:00
|
|
|
delete "$INSTDIR\logo.ico"
|
2019-06-01 14:38:28 +00:00
|
|
|
delete "$INSTDIR\README.md"
|
|
|
|
delete "$INSTDIR\LICENSE"
|
2019-05-29 23:48:31 +00:00
|
|
|
rmdir /r "$INSTDIR\Library"
|
|
|
|
rmdir /r "$INSTDIR\bin"
|
|
|
|
rmdir /r "$INSTDIR\C"
|
2019-06-01 14:38:28 +00:00
|
|
|
rmdir /r "$INSTDIR\docs"
|
|
|
|
|
2019-05-29 00:45:39 +00:00
|
|
|
# Remove env vars
|
2019-06-01 15:34:28 +00:00
|
|
|
!insertmacro DelEnv JANET_PATH
|
|
|
|
!insertmacro DelEnv JANET_HEADERPATH
|
2019-07-27 03:43:54 +00:00
|
|
|
!insertmacro DelEnv JANET_LIBPATH
|
2019-06-01 15:34:28 +00:00
|
|
|
!insertmacro DelEnv JANET_BINPATH
|
2019-05-29 00:45:39 +00:00
|
|
|
|
|
|
|
# Unset PATH
|
2019-07-28 05:05:15 +00:00
|
|
|
${If} $MultiUser.InstallMode == "AllUsers"
|
|
|
|
${un.EnvVarUpdate} $0 "PATH" "R" "HKLM" "$INSTDIR\bin" ; Remove
|
|
|
|
${Else}
|
|
|
|
${un.EnvVarUpdate} $0 "PATH" "R" "HKCU" "$INSTDIR\bin" ; Remove
|
|
|
|
${EndIf}
|
2019-06-01 14:38:28 +00:00
|
|
|
|
2019-05-29 00:45:39 +00:00
|
|
|
# make sure windows knows about the change
|
|
|
|
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
|
2019-06-01 14:38:28 +00:00
|
|
|
|
2019-07-28 05:05:15 +00:00
|
|
|
# Always delete uninstaller as the last action
|
|
|
|
delete "$INSTDIR\uninstall.exe"
|
2019-06-01 14:38:28 +00:00
|
|
|
|
2019-07-28 05:05:15 +00:00
|
|
|
# Remove uninstaller information from the registry
|
2019-06-01 15:34:28 +00:00
|
|
|
DeleteRegKey SHCTX "${UNINST_KEY}"
|
2019-07-28 05:05:15 +00:00
|
|
|
|
2019-08-08 02:51:16 +00:00
|
|
|
sectionEnd
|