Merge lp:~shevonar/widelands/nsis-cmake into lp:widelands

Proposed by Shevonar
Status: Merged
Merged at revision: 6231
Proposed branch: lp:~shevonar/widelands/nsis-cmake
Merge into: lp:widelands
Diff against target: 1228 lines (+1155/-8)
2 files modified
CMakeLists.txt (+161/-8)
cmake/Modules/NSIS.template.in (+994/-0)
To merge this branch: bzr merge lp:~shevonar/widelands/nsis-cmake
Reviewer Review Type Date Requested Status
Shevonar Approve
Tino Approve
Nasenbaer Approve
Review via email: mp+91669@code.launchpad.net

Description of the change

I added NSIS support for CMake/CPack and tested it on Window 7 64bit with MinGW. For me everything is fine. However I would like some other "Windows developers" to also test it before merging into trunk (Tino?). Changes to the InnoSetup installer: Language is selected automatically (at least I hope so), desktop icons are always created and the changelog is not shown. All of these things can be implemented if necessary.

To post a comment you must log in.
Revision history for this message
Nasenbaer (nasenbaer) wrote :

First of all: please do not missunderstand me, I am not against a move to nsis, however:

* What are the benefits of this change?
 - Is the file size of the resulting setup smaller?
 - Is the setup installation faster than the old one?
 - is there any other cool new feature like optional download of further maps or the like?
* The changes you listed were all avialable for innosetup as well, however when I initially created the innosetup script I decided to (1) show the language list, as I know a lot of people using e.g. English Windows version, but they are actually from another country and would like to select their mother tounge (2) I always hated, if programs installed icons without asking - I am sure I am not the only one ;) (3) the changelog ... well not necessary, but I thought it might be interesting for users to see, what changed. -> but to be honest I created that file without much feedback by the community, so maybe 1, 2 or maybe even all of your changes are mostly wished.

However, it would be nice, if you could point this out :)

review: Needs Information
Revision history for this message
Shevonar (shevonar) wrote :

The only advantage is that you can simply run "make package" and have a ready-to-run installer after a while. No extra step is necessary.
 - The installer file size is about the same or slightly bigger
 - I just tested the installation speed and InnoSetup is about more than 3 times slower! 8:40 min vs 2:25min. (However the creation of the NSIS installer takes about 3 or 4 times longer, but that shouldn't be a problem)
 - NSIS and InnoSetup have nearly the same features. But NSIS is integrated into CPack and InnoSetup is not.

The changes are less changes than "bugs". I just didn't work on them yet. If there is need for these features there will be a way to realize them ;)

Revision history for this message
Nasenbaer (nasenbaer) wrote :

Alright this is indeed a good point.
I personally would like to see (1) and (2) from above implemented before merge - but well I did not mark this comment as "Needs fixing" by purpose :).

Anyone else an opinion?

Revision history for this message
Shevonar (shevonar) wrote :

I'd like to point out that it is an alternative to the InnoSetup not a replacement, so there shouldn't be any disadvantage at all ;) I just didn't want to commit code that is working only on my system and development environment.

Revision history for this message
Nasenbaer (nasenbaer) wrote :

I understand.
However I see things different. So here is my history lesson ;) :
Before Widelands' cmake implementation was ready for the public, we had 4 completely different build systems (scons for linux, xcode for mac, make for mingw win32 and msvc for win32). All of these needed maintenance. E.g. if a new source file was added, all of those 4 build systems required to add those files to a list somewhere in their files. The msvc Buildsystem was the first that was abonded and left alone in the wild ;). scons - also very often used didn't really work out that fine and had a lot of problems... Long speech short sense:

The bug you linked says in the description "We should try to replace InnoSetup with CPack NSIS functionality if that's is comfortable and also as complete and as intuitive as InnoSetup." and I agree, that we should do this, if the "ifs" are met.

There are not that much people that regulary build Widelands on windows + build a setup to provide for the public (am only aware of Tino), so taking care about 2 setup compiler scripts would be way to overpowered.

Revision history for this message
Shevonar (shevonar) wrote :

I understand. :)
Getting rid of InnoSetup would even more unify the build process on Windows because only the CMake file needs to be changed not also the InnoSetup script. Since Tino is the only one who will use this feature regularly I really like to hear his opinion. I could imagine he would like a "WL_NOMUSIC" variable because his development builds usually don't have music. I will try to fix the bugs and make them easily changeable (even more variables in CMake) so everyones needs can be satisfied. I mark it as "Needs Fixing" myself ;)

review: Needs Fixing
Revision history for this message
Tino (tino79) wrote :

This is really nice, i am looking forward to test (not sure when...).
I tried once last year to do this, but failed miserably and stayed with the Inno Script.

A really nice feature would be to somehow incoporate the integration of the needed dlls. At the moment i've a manually edited inno script which takes them from an external dir.
Your script just takes all dlls from the <cmakedir>/src ? Where the widelands.exe resides?

Revision history for this message
Shevonar (shevonar) wrote :

Currently the script takes them from the checkout folder where everything is in, like the (default) InnoSetup script did. I also thought of including the dlls from wherever they might be, but don't really have a idea how to do this, because the dlls could be in any place...

Revision history for this message
Shevonar (shevonar) wrote :

Now with all the requested changes:
 - language dialog (CPACK_NSIS_LANGUAGE_DIALOG=ON)
 - changelog (CPACK_NSIS_CHANGELOG=ON)
 - a checkbox to optionally add desktop icons
 - and WL_NOMUSIC to disable the packing of music files and soundfx to the installer
Any other needs or wishes?

Revision history for this message
Nasenbaer (nasenbaer) wrote :

seems good to me :)!

If Tino has no arguments against it, I would suggest you merge your branch and remove the innoc setup script :)

review: Approve
Revision history for this message
Tino (tino79) wrote :

Ok, i've tried, but cmake fails when called:

mit@KITANO /c/data/wl
$ cmake /c/data/repo/trunk
-- Disabled Unit Tests
-- Using compiler flags: -O3 -DNDEBUG
-- Found GGZ_Core: c:/bin/mingw32/lib/libggzmod.dll.a;c:/bin/mingw32/lib/libggzc
ore.dll.a;c:/bin/mingw32/lib/libggz.dll.a
-- SDLMAIN_LIBRARY is c:/bin/mingw32/lib/libSDLmain.a
CMake Error at c:/bin/CMake/share/cmake-2.8/Modules/CPack.cmake:338 (message):
  CPack license resource file: "C:/data/wl\..\COPYING" could not be found.
Call Stack (most recent call first):
  c:/bin/CMake/share/cmake-2.8/Modules/CPack.cmake:343 (cpack_check_file_exists)

  CMakeLists.txt:607 (include)

CMake Error at c:/bin/CMake/share/cmake-2.8/Modules/CPack.cmake:338 (message):
  CPack readme resource file: "C:/data/wl\..\ChangeLog" could not be found.
Call Stack (most recent call first):
  c:/bin/CMake/share/cmake-2.8/Modules/CPack.cmake:344 (cpack_check_file_exists)

  CMakeLists.txt:607 (include)

-- Configuring incomplete, errors occurred!

mit@KITANO /c/data/wl
$

Do i have to set any new variables?

review: Needs Information
Revision history for this message
Shevonar (shevonar) wrote :

I guess you are running cmake directly from within the checkout folder. I run it from a "build" subfolder to keep the checkout folder clean. I think that is the problem. I will see if I can change the path to eliminate that problem. Could you try to run cmake from a subfolder meanwhile?

Revision history for this message
Tino (tino79) wrote :

No, i am in a subfolder:

/c/data/repo/trunk <= checkout dir
/c/data/wl <= build dir

I call in the build dir (in a msys mingw shell):

   cmake /c/data/repo/trunk
   make -j4

This was working just fine with the current trunk.

Revision history for this message
Shevonar (shevonar) wrote :

Yet another try: I changed the paths so they should find the correct files also in your building environment. The dll files are loaded from the directory where you run cmake in (build dir). Could you try it again.

Just to clarify the problem:
My building environment looks this way:
widelands/trunk <= checkout dir
widelands/trunk/build <= build dir
So the ChangeLog file is in the parent folder of my build directory. Now it looks for the ChangeLog file next to the current cmake lists file which is correct in all environments.

Revision history for this message
Tino (tino79) wrote :

