-
Notifications
You must be signed in to change notification settings - Fork 27
/
lpy-bundle.nsi
201 lines (144 loc) · 6 KB
/
lpy-bundle.nsi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# LPy NSIS installer script.
#
# This file is part of LPy.
#
# This copy of LPy is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2, or (at your option) any later
# version.
#
# LPy is supplied in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# LPy; see the file LICENSE. If not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# These will change with different releases.
!define LPY_VERSION "2.0.0"
!define LPY_VERSION_EXTRA "Alpha"
!define LPY_VERSION_MEXTRA "a"
!define LPY_LICENSE "GPL"
!define LPY_LICENSE_LC "gpl"
# These are all derived from the above.
!define LPY_BASE_NAME "Lpy"
!define LPY_SHORT_NAME "${LPY_BASE_NAME} ${LPY_LICENSE} v${LPY_VERSION}${LPY_VERSION_MEXTRA}"
!define LPY_LONG_NAME "${LPY_BASE_NAME} ${LPY_LICENSE} v${LPY_VERSION} ${LPY_VERSION_EXTRA}"
# Tweak some of the standard pages.
!define MUI_WELCOMEPAGE_TEXT \
"This wizard will guide you through the installation of ${LPY_LONG_NAME}.\r\n\
\r\n\
Any code you write must be released under a license that is compatible with \
the GPL.\r\n\
\r\n\
Click Next to continue."
!define MUI_FINISHPAGE_RUN "$LPY_INSTDIR\bin\lpy.exe"
#!define MUI_FINISHPAGE_RUN_TEXT "Run L-Py"
!define MUI_FINISHPAGE_LINK "Get the latest news of L-Py here"
!define MUI_FINISHPAGE_LINK_LOCATION "http://openalea.gforge.inria.fr/dokuwiki/doku.php?id=packages:vplants:lpy:main"
# Include the tools we use.
!include MUI.nsh
!include LogicLib.nsh
# Define the product name and installer executable.
Name "L-Py"
Caption "${LPY_LONG_NAME} Setup"
OutFile "LPy-${LPY_VERSION}${LPY_VERSION_MEXTRA}-win32-Bundle.exe"
# Set the install directory, from the registry if possible.
#InstallDir "${LPY_INSTALLDIR}"
# The different installation types. "Full" is everything. "Minimal" is the
# runtime environment.
InstType "Full"
InstType "Minimal"
# Maximum compression.
SetCompressor /SOLID lzma
# We want the user to confirm they want to cancel.
!define MUI_ABORTWARNING
Var LPY_INSTDIR
Function .onInit
StrCpy $LPY_INSTDIR "$PROGRAMFILES\L-Py"
FunctionEnd
# Define the different pages.
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "doc/LICENSE.txt"
!insertmacro MUI_PAGE_COMPONENTS
!define MUI_DIRECTORYPAGE_TEXT_DESTINATION "L-Py repository"
!define MUI_DIRECTORYPAGE_VARIABLE $LPY_INSTDIR
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
# Other settings.
!insertmacro MUI_LANGUAGE "English"
# Installer sections.
Section "Binaries" SecModules
SectionIn 1 2 RO
# Make sure this is clean and tidy.
RMDir /r $LPY_INSTDIR
CreateDirectory $LPY_INSTDIR
SetOverwrite on
# We have to take the SIP files from where they should have been installed.
SetOutPath $LPY_INSTDIR\bin
File /r .\dist\*
SectionEnd
Section "Documentation" SecDocumentation
SectionIn 1
SetOverwrite on
SetOutPath $LPY_INSTDIR\doc
File .\doc\*
SectionEnd
Section "Examples and tutorial" SecExamples
SectionIn 1
SetOverwrite on
IfFileExists "$LPY_INSTDIR\examples" 0 +2
CreateDirectory $LPY_INSTDIR\examples
SetOutPath $LPY_INSTDIR\examples
File /r .\share\*
SectionEnd
Section "Start Menu shortcuts" SecShortcuts
SectionIn 1
# Make sure this is clean and tidy.
RMDir /r "$SMPROGRAMS\${LPY_BASE_NAME}"
CreateDirectory "$SMPROGRAMS\${LPY_BASE_NAME}"
CreateShortCut "$SMPROGRAMS\${LPY_BASE_NAME}\LPy.lnk" "$LPY_INSTDIR\bin\lpy.exe"
IfFileExists "$LPY_INSTDIR\doc" 0 +2
CreateShortCut "$SMPROGRAMS\${LPY_BASE_NAME}\Web Site.lnk" "http://openalea.gforge.inria.fr/dokuwiki/doku.php?id=packages:vplants:lpy:main"
IfFileExists "$LPY_INSTDIR\examples" 0 +2
CreateShortCut "$SMPROGRAMS\${LPY_BASE_NAME}\Examples Source.lnk" "$LPY_INSTDIR\examples"
CreateShortCut "$SMPROGRAMS\${LPY_BASE_NAME}\Uninstall LPy.lnk" "$LPY_INSTDIR\Uninstall.exe"
SectionEnd
Section -post
# Tell Windows about the package.
WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LPy" "UninstallString" '"$LPY_INSTDIR\Uninstall.exe"'
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LPy" "DisplayName" "${LPY_BASE_NAME}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LPy" "DisplayVersion" "${LPY_VERSION} ${LPY_VERSION_MEXTRA}"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LPy" "NoModify" "1"
WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LPy" "NoRepair" "1"
# Save the installation directory for the uninstaller.
WriteRegStr HKLM "Software\LPy" "Install Path" $LPY_INSTDIR
# Create the uninstaller.
WriteUninstaller "$LPY_INSTDIR\Uninstall.exe"
SectionEnd
# Section description text.
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SecModules} \
"The L-Py binaries."
!insertmacro MUI_DESCRIPTION_TEXT ${SecDocumentation} \
"The L-Py documentation."
!insertmacro MUI_DESCRIPTION_TEXT ${SecExamples} \
"Some first L-Py examples."
!insertmacro MUI_DESCRIPTION_TEXT ${SecShortcuts} \
"This adds shortcuts to your Start Menu."
!insertmacro MUI_FUNCTION_DESCRIPTION_END
Section "Uninstall"
# Get the install directory.
ReadRegStr $LPY_INSTDIR HKLM "Software\LPy" "Install Path"
# The shortcuts section.
RMDir /r "$SMPROGRAMS\${LPY_BASE_NAME}"
# The examples section and the installer itself.
RMDir /r "$LPY_INSTDIR"
# Clean the registry.
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\LPy"
DeleteRegKey HKLM "Software\LPy"
SectionEnd