-
Notifications
You must be signed in to change notification settings - Fork 891
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #635 from Boddlnagg/msi-installer
[WIP] MSI Installer
- Loading branch information
Showing
17 changed files
with
400 additions
and
28 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[package] | ||
name = "rustup-win-installer" | ||
version = "0.5.0" | ||
authors = ["Patrick Reisert"] | ||
build = "build.rs" | ||
|
||
[lib] | ||
name = "rustup_msi" | ||
crate-type = ["cdylib"] | ||
|
||
[dependencies] | ||
winapi = "0.2" | ||
rustup = { path = "../../", version = "0.5.0" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use std::env; | ||
|
||
fn main() { | ||
println!("cargo:rustc-link-lib=static=wcautil"); | ||
println!("cargo:rustc-link-lib=static=dutil"); | ||
println!("cargo:rustc-link-lib=dylib=msi"); | ||
println!("cargo:rustc-link-lib=dylib=user32"); | ||
println!("cargo:rustc-link-lib=dylib=mincore"); | ||
|
||
let wix_path = env::var("WIX").unwrap(); | ||
// x86 target is hard-coded because we only build an x86 installer (works just fine on x64) | ||
println!("cargo:rustc-link-search=native={}SDK\\VS2015\\lib\\x86", wix_path); | ||
} |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
param( | ||
[Parameter(Mandatory=$true)] | ||
[string] $Target | ||
) | ||
|
||
$manifest = cargo read-manifest --manifest-path ..\..\..\Cargo.toml | ConvertFrom-Json | ||
$version = $manifest.version.Split(".") | ||
$env:CFG_VER_MAJOR = $version[0] | ||
$env:CFG_VER_MINOR = $version[1] | ||
$env:CFG_VER_PATCH = $version[2] | ||
|
||
foreach($file in Get-ChildItem *.wxs) { | ||
$in = $file.Name | ||
$out = $($file.Name.Replace(".wxs",".wixobj")) | ||
&"$($env:WIX)bin\candle.exe" -nologo -arch x86 "-dTARGET=$Target" -ext WixUIExtension -ext WixUtilExtension -out "target\$out" $in | ||
if ($LASTEXITCODE -ne 0) { exit 1 } | ||
} | ||
|
||
# ICE57 wrongly complains about per-machine data in per-user install, because it doesn't know that INSTALLLOCATION is in per-user directory | ||
&"$($env:WIX)\bin\light.exe" -nologo -ext WixUIExtension -ext WixUtilExtension -out "target\rustup.msi" -sice:ICE57 $(Get-ChildItem target\*.wixobj) |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> | ||
<!-- TODO: Change paths and names accordingly --> | ||
<?define TargetPath="..\..\..\target\$(var.TARGET)\release"?> | ||
<?define RustupCustomActionDll="$(var.TargetPath)\rustup_msi.dll"?> | ||
<?define RustupExe="$(var.TargetPath)\rustup-init.exe"?> | ||
|
||
<Product Id="*" Name="rustup" Language="1033" Version="$(env.CFG_VER_MAJOR).$(env.CFG_VER_MINOR).$(env.CFG_VER_PATCH).0" Manufacturer="The Rust Project Developers" UpgradeCode="09acbb1c-7123-44ac-b2a9-4a04b28ced11"> | ||
<Package InstallerVersion="200" Compressed="yes" InstallScope="perUser" /> | ||
|
||
<!-- TODO: How to configure updates? `AllowDowngrades` automatically removes previously installed versions, no matter what version they have --> | ||
<MajorUpgrade AllowDowngrades="yes" /> | ||
|
||
<!-- Specifies a single cab file to be embedded in the installer's .msi. --> | ||
<MediaTemplate EmbedCab="yes" CompressionLevel="high" /> | ||
|
||
<Feature Id="ProductFeature" Title="rustup" Level="1"> | ||
<ComponentRef Id="CompleteInstallation" /> | ||
</Feature> | ||
|
||
<!-- Set some metadata that will appear in the "Installed Programs" list --> | ||
<Property Id="ARPCONTACT" Value="rustup" /> | ||
<Property Id="ARPCOMMENTS" Value="rustup – The Rust Toolchain Installer" /> | ||
<Property Id="ARPURLINFOABOUT" Value="http://www.rustup.rs" /> | ||
<!--<Property Id="ARPHELPLINK" Value="http://www.rustup.rs" />--> | ||
<Property Id="ARPPRODUCTICON" Value="rust.ico" /> | ||
|
||
<!-- Disable Modify and Repair options (our custom actions based install model does not support repairing) --> | ||
<Property Id="ARPNOMODIFY" Value="1" /> | ||
<Property Id="ARPNOREPAIR" Value="1" /> | ||
|
||
<Icon Id="rust.ico" SourceFile="rust-logo.ico"/> | ||
|
||
<!-- Reference the UI defined in ui.wxs --> | ||
<UIRef Id="CustomUI" /> | ||
<WixVariable Id="WixUIDialogBmp" Value="dialogbg.bmp" /> | ||
<WixVariable Id="WixUIBannerBmp" Value="banner.bmp" /> | ||
<!-- TODO: Include/generate license file --> | ||
<!--<WixVariable Id="WixUILicenseRtf" Value="LICENSE.rtf" />--> | ||
|
||
<Directory Id="TARGETDIR" Name="SourceDir"> | ||
<!-- `INSTALLLOCATION` will be set by custom action --> | ||
<Directory Id="INSTALLLOCATION"> | ||
<Directory Id="INSTALLLOCATION_BINARY" Name="bin"/> | ||
</Directory> | ||
</Directory> | ||
|
||
<DirectoryRef Id="INSTALLLOCATION_BINARY"> | ||
<Component Id="CompleteInstallation" Guid="df2ab9f7-7888-465c-98dd-bb58cbca68f7"> | ||
<!-- Write the product code to the registry, so we can use it to run the uninstaller --> | ||
<RegistryKey Root="HKCU" Key="Software\rustup"> | ||
<RegistryValue Name="InstalledProductCode" Type="string" Value="[ProductCode]" KeyPath="yes" /> | ||
</RegistryKey> | ||
<!-- Install the main rustup.exe binary --> | ||
<File Source="$(var.RustupExe)" Name="rustup.exe"/> | ||
<!-- Append to PATH environment variable --> | ||
<Environment Id="PATH" Name="PATH" Value="[INSTALLLOCATION_BINARY]" Permanent="no" Part="first" Action="set" System="no" /> | ||
</Component> | ||
</DirectoryRef> | ||
|
||
<!-- Register the DLL containing the custom actions as an embedded binary --> | ||
<Binary Id="RustupCustomActionDll" SourceFile="$(var.RustupCustomActionDll)"/> | ||
<!-- Use a type 51 custom action to send options to deferred custom action `RustupInstall` | ||
(can use arbitrary value that encodes all necessary properties and will be parsed from Rust) --> | ||
<CustomAction Id="SetInstallOptions" Property="RustupInstall" Value="... we can pass arbitrary options here ..." /> | ||
<CustomAction Id="RustupSetInstallLocation" BinaryKey="RustupCustomActionDll" DllEntry="RustupSetInstallLocation" Execute="immediate" Return="check" Impersonate="yes"/> | ||
<!-- Propagate the value of `RustupInstallLocation` (set by custom action) to `INSTALLLOCATION` --> | ||
<CustomAction Id="AssignInstallLocation" Directory="INSTALLLOCATION" Value="[RustupInstallLocation]"/> | ||
<CustomAction Id="RustupInstall" BinaryKey="RustupCustomActionDll" DllEntry="RustupInstall" Execute="deferred" Return="check" Impersonate="yes"/> | ||
<CustomAction Id="RustupUninstall" BinaryKey="RustupCustomActionDll" DllEntry="RustupUninstall" Execute="deferred" Return="check" Impersonate="yes"/> | ||
|
||
<InstallExecuteSequence> | ||
<DisableRollback Before="InstallInitialize"/> | ||
<Custom Action="RustupSetInstallLocation" After="CostFinalize"/> | ||
<Custom Action="AssignInstallLocation" After="RustupSetInstallLocation"/> | ||
<Custom Action="SetInstallOptions" Before="InstallInitialize">NOT Installed</Custom> | ||
<Custom Action="RustupInstall" After="InstallFiles">NOT Installed</Custom> | ||
<!-- Run RustupUninstall only on true uninstall, not on upgrade --> | ||
<Custom Action="RustupUninstall" After="RemoveFiles">Installed AND (NOT UPGRADINGPRODUCTCODE)</Custom> | ||
</InstallExecuteSequence> | ||
|
||
<!-- Send a WM_SETTINGCHANGE message to tell processes like explorer to update their | ||
environments so any new command prompts get the updated %PATH% --> | ||
<CustomActionRef Id="WixBroadcastEnvironmentChange" /> | ||
</Product> | ||
</Wix> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Based on WixUI_Advanced | ||
--> | ||
|
||
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> | ||
<Fragment> | ||
<UI Id="CustomUI"> | ||
<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="InstallDir" /> | ||
|
||
<DialogRef Id="DiskCostDlg" /> | ||
<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="VerifyReadyDlg">1</Publish> | ||
|
||
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="1">1</Publish> | ||
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg" Order="2">Installed AND NOT PATCH</Publish> | ||
|
||
<Publish Dialog="MaintenanceWelcomeDlg" Control="Next" Event="NewDialog" Value="MaintenanceTypeDlg">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> |
Oops, something went wrong.