Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2875 dpurdie 1
;-------------------------------------------------------------------------------
2
;
3
;   Example of a NSIS basis Windows Installer suitable for use within the
4
;   Vix-ERG environment
5
;
6
;   This is an example of how things can be done
7
;   It includes a lot of excess documentation that can be removed
8
;
9
;--------------------------------
10
;   Include Modern UI
11
;   Provides an Installer that is similar to many other Windows-XP installers
12
!include "MUI2.nsh"
13
 
14
;--------------------------------
15
;   General
16
;   Specify basic settings
17
;
18
;   Name            - Already set based on package name and version
19
;   BrandingText    - Already set
20
;   Caption         - Already set
21
 
22
;   FileDescription
23
;       Will be available when the user selects the properties
24
;       of the installer. All other properties have been set based the
25
;       package name and version.    
26
;                       
27
VIAddVersionKey "FileDescription" "ArmCompiler 251"
28
 
29
;   Default installation folder
30
;   Sets $INSTDIR
31
;   
32
InstallDir "C:\ARM251" 
33
 
34
;   Get installation folder from registry if available
35
!define InstallDirReg "Software\Vix-ERG\ArmCompiler-251"
36
InstallDirRegKey HKCU ${InstallDirReg} ""
37
 
38
;   Request application privileges for Windows Vista
39
RequestExecutionLevel admin
40
 
41
;   Program Group for Shortcuts
42
!define ProgramGroupBase "BuildTools"
43
!define ProgramGroup "${ProgramGroupBase}\ArmCompiler-251"
44
 
45
;
46
; This is NOT a VIX piece of Software
47
; Don't brand it as such.
48
; Don't know where it came from - just created an installer to ensure that it 
49
; can be installed
50
 
51
!undef  GBE_COMPANY
52
!define GBE_COMPANY "Legacy Installer"
53
 
54
;--------------------------------
55
;   Modern Interface Settings
56
 
57
#!define MUI_ABORTWARNING
58
# !define MUI_ICON                       "${GBE_NSISDATA}\VixIcon.ico"
59
# !define MUI_UNICON                     "${GBE_NSISDATA}\VixIcon.ico"
60
 !define MUI_HEADERIMAGE
61
# !define MUI_HEADERIMAGE_BITMAP         "${GBE_NSISDATA}\VixHeader.bmp"
62
# !define MUI_WELCOMEFINISHPAGE_BITMAP   "${GBE_NSISDATA}\VixPanel.bmp"
63
# !define MUI_UNWELCOMEFINISHPAGE_BITMAP "${GBE_NSISDATA}\VixPanel.bmp"
64
 !define MUI_FINISHPAGE_NOAUTOCLOSE
65
 !define MUI_UNFINISHPAGE_NOAUTOCLOSE
66
 !define MUI_WELCOMEPAGE_TITLE_3LINES
67
 !define MUI_FINISHPAGE_TITLE_3LINES
68
 
69
;--------------------------------
70
;   Pages
71
;   List of Pages for the Modern UI to show
72
 
73
 !insertmacro MUI_PAGE_WELCOME
74
#!insertmacro MUI_PAGE_LICENSE "${GBE_NSISDATA}\license.txt"
75
#!insertmacro MUI_PAGE_COMPONENTS
76
#!insertmacro MUI_PAGE_DIRECTORY
77
 !insertmacro MUI_PAGE_INSTFILES
78
#!insertmacro MUI_PAGE_FINISH
79
 
80
#!insertmacro MUI_UNPAGE_WELCOME
81
 !insertmacro MUI_UNPAGE_CONFIRM
82
#!insertmacro MUI_UNPAGE_COMPONENTS
83
 !insertmacro MUI_UNPAGE_INSTFILES
84
#!insertmacro MUI_UNPAGE_FINISH
85
 
86
;--------------------------------
87
;   Languages
88
;   System will select default language
89
 
90
  !insertmacro MUI_LANGUAGE "English"
91
  !insertmacro MUI_LANGUAGE "French"
92
#  !insertmacro MUI_LANGUAGE "Swedish"
93
 
94
;--------------------------------
95
;   Allow user to select the language
96
#Function .onInit 
97
#    !insertmacro MUI_LANGDLL_DISPLAY 
98
#FunctionEnd
99
 
100
#Function un.onInit 
101
#    !insertmacro MUI_LANGDLL_DISPLAY 
102
#FunctionEnd
103
 
104
;--------------------------------
105
;   Installer Sections
106
;   Each section will show up as a 'component', if that page is shown
107
;
108
Section "Application" SecDummy
109
 
110
    SetOutPath "$INSTDIR"
111
 
112
    ; Install a program
113
    CreateDirectory "$INSTDIR"
114
    IfErrors 0 +2
115
        Abort "Error creating application directory structure"
116
 
117
 
118
    SetOutPath "$INSTDIR"
119
    File /r "ARM251\*"
120
 
121
    IfErrors 0 +2
122
        Abort "Error installing application files"
123
 
124
    ; Create a Short Cut
125
    SetShellVarContext all
126
    CreateDirectory "$SMPROGRAMS\${ProgramGroup}"
127
    CreateShortCut  "$SMPROGRAMS\${ProgramGroup}\UnInstall ArmCompiler.lnk" "$INSTDIR\Uninstall.exe"
128
    IfErrors 0 +2
129
        Abort "Error creating shortcuts"
130
 
131
    IfErrors 0 +2
132
        Abort "Error Installing Application"
133
 
134
SectionEnd
135
 
136
;--------------------------------
137
;Uninstaller Sections
138
 
139
;   Un Installer for files installed by the user
140
;
141
Section "un.Application"
142
  ;
143
  ; Remove the program
144
  RMDir /r "$INSTDIR"
145
 
146
  SetShellVarContext all
147
  RMDir /r "$SMPROGRAMS\${ProgramGroup}"
148
  RMDir "$SMPROGRAMS\${ProgramGroupBase}"
149
 
150
SectionEnd
151
 
152
;--------------------------------
153
;   Section to create the Core of the Uninstaller
154
;   This will be hidden
155
Section "-Core"
156
 
157
    ;Store installation folder
158
    WriteRegStr HKCU ${InstallDirReg} "" $INSTDIR
159
 
160
    ;Create uninstaller and copy it into the install directory
161
    SetOutPath "$INSTDIR"
162
    WriteUninstaller "$INSTDIR\Uninstall.exe"
163
 
164
    ; Write the uninstall keys for Windows so that the package is seen in the
165
    ; Add/Remove Program section of the Control Panel.
166
    ;     Create a 'unique' key in the windows registry
167
    ;     Base it on the package name
168
    ;         Could use a GUID but it MUST NOT be copied if this file is copied
169
    ;
170
    !define UnInstallKeyBase "Software\Microsoft\Windows\CurrentVersion\Uninstall"
171
    !define UnInstallKey "${UnInstallKeyBase}\${GBE_PACKAGE}"
172
 
173
    WriteRegStr   HKLM ${UnInstallKey} "DisplayName" "${GBE_PACKAGE}, ${GBE_VERSION}"
174
    WriteRegStr   HKLM ${UnInstallKey} "Version" "${GBE_VERSION}"
175
    WriteRegStr   HKLM ${UnInstallKey} "DisplayVersion" "${GBE_VERSION_FULL}"
176
    WriteRegStr   HKLM ${UnInstallKey} "Publisher" "${GBE_COMPANY}"
177
    WriteRegStr   HKLM ${UnInstallKey} "InstallLocation" "$INSTDIR"
178
    WriteRegStr   HKLM ${UnInstallKey} "UninstallString" '"$INSTDIR\uninstall.exe"'
179
    WriteRegDWORD HKLM ${UnInstallKey} "NoModify" 1
180
    WriteRegDWORD HKLM ${UnInstallKey} "NoRepair" 1
181
 
182
SectionEnd
183
 
184
;--------------------------------
185
;   Uninistaller section to uninstall keys
186
;   That have been installed as a part of the core installer
187
;
188
Section "-un.Core"
189
 
190
  ; Delete the uninstaller and then the containing directory
191
  ; The directory will only be removed if its empty  
192
  Delete "$INSTDIR\Uninstall.exe"
193
  RMDir "$INSTDIR"
194
 
195
  ; Remove the programs registry key
196
  DeleteRegKey /ifempty HKCU ${InstallDirReg}
197
 
198
  ; Remove Uninstaller registry keys
199
  DeleteRegKey HKLM ${UnInstallKey}
200
 
201
SectionEnd
202