summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThanos Doukoudakis <thanos.doukoudakis@isode.com>2017-09-07 16:44:42 (GMT)
committerThanos Doukoudakis <thanos.doukoudakis@isode.com>2018-03-12 11:24:12 (GMT)
commitc57ffc95daa7e9fef8663979d01b08a122447ba4 (patch)
tree27bc9483be322837a4408431304dd992e0fff9f5
parent863c72980c9c25c81ef8864b310e1fd9cb9a57df (diff)
downloadswift-c57ffc95daa7e9fef8663979d01b08a122447ba4.zip
swift-c57ffc95daa7e9fef8663979d01b08a122447ba4.tar.bz2
Enable per user installations on Windows
This patch will allow the installer to perform per-user installations that doesn't require elevated rights. If the Visual Studio prerequisites are missing, the installer will ask the user if he wants to install them. If the user chooses not to, the installer will deploy the necessary files in the installation folder. Installations for all users (per machine) are still available. Upon upgrading in per-user installs from previous versions, the user can still access the settings that were stored in the registry, but not the settings stored in system-settings.xml. Test-Information: Build and tested with Wix3.11, Qt 5.8 and Visual Studio 2015 on Windows 10 and Windows 7. Tested fresh install and upgrade, for per-machine and per-user installations. Tested the vcredist install and the dll deployment when the installation is not present. Verified that the installer uses the registry settings in per-user installations. Change-Id: I1879e2fb7ee347dab58852eb73d4ddddec15b35d
-rw-r--r--BuildTools/SCons/SConscript.boot3
-rw-r--r--BuildTools/SCons/Tools/wix.py3
-rw-r--r--DEVELOPMENT.md5
-rw-r--r--Swift/Packaging/WiX/Swift.wxs143
-rw-r--r--Swift/Packaging/WiX/Swift_en-us.wxl4
-rw-r--r--Swift/QtUI/SConscript11
6 files changed, 154 insertions, 15 deletions
diff --git a/BuildTools/SCons/SConscript.boot b/BuildTools/SCons/SConscript.boot
index fc943f7..c4728ff 100644
--- a/BuildTools/SCons/SConscript.boot
+++ b/BuildTools/SCons/SConscript.boot
@@ -37,7 +37,8 @@ if os.name == "mac" or (os.name == "posix" and os.uname()[0] == "Darwin"):
vars.Add(BoolVariable("mac105", "Link against the 10.5 frameworks", "no"))
vars.Add(BoolVariable("mac106", "Link against the 10.6 frameworks", "no"))
if os.name == "nt" :
- vars.Add(PathVariable("vcredist", "MSVC redistributable dir", None, PathVariable.PathAccept))
+ vars.Add(PathVariable("vcredist", "MSVC redistributable path", None, PathVariable.PathAccept))
+ vars.Add(PathVariable("vcredistdir", "MSVC redistributable dir", None, PathVariable.PathAccept))
if os.name == "nt" :
vars.Add(PathVariable("wix_bindir", "Path to WiX binaries", "", PathVariable.PathAccept))
if os.name == "nt" :
diff --git a/BuildTools/SCons/Tools/wix.py b/BuildTools/SCons/Tools/wix.py
index 907b6d9..889afe4 100644
--- a/BuildTools/SCons/Tools/wix.py
+++ b/BuildTools/SCons/Tools/wix.py
@@ -38,7 +38,7 @@ def generate(env) :
light_builder = SCons.Builder.Builder(
- action = '"$WIX_LIGHT" $WIX_LIGHT_OPTIONS -b "$WIX_SOURCE_OBJECT_DIR" ${SOURCES} -o ${TARGET}',
+ action = '"$WIX_LIGHT" $WIX_LIGHT_OPTIONS -b "$WIX_SOURCE_OBJECT_DIR" ${SOURCES} -loc Swift\\Packaging\\WiX\\Swift_en-us.wxl -o ${TARGET}',
src_suffix = '.wixobj',
src_builder = candle_builder)
@@ -48,4 +48,3 @@ def generate(env) :
def exists(env) :
return True
-
diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md
index 3e48510..5873300 100644
--- a/DEVELOPMENT.md
+++ b/DEVELOPMENT.md
@@ -46,10 +46,11 @@ The Windows package consist of a Widnows Installer (.msi) file. This is generate
For packaging use:
- Microsoft VS 2013 Express
- WiX
-- Download the C++ redistributable package from Microsoft and put it at `C:\Program Files (x86)\Common Files\Merge Modules\`
+- Swift has a dependency on C++ redistributable package from Microsoft that needs to be deployed during install. If the common tools for Visual C++ is installed, then the installation file should be located under `C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\redist\1033\` (for Visual Studio 2013). If not download from Microsoft and put it at `C:\Program Files (x86)\Common Files\Merge Modules\`
- `config.py` should contain:
qt = "c:\\qt\\5.4.2"
- vcredist = "C:\\Program Files (x86)\\Common Files\\Merge Modules\\vcredist_x86.exe"
+ vcredist = "C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\redist\\vcredist_x86.exe"
+ vcredistdir = "C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\redist\\x86\Microsoft.VC120.CRT\\"
debug = 1
optimize = 1
wix_bindir = "c:\\program files\\Windows Installer XML v3.5\\bin"
diff --git a/Swift/Packaging/WiX/Swift.wxs b/Swift/Packaging/WiX/Swift.wxs
index 1e8d129..a2e8dd6 100644
--- a/Swift/Packaging/WiX/Swift.wxs
+++ b/Swift/Packaging/WiX/Swift.wxs
@@ -3,18 +3,29 @@
<!-- For a sensible tutorial on WiX, see http://wix.tramontana.co.hu/tutorial -->
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
-
<?include variables.wxs ?>
<Product Name='Swift' Id='*' UpgradeCode='D7F276D5-BA67-421E-817B-9E7AB4B7D2BF' Language='1033' Codepage='1252' Version='$(var.Version)' Manufacturer='Swift.im'>
- <Package Id='*' Keywords='Installer' Description="Swift Installer" Comments="Swift is available under the GPL version 3" Manufacturer="Swift.im" InstallerVersion='300' Languages='1033' Compressed='yes' SummaryCodepage='1252' InstallScope="perMachine"/>
+ <Package Id='*' Keywords='Installer' Description="Swift Installer" Comments="Swift is available under the GPL version 3" Manufacturer="Swift.im" InstallerVersion='500' Languages='1033' Compressed='yes' SummaryCodepage='1252' />
+ <Property Id="ALLUSERS" Value="2" />
+ <Property Id="MSIINSTALLPERUSER" Value="1" />
+ <Property Id="WIXUIVCREDISTINSTALL" Value="0" />
+
+ <Property Id="VCREDISTINSTALLED">
+ <RegistrySearch Id="VCREDISTINSTALLED"
+ Root="HKLM"
+ Key="SOFTWARE\Wow6432Node\Microsoft\VisualStudio\$(var.MsvcDotVersion)\VC\Runtimes\$(sys.BUILDARCH)"
+ Name="Installed"
+ Type="raw" />
+
+ </Property>
<Media Id='1' Cabinet='Swift.cab' EmbedCab='yes'/>
<!-- Schedule the upgrade to afterInstallExecute means that MSI will first install the new version
over the existing version and run the uninstall of the old version afterwards. This way shortcuts
are not recreated on every new installation and pinned shortcuts stay alive.
However this requires that the components for installed files with the same filename will always
- have the same GUID (do not run heat.exe with -gg flag) or else when MSI removes the components
+ have the same GUID (do not run heat.exe with -gg flag) or else when MSI removes the components
of the old version with the same filename as components of the new version it will delete the
files that belong to components of the new version.-->
<MajorUpgrade Schedule="afterInstallExecute" DowngradeErrorMessage="A newer version is already installed. Remove this version if you wish to downgrade." />
@@ -25,6 +36,9 @@
-->
<Directory Id='ProgramFilesFolder' Name='PFiles'>
+ <Directory Id="APPLICATIONFOLDER" Name="Swift">
+ </Directory>
+
<!--<Directory Id='INSTALLDIR' Name='Swift'>
</Directory>-->
</Directory>
@@ -42,8 +56,11 @@
<Directory Id="DesktopFolder" Name="Desktop" />
</Directory>
+ <Property Id="WixAppFolder" Value="WixPerUserFolder" />
+
<Feature Id='Core' Level='1' Title='Swift' Description='All necessary Swift files' Display='expand' ConfigurableDirectory='INSTALLDIR' AllowAdvertise='no' Absent='disallow'>
<ComponentGroupRef Id='Files' />
+ <ComponentGroupRef Id='VCFiles' />
<!--<ComponentRef Id='Manual' />-->
</Feature>
@@ -53,23 +70,133 @@
<!--<UIRef Id='WixUI_Advanced'/>-->
<!--<UIRef Id="WixUI_Minimal"/>-->
- <UIRef Id="WixUI_Mondo"/>
+ <!--UIRef Id="WixUI_Mondo"/-->
+ <UIRef Id="WixUI_Swift"/>
+
<WixVariable Id='WixUILicenseRtf' Value='COPYING.rtf'/>
<Icon Id="Swift.exe" SourceFile="Swift.exe" />
<Property Id="ARPPRODUCTICON" Value="Swift.exe"/> <!-- The icon in the "Programs" dialog -->
- <!--
- VC Redistributable
+ <!--
+ VC Redistributable
-->
<Binary Id="CRTBinary" SourceFile="$(var.VCCRTFile)"/>
<CustomAction Id="CRTAction" Impersonate="no" Return="asyncNoWait" Execute="deferred" BinaryKey="CRTBinary" ExeCommand="/passive"/>
-
+ <InstallUISequence>
+ <!-- Suppress FindRelatedProducts untill the user selects the scope of the install -->
+ <FindRelatedProducts Suppress="yes" />
+ </InstallUISequence>
<InstallExecuteSequence>
- <Custom Action='CRTAction' After='InstallInitialize'/>
+ <Custom Action='CRTAction' After='InstallInitialize'>(NOT VCREDISTINSTALLED AND ALLUSERS = 1) OR WIXUIVCREDISTINSTALL = 1</Custom>
</InstallExecuteSequence>
</Product>
+ <Fragment>
+ <DirectoryRef Id="INSTALLDIR">
+ <Component Id="msvcp.dll" Guid="*">
+ <Condition>(NOT (VCREDISTINSTALLED OR ALLUSERS = 1)) AND WIXUIVCREDISTINSTALL = 0 </Condition>
+ <File Id="msvcp$(var.MsvcVersion).dll" KeyPath="yes" Source="$(var.VCCRTPath)\msvcp$(var.MsvcVersion).dll" />
+ </Component>
+ <Component Id="vcruntime.dll" Guid="*">
+ <Condition>(NOT (VCREDISTINSTALLED OR ALLUSERS = 1)) AND WIXUIVCREDISTINSTALL = 0 </Condition>
+ <?if $(var.MsvcVersion) > "120"?>
+ <File Id="vcruntime$(var.MsvcVersion).dll" KeyPath="yes" Source="$(var.VCCRTPath)\vcruntime$(var.MsvcVersion).dll" />
+ <?else?>
+ <File Id="msvcr$(var.MsvcVersion).dll" KeyPath="yes" Source="$(var.VCCRTPath)\msvcr$(var.MsvcVersion).dll" />
+ <?endif?>
+ </Component>
+ </DirectoryRef>
+ </Fragment>
+ <Fragment>
+ <ComponentGroup Id="VCFiles">
+ <ComponentRef Id="msvcp.dll" />
+ <ComponentRef Id="vcruntime.dll" />
+ </ComponentGroup>
+ </Fragment>
+ <Fragment>
+
+ <WixVariable Id="WixUISupportPerUser" Value="1" Overridable="yes" />
+ <WixVariable Id="WixUISupportPerMachine" Value="1" Overridable="yes" />
+
+ <!-- This is Based on WixUI_Mondo, but it adds an InstallScopeDlg dialog -->
+ <UI Id="WixUI_Swift">
+ <TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
+ <TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
+ <TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />
+
+ <Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
+ <Property Id="WixUI_Mode" Value="Mondo" />
+
+ <DialogRef Id="ErrorDlg" />
+ <DialogRef Id="FatalError" />
+ <DialogRef Id="FilesInUse" />
+ <DialogRef Id="MsiRMFilesInUse" />
+ <DialogRef Id="PrepareDlg" />
+ <DialogRef Id="ProgressDlg" />
+ <DialogRef Id="ResumeDlg" />
+ <DialogRef Id="UserExit" />
+
+ <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
+
+ <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="LicenseAgreementDlg">NOT Installed AND NOT PATCH</Publish>
+ <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg">Installed AND PATCH</Publish>
+
+ <Publish Dialog="LicenseAgreementDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
+ <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="InstallScopeDlg" Order="2">LicenseAccepted = "1"</Publish>
+
+ <Publish Dialog="InstallScopeDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
+ <!-- override default WixAppFolder of WixPerMachineFolder as standard user won't be shown the radio group to set WixAppFolder -->
+ <Publish Dialog="InstallScopeDlg" Control="Next" Property="WixAppFolder" Value="WixPerUserFolder" Order="1">!(wix.WixUISupportPerUser) AND NOT Privileged</Publish>
+ <Publish Dialog="InstallScopeDlg" Control="Next" Property="ALLUSERS" Value="{}" Order="2">WixAppFolder = "WixPerUserFolder"</Publish>
+ <Publish Dialog="InstallScopeDlg" Control="Next" Property="ALLUSERS" Value="1" Order="3">WixAppFolder = "WixPerMachineFolder"</Publish>
+ <Publish Dialog="InstallScopeDlg" Control="Next" Property="APPLICATIONFOLDER" Value="[WixPerUserFolder]" Order="4">WixAppFolder = "WixPerUserFolder"</Publish>
+ <Publish Dialog="InstallScopeDlg" Control="Next" Property="APPLICATIONFOLDER" Value="[WixPerMachineFolder]" Order="5">WixAppFolder = "WixPerMachineFolder"</Publish>
+ <Publish Dialog="InstallScopeDlg" Control="Next" Event="NewDialog" Value="SetupTypeDlg">1</Publish>
+ <!-- After selecting the scope of the installation, run FindRelatedProducts to find previous versions that needs upgrading -->
+ <Publish Dialog="InstallScopeDlg" Control="Next" Event="DoAction" Value="FindRelatedProducts" Order="6">1</Publish>
+
+ <Publish Dialog="SetupTypeDlg" Control="Back" Event="NewDialog" Value="InstallScopeDlg">1</Publish>
+ <Publish Dialog="SetupTypeDlg" Control="TypicalButton" Event="NewDialog" Value="VCResdistDialog">NOT VCREDISTINSTALLED AND NOT ALLUSERS </Publish>
+ <Publish Dialog="SetupTypeDlg" Control="CustomButton" Event="NewDialog" Value="CustomizeDlg">NOT VCREDISTINSTALLED AND NOT ALLUSERS </Publish>
+ <Publish Dialog="SetupTypeDlg" Control="CompleteButton" Event="NewDialog" Value="VCResdistDialog">NOT VCREDISTINSTALLED AND NOT ALLUSERS </Publish>
+ <Publish Dialog="SetupTypeDlg" Control="TypicalButton" Event="NewDialog" Value="VerifyReadyDlg">VCREDISTINSTALLED OR ALLUSERS = 1</Publish>
+ <Publish Dialog="SetupTypeDlg" Control="CustomButton" Event="NewDialog" Value="CustomizeDlg">VCREDISTINSTALLED OR ALLUSERS = 1</Publish>
+ <Publish Dialog="SetupTypeDlg" Control="CompleteButton" Event="NewDialog" Value="VerifyReadyDlg">VCREDISTINSTALLED OR ALLUSERS = 1</Publish>
+
+ <Dialog Id="VCResdistDialog" Width="260" Height="85" Title="[ProductName] Setup">
+ <Control Id="VcRredistNo" Type="PushButton" X="132" Y="57" Width="56" Height="17" Default="yes" Cancel="yes" Text="!(loc.WixUINo)">
+ <Publish Property="WIXUIVCREDISTINSTALL" Value="0">1</Publish>
+ <Publish Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
+ </Control>
+ <Control Id="VcRredistYes" Type="PushButton" X="72" Y="57" Width="56" Height="17" Text="!(loc.WixUIYes)">
+ <Publish Property="WIXUIVCREDISTINSTALL" Value="1">1</Publish>
+ <Publish Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
+ </Control>
+ <Control Id="Text" Type="Text" X="48" Y="15" Width="194" Height="30" NoPrefix="yes" Text="Visual Studio redistributables installation was not found on your computer. Would you like Swift to install them?" />
+ <Control Id="Icon" Type="Icon" X="15" Y="15" Width="24" Height="24" ToolTip="!(loc.CancelDlgIconTooltip)" FixedSize="yes" IconSize="32" Text="!(loc.CancelDlgIcon)" />
+ </Dialog>
+
+ <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="1">WixUI_InstallMode = "Change"</Publish>
+ <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg" Order="2">WixUI_InstallMode = "InstallCustom"</Publish>
+ <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="VCResdistDialog" Order="1">NOT VCREDISTINSTALLED AND NOT ALLUSERS</Publish>
+ <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="2">VCREDISTINSTALLED OR ALLUSERS = 1</Publish>
+
+ <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="1">WixUI_InstallMode = "InstallCustom"</Publish>
+ <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="SetupTypeDlg" Order="2">WixUI_InstallMode = "InstallTypical" OR WixUI_InstallMode = "InstallComplete"</Publish>
+ <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="3">WixUI_InstallMode = "Change"</Publish>
+ <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="4">WixUI_InstallMode = "Repair" OR WixUI_InstallMode = "Remove"</Publish>
+ <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="2">WixUI_InstallMode = "Update"</Publish>
+
+ <Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">1</Publish>
+
+ <Publish Dialog="MaintenanceTypeDlg" Control="ChangeButton" Event="NewDialog" Value="CustomizeDlg">1</Publish>
+ <Publish Dialog="MaintenanceTypeDlg" Control="RepairButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
+ <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
+ <Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>
+ </UI>
+ <UIRef Id="WixUI_Common" />
+ </Fragment>
</Wix>
diff --git a/Swift/Packaging/WiX/Swift_en-us.wxl b/Swift/Packaging/WiX/Swift_en-us.wxl
new file mode 100644
index 0000000..780b290
--- /dev/null
+++ b/Swift/Packaging/WiX/Swift_en-us.wxl
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<WixLocalization Culture="en-us" xmlns="http://schemas.microsoft.com/wix/2006/localization">
+ <String Id="InstallScopeDlgPerUserDescription">[ProductName] will be installed in a user folder and auto-updates will be enabled. The application be installed only for your user and you do not need to be an Administrator. </String>
+</WixLocalization>
diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript
index ff97b42..77731df 100644
--- a/Swift/QtUI/SConscript
+++ b/Swift/QtUI/SConscript
@@ -57,7 +57,7 @@ myenv.Tool("textfile", toolpath = ["#/BuildTools/SCons/Tools"])
qt4modules = ['QtCore', 'QtWebKit', 'QtGui']
if myenv["qt5"] :
qt_version = '5'
- # QtSvg is required so the image format plugin for SVG images is installed
+ # QtSvg is required so the image format plugin for SVG images is installed
# correctly by Qt's deployment tools.
qt4modules += ['QtWidgets', 'QtWebKitWidgets', 'QtMultimedia', 'QtSvg']
if env["PLATFORM"] != "win32" and env["PLATFORM"] != "darwin" :
@@ -478,9 +478,16 @@ if env["PLATFORM"] == "win32" :
outfile.close()
infile.close()
copying = env.Command(["Swift/COPYING.rtf"], ["COPYING"], convertToRTF)
+ if env.get("vcredistdir", "") :
+ vcredistdir = os.path.dirname(env["vcredistdir"])
+ else:
+ vcredistdir = os.path.dirname(env["vcredist"])+"\\..\\" + ("x86" if env["win_target_arch"] == "x86" else "x64") + "\\Microsoft.VC"+env.get("MSVC_VERSION", "").replace(".","")[:3]+".CRT\\"
wixvariables = {
'VCCRTFile': env["vcredist"],
- 'Version': str(myenv["SWIFT_VERSION_MAJOR"]) + "." + str(myenv["SWIFT_VERSION_MINOR"]) + "." + str(myenv["SWIFT_VERSION_PATCH"])
+ 'VCCRTPath': vcredistdir,
+ 'Version': str(myenv["SWIFT_VERSION_MAJOR"]) + "." + str(myenv["SWIFT_VERSION_MINOR"]) + "." + str(myenv["SWIFT_VERSION_PATCH"]),
+ 'MsvcVersion': str(env.get("MSVC_VERSION", "").replace(".","")[:3]),
+ 'MsvcDotVersion': str(env.get("MSVC_VERSION", "")[:4])
}
wixincludecontent = "<Include>"
for key in wixvariables: