2009-04-07 10:07:37 +08:00
|
|
|
#!Nsis Installer Command Script
|
|
|
|
|
2009-09-22 03:15:55 +08:00
|
|
|
#
|
2009-04-07 10:07:37 +08:00
|
|
|
# Copyright (c) 2009, Shao Miller (shao.miller@yrdsb.edu.on.ca)
|
2009-09-22 03:15:55 +08:00
|
|
|
# Copyright (c) 2009, Cyrill Gorcunov (gorcunov@gmail.com)
|
2009-04-07 10:07:37 +08:00
|
|
|
# All rights reserved.
|
|
|
|
#
|
2009-09-22 03:15:55 +08:00
|
|
|
# The script requires NSIS v2.45 (or any later)
|
|
|
|
#
|
2009-04-07 10:07:37 +08:00
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions are met:
|
|
|
|
# * Redistributions of source code must retain the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer.
|
|
|
|
# * Redistributions in binary form must reproduce the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer in the
|
|
|
|
# documentation and/or other materials provided with the distribution.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
# ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR
|
|
|
|
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
|
|
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
|
|
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
|
|
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
2016-05-17 11:30:09 +08:00
|
|
|
!addincludedir "${objdir}/nsis"
|
|
|
|
!addincludedir "${srcdir}/nsis"
|
2009-04-07 10:12:34 +08:00
|
|
|
!include "version.nsh"
|
2016-03-04 13:37:37 +08:00
|
|
|
!include /nonfatal "arch.nsh"
|
2016-10-23 18:16:31 +08:00
|
|
|
!include /nonfatal "x64.nsh"
|
2016-03-04 13:37:37 +08:00
|
|
|
|
2009-04-07 10:07:37 +08:00
|
|
|
!define PRODUCT_NAME "Netwide Assembler"
|
|
|
|
!define PRODUCT_SHORT_NAME "nasm"
|
|
|
|
!define PACKAGE_NAME "${PRODUCT_NAME} ${VERSION}"
|
|
|
|
!define PACKAGE_SHORT_NAME "${PRODUCT_SHORT_NAME}-${VERSION}"
|
|
|
|
|
2009-09-24 01:14:32 +08:00
|
|
|
SetCompressor lzma
|
|
|
|
|
2009-09-22 03:15:55 +08:00
|
|
|
!define MULTIUSER_EXECUTIONLEVEL Highest
|
|
|
|
!define MULTIUSER_MUI
|
|
|
|
!define MULTIUSER_INSTALLMODE_COMMANDLINE
|
2016-03-04 13:37:37 +08:00
|
|
|
!define MULTIUSER_INSTALLMODE_INSTDIR "NASM"
|
|
|
|
!include "MultiUser.nsh"
|
2009-09-22 03:15:55 +08:00
|
|
|
|
|
|
|
!insertmacro MULTIUSER_PAGE_INSTALLMODE
|
|
|
|
!insertmacro MULTIUSER_INSTALLMODEPAGE_INTERFACE
|
|
|
|
|
|
|
|
;--------------------------------
|
|
|
|
;General
|
|
|
|
|
|
|
|
;Name and file
|
2009-04-07 10:07:37 +08:00
|
|
|
Name "${PACKAGE_NAME}"
|
2016-05-17 11:30:09 +08:00
|
|
|
OutFile "${objdir}/${PACKAGE_SHORT_NAME}-installer-${ARCH}.exe"
|
2009-09-22 03:15:55 +08:00
|
|
|
|
|
|
|
;Get installation folder from registry if available
|
|
|
|
InstallDirRegKey HKCU "Software\${PRODUCT_SHORT_NAME}" ""
|
|
|
|
|
|
|
|
;Request application privileges for Windows Vista
|
|
|
|
RequestExecutionLevel user
|
|
|
|
|
|
|
|
;--------------------------------
|
|
|
|
;Variables
|
|
|
|
|
|
|
|
Var StartMenuFolder
|
|
|
|
Var CmdFailed
|
|
|
|
|
|
|
|
;--------------------------------
|
|
|
|
;Interface Settings
|
|
|
|
Caption "${PACKAGE_SHORT_NAME} installation"
|
2016-05-17 11:30:09 +08:00
|
|
|
Icon "${srcdir}/nsis/nasm.ico"
|
|
|
|
UninstallIcon "${srcdir}/nsis/nasm-un.ico"
|
2009-09-22 03:15:55 +08:00
|
|
|
|
|
|
|
!define MUI_ABORTWARNING
|
|
|
|
|
|
|
|
;--------------------------------
|
|
|
|
;Pages
|
|
|
|
|
|
|
|
!insertmacro MUI_PAGE_COMPONENTS
|
|
|
|
!insertmacro MUI_PAGE_DIRECTORY
|
|
|
|
|
|
|
|
;Start Menu Folder Page Configuration
|
|
|
|
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
|
|
|
|
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\${PRODUCT_SHORT_NAME}"
|
|
|
|
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_SHORT_NAME}"
|
|
|
|
|
|
|
|
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
|
|
|
|
|
|
|
|
!insertmacro MUI_PAGE_INSTFILES
|
|
|
|
|
|
|
|
!insertmacro MUI_UNPAGE_CONFIRM
|
|
|
|
!insertmacro MUI_UNPAGE_INSTFILES
|
|
|
|
|
|
|
|
;--------------------------------
|
|
|
|
;Installer Sections
|
|
|
|
|
|
|
|
!insertmacro MUI_LANGUAGE English
|
|
|
|
|
|
|
|
Section "NASM" SecNasm
|
|
|
|
Sectionin RO
|
|
|
|
SetOutPath "$INSTDIR"
|
2016-05-17 11:30:09 +08:00
|
|
|
File "${srcdir}/LICENSE"
|
|
|
|
File "${objdir}/nasm.exe"
|
|
|
|
File "${objdir}/ndisasm.exe"
|
|
|
|
File "${srcdir}/nsis/nasm.ico"
|
2009-09-22 03:15:55 +08:00
|
|
|
|
|
|
|
;Store installation folder
|
|
|
|
WriteRegStr HKCU "Software\${PRODUCT_SHORT_NAME}" "" $INSTDIR
|
|
|
|
|
|
|
|
;Store shortcuts folder
|
|
|
|
WriteRegStr HKCU "Software\${PRODUCT_SHORT_NAME}\" "lnk" $SMPROGRAMS\$StartMenuFolder
|
2011-07-16 03:10:46 +08:00
|
|
|
WriteRegStr HKCU "Software\${PRODUCT_SHORT_NAME}\" "bat-lnk" $DESKTOP\${PRODUCT_SHORT_NAME}.lnk
|
2009-09-22 03:15:55 +08:00
|
|
|
|
|
|
|
;
|
|
|
|
; the bat we need
|
|
|
|
StrCpy $CmdFailed "true"
|
|
|
|
FileOpen $0 "nasmpath.bat" w
|
|
|
|
IfErrors skip
|
|
|
|
StrCpy $CmdFailed "false"
|
|
|
|
FileWrite $0 "@set path=$INSTDIR;%path%$\r$\n"
|
|
|
|
FileWrite $0 "@%comspec%"
|
|
|
|
FileClose $0
|
|
|
|
CreateShortCut "$DESKTOP\${PRODUCT_SHORT_NAME}.lnk" "$INSTDIR\nasmpath.bat" "" "$INSTDIR\nasm.ico" 0
|
|
|
|
skip:
|
|
|
|
;Create uninstaller
|
|
|
|
WriteUninstaller "$INSTDIR\Uninstall.exe"
|
|
|
|
|
|
|
|
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
|
|
|
|
|
|
|
|
;Create shortcuts
|
|
|
|
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
|
|
|
|
StrCmp $CmdFailed "true" +2
|
|
|
|
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\${PRODUCT_SHORT_NAME}-shell.lnk" "$INSTDIR\nasmpath.bat"
|
|
|
|
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\${PRODUCT_SHORT_NAME}.lnk" "$INSTDIR\nasm.exe" "" "$INSTDIR\nasm.ico" 0
|
|
|
|
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
|
|
|
|
|
|
|
|
!insertmacro MUI_STARTMENU_WRITE_END
|
2009-04-07 10:07:37 +08:00
|
|
|
SectionEnd
|
|
|
|
|
2009-09-22 03:15:55 +08:00
|
|
|
Section "RDOFF" SecRdoff
|
2016-05-17 11:30:09 +08:00
|
|
|
File "${objdir}/rdoff/ldrdf.exe"
|
|
|
|
File "${objdir}/rdoff/rdf2bin.exe"
|
|
|
|
File "${objdir}/rdoff/rdf2com.exe"
|
|
|
|
File "${objdir}/rdoff/rdf2ith.exe"
|
|
|
|
File "${objdir}/rdoff/rdf2ihx.exe"
|
|
|
|
File "${objdir}/rdoff/rdf2srec.exe"
|
|
|
|
File "${objdir}/rdoff/rdfdump.exe"
|
|
|
|
File "${objdir}/rdoff/rdflib.exe"
|
2009-04-07 10:07:37 +08:00
|
|
|
SectionEnd
|
|
|
|
|
2009-09-22 03:15:55 +08:00
|
|
|
Section "Manual" SecManual
|
|
|
|
SetOutPath "$INSTDIR"
|
2016-05-17 11:30:09 +08:00
|
|
|
File "${objdir}/doc/nasmdoc.pdf"
|
2009-09-24 03:33:11 +08:00
|
|
|
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Manual.lnk" "$INSTDIR\nasmdoc.pdf"
|
2009-04-07 10:07:37 +08:00
|
|
|
SectionEnd
|
|
|
|
|
2009-09-26 15:21:20 +08:00
|
|
|
Section "VS8 integration" SecVS8
|
2016-03-04 13:37:37 +08:00
|
|
|
CreateDirectory "$INSTDIR\VSrules"
|
|
|
|
SetOutPath "$INSTDIR\VSrules"
|
2016-05-17 11:30:09 +08:00
|
|
|
File "${srcdir}/contrib/VSrules/nasm.README"
|
|
|
|
File "${srcdir}/contrib/VSrules/nasm.rules"
|
2009-09-26 15:21:20 +08:00
|
|
|
SectionEnd
|
|
|
|
|
2009-09-22 03:15:55 +08:00
|
|
|
;--------------------------------
|
|
|
|
;Descriptions
|
|
|
|
|
|
|
|
;Language strings
|
|
|
|
LangString DESC_SecNasm ${LANG_ENGLISH} "NASM assembler and disassember modules"
|
|
|
|
LangString DESC_SecManual ${LANG_ENGLISH} "Complete NASM manual (pdf file)"
|
|
|
|
LangString DESC_SecRdoff ${LANG_ENGLISH} "RDOFF utilities (you may not need it if you don't know what is it)"
|
2009-09-26 15:21:20 +08:00
|
|
|
LangString DESC_SecVS8 ${LANG_ENGLISH} "Visual Studio 2008 NASM integration (rules file)"
|
2009-09-22 03:15:55 +08:00
|
|
|
|
|
|
|
;Assign language strings to sections
|
|
|
|
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
|
|
|
|
!insertmacro MUI_DESCRIPTION_TEXT ${SecNasm} $(DESC_SecNasm)
|
|
|
|
!insertmacro MUI_DESCRIPTION_TEXT ${SecRdoff} $(DESC_SecRdoff)
|
|
|
|
!insertmacro MUI_DESCRIPTION_TEXT ${SecManual} $(DESC_SecManual)
|
2009-09-26 15:21:20 +08:00
|
|
|
!insertmacro MUI_DESCRIPTION_TEXT ${SecVS8} $(DESC_SecVS8)
|
2009-09-22 03:15:55 +08:00
|
|
|
!insertmacro MUI_FUNCTION_DESCRIPTION_END
|
|
|
|
|
|
|
|
;--------------------------------
|
|
|
|
;Uninstaller Section
|
|
|
|
|
2009-04-07 10:07:37 +08:00
|
|
|
Section "Uninstall"
|
2009-09-22 03:15:55 +08:00
|
|
|
;
|
|
|
|
; files on HDD
|
2011-07-07 04:56:35 +08:00
|
|
|
IfFileExists "$INSTDIR" +3 +1
|
|
|
|
MessageBox MB_OK "No files found, aborting."
|
|
|
|
Abort
|
2011-07-16 02:38:47 +08:00
|
|
|
MessageBox MB_YESNO "The following directory will be deleted$\n$INSTDIR" IDYES rm_instdir_true IDNO rm_instdir_false
|
|
|
|
rm_instdir_true:
|
|
|
|
RMDir /r /rebootok "$INSTDIR"
|
|
|
|
rm_instdir_false:
|
2011-07-16 03:10:46 +08:00
|
|
|
|
2011-07-07 04:56:35 +08:00
|
|
|
;
|
2011-07-16 03:10:46 +08:00
|
|
|
; Desktop link
|
|
|
|
ReadRegStr $0 HKCU Software\${PRODUCT_SHORT_NAME} "bat-lnk"
|
|
|
|
StrCmp $0 0 +1 +3
|
|
|
|
MessageBox MB_OK "Invalid path to a bat-lnk file, aborting"
|
|
|
|
Abort
|
|
|
|
IfFileExists $0 +3 +1
|
|
|
|
MessageBox MB_OK "No bat-lnk files found, aborting."
|
|
|
|
Abort
|
|
|
|
MessageBox MB_YESNO "The following file will be deleted$\n$0" IDYES rm_batlinks_true IDNO rm_batlinks_false
|
|
|
|
rm_batlinks_true:
|
|
|
|
Delete /rebootok "$0"
|
|
|
|
RMDir "$0"
|
|
|
|
rm_batlinks_false:
|
|
|
|
|
2009-09-22 03:15:55 +08:00
|
|
|
;
|
2011-07-07 04:56:35 +08:00
|
|
|
; Start menu folder
|
2009-09-22 03:15:55 +08:00
|
|
|
ReadRegStr $0 HKCU Software\${PRODUCT_SHORT_NAME} "lnk"
|
2011-07-07 04:56:35 +08:00
|
|
|
StrCmp $0 0 +1 +3
|
|
|
|
MessageBox MB_OK "Invalid path to a lnk file, aborting"
|
|
|
|
Abort
|
|
|
|
IfFileExists $0 +3 +1
|
|
|
|
MessageBox MB_OK "No lnk files found, aborting."
|
|
|
|
Abort
|
2011-07-16 02:38:47 +08:00
|
|
|
MessageBox MB_YESNO "The following directory will be deleted$\n$0" IDYES rm_links_true IDNO rm_links_false
|
|
|
|
rm_links_true:
|
|
|
|
Delete /rebootok "$0\*"
|
|
|
|
RMDir "$0"
|
|
|
|
rm_links_false:
|
2011-07-16 03:10:46 +08:00
|
|
|
DeleteRegKey /ifempty HKCU "Software\${PRODUCT_SHORT_NAME}"
|
2009-04-07 10:07:37 +08:00
|
|
|
SectionEnd
|
|
|
|
|
2009-09-22 03:15:55 +08:00
|
|
|
;
|
|
|
|
; MUI requires this hooks
|
|
|
|
Function .onInit
|
|
|
|
!insertmacro MULTIUSER_INIT
|
2016-10-23 18:16:31 +08:00
|
|
|
${If} ${RunningX64}
|
|
|
|
SetRegView 64
|
|
|
|
${EnableX64FSRedirection}
|
|
|
|
StrCpy $INSTDIR "$PROGRAMFILES64\${PRODUCT_SHORT_NAME}"
|
|
|
|
${Else}
|
|
|
|
StrCpy $INSTDIR "$PROGRAMFILES\${PRODUCT_SHORT_NAME}"
|
|
|
|
${EndIf}
|
2009-09-22 03:15:55 +08:00
|
|
|
FunctionEnd
|
2009-04-07 10:07:37 +08:00
|
|
|
|
2009-09-22 03:15:55 +08:00
|
|
|
Function un.onInit
|
|
|
|
!insertmacro MULTIUSER_UNINIT
|
|
|
|
FunctionEnd
|