3 # NSIS configuration file for LibrePilot GCS
4 # The OpenPilot Team, http://www.openpilot.org, Copyright (C) 2010-2015.
5 # The LibrePilot Team, http://www.librepilot.org, Copyright (C) 2015-2016.
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 # You should have received a copy of the GNU General Public License along
18 # with this program; if not, write to the Free Software Foundation, Inc.,
19 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 # This script requires Unicode NSIS 2.46 or higher:
23 # http://www.scratchpaper.com/
26 # - install only built/used modules, not a whole directory.
27 # - remove only installed files, not a whole directory.
29 ;--------------------------------
34 ;--------------------------------
37 !define NSIS_DATA_TREE
"."
38 !define AEROSIMRC_TREE
"${GCS_BUILD_TREE}\misc\AeroSIM-RC"
40 ; Default installation folder
42 InstallDir "$PROGRAMFILES64\${ORG_BIG_NAME}"
44 InstallDir "$PROGRAMFILES32\${ORG_BIG_NAME}"
47 ; Get installation folder from registry if available
48 InstallDirRegKey HKLM "Software\${ORG_BIG_NAME}" "Install Location"
50 ;--------------------------------
53 Name "${GCS_BIG_NAME}"
56 VIProductVersion
${VERSION_FOUR_NUM}
57 VIAddVersionKey
"ProductName" "${GCS_BIG_NAME}"
58 VIAddVersionKey
"ProductVersion" "${VERSION_FOUR_NUM}"
59 VIAddVersionKey
"CompanyName" "The LibrePilot Team, http://www.librepilot.org"
60 VIAddVersionKey
"LegalCopyright" "© 2015-2016 The LibrePilot Team"
61 VIAddVersionKey
"FileDescription" "${GCS_BIG_NAME} Installer"
63 ;--------------------------------
64 ; Installer interface and base settings
67 !define MUI_ABORTWARNING
69 ; Adds an XP manifest to the installer
72 ; Request application privileges for Windows Vista/7
73 RequestExecutionLevel admin
76 SetCompressor
/solid lzma
78 ;--------------------------------
81 BrandingText "© 2015-2016 The LibrePilot Team, http://www.librepilot.org"
83 !define MUI_ICON
"${NSIS_DATA_TREE}\resources\installer_icon.ico"
84 !define MUI_HEADERIMAGE
85 !define MUI_HEADERIMAGE_BITMAP
"${NSIS_DATA_TREE}\resources\header.bmp"
86 !define MUI_WELCOMEFINISHPAGE_BITMAP
"${NSIS_DATA_TREE}\resources\welcome.bmp"
87 !define MUI_UNWELCOMEFINISHPAGE_BITMAP
"${NSIS_DATA_TREE}\resources\welcome.bmp"
89 !define HEADER_BGCOLOR
"0x8C8C8C"
90 !define HEADER_FGCOLOR
"0x343434"
92 !macro SetHeaderColors un
93 Function ${un}SetHeaderColors
94 GetDlgItem
$r3 $HWNDPARENT 1034
95 SetCtlColors
$r3 ${HEADER_BGCOLOR} ${HEADER_FGCOLOR}
96 GetDlgItem
$r3 $HWNDPARENT 1037
97 SetCtlColors
$r3 ${HEADER_BGCOLOR} ${HEADER_FGCOLOR}
98 GetDlgItem
$r3 $HWNDPARENT 1038
99 SetCtlColors
$r3 ${HEADER_BGCOLOR} ${HEADER_FGCOLOR}
103 !insertmacro SetHeaderColors
""
104 !insertmacro SetHeaderColors
"un."
106 ;--------------------------------
107 ; Language selection dialog settings
109 ; Remember the installer language
110 !define MUI_LANGDLL_REGISTRY_ROOT
"HKCU"
111 !define MUI_LANGDLL_REGISTRY_KEY
"Software\${ORG_BIG_NAME}"
112 !define MUI_LANGDLL_REGISTRY_VALUENAME
"Installer Language"
113 !define MUI_LANGDLL_ALWAYSSHOW
115 ;--------------------------------
116 ; Settings for MUI_PAGE_FINISH
117 !define MUI_FINISHPAGE_RUN
118 !define MUI_FINISHPAGE_SHOWREADME
"$INSTDIR\WHATSNEW.txt"
119 !define MUI_FINISHPAGE_RUN_FUNCTION
"RunApplication"
121 ;--------------------------------
124 !define MUI_PAGE_CUSTOMFUNCTION_PRE
"SetHeaderColors"
126 !insertmacro MUI_PAGE_WELCOME
127 !insertmacro MUI_PAGE_LICENSE
"$(LicenseFile)"
128 !insertmacro MUI_PAGE_COMPONENTS
129 !insertmacro MUI_PAGE_DIRECTORY
130 !insertmacro MUI_PAGE_INSTFILES
131 !insertmacro MUI_PAGE_FINISH
133 !define MUI_PAGE_CUSTOMFUNCTION_PRE
"un.SetHeaderColors"
135 !insertmacro MUI_UNPAGE_WELCOME
136 !insertmacro MUI_UNPAGE_CONFIRM
137 !insertmacro MUI_UNPAGE_COMPONENTS
138 !insertmacro MUI_UNPAGE_INSTFILES
139 !insertmacro MUI_UNPAGE_FINISH
141 ;--------------------------------
142 ; Supported languages, license files and translations
144 !include "${NSIS_DATA_TREE}\translations\languages.nsh"
146 ;--------------------------------
149 ; If you are using solid compression, files that are required before
150 ; the actual installation should be stored first in the data block,
151 ; because this will make your installer start faster.
153 !insertmacro MUI_RESERVEFILE_LANGDLL
155 ;--------------------------------
158 ; Copy GCS core files
159 Section "${GCS_BIG_NAME}" InSecCore
161 SetOutPath "$INSTDIR\bin"
162 File /r
"${GCS_BUILD_TREE}\bin\*"
163 SetOutPath "$INSTDIR"
164 File "${PROJECT_ROOT}\LICENSE.txt"
165 File "/oname=README.txt" "${PROJECT_ROOT}\README.md"
166 File "${PROJECT_ROOT}\WHATSNEW.txt"
167 File "${PROJECT_ROOT}\MILESTONES.txt"
168 File "${PROJECT_ROOT}\GPLv3.txt"
172 Section "-Plugins" InSecPlugins
174 SetOutPath "$INSTDIR\lib\${GCS_SMALL_NAME}\plugins"
175 File /r
"${GCS_BUILD_TREE}\lib\${GCS_SMALL_NAME}\plugins\*.dll"
176 File /r
"${GCS_BUILD_TREE}\lib\${GCS_SMALL_NAME}\plugins\*.pluginspec"
179 ; Copy GCS third party libs
180 Section "-Libs" InSecLibs
182 SetOutPath "$INSTDIR\lib\${GCS_SMALL_NAME}\osg"
183 File /r
"${GCS_BUILD_TREE}\lib\${GCS_SMALL_NAME}\osg\*.dll"
184 SetOutPath "$INSTDIR\lib\${GCS_SMALL_NAME}\gstreamer-1.0"
185 File /r
"${GCS_BUILD_TREE}\lib\${GCS_SMALL_NAME}\gstreamer-1.0\*.dll"
189 Section "-Resources" InSecResources
190 SetOutPath "$INSTDIR\share"
191 File /r
"${GCS_BUILD_TREE}\share\${GCS_SMALL_NAME}"
195 Section "-Utilities" InSecUtilities
196 SetOutPath "$INSTDIR\utilities"
197 File "/oname=OPLogConvert-${PACKAGE_LBL}.m" "${UAVO_SYNTH_TREE}\matlab\OPLogConvert.m"
200 Section "Shortcuts" InSecShortcuts
201 ; Create desktop and start menu shortcuts
202 SetOutPath "$INSTDIR"
203 CreateDirectory "$SMPROGRAMS\${ORG_BIG_NAME}"
204 CreateShortCut "$SMPROGRAMS\${ORG_BIG_NAME}\${GCS_BIG_NAME}.lnk" "$INSTDIR\bin\${GCS_SMALL_NAME}.exe" \
205 "" "$INSTDIR\bin\${GCS_SMALL_NAME}.exe" 0
206 CreateShortCut "$SMPROGRAMS\${ORG_BIG_NAME}\${GCS_BIG_NAME} (clean configuration).lnk" "$INSTDIR\bin\${GCS_SMALL_NAME}.exe" \
207 "-reset" "$INSTDIR\bin\${GCS_SMALL_NAME}.exe" 0
208 CreateShortCut "$SMPROGRAMS\${ORG_BIG_NAME}\License.lnk" "$INSTDIR\LICENSE.txt" \
209 "" "$INSTDIR\bin\${GCS_SMALL_NAME}.exe" 0
210 CreateShortCut "$SMPROGRAMS\${ORG_BIG_NAME}\ReadMe.lnk" "$INSTDIR\README.txt" \
211 "" "$INSTDIR\bin\${GCS_SMALL_NAME}.exe" 0
212 CreateShortCut "$SMPROGRAMS\${ORG_BIG_NAME}\ReleaseNotes.lnk" "$INSTDIR\WHATSNEW.txt" \
213 "" "$INSTDIR\bin\${GCS_SMALL_NAME}.exe" 0
214 CreateShortCut "$SMPROGRAMS\${ORG_BIG_NAME}\Milestones.lnk" "$INSTDIR\MILESTONES.txt" \
215 "" "$INSTDIR\bin\${GCS_SMALL_NAME}.exe" 0
216 CreateShortCut "$SMPROGRAMS\${ORG_BIG_NAME}\Website.lnk" "http://www.librepilot.org" \
217 "" "$INSTDIR\bin\${GCS_SMALL_NAME}.exe" 0
218 CreateShortCut "$SMPROGRAMS\${ORG_BIG_NAME}\Wiki.lnk" "https://librepilot.atlassian.net/wiki/display/LPDOC/LibrePilot+Documentation" \
219 "" "$INSTDIR\bin\${GCS_SMALL_NAME}.exe" 0
220 CreateShortCut "$SMPROGRAMS\${ORG_BIG_NAME}\Forums.lnk" "http://forum.librepilot.org" \
221 "" "$INSTDIR\bin\${GCS_SMALL_NAME}.exe" 0
222 CreateShortCut "$DESKTOP\${GCS_BIG_NAME}.lnk" "$INSTDIR\bin\${GCS_SMALL_NAME}.exe" \
223 "" "$INSTDIR\bin\${GCS_SMALL_NAME}.exe" 0
224 CreateShortCut "$SMPROGRAMS\${ORG_BIG_NAME}\Uninstall.lnk" "$INSTDIR\Uninstall.exe" "" "$INSTDIR\Uninstall.exe" 0
227 ; AeroSimRC plugin files
228 Section "AeroSimRC plugin" InSecAeroSimRC
229 SetOutPath "$INSTDIR\misc\AeroSIM-RC"
230 File /r
"${AEROSIMRC_TREE}\*"
233 ; Copy driver files (hidden, driver is always copied to install directory)
234 Section "-Drivers" InSecDrivers
235 SetOutPath "$INSTDIR\drivers"
236 File /r
"${PROJECT_ROOT}\flight\Project\WindowsUSB\*"
239 ; Preinstall OpenPilot CDC driver (disabled by default)
240 Section /o
"CDC driver" InSecInstallDrivers
242 SetOutPath "$PLUGINSDIR"
244 File "/oname=dpinst.exe" "${NSIS_DATA_TREE}\redist\dpinst_x64.exe"
246 File "/oname=dpinst.exe" "${NSIS_DATA_TREE}\redist\dpinst_x86.exe"
248 ExecWait '"$PLUGINSDIR\dpinst.exe" /lm /path "$INSTDIR\drivers"'
251 ; Copy Opengl32.dll if needed (disabled by default)
252 Section /o
"Mesa OpenGL driver" InSecInstallOpenGL
253 SetOutPath "$INSTDIR\bin"
254 File /r
"${GCS_BUILD_TREE}\bin\opengl32\opengl32.dll"
257 Section ; create uninstall info
258 ; Write the installation path into the registry
259 WriteRegStr HKCU "Software\${ORG_BIG_NAME}" "Install Location" $INSTDIR
261 ; Write the uninstall keys for Windows
262 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${ORG_BIG_NAME}" "DisplayName" "${GCS_BIG_NAME}"
263 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${ORG_BIG_NAME}" "UninstallString" '"$INSTDIR\Uninstall.exe"'
264 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${ORG_BIG_NAME}" "DisplayIcon" '"$INSTDIR\bin\${GCS_SMALL_NAME}.exe"'
265 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${ORG_BIG_NAME}" "Publisher" "LibrePilot Team"
266 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${ORG_BIG_NAME}" "URLInfoAbout" "http://www.librepilot.org"
267 WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${ORG_BIG_NAME}" "HelpLink" "https://librepilot.atlassian.net/wiki/display/LPDOC/LibrePilot+Documentation"
268 WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${ORG_BIG_NAME}" "EstimatedSize" 100600
269 WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${ORG_BIG_NAME}" "NoModify" 1
270 WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${ORG_BIG_NAME}" "NoRepair" 1
273 WriteUninstaller "$INSTDIR\Uninstall.exe"
276 ;--------------------------------
277 ; Installer section descriptions
279 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
280 !insertmacro MUI_DESCRIPTION_TEXT
${InSecCore} $(DESC_InSecCore
)
281 !insertmacro MUI_DESCRIPTION_TEXT
${InSecPlugins} $(DESC_InSecPlugins
)
282 !insertmacro MUI_DESCRIPTION_TEXT
${InSecLibs} $(DESC_InSecLibs
)
283 !insertmacro MUI_DESCRIPTION_TEXT
${InSecResources} $(DESC_InSecResources
)
284 !insertmacro MUI_DESCRIPTION_TEXT
${InSecUtilities} $(DESC_InSecUtilities
)
285 !insertmacro MUI_DESCRIPTION_TEXT
${InSecDrivers} $(DESC_InSecDrivers
)
286 !insertmacro MUI_DESCRIPTION_TEXT
${InSecInstallDrivers} $(DESC_InSecInstallDrivers
)
287 !insertmacro MUI_DESCRIPTION_TEXT
${InSecInstallOpenGL} $(DESC_InSecInstallOpenGL
)
288 !insertmacro MUI_DESCRIPTION_TEXT
${InSecAeroSimRC} $(DESC_InSecAeroSimRC
)
289 !insertmacro MUI_DESCRIPTION_TEXT
${InSecShortcuts} $(DESC_InSecShortcuts
)
290 !insertmacro MUI_FUNCTION_DESCRIPTION_END
292 ;--------------------------------
293 ; Installer functions
297 SetShellVarContext all
298 !insertmacro MUI_LANGDLL_DISPLAY
302 ;--------------------------------
303 ; Uninstaller sections
305 Section "un.${GCS_BIG_NAME}" UnSecProgram
306 ; Remove installed files and/or directories
307 RMDir /r
/rebootok
"$INSTDIR\bin"
308 RMDir /r
/rebootok
"$INSTDIR\lib"
309 RMDir /r
/rebootok
"$INSTDIR\share"
310 RMDir /r
/rebootok
"$INSTDIR\firmware"
311 RMDir /r
/rebootok
"$INSTDIR\utilities"
312 RMDir /r
/rebootok
"$INSTDIR\drivers"
313 RMDir /r
/rebootok
"$INSTDIR\misc"
314 Delete /rebootok
"$INSTDIR\*.txt"
315 Delete /rebootok
"$INSTDIR\Uninstall.exe"
318 RMDir /rebootok
"$INSTDIR"
320 ; Remove registry keys
321 DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\${ORG_BIG_NAME}"
322 DeleteRegKey HKCU "Software\${ORG_BIG_NAME}"
324 ; Remove shortcuts, if any
325 SetShellVarContext all
326 Delete /rebootok
"$DESKTOP\${GCS_BIG_NAME}.lnk"
327 Delete /rebootok
"$SMPROGRAMS\${ORG_BIG_NAME}\*"
328 RMDir /rebootok
"$SMPROGRAMS\${ORG_BIG_NAME}"
331 Section "un.Maps cache" UnSecCache
332 ; Remove local app data (maps cache, ...)
333 SetShellVarContext current
334 ; disable status updates as there is potentially a lot of cached files...
336 RMDir /r
/rebootok
"$LOCALAPPDATA\${ORG_BIG_NAME}\${GCS_BIG_NAME}"
338 ; Only remove if no other versions have data here
339 RMDir /rebootok
"$LOCALAPPDATA\${ORG_BIG_NAME}"
342 Section "un.GCS Layout" UnSecConfig
343 ; Remove GCS configuration files
344 SetShellVarContext current
345 Delete /rebootok
"$APPDATA\${ORG_BIG_NAME}\${GCS_BIG_NAME}.db"
346 Delete /rebootok
"$APPDATA\${ORG_BIG_NAME}\${GCS_BIG_NAME}.xml"
349 Section "-un.Profile" UnSecProfile
350 ; Remove ${ORG_BIG_NAME} user profile subdirectory if empty
351 SetShellVarContext current
352 RMDir /rebootok
"$APPDATA\${ORG_BIG_NAME}"
355 ;--------------------------------
356 ; Uninstall section descriptions
358 !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN
359 !insertmacro MUI_DESCRIPTION_TEXT
${UnSecProgram} $(DESC_UnSecProgram
)
360 !insertmacro MUI_DESCRIPTION_TEXT
${UnSecCache} $(DESC_UnSecCache
)
361 !insertmacro MUI_DESCRIPTION_TEXT
${UnSecConfig} $(DESC_UnSecConfig
)
362 !insertmacro MUI_UNFUNCTION_DESCRIPTION_END
364 ;--------------------------------
365 ; Uninstaller functions
369 SetShellVarContext all
370 !insertmacro MUI_UNGETLANGUAGE
374 ;--------------------------------
375 ; Function to run the application from installer
377 Function RunApplication
379 Exec '"$INSTDIR\bin\${GCS_SMALL_NAME}.exe"'