Ok, it is working now. But the installer gets named "widelands-0.1.1-win32.exe", shouldn't it be e.g. "widelands-bzr6226[trunk](Release).exe" ?

I've tried to fix this in my branch, perhaps you could have a look at my changes, Shevonar. I think there were some duplicate variable sets...
But even with my changes the naming does not change :/

review: Needs Fixing
Revision history for this message
Shevonar (shevonar) wrote :

I think my package naming will work, once Widelands gets proper version numbers. The problem is not in the part of the script I wrote, but a more general one. The current version isn't defined until make is executed. Since the CPack script is generated when cmake runs it cannot even know the current version. To work around this I set the WL_VERSION variable manually:
cmake -DWL_VERSION=bzr6226 ..

Revision history for this message
Shevonar (shevonar) wrote :

Okay it should work now. I will commit soon after the test run has finished, but the CPack script looks good so far.

Revision history for this message
Shevonar (shevonar) wrote :

Took me much longer than expected. I tried to move the dlls to the src folder like you did Tino, but I got a linking error. Another problem were the square brackets [] in the filename. I removed them. The file is now called "widelands-bzr6xxx-trunk(Release)-win32.exe". Could you try it for the last time, hopefully :) Thanks for all your feedback!

Revision history for this message
Tino (tino79) wrote :

Nice work, works fine here now, too!

I've not "moved" the dll files to the src folder, i've only copied them there for easier testing the widelands.exe. Linking works btw only with the .lib files, the dlls are only needed at runtime. This way i can just go to the /src folder, reset my path variable and start widelands checking if all dlls are correct.

So in my opinion this can be merged. I am just wondering, why the packaging with cpack takes such a long time (way over 30 minutes on my system, while Innosetup takes 3-4 minutes).

And do we want to keep the Innosetup files around? Perhaps we should at least for a time...

review: Approve
Revision history for this message
Shevonar (shevonar) wrote :

I know that he needs the .lib files for linking. That's why I really didn't understand when he complained about "know target for lua51.dll but needed for target widelands" or so. I thought he tried to compile the dll again cause there was one in the src folder.

Why it takes so much longer I don't know. Both use lzma compression. Don't know why NSIS has that much higher decompression rate. Maybe the problem is that CPack copies all files to _CPack_Packages\win32\NSIS\widelands-...-win32 in the build directory before it actually starts compressing. But also compressing alone takes longer than with InnoSetup. For this reason I would also suggest to keep the InnoSetup files for now. Removing them later shouldn't be a big problem.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2012-02-04 14:46:59 +0000
3+++ CMakeLists.txt 2012-02-18 14:12:20 +0000
4@@ -347,6 +347,18 @@
5 BzrRevision ALL
6 COMMAND ${CMAKE_COMMAND} -DWL_INSTALL_PREFIX=${WL_INSTALL_PREFIX} -DWL_INSTALL_BINDIR=${WL_INSTALL_BINDIR} -DWL_INSTALL_DATADIR=${WL_INSTALL_DATADIR} -DWL_INSTALL_LOCALEDIR=${WL_INSTALL_LOCALEDIR} -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -DBINARY_DIR=${CMAKE_CURRENT_BINARY_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/BzrRevision.cmake
7 )
8+
9+ # Detect version now
10+ execute_process (
11+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/utils/detect_revision.py
12+ OUTPUT_VARIABLE WL_VERSION
13+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
14+ OUTPUT_STRIP_TRAILING_WHITESPACE
15+ )
16+ file (WRITE ${CMAKE_CURRENT_BINARY_DIR}/VERSION "${WL_VERSION}")
17+ configure_file (${CMAKE_CURRENT_SOURCE_DIR}/src/build_info.cc.cmake ${CMAKE_CURRENT_BINARY_DIR}/src/build_info.cc)
18+ message (STATUS "Version of Widelands Build is ${WL_VERSION}(${CMAKE_BUILD_TYPE})")
19+
20 else (NOT DEFINED WL_VERSION)
21 add_custom_target (
22 InputRevision ALL
23@@ -360,6 +372,8 @@
24 CONFIGURATIONS Debug;Release
25 COMPONENT CoreVersionFile
26 )
27+set(CPACK_COMPONENT_COREVERSIONFILE_HIDDEN TRUE)
28+set(CPACK_COMPONENT_COREVERSIONFILE_REQUIRED TRUE)
29
30 include_directories(src ${CMAKE_CURRENT_BINARY_DIR}/src)
31
32@@ -414,9 +428,6 @@
33 campaigns
34 fonts
35 global
36- maps
37- music
38- sound
39 tribes
40 txts
41 worlds
42@@ -426,6 +437,28 @@
43 CONFIGURATIONS Debug;Release
44 COMPONENT CoreDataFiles
45 )
46+set(CPACK_COMPONENT_COREDATAFILES_DISPLAY_NAME "Widelands Core")
47+set(CPACK_COMPONENT_COREDATAFILES_HIDDEN FALSE)
48+set(CPACK_COMPONENT_COREDATAFILES_REQUIRED TRUE)
49+
50+install(
51+ DIRECTORY
52+ maps
53+ DESTINATION ${WL_INSTALL_DATADIR}
54+ CONFIGURATIONS Debug;Release
55+ COMPONENT MapFiles
56+)
57+set(CPACK_COMPONENT_MAPFILES_DISPLAY_NAME "Maps Files")
58+
59+install(
60+ DIRECTORY
61+ music
62+ sound
63+ DESTINATION ${WL_INSTALL_DATADIR}
64+ CONFIGURATIONS Debug;Release
65+ COMPONENT MusicFiles
66+)
67+set(CPACK_COMPONENT_MUSICFILES_DISPLAY_NAME "Music and Sound Files")
68
69 install(
70 FILES
71@@ -436,6 +469,8 @@
72 CONFIGURATIONS Debug;Release
73 COMPONENT CoreLicenseFiles
74 )
75+set(CPACK_COMPONENT_CORELICENSEFILES_HIDDEN TRUE)
76+set(CPACK_COMPONENT_CORELICENSEFILES_REQUIRED TRUE)
77
78 install(
79 DIRECTORY
80@@ -445,6 +480,9 @@
81 COMPONENT DocFiles
82 PATTERN "CMakeLists.txt" EXCLUDE
83 )
84+set(CPACK_COMPONENT_DOCFILES_DISPLAY_NAME "Documentation")
85+set(CPACK_COMPONENT_DOCFILES_HIDDEN TRUE)
86+set(CPACK_COMPONENT_DOCFILES_REQUIRED FALSE)
87
88 find_package (PythonInterp REQUIRED)
89
90@@ -457,9 +495,124 @@
91 CONFIGURATIONS Debug;Release
92 COMPONENT CoreLanguageFiles
93 )
94-
95-set (CPACK_PACKAGE_FILE_NAME widelands-${WL_VERSION})
96-set (CPACK_COMPONENTS_ALL ExecutableFiles CoreDataFiles DocFiles CoreLanguageFiles CoreVersionFile CoreLicenseFiles)
97-set (CPACK_GENERATOR "TGZ")
98-set (CPACK_SOURCE_GENERATOR "TGZ")
99+set(CPACK_COMPONENT_CORELANGUAGEFILES_DISPLAY_NAME "Language Files")
100+
101+set(CPACK_COMPONENT_EXECUTABLEFILES_HIDDEN TRUE)
102+set(CPACK_COMPONENT_EXECUTABLEFILES_REQUIRED TRUE)
103+
104+# Components to install
105+set(CPACK_COMPONENTS_ALL ExecutableFiles CoreDataFiles MapFiles CoreLanguageFiles CoreVersionFile CoreLicenseFiles)
106+if (NOT WL_NOMUSIC)
107+ set(CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL} MusicFiles)
108+endif (NOT WL_NOMUSIC)
109+
110+if (WIN32)
111+ # Install files only needed for Windows
112+ FILE(GLOB dlls "${CMAKE_CURRENT_BINARY_DIR}/*.dll")
113+ install(
114+ FILES
115+ ${dlls}
116+ utils/win32/WL-Editor.ico
117+ DESTINATION ${WL_INSTALL_DATADIR}
118+ CONFIGURATIONS Debug;Release
119+ COMPONENT Win32Specific
120+ )
121+ set(CPACK_COMPONENT_WIN32SPECIFIC_HIDDEN TRUE)
122+ set(CPACK_COMPONENT_WIN32SPECIFIC_REQUIRED TRUE)
123+ set(CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL} Win32Specific)
124+
125+ # Only NSIS supports install types
126+ set(CPACK_ALL_INSTALL_TYPES Full Minimal)
127+ set(CPACK_COMPONENT_EXECUTABLEFILES_INSTALL_TYPES Full Minimal)
128+ set(CPACK_COMPONENT_COREDATAFILES_INSTALL_TYPES Full Minimal)
129+ set(CPACK_COMPONENT_COREVERSIONFILE_INSTALL_TYPES Full Minimal)
130+ set(CPACK_COMPONENT_CORELICENSEFILES_INSTALL_TYPES Full Minimal)
131+ set(CPACK_COMPONENT_MAPFILES_INSTALL_TYPES Full)
132+ set(CPACK_COMPONENT_MUSICFILES_INSTALL_TYPES Full)
133+ set(CPACK_COMPONENT_CORELANGUAGEFILES_INSTALL_TYPES Full)
134+ set(CPACK_COMPONENT_WIN32SPECIFIC_INSTALL_TYPES Full Minimal)
135+
136+ # Set generator
137+ set(CPACK_GENERATOR NSIS)
138+
139+ # Graphics for the installer (all slashes are necessary!)
140+ set(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_LIST_DIR}\\\\utils\\\\win32\\\\wl-ico-128.ico")
141+ set(CPACK_NSIS_MUI_UNIICON "${CMAKE_CURRENT_LIST_DIR}\\\\utils\\\\win32\\\\wl-ico-128.ico")
142+ set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_LIST_DIR}\\\\utils\\\\win32\\\\nsis\\\\install_header.bmp")
143+ set(CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP "${CMAKE_CURRENT_LIST_DIR}\\\\utils\\\\win32\\\\nsis\\\\WL.bmp")
144+
145+ # Name for installer and Windows Add/Remove
146+ set(CPACK_NSIS_PACKAGE_NAME "Widelands")
147+ set(CPACK_NSIS_DISPLAY_NAME "Widelands ${WL_VERSION}")
148+ set(CPACK_NSIS_DISPLAY_NAME_SET "TRUE")
149+
150+ # Optional dialogs
151+ if (NOT DEFINED CPACK_NSIS_LANGUAGE_DIALOG)
152+ set(CPACK_NSIS_LANGUAGE_DIALOG "ON")
153+ endif (NOT DEFINED CPACK_NSIS_LANGUAGE_DIALOG)
154+ if (NOT DEFINED CPACK_NSIS_CHANGELOG)
155+ set(CPACK_NSIS_CHANGELOG "ON")
156+ endif (NOT DEFINED CPACK_NSIS_CHANGELOG)
157+
158+ # Setup (and remove) shortcuts to Widelands (all slashes are necessary!)
159+ set(CPACK_PACKAGE_EXECUTABLES "..\\\\widelands;Widelands")
160+ set(CPACK_NSIS_MENU_LINKS "http://wl.widelands.org/;Widelands Homepage")
161+ set(CPACK_NSIS_CREATE_ICONS_EXTRA "
162+ CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Widelands - Mapeditor.lnk\\\" \\\"$INSTDIR\\\\widelands.exe\\\" \\\"--editor\\\" \\\"$INSTDIR\\\\WL-Editor.ico\\\"
163+ ")
164+ set(CPACK_NSIS_DELETE_ICONS_EXTRA "
165+ Delete \\\"$DESKTOP\\\\Widelands.lnk\\\"
166+ Delete \\\"$DESKTOP\\\\Widelands - Mapeditor.lnk\\\"
167+ Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\Widelands - Mapeditor.lnk\\\"
168+ ")
169+
170+ # Additional information (all slashes are necessary!)
171+ set(CPACK_NSIS_URL_INFO_ABOUT "http://wl.widelands.org/")
172+ set(CPACK_NSIS_HELP_LINK "http://wl.widelands.org/")
173+ set(CPACK_NSIS_INSTALLED_ICON_NAME "widelands.exe")
174+ set(CPACK_NSIS_MUI_FINISHPAGE_RUN "..\\\\widelands.exe")
175+ set(CPACK_NSIS_MUI_FINISHPAGE_README "$INSTDIR\\\\ChangeLog")
176+ set(CPACK_PACKAGE_VENDOR "Widelands Development Team")
177+ # replace [ and ], they will cause problems in filename!
178+ STRING(REPLACE "[" "-" PACKAGE_VERSION ${WL_VERSION})
179+ STRING(REPLACE "]" "" PACKAGE_VERSION ${PACKAGE_VERSION})
180+ set(CPACK_PACKAGE_VERSION "${PACKAGE_VERSION}(${CMAKE_BUILD_TYPE})")
181+ set(CPACK_PACKAGE_VERSION_MAJOR ${WL_VERSION_MAJOR})
182+ set(CPACK_PACKAGE_VERSION_MINOR ${WL_VERSION_MINOR})
183+ set(CPACK_PACKAGE_VERSION_PATCH ${WL_VERSION_PATCH})
184+ set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_LIST_DIR}\\\\COPYING")
185+ set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_LIST_DIR}\\\\ChangeLog")
186+
187+ # Setup (and remove) Registry entries for Widelands (all slashes are necessary!)
188+ set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "
189+ WriteRegStr HKCR \\\".wgf\\\" \\\"\\\" \\\"WidelandsSavegame\\\"
190+ WriteRegStr HKCR \\\"WidelandsSavegame\\\" \\\"\\\" \\\"Widelands Savegame\\\"
191+ WriteRegStr HKCR \\\"WidelandsSavegame\\\\DefaultIcon\\\" \\\"\\\" \\\"$INSTDIR\\\\widelands.exe,0\\\"
192+ WriteRegStr HKCR \\\"WidelandsSavegame\\\\shell\\\\open\\\\command\\\" \\\"\\\" \\\"$INSTDIR\\\\widelands.exe --loadgame=%1\\\"
193+
194+ WriteRegStr HKCR \\\".wmf\\\" \\\"\\\" \\\"WidelandsMapFile\\\"
195+ WriteRegStr HKCR \\\"WidelandsMapFile\\\" \\\"\\\" \\\"Widelands Mapfile\\\"
196+ WriteRegStr HKCR \\\"WidelandsMapFile\\\\DefaultIcon\\\" \\\"\\\" \\\"$INSTDIR\\\\WL-Editor.ico\\\"
197+ WriteRegStr HKCR \\\"WidelandsMapFile\\\\shell\\\\open\\\\command\\\" \\\"\\\" \\\"$INSTDIR\\\\widelands.exe --editor=%1\\\"
198+ ")
199+ set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "
200+ DeleteRegValue HKCR \\\".wgf\\\" \\\"WidelandsSavegame\\\"
201+ DeleteRegKey /ifempty HKCR \\\".wgf\\\"
202+ DeleteRegKey HKCR \\\"WidelandsSavegame\\\"
203+
204+ DeleteRegValue HKCR \\\".wmf\\\" \\\"WidelandsMapFile\\\"
205+ DeleteRegKey /ifempty HKCR \\\".wmf\\\"
206+ DeleteRegKey HKCR \\\"WidelandsMapFile\\\"
207+
208+ Delete \\\"$INSTDIR\\\\stdout.txt\\\"
209+ Delete \\\"$INSTDIR\\\\stderr.txt\\\"
210+ Delete \\\"$INSTDIR\\\"
211+ ")
212+
213+elseif (WIN32)
214+ set (CPACK_PACKAGE_FILE_NAME widelands-${WL_VERSION})
215+ set (CPACK_GENERATOR "TGZ")
216+ set (CPACK_SOURCE_GENERATOR "TGZ")
217+endif (WIN32)
218+
219 include(CPack)
220
221=== added file 'cmake/Modules/NSIS.template.in'
222--- cmake/Modules/NSIS.template.in 1970-01-01 00:00:00 +0000
223+++ cmake/Modules/NSIS.template.in 2012-02-18 14:12:20 +0000
224@@ -0,0 +1,994 @@
225+; CPack install script designed for a nmake build
226+; Modified to fit Widelands' needs!
227+
228+;--------------------------------
229+; You must define these values
230+
231+ !define VERSION "@CPACK_PACKAGE_VERSION@"
232+ !define PATCH "@CPACK_PACKAGE_VERSION_PATCH@"
233+ !define INST_DIR "@CPACK_TEMPORARY_DIRECTORY@"
234+
235+;--------------------------------
236+;Variables
237+
238+ Var MUI_TEMP
239+ Var STARTMENU_FOLDER
240+ Var SV_ALLUSERS
241+ Var START_MENU
242+ Var DO_NOT_ADD_TO_PATH
243+ Var ADD_TO_PATH_ALL_USERS
244+ Var ADD_TO_PATH_CURRENT_USER
245+ Var INSTALL_DESKTOP
246+ Var IS_DEFAULT_INSTALLDIR
247+;--------------------------------
248+;Include Modern UI
249+
250+ !include "MUI.nsh"
251+
252+ ;Default installation folder
253+ InstallDir "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
254+
255+;--------------------------------
256+;General
257+
258+ ;Name and file
259+ Name "@CPACK_NSIS_PACKAGE_NAME@"
260+ OutFile "@CPACK_TOPLEVEL_DIRECTORY@/@CPACK_OUTPUT_FILE_NAME@"
261+
262+ ;Set compression
263+ SetCompressor @CPACK_NSIS_COMPRESSOR@
264+
265+@CPACK_NSIS_DEFINES@
266+
267+ !include Sections.nsh
268+
269+;--- Component support macros: ---
270+; The code for the add/remove functionality is from:
271+; http://nsis.sourceforge.net/Add/Remove_Functionality
272+; It has been modified slightly and extended to provide
273+; inter-component dependencies.
274+Var AR_SecFlags
275+Var AR_RegFlags
276+@CPACK_NSIS_SECTION_SELECTED_VARS@
277+
278+; Loads the "selected" flag for the section named SecName into the
279+; variable VarName.
280+!macro LoadSectionSelectedIntoVar SecName VarName
281+ SectionGetFlags ${${SecName}} $${VarName}
282+ IntOp $${VarName} $${VarName} & ${SF_SELECTED} ;Turn off all other bits
283+!macroend
284+
285+; Loads the value of a variable... can we get around this?
286+!macro LoadVar VarName
287+ IntOp $R0 0 + $${VarName}
288+!macroend
289+
290+; Sets the value of a variable
291+!macro StoreVar VarName IntValue
292+ IntOp $${VarName} 0 + ${IntValue}
293+!macroend
294+
295+!macro InitSection SecName
296+ ; This macro reads component installed flag from the registry and
297+ ;changes checked state of the section on the components page.
298+ ;Input: section index constant name specified in Section command.
299+
300+ ClearErrors
301+ ;Reading component status from registry
302+ ReadRegDWORD $AR_RegFlags HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" "Installed"
303+ IfErrors "default_${SecName}"
304+ ;Status will stay default if registry value not found
305+ ;(component was never installed)
306+ IntOp $AR_RegFlags $AR_RegFlags & ${SF_SELECTED} ;Turn off all other bits
307+ SectionGetFlags ${${SecName}} $AR_SecFlags ;Reading default section flags
308+ IntOp $AR_SecFlags $AR_SecFlags & 0xFFFE ;Turn lowest (enabled) bit off
309+ IntOp $AR_SecFlags $AR_RegFlags | $AR_SecFlags ;Change lowest bit
310+
311+ ; Note whether this component was installed before
312+ !insertmacro StoreVar ${SecName}_was_installed $AR_RegFlags
313+ IntOp $R0 $AR_RegFlags & $AR_RegFlags
314+
315+ ;Writing modified flags
316+ SectionSetFlags ${${SecName}} $AR_SecFlags
317+
318+ "default_${SecName}:"
319+ !insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected
320+!macroend
321+
322+!macro FinishSection SecName
323+ ; This macro reads section flag set by user and removes the section
324+ ;if it is not selected.
325+ ;Then it writes component installed flag to registry
326+ ;Input: section index constant name specified in Section command.
327+
328+ SectionGetFlags ${${SecName}} $AR_SecFlags ;Reading section flags
329+ ;Checking lowest bit:
330+ IntOp $AR_SecFlags $AR_SecFlags & ${SF_SELECTED}
331+ IntCmp $AR_SecFlags 1 "leave_${SecName}"
332+ ;Section is not selected:
333+ ;Calling Section uninstall macro and writing zero installed flag
334+ !insertmacro "Remove_${${SecName}}"
335+ WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" \
336+ "Installed" 0
337+ Goto "exit_${SecName}"
338+
339+ "leave_${SecName}:"
340+ ;Section is selected:
341+ WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@\Components\${SecName}" \
342+ "Installed" 1
343+
344+ "exit_${SecName}:"
345+!macroend
346+
347+!macro RemoveSection SecName
348+ ; This macro is used to call section's Remove_... macro
349+ ;from the uninstaller.
350+ ;Input: section index constant name specified in Section command.
351+
352+ !insertmacro "Remove_${${SecName}}"
353+!macroend
354+
355+; Determine whether the selection of SecName changed
356+!macro MaybeSelectionChanged SecName
357+ !insertmacro LoadVar ${SecName}_selected
358+ SectionGetFlags ${${SecName}} $R1
359+ IntOp $R1 $R1 & ${SF_SELECTED} ;Turn off all other bits
360+
361+ ; See if the status has changed:
362+ IntCmp $R0 $R1 "${SecName}_unchanged"
363+ !insertmacro LoadSectionSelectedIntoVar ${SecName} ${SecName}_selected
364+
365+ IntCmp $R1 ${SF_SELECTED} "${SecName}_was_selected"
366+ !insertmacro "Deselect_required_by_${SecName}"
367+ goto "${SecName}_unchanged"
368+
369+ "${SecName}_was_selected:"
370+ !insertmacro "Select_${SecName}_depends"
371+
372+ "${SecName}_unchanged:"
373+!macroend
374+;--- End of Add/Remove macros ---
375+
376+;--------------------------------
377+;Interface Settings
378+
379+ !define MUI_HEADERIMAGE
380+ !define MUI_ABORTWARNING
381+
382+;--------------------------------
383+; path functions
384+
385+!verbose 3
386+!include "WinMessages.NSH"
387+!verbose 4
388+
389+;----------------------------------------
390+; based upon a script of "Written by KiCHiK 2003-01-18 05:57:02"
391+;----------------------------------------
392+!verbose 3
393+!include "WinMessages.NSH"
394+!verbose 4
395+;====================================================
396+; get_NT_environment
397+; Returns: the selected environment
398+; Output : head of the stack
399+;====================================================
400+!macro select_NT_profile UN
401+Function ${UN}select_NT_profile
402+ StrCmp $ADD_TO_PATH_ALL_USERS "1" 0 environment_single
403+ DetailPrint "Selected environment for all users"
404+ Push "all"
405+ Return
406+ environment_single:
407+ DetailPrint "Selected environment for current user only."
408+ Push "current"
409+ Return
410+FunctionEnd
411+!macroend
412+!insertmacro select_NT_profile ""
413+!insertmacro select_NT_profile "un."
414+;----------------------------------------------------
415+!define NT_current_env 'HKCU "Environment"'
416+!define NT_all_env 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
417+
418+!ifndef WriteEnvStr_RegKey
419+ !ifdef ALL_USERS
420+ !define WriteEnvStr_RegKey \
421+ 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
422+ !else
423+ !define WriteEnvStr_RegKey 'HKCU "Environment"'
424+ !endif
425+!endif
426+
427+; AddToPath - Adds the given dir to the search path.
428+; Input - head of the stack
429+; Note - Win9x systems requires reboot
430+
431+Function AddToPath
432+ Exch $0
433+ Push $1
434+ Push $2
435+ Push $3
436+
437+ # don't add if the path doesn't exist
438+ IfFileExists "$0\*.*" "" AddToPath_done
439+
440+ ReadEnvStr $1 PATH
441+ ; if the path is too long for a NSIS variable NSIS will return a 0
442+ ; length string. If we find that, then warn and skip any path
443+ ; modification as it will trash the existing path.
444+ StrLen $2 $1
445+ IntCmp $2 0 CheckPathLength_ShowPathWarning CheckPathLength_Done CheckPathLength_Done
446+ CheckPathLength_ShowPathWarning:
447+ Messagebox MB_OK|MB_ICONEXCLAMATION "Warning! PATH too long installer unable to modify PATH!"
448+ Goto AddToPath_done
449+ CheckPathLength_Done:
450+ Push "$1;"
451+ Push "$0;"
452+ Call StrStr
453+ Pop $2
454+ StrCmp $2 "" "" AddToPath_done
455+ Push "$1;"
456+ Push "$0\;"
457+ Call StrStr
458+ Pop $2
459+ StrCmp $2 "" "" AddToPath_done
460+ GetFullPathName /SHORT $3 $0
461+ Push "$1;"
462+ Push "$3;"
463+ Call StrStr
464+ Pop $2
465+ StrCmp $2 "" "" AddToPath_done
466+ Push "$1;"
467+ Push "$3\;"
468+ Call StrStr
469+ Pop $2
470+ StrCmp $2 "" "" AddToPath_done
471+
472+ Call IsNT
473+ Pop $1
474+ StrCmp $1 1 AddToPath_NT
475+ ; Not on NT
476+ StrCpy $1 $WINDIR 2
477+ FileOpen $1 "$1\autoexec.bat" a
478+ FileSeek $1 -1 END
479+ FileReadByte $1 $2
480+ IntCmp $2 26 0 +2 +2 # DOS EOF
481+ FileSeek $1 -1 END # write over EOF
482+ FileWrite $1 "$\r$\nSET PATH=%PATH%;$3$\r$\n"
483+ FileClose $1
484+ SetRebootFlag true
485+ Goto AddToPath_done
486+
487+ AddToPath_NT:
488+ StrCmp $ADD_TO_PATH_ALL_USERS "1" ReadAllKey
489+ ReadRegStr $1 ${NT_current_env} "PATH"
490+ Goto DoTrim
491+ ReadAllKey:
492+ ReadRegStr $1 ${NT_all_env} "PATH"
493+ DoTrim:
494+ StrCmp $1 "" AddToPath_NTdoIt
495+ Push $1
496+ Call Trim
497+ Pop $1
498+ StrCpy $0 "$1;$0"
499+ AddToPath_NTdoIt:
500+ StrCmp $ADD_TO_PATH_ALL_USERS "1" WriteAllKey
501+ WriteRegExpandStr ${NT_current_env} "PATH" $0
502+ Goto DoSend
503+ WriteAllKey:
504+ WriteRegExpandStr ${NT_all_env} "PATH" $0
505+ DoSend:
506+ SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
507+
508+ AddToPath_done:
509+ Pop $3
510+ Pop $2
511+ Pop $1
512+ Pop $0
513+FunctionEnd
514+
515+
516+; RemoveFromPath - Remove a given dir from the path
517+; Input: head of the stack
518+
519+Function un.RemoveFromPath
520+ Exch $0
521+ Push $1
522+ Push $2
523+ Push $3
524+ Push $4
525+ Push $5
526+ Push $6
527+
528+ IntFmt $6 "%c" 26 # DOS EOF
529+
530+ Call un.IsNT
531+ Pop $1
532+ StrCmp $1 1 unRemoveFromPath_NT
533+ ; Not on NT
534+ StrCpy $1 $WINDIR 2
535+ FileOpen $1 "$1\autoexec.bat" r
536+ GetTempFileName $4
537+ FileOpen $2 $4 w
538+ GetFullPathName /SHORT $0 $0
539+ StrCpy $0 "SET PATH=%PATH%;$0"
540+ Goto unRemoveFromPath_dosLoop
541+
542+ unRemoveFromPath_dosLoop:
543+ FileRead $1 $3
544+ StrCpy $5 $3 1 -1 # read last char
545+ StrCmp $5 $6 0 +2 # if DOS EOF
546+ StrCpy $3 $3 -1 # remove DOS EOF so we can compare
547+ StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoopRemoveLine
548+ StrCmp $3 "$0$\n" unRemoveFromPath_dosLoopRemoveLine
549+ StrCmp $3 "$0" unRemoveFromPath_dosLoopRemoveLine
550+ StrCmp $3 "" unRemoveFromPath_dosLoopEnd
551+ FileWrite $2 $3
552+ Goto unRemoveFromPath_dosLoop
553+ unRemoveFromPath_dosLoopRemoveLine:
554+ SetRebootFlag true
555+ Goto unRemoveFromPath_dosLoop
556+
557+ unRemoveFromPath_dosLoopEnd:
558+ FileClose $2
559+ FileClose $1
560+ StrCpy $1 $WINDIR 2
561+ Delete "$1\autoexec.bat"
562+ CopyFiles /SILENT $4 "$1\autoexec.bat"
563+ Delete $4
564+ Goto unRemoveFromPath_done
565+
566+ unRemoveFromPath_NT:
567+ StrCmp $ADD_TO_PATH_ALL_USERS "1" unReadAllKey
568+ ReadRegStr $1 ${NT_current_env} "PATH"
569+ Goto unDoTrim
570+ unReadAllKey:
571+ ReadRegStr $1 ${NT_all_env} "PATH"
572+ unDoTrim:
573+ StrCpy $5 $1 1 -1 # copy last char
574+ StrCmp $5 ";" +2 # if last char != ;
575+ StrCpy $1 "$1;" # append ;
576+ Push $1
577+ Push "$0;"
578+ Call un.StrStr ; Find `$0;` in $1
579+ Pop $2 ; pos of our dir
580+ StrCmp $2 "" unRemoveFromPath_done
581+ ; else, it is in path
582+ # $0 - path to add
583+ # $1 - path var
584+ StrLen $3 "$0;"
585+ StrLen $4 $2
586+ StrCpy $5 $1 -$4 # $5 is now the part before the path to remove
587+ StrCpy $6 $2 "" $3 # $6 is now the part after the path to remove
588+ StrCpy $3 $5$6
589+
590+ StrCpy $5 $3 1 -1 # copy last char
591+ StrCmp $5 ";" 0 +2 # if last char == ;
592+ StrCpy $3 $3 -1 # remove last char
593+
594+ StrCmp $ADD_TO_PATH_ALL_USERS "1" unWriteAllKey
595+ WriteRegExpandStr ${NT_current_env} "PATH" $3
596+ Goto unDoSend
597+ unWriteAllKey:
598+ WriteRegExpandStr ${NT_all_env} "PATH" $3
599+ unDoSend:
600+ SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
601+
602+ unRemoveFromPath_done:
603+ Pop $6
604+ Pop $5
605+ Pop $4
606+ Pop $3
607+ Pop $2
608+ Pop $1
609+ Pop $0
610+FunctionEnd
611+
612+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
613+; Uninstall sutff
614+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
615+
616+###########################################
617+# Utility Functions #
618+###########################################
619+
620+;====================================================
621+; IsNT - Returns 1 if the current system is NT, 0
622+; otherwise.
623+; Output: head of the stack
624+;====================================================
625+; IsNT
626+; no input
627+; output, top of the stack = 1 if NT or 0 if not
628+;
629+; Usage:
630+; Call IsNT
631+; Pop $R0
632+; ($R0 at this point is 1 or 0)
633+
634+!macro IsNT un
635+Function ${un}IsNT
636+ Push $0
637+ ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
638+ StrCmp $0 "" 0 IsNT_yes
639+ ; we are not NT.
640+ Pop $0
641+ Push 0
642+ Return
643+
644+ IsNT_yes:
645+ ; NT!!!
646+ Pop $0
647+ Push 1
648+FunctionEnd
649+!macroend
650+!insertmacro IsNT ""
651+!insertmacro IsNT "un."
652+
653+; StrStr
654+; input, top of stack = string to search for
655+; top of stack-1 = string to search in
656+; output, top of stack (replaces with the portion of the string remaining)
657+; modifies no other variables.
658+;
659+; Usage:
660+; Push "this is a long ass string"
661+; Push "ass"
662+; Call StrStr
663+; Pop $R0
664+; ($R0 at this point is "ass string")
665+
666+!macro StrStr un
667+Function ${un}StrStr
668+Exch $R1 ; st=haystack,old$R1, $R1=needle
669+ Exch ; st=old$R1,haystack
670+ Exch $R2 ; st=old$R1,old$R2, $R2=haystack
671+ Push $R3
672+ Push $R4
673+ Push $R5
674+ StrLen $R3 $R1
675+ StrCpy $R4 0
676+ ; $R1=needle
677+ ; $R2=haystack
678+ ; $R3=len(needle)
679+ ; $R4=cnt
680+ ; $R5=tmp
681+ loop:
682+ StrCpy $R5 $R2 $R3 $R4
683+ StrCmp $R5 $R1 done
684+ StrCmp $R5 "" done
685+ IntOp $R4 $R4 + 1
686+ Goto loop
687+done:
688+ StrCpy $R1 $R2 "" $R4
689+ Pop $R5
690+ Pop $R4
691+ Pop $R3
692+ Pop $R2
693+ Exch $R1
694+FunctionEnd
695+!macroend
696+!insertmacro StrStr ""
697+!insertmacro StrStr "un."
698+
699+Function Trim ; Added by Pelaca
700+ Exch $R1
701+ Push $R2
702+Loop:
703+ StrCpy $R2 "$R1" 1 -1
704+ StrCmp "$R2" " " RTrim
705+ StrCmp "$R2" "$\n" RTrim
706+ StrCmp "$R2" "$\r" RTrim
707+ StrCmp "$R2" ";" RTrim
708+ GoTo Done
709+RTrim:
710+ StrCpy $R1 "$R1" -1
711+ Goto Loop
712+Done:
713+ Pop $R2
714+ Exch $R1
715+FunctionEnd
716+
717+Function ConditionalAddToRegisty
718+ Pop $0
719+ Pop $1
720+ StrCmp "$0" "" ConditionalAddToRegisty_EmptyString
721+ WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" \
722+ "$1" "$0"
723+ ;MessageBox MB_OK "Set Registry: '$1' to '$0'"
724+ DetailPrint "Set install registry entry: '$1' to '$0'"
725+ ConditionalAddToRegisty_EmptyString:
726+FunctionEnd
727+
728+;--------------------------------
729+
730+!ifdef CPACK_USES_DOWNLOAD
731+Function DownloadFile
732+ IfFileExists $INSTDIR\* +2
733+ CreateDirectory $INSTDIR
734+ Pop $0
735+
736+ ; Skip if already downloaded
737+ IfFileExists $INSTDIR\$0 0 +2
738+ Return
739+
740+ StrCpy $1 "@CPACK_DOWNLOAD_SITE@"
741+
742+ try_again:
743+ NSISdl::download "$1/$0" "$INSTDIR\$0"
744+
745+ Pop $1
746+ StrCmp $1 "success" success
747+ StrCmp $1 "Cancelled" cancel
748+ MessageBox MB_OK "Download failed: $1"
749+ cancel:
750+ Return
751+ success:
752+FunctionEnd
753+!endif
754+
755+;--------------------------------
756+; Installation types
757+@CPACK_NSIS_INSTALLATION_TYPES@
758+
759+;--------------------------------
760+; Component sections
761+@CPACK_NSIS_COMPONENT_SECTIONS@
762+
763+;--------------------------------
764+; Define some macro setting for the gui
765+@CPACK_NSIS_INSTALLER_MUI_ICON_CODE@
766+@CPACK_NSIS_INSTALLER_ICON_CODE@
767+@CPACK_NSIS_INSTALLER_MUI_COMPONENTS_DESC@
768+@CPACK_NSIS_INSTALLER_MUI_FINISHPAGE_RUN_CODE@
769+
770+Function createShortcuts
771+ CreateShortCut "$DESKTOP\Widelands.lnk" "$INSTDIR\widelands.exe"
772+ CreateShortCut "$DESKTOP\Widelands - Mapeditor.lnk" "$INSTDIR\widelands.exe" "--editor" "$INSTDIR\WL-Editor.ico"
773+FunctionEnd
774+
775+!define MUI_FINISHPAGE_SHOWREADME ""
776+!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
777+!define MUI_FINISHPAGE_SHOWREADME_TEXT "Create Desktop Shortcut"
778+!define MUI_FINISHPAGE_SHOWREADME_FUNCTION createShortcuts
779+
780+!define MUI_WELCOMEFINISHPAGE_BITMAP "@CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP@"
781+!define MUI_UNWELCOMEFINISHPAGE_BITMAP "@CPACK_NSIS_MUI_WELCOMEFINISHPAGE_BITMAP@"
782+
783+;--------------------------------
784+;Pages
785+ !insertmacro MUI_PAGE_WELCOME
786+
787+ !insertmacro MUI_PAGE_LICENSE "@CPACK_RESOURCE_FILE_LICENSE@"
788+ Page custom InstallOptionsPage
789+ !insertmacro MUI_PAGE_DIRECTORY
790+
791+ ;Start Menu Folder Page Configuration
792+ !define MUI_STARTMENUPAGE_REGISTRY_ROOT "SHCTX"
793+ !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
794+ !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
795+ !insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
796+
797+ @CPACK_NSIS_PAGE_COMPONENTS@
798+
799+ !insertmacro MUI_PAGE_INSTFILES
800+
801+ ;Changelog
802+ !define CPACK_NSIS_CHANGELOG_@CPACK_NSIS_CHANGELOG@
803+ !ifdef CPACK_NSIS_CHANGELOG_ON
804+ !define MUI_PAGE_HEADER_TEXT "Changelog"
805+ !define MUI_PAGE_HEADER_SUBTEXT ""
806+ !define MUI_LICENSEPAGE_TEXT_TOP ""
807+ !define MUI_LICENSEPAGE_TEXT_BOTTOM " "
808+ !define MUI_LICENSEPAGE_BUTTON "$(^NextBtn)"
809+ !insertmacro MUI_PAGE_LICENSE "@CPACK_RESOURCE_FILE_README@"
810+ !endif
811+
812+ !insertmacro MUI_PAGE_FINISH
813+
814+ !insertmacro MUI_UNPAGE_CONFIRM
815+ !insertmacro MUI_UNPAGE_INSTFILES
816+
817+;--------------------------------
818+;Languages
819+
820+ !insertmacro MUI_LANGUAGE "English" ;first language is the default language
821+ !insertmacro MUI_LANGUAGE "Albanian"
822+ !insertmacro MUI_LANGUAGE "Arabic"
823+ !insertmacro MUI_LANGUAGE "Basque"
824+ !insertmacro MUI_LANGUAGE "Belarusian"
825+ !insertmacro MUI_LANGUAGE "Bosnian"
826+ !insertmacro MUI_LANGUAGE "Breton"
827+ !insertmacro MUI_LANGUAGE "Bulgarian"
828+ !insertmacro MUI_LANGUAGE "Croatian"
829+ !insertmacro MUI_LANGUAGE "Czech"
830+ !insertmacro MUI_LANGUAGE "Danish"
831+ !insertmacro MUI_LANGUAGE "Dutch"
832+ !insertmacro MUI_LANGUAGE "Estonian"
833+ !insertmacro MUI_LANGUAGE "Farsi"
834+ !insertmacro MUI_LANGUAGE "Finnish"
835+ !insertmacro MUI_LANGUAGE "French"
836+ !insertmacro MUI_LANGUAGE "German"
837+ !insertmacro MUI_LANGUAGE "Greek"
838+ !insertmacro MUI_LANGUAGE "Hebrew"
839+ !insertmacro MUI_LANGUAGE "Hungarian"
840+ !insertmacro MUI_LANGUAGE "Icelandic"
841+ !insertmacro MUI_LANGUAGE "Indonesian"
842+ !insertmacro MUI_LANGUAGE "Irish"
843+ !insertmacro MUI_LANGUAGE "Italian"
844+ !insertmacro MUI_LANGUAGE "Japanese"
845+ !insertmacro MUI_LANGUAGE "Korean"
846+ !insertmacro MUI_LANGUAGE "Kurdish"
847+ !insertmacro MUI_LANGUAGE "Latvian"
848+ !insertmacro MUI_LANGUAGE "Lithuanian"
849+ !insertmacro MUI_LANGUAGE "Luxembourgish"
850+ !insertmacro MUI_LANGUAGE "Macedonian"
851+ !insertmacro MUI_LANGUAGE "Malay"
852+ !insertmacro MUI_LANGUAGE "Mongolian"
853+ !insertmacro MUI_LANGUAGE "Norwegian"
854+ !insertmacro MUI_LANGUAGE "Polish"
855+ !insertmacro MUI_LANGUAGE "Portuguese"
856+ !insertmacro MUI_LANGUAGE "PortugueseBR"
857+ !insertmacro MUI_LANGUAGE "Romanian"
858+ !insertmacro MUI_LANGUAGE "Russian"
859+ !insertmacro MUI_LANGUAGE "Serbian"
860+ !insertmacro MUI_LANGUAGE "SerbianLatin"
861+ !insertmacro MUI_LANGUAGE "SimpChinese"
862+ !insertmacro MUI_LANGUAGE "Slovak"
863+ !insertmacro MUI_LANGUAGE "Slovenian"
864+ !insertmacro MUI_LANGUAGE "Spanish"
865+ !insertmacro MUI_LANGUAGE "Swedish"
866+ !insertmacro MUI_LANGUAGE "Thai"
867+ !insertmacro MUI_LANGUAGE "TradChinese"
868+ !insertmacro MUI_LANGUAGE "Turkish"
869+ !insertmacro MUI_LANGUAGE "Ukrainian"
870+ !insertmacro MUI_LANGUAGE "Welsh"
871+
872+
873+;--------------------------------
874+;Reserve Files
875+
876+ ;These files should be inserted before other files in the data block
877+ ;Keep these lines before any File command
878+ ;Only for solid compression (by default, solid compression is enabled for BZIP2 and LZMA)
879+
880+ ReserveFile "NSIS.InstallOptions.ini"
881+ !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
882+
883+;--------------------------------
884+;Installer Sections
885+
886+Section "-Core installation"
887+ ;Use the entire tree produced by the INSTALL target. Keep the
888+ ;list of directories here in sync with the RMDir commands below.
889+ SetOutPath "$INSTDIR"
890+ @CPACK_NSIS_FULL_INSTALL@
891+
892+ ;Store installation folder
893+ WriteRegStr SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "" $INSTDIR
894+
895+ ;Create uninstaller
896+ WriteUninstaller "$INSTDIR\Uninstall.exe"
897+ Push "DisplayName"
898+ Push "@CPACK_NSIS_DISPLAY_NAME@"
899+ Call ConditionalAddToRegisty
900+ Push "DisplayVersion"
901+ Push "@CPACK_PACKAGE_VERSION@"
902+ Call ConditionalAddToRegisty
903+ Push "Publisher"
904+ Push "@CPACK_PACKAGE_VENDOR@"
905+ Call ConditionalAddToRegisty
906+ Push "UninstallString"
907+ Push "$INSTDIR\Uninstall.exe"
908+ Call ConditionalAddToRegisty
909+ Push "NoRepair"
910+ Push "1"
911+ Call ConditionalAddToRegisty
912+
913+ !ifdef CPACK_NSIS_ADD_REMOVE
914+ ;Create add/remove functionality
915+ Push "ModifyPath"
916+ Push "$INSTDIR\AddRemove.exe"
917+ Call ConditionalAddToRegisty
918+ !else
919+ Push "NoModify"
920+ Push "1"
921+ Call ConditionalAddToRegisty
922+ !endif
923+
924+ ; Optional registration
925+ Push "DisplayIcon"
926+ Push "$INSTDIR\@CPACK_NSIS_INSTALLED_ICON_NAME@"
927+ Call ConditionalAddToRegisty
928+ Push "HelpLink"
929+ Push "@CPACK_NSIS_HELP_LINK@"
930+ Call ConditionalAddToRegisty
931+ Push "URLInfoAbout"
932+ Push "@CPACK_NSIS_URL_INFO_ABOUT@"
933+ Call ConditionalAddToRegisty
934+ Push "Contact"
935+ Push "@CPACK_NSIS_CONTACT@"
936+ Call ConditionalAddToRegisty
937+ !insertmacro MUI_INSTALLOPTIONS_READ $INSTALL_DESKTOP "NSIS.InstallOptions.ini" "Field 5" "State"
938+ !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
939+
940+ ;Create shortcuts
941+ CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
942+@CPACK_NSIS_CREATE_ICONS@
943+@CPACK_NSIS_CREATE_ICONS_EXTRA@
944+ CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
945+
946+ ;Read a value from an InstallOptions INI file
947+ !insertmacro MUI_INSTALLOPTIONS_READ $DO_NOT_ADD_TO_PATH "NSIS.InstallOptions.ini" "Field 2" "State"
948+ !insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH_ALL_USERS "NSIS.InstallOptions.ini" "Field 3" "State"
949+ !insertmacro MUI_INSTALLOPTIONS_READ $ADD_TO_PATH_CURRENT_USER "NSIS.InstallOptions.ini" "Field 4" "State"
950+
951+ ; Write special uninstall registry entries
952+ Push "StartMenu"
953+ Push "$STARTMENU_FOLDER"
954+ Call ConditionalAddToRegisty
955+ Push "DoNotAddToPath"
956+ Push "$DO_NOT_ADD_TO_PATH"
957+ Call ConditionalAddToRegisty
958+ Push "AddToPathAllUsers"
959+ Push "$ADD_TO_PATH_ALL_USERS"
960+ Call ConditionalAddToRegisty
961+ Push "AddToPathCurrentUser"
962+ Push "$ADD_TO_PATH_CURRENT_USER"
963+ Call ConditionalAddToRegisty
964+ Push "InstallToDesktop"
965+ Push "$INSTALL_DESKTOP"
966+ Call ConditionalAddToRegisty
967+
968+ !insertmacro MUI_STARTMENU_WRITE_END
969+
970+@CPACK_NSIS_EXTRA_INSTALL_COMMANDS@
971+
972+SectionEnd
973+
974+Section "-Add to path"
975+ Push $INSTDIR\bin
976+ StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 doNotAddToPath
977+ StrCmp $DO_NOT_ADD_TO_PATH "1" doNotAddToPath 0
978+ Call AddToPath
979+ doNotAddToPath:
980+SectionEnd
981+
982+;--------------------------------
983+; Create custom pages
984+Function InstallOptionsPage
985+ !insertmacro MUI_HEADER_TEXT "Install Options" "Choose options for installing @CPACK_NSIS_PACKAGE_NAME@"
986+ !insertmacro MUI_INSTALLOPTIONS_DISPLAY "NSIS.InstallOptions.ini"
987+
988+FunctionEnd
989+
990+;--------------------------------
991+; determine admin versus local install
992+Function un.onInit
993+
994+ ;Load selected language from registry
995+ !ifndef CPACK_NSIS_LANGUAGE_DIALOG_@CPACK_NSIS_LANGUAGE_DIALOG@
996+ !define CPACK_NSIS_LANGUAGE_DIALOG_@CPACK_NSIS_LANGUAGE_DIALOG@
997+ !endif
998+ !ifdef CPACK_NSIS_LANGUAGE_DIALOG_ON
999+ !insertmacro MUI_UNGETLANGUAGE
1000+ !endif
1001+
1002+ ClearErrors
1003+ UserInfo::GetName
1004+ IfErrors noLM
1005+ Pop $0
1006+ UserInfo::GetAccountType
1007+ Pop $1
1008+ StrCmp $1 "Admin" 0 +3
1009+ SetShellVarContext all
1010+ ;MessageBox MB_OK 'User "$0" is in the Admin group'
1011+ Goto done
1012+ StrCmp $1 "Power" 0 +3
1013+ SetShellVarContext all
1014+ ;MessageBox MB_OK 'User "$0" is in the Power Users group'
1015+ Goto done
1016+
1017+ noLM:
1018+ ;Get installation folder from registry if available
1019+
1020+ done:
1021+
1022+FunctionEnd
1023+
1024+;--- Add/Remove callback functions: ---
1025+!macro SectionList MacroName
1026+ ;This macro used to perform operation on multiple sections.
1027+ ;List all of your components in following manner here.
1028+@CPACK_NSIS_COMPONENT_SECTION_LIST@
1029+!macroend
1030+
1031+Section -FinishComponents
1032+ ;Removes unselected components and writes component status to registry
1033+ !insertmacro SectionList "FinishSection"
1034+
1035+!ifdef CPACK_NSIS_ADD_REMOVE
1036+ ; Get the name of the installer executable
1037+ System::Call 'kernel32::GetModuleFileNameA(i 0, t .R0, i 1024) i r1'
1038+ StrCpy $R3 $R0
1039+
1040+ ; Strip off the last 13 characters, to see if we have AddRemove.exe
1041+ StrLen $R1 $R0
1042+ IntOp $R1 $R0 - 13
1043+ StrCpy $R2 $R0 13 $R1
1044+ StrCmp $R2 "AddRemove.exe" addremove_installed
1045+
1046+ ; We're not running AddRemove.exe, so install it
1047+ CopyFiles $R3 $INSTDIR\AddRemove.exe
1048+
1049+ addremove_installed:
1050+!endif
1051+SectionEnd
1052+;--- End of Add/Remove callback functions ---
1053+
1054+;--------------------------------
1055+; Component dependencies
1056+Function .onSelChange
1057+ !insertmacro SectionList MaybeSelectionChanged
1058+FunctionEnd
1059+
1060+;--------------------------------
1061+;Uninstaller Section
1062+
1063+Section "Uninstall"
1064+ ReadRegStr $START_MENU SHCTX \
1065+ "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "StartMenu"
1066+ ;MessageBox MB_OK "Start menu is in: $START_MENU"
1067+ ReadRegStr $DO_NOT_ADD_TO_PATH SHCTX \
1068+ "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "DoNotAddToPath"
1069+ ReadRegStr $ADD_TO_PATH_ALL_USERS SHCTX \
1070+ "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "AddToPathAllUsers"
1071+ ReadRegStr $ADD_TO_PATH_CURRENT_USER SHCTX \
1072+ "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "AddToPathCurrentUser"
1073+ ;MessageBox MB_OK "Add to path: $DO_NOT_ADD_TO_PATH all users: $ADD_TO_PATH_ALL_USERS"
1074+ ReadRegStr $INSTALL_DESKTOP SHCTX \
1075+ "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@" "InstallToDesktop"
1076+ ;MessageBox MB_OK "Install to desktop: $INSTALL_DESKTOP "
1077+
1078+@CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS@
1079+
1080+ ;Remove files we installed.
1081+ ;Keep the list of directories here in sync with the File commands above.
1082+@CPACK_NSIS_DELETE_FILES@
1083+@CPACK_NSIS_DELETE_DIRECTORIES@
1084+
1085+!ifdef CPACK_NSIS_ADD_REMOVE
1086+ ;Remove the add/remove program
1087+ Delete "$INSTDIR\AddRemove.exe"
1088+!endif
1089+
1090+ ;Remove the uninstaller itself.
1091+ Delete "$INSTDIR\Uninstall.exe"
1092+ DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
1093+
1094+ ;Remove the installation directory if it is empty.
1095+ RMDir "$INSTDIR"
1096+
1097+ ; Remove the registry entries.
1098+ DeleteRegKey SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
1099+
1100+ ; Removes all optional components
1101+ !insertmacro SectionList "RemoveSection"
1102+
1103+ !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
1104+
1105+ Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
1106+@CPACK_NSIS_DELETE_ICONS@
1107+@CPACK_NSIS_DELETE_ICONS_EXTRA@
1108+
1109+ ;Delete empty start menu parent diretories
1110+ StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
1111+
1112+ startMenuDeleteLoop:
1113+ ClearErrors
1114+ RMDir $MUI_TEMP
1115+ GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
1116+
1117+ IfErrors startMenuDeleteLoopDone
1118+
1119+ StrCmp "$MUI_TEMP" "$SMPROGRAMS" startMenuDeleteLoopDone startMenuDeleteLoop
1120+ startMenuDeleteLoopDone:
1121+
1122+ ; If the user changed the shortcut, then untinstall may not work. This should
1123+ ; try to fix it.
1124+ StrCpy $MUI_TEMP "$START_MENU"
1125+ Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
1126+@CPACK_NSIS_DELETE_ICONS_EXTRA@
1127+
1128+ ;Delete empty start menu parent diretories
1129+ StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
1130+
1131+ secondStartMenuDeleteLoop:
1132+ ClearErrors
1133+ RMDir $MUI_TEMP
1134+ GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
1135+
1136+ IfErrors secondStartMenuDeleteLoopDone
1137+
1138+ StrCmp "$MUI_TEMP" "$SMPROGRAMS" secondStartMenuDeleteLoopDone secondStartMenuDeleteLoop
1139+ secondStartMenuDeleteLoopDone:
1140+
1141+ DeleteRegKey /ifempty SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
1142+
1143+ Push $INSTDIR\bin
1144+ StrCmp $DO_NOT_ADD_TO_PATH_ "1" doNotRemoveFromPath 0
1145+ Call un.RemoveFromPath
1146+ doNotRemoveFromPath:
1147+SectionEnd
1148+
1149+;--------------------------------
1150+; determine admin versus local install
1151+; Is install for "AllUsers" or "JustMe"?
1152+; Default to "JustMe" - set to "AllUsers" if admin or on Win9x
1153+; This function is used for the very first "custom page" of the installer.
1154+; This custom page does not show up visibly, but it executes prior to the
1155+; first visible page and sets up $INSTDIR properly...
1156+; Choose different default installation folder based on SV_ALLUSERS...
1157+; "Program Files" for AllUsers, "My Documents" for JustMe...
1158+
1159+Function .onInit
1160+ ;Language Selection Dialog
1161+ !ifndef CPACK_NSIS_LANGUAGE_DIALOG_@CPACK_NSIS_LANGUAGE_DIALOG@
1162+ !define CPACK_NSIS_LANGUAGE_DIALOG_@CPACK_NSIS_LANGUAGE_DIALOG@
1163+ !endif
1164+ !ifdef CPACK_NSIS_LANGUAGE_DIALOG_ON
1165+ !define MUI_LANGDLL_REGISTRY_ROOT SHCTX
1166+ !define MUI_LANGDLL_REGISTRY_KEY "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
1167+ !define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
1168+ !insertmacro MUI_LANGDLL_DISPLAY
1169+ !endif
1170+
1171+ ; Reads components status for registry
1172+ !insertmacro SectionList "InitSection"
1173+
1174+ ; check to see if /D has been used to change
1175+ ; the install directory by comparing it to the
1176+ ; install directory that is expected to be the
1177+ ; default
1178+ StrCpy $IS_DEFAULT_INSTALLDIR 0
1179+ StrCmp "$INSTDIR" "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@" 0 +2
1180+ StrCpy $IS_DEFAULT_INSTALLDIR 1
1181+
1182+ StrCpy $SV_ALLUSERS "JustMe"
1183+ ; if default install dir then change the default
1184+ ; if it is installed for JustMe
1185+ StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2
1186+ StrCpy $INSTDIR "$DOCUMENTS\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
1187+
1188+ ClearErrors
1189+ UserInfo::GetName
1190+ IfErrors noLM
1191+ Pop $0
1192+ UserInfo::GetAccountType
1193+ Pop $1
1194+ StrCmp $1 "Admin" 0 +3
1195+ SetShellVarContext all
1196+ ;MessageBox MB_OK 'User "$0" is in the Admin group'
1197+ StrCpy $SV_ALLUSERS "AllUsers"
1198+ Goto done
1199+ StrCmp $1 "Power" 0 +3
1200+ SetShellVarContext all
1201+ ;MessageBox MB_OK 'User "$0" is in the Power Users group'
1202+ StrCpy $SV_ALLUSERS "AllUsers"
1203+ Goto done
1204+
1205+ noLM:
1206+ StrCpy $SV_ALLUSERS "AllUsers"
1207+ ;Get installation folder from registry if available
1208+
1209+ done:
1210+ StrCmp $SV_ALLUSERS "AllUsers" 0 +3
1211+ StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2
1212+ StrCpy $INSTDIR "@CPACK_NSIS_INSTALL_ROOT@\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
1213+
1214+ StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 noOptionsPage
1215+ !insertmacro MUI_INSTALLOPTIONS_EXTRACT "NSIS.InstallOptions.ini"
1216+
1217+ noOptionsPage:
1218+FunctionEnd
1219
1220=== added file 'utils/win32/WL-Editor.ico'
1221Binary files utils/win32/WL-Editor.ico 1970-01-01 00:00:00 +0000 and utils/win32/WL-Editor.ico 2012-02-18 14:12:20 +0000 differ
1222=== added directory 'utils/win32/nsis'
1223=== added file 'utils/win32/nsis/WL.bmp'
1224Binary files utils/win32/nsis/WL.bmp 1970-01-01 00:00:00 +0000 and utils/win32/nsis/WL.bmp 2012-02-18 14:12:20 +0000 differ
1225=== added file 'utils/win32/nsis/install_header.bmp'
1226Binary files utils/win32/nsis/install_header.bmp 1970-01-01 00:00:00 +0000 and utils/win32/nsis/install_header.bmp 2012-02-18 14:12:20 +0000 differ
1227=== added file 'utils/win32/wl-ico-128.ico'
1228Binary files utils/win32/wl-ico-128.ico 1970-01-01 00:00:00 +0000 and utils/win32/wl-ico-128.ico 2012-02-18 14:12:20 +0000 differ

Subscribers

People subscribed via source and target branches

to status/vote changes: