Skip to content

Commit

Permalink
Refactor windows installers and fix vcredist
Browse files Browse the repository at this point in the history
- Separate 64 and 32 bit MSIs
- Add wix bundle to combine MSIs into single installer
- Use basic wix UI
- Use merge modules to install vcredist package
- Add script to locate vcredist merge modules
- Fix installer status text by adding WixUI_ErrorProgressText ref

Merge modules seems to be the preferred method for installing the
redistributable package, which should decrease the package size and
speed up installation. This commit also addresses a bug where the
installer does not work when VC redistributable is not already
installed.

The 32 and 64 bit components were split into separate MSIs because
Windows Installer only officially supports packages containing a
single architecture. A package bundle is then created containing both
MSIs so only a single file needs to be distributed.

There seemed to be no trivial way to get the path to the vcredist
merge modules bundled with visual studio so I added a script
(locate-vcredist.bat) that handles this. It will need to be updated in
the future for compatibility with newer VS platform toolsets.

Some paths and name were changed, here's a summary:

32-bit install path: C:\Program Files (x86)\Chez Scheme 9.4.1\
64-bit install path: C:\Program Files\Chez Scheme 9.4.1\
installer file name: ChezScheme.exe
installer product name: Chez Scheme 9.4.1 x64
  • Loading branch information
kleinpa committed Aug 31, 2017
1 parent 42a0d34 commit a886774
Show file tree
Hide file tree
Showing 10 changed files with 244 additions and 71 deletions.
11 changes: 10 additions & 1 deletion LOG
Original file line number Diff line number Diff line change
Expand Up @@ -566,4 +566,13 @@
mats/Mf-a6nt, mats/Mf-ta6nt, mats/ftype.ms
- added support for building Windows installs with Bash/WSL
wininstall/Makefile, candle.bat, light.bat
- added support for building with Visual Studio 2017's BuildTools in c/vs.bat
- added support for building with Visual Studio 2017's BuildTools
c/vs.bat
- check for git before using to get submodules
configure
- fixed windows installer failure when vcredist is not preinstalled by
using the vcredist merge module, split the 32 and 64 bit MSIs and
added a wix bundle to combine the MSIs into a single exe installer,
added a batch script for locating Visual Studio's vcredist merge
modules, updated installer paths and names.
wininstall/*
2 changes: 1 addition & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ if [ "$m" = "" -o ! -f boot/$m/scheme.boot ] ; then
exit 1
fi

if [ -d '.git' ] ; then
if [ -d '.git' ] && command -v git >/dev/null 2>&1 ; then
git submodule init && git submodule update || exit 1
else
if [ ! -f 'nanopass/nanopass.ss' ] ; then
Expand Down
8 changes: 5 additions & 3 deletions wininstall/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/*.wixobj
/*.wixpdb
/Chez Scheme.msi
*.exe
*.msi
*.wixobj
*.wixpdb
/vcredist.wxs
24 changes: 18 additions & 6 deletions wininstall/Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
VERSION := 9.4.1
WIXEXTENSIONS := -ext WixUIExtension
WIXEXTENSIONS := -ext WixUIExtension -ext WixBalExtension

Chez\ Scheme.msi: product.wixobj a6nt.wixobj examples.wixobj i3nt.wixobj ta6nt.wixobj ti3nt.wixobj
cmd.exe /c light.bat -nologo $(WIXEXTENSIONS) product.wixobj a6nt.wixobj examples.wixobj i3nt.wixobj ta6nt.wixobj ti3nt.wixobj -sice:ICE64 -out "$@"
ChezScheme.exe: x86/bundle.wixobj ChezScheme32.msi ChezScheme64.msi
cmd.exe /c light.bat -nologo $(WIXEXTENSIONS) $< -out $@

%.wixobj: %.wxs
cmd.exe /c candle.bat -nologo -dVersion=$(VERSION) $(WIXEXTENSIONS) $<
ChezScheme32.msi: x86/product.wixobj x86/examples.wixobj x86/i3nt.wixobj x86/ti3nt.wixobj x86/vcredist.wixobj x86/ui.wixobj
cmd.exe /c light.bat -nologo $(WIXEXTENSIONS) $^ -sice:ICE64 -sice:ICE03 -sice:ICE82 -sice:ICE61 -out "$@"

ChezScheme64.msi: x64/product.wixobj x64/a6nt.wixobj x64/examples.wixobj x64/ta6nt.wixobj x64/vcredist.wixobj x64/ui.wixobj
cmd.exe /c light.bat -nologo $(WIXEXTENSIONS) $^ -sice:ICE64 -sice:ICE03 -sice:ICE82 -sice:ICE61 -out "$@"

x86/%.wixobj: %.wxs
cmd.exe /c candle.bat -nologo -dVersion=$(VERSION) $(WIXEXTENSIONS) $< -out $@

x64/%.wixobj: %.wxs
cmd.exe /c candle.bat -arch x64 -nologo -dVersion=$(VERSION) $(WIXEXTENSIONS) $< -out $@

vcredist.wxs: locate-vcredist.bat
cmd.exe /c locate-vcredist.bat

.PHONY: workareas
workareas:
Expand All @@ -16,4 +28,4 @@ workareas:

.PHONY: clean
clean:
-rm -f Chez\ Scheme.msi *.wixobj *.wixpdb
-rm -rf *.msi *.wixpdb x86/ x64/ vcredist.wxs *.wixobj *.exe
26 changes: 26 additions & 0 deletions wininstall/bundle.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>

<?define ProductName = "Chez Scheme"?>
<?define Manufacturer = "Cisco Systems, Inc."?>
<?define UpgradeCode = "f1d9058d-fb72-4896-862d-f332388cf392"?>

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension">
<Bundle Name="$(var.ProductName) $(var.Version)"
Version="$(var.Version)"
Manufacturer="$(var.Manufacturer)"
UpgradeCode="$(var.UpgradeCode)">

<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
<bal:WixStandardBootstrapperApplication
LicenseFile="license.rtf"
LogoFile="cs.png"
SuppressOptionsUI="yes" />
</BootstrapperApplicationRef>

<Chain>
<MsiPackage SourceFile="ChezScheme32.msi" Cache="yes" />
<MsiPackage InstallCondition="VersionNT64" SourceFile="ChezScheme64.msi" Cache="yes" />
</Chain>
</Bundle>
</Wix>
73 changes: 73 additions & 0 deletions wininstall/locate-vcredist.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
@call "../c/vs.bat" x86

@IF "%VisualStudioVersion%"=="" ( GOTO error-undefined-vs )

@IF "%VisualStudioVersion%"=="14.0" (
SET "Path32=%CommonProgramFiles(x86)%\Merge Modules\Microsoft_VC140_CRT_x86.msm"
SET "Path64=%CommonProgramFiles(x86)%\Merge Modules\Microsoft_VC140_CRT_x64.msm"
)

@IF "%VisualStudioVersion%"=="15.0" (
@IF EXIST "%VCINSTALLDIR%Redist\MSVC\14.10.25008" (
@SET "Path32=%VCINSTALLDIR%Redist\MSVC\14.10.25008\MergeModules\Microsoft_VC150_CRT_x86.msm"
@SET "Path64=%VCINSTALLDIR%Redist\MSVC\14.10.25008\MergeModules\Microsoft_VC150_CRT_x64.msm"
)

@IF EXIST "%VCINSTALLDIR%Redist\MSVC\14.11.25325" (
@SET "Path32=%VCINSTALLDIR%Redist\MSVC\14.11.25325\MergeModules\Microsoft_VC141_CRT_x86.msm"
@SET "Path64=%VCINSTALLDIR%Redist\MSVC\14.11.25325\MergeModules\Microsoft_VC141_CRT_x64.msm"
)
)

@DEL vcredist.wxs >nul 2>&1

IF "%Path32%"=="" ( GOTO error-unknown-vs )
IF NOT EXIST "%Path32%" ( GOTO error-32-doesnt-exist )
IF NOT EXIST "%Path64%" ( GOTO error-64-doesnt-exist )

@(
@ECHO ^<?xml version="1.0" encoding="utf-8"?^>
@ECHO ^<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"^>
@ECHO ^<Fragment^>
@ECHO ^<DirectoryRef Id="TARGETDIR"^>
@ECHO ^<Merge Id="VCRedist64Merge" SourceFile="%Path64%" Language="0" DiskId="1" /^>
@ECHO ^</DirectoryRef^>
@ECHO ^</Fragment^>
@ECHO ^<Fragment^>
@ECHO ^<DirectoryRef Id="TARGETDIR"^>
@ECHO ^<Merge Id="VCRedist32Merge" SourceFile="%Path32%" Language="0" DiskId="1" /^>
@ECHO ^</DirectoryRef^>
@ECHO ^</Fragment^>
@ECHO ^<Fragment^>
@ECHO ^<Feature Id="VCRedist64" Title="Visual C++ Runtime (64-bit)" AllowAdvertise="no" Display="hidden" Level="1"^>
@ECHO ^<MergeRef Id="VCRedist64Merge" /^>
@ECHO ^</Feature^>
@ECHO ^</Fragment^>
@ECHO ^<Fragment^>
@ECHO ^<Feature Id="VCRedist32" Title="Visual C++ Runtime (32-bit)" AllowAdvertise="no" Display="hidden" Level="1"^>
@ECHO ^<MergeRef Id="VCRedist32Merge" /^>
@ECHO ^</Feature^>
@ECHO ^</Fragment^>
@ECHO ^</Wix^>
) > vcredist.wxs

@ECHO Built vcredist.wxs
@EXIT /b 0

:error-undefined-vs
@ECHO Error building vcredist.wxs: Visual Studio version not defined.
@EXIT /b 1

:error-unknown-vs
@ECHO Error building vcredist.wxs: Unexpected Visual Studio version.
@EXIT /b 1

:error-32-doesnt-exist
@ECHO Error building vcredist.wxs: Merge Module couldn't be found:
@ECHO %Path32%
@EXIT /b 1

:error-64-doesnt-exist
@ECHO Error building vcredist.wxs: Merge Module couldn't be found:
@ECHO %Path64%
@EXIT /b 1
112 changes: 52 additions & 60 deletions wininstall/product.wxs
Original file line number Diff line number Diff line change
@@ -1,92 +1,84 @@
<?xml version="1.0" encoding="utf-8"?>
<?define ProductName = "Chez Scheme Version $(var.Version)"?>

<?define ProductName = "Chez Scheme"?>
<?define Manufacturer = "Cisco Systems, Inc."?>

<?if $(sys.BUILDARCH)="x86"?>
<?define UpgradeCode="e183c83e-1216-446f-bee1-f25db3297efa"?>
<?define PlatformProgramFilesFolder="ProgramFilesFolder"?>
<?elseif $(sys.BUILDARCH)="x64"?>
<?define UpgradeCode="07a89f71-9c12-4e7d-b618-f7c255337640"?>
<?define PlatformProgramFilesFolder="ProgramFiles64Folder"?>
<?else?>
<?error Unsupported value of sys.BUILDARCH=$(sys.BUILDARCH)?>
<?endif?>

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product
Name="$(var.ProductName)"
Id="49f75024-1225-42e4-aa8d-15ddb60a13d2"
UpgradeCode="e183c83e-1216-446f-bee1-f25db3297efa"
Name="$(var.ProductName) $(var.Version) $(sys.BUILDARCH)"
Id="*"
UpgradeCode="$(var.UpgradeCode)"
Language="1033"
Codepage="1252"
Version="$(var.Version)"
Manufacturer="$(var.Manufacturer)">
<Package
InstallerVersion="301"
Keywords="Installer"
Description="$(var.ProductName) Installer"
Manufacturer="$(var.Manufacturer)"
InstallScope="perMachine"
Languages="1033"
Compressed="yes"
SummaryCodepage="1252"/>

<MajorUpgrade
AllowDowngrades="no"
DowngradeErrorMessage="A newer version is already installed."
AllowSameVersionUpgrades="yes" />

<MediaTemplate EmbedCab="yes"/>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder" Name="Program Files">
<Directory Id="APPLICATIONFOLDER" Name="$(var.ProductName)">

<Directory Id="TARGETDIR" Name="SourceDir" DiskId="1">
<Directory Id="$(var.PlatformProgramFilesFolder)">
<Directory Id="APPLICATIONFOLDER" Name="$(var.ProductName) $(var.Version)">
<Directory Id="D_bin" Name="bin"/>
<Directory Id="D_boot" Name="boot"/>
<Directory Id="D_examples" Name="examples"/>
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="D_shortcuts" Name="$(var.ProductName)"/>
<Directory Id="D_shortcuts" Name="$(var.ProductName) $(var.Version)"/>
</Directory>
</Directory>

<Feature Id="Examples" Level="1" Title="Chez Scheme examples">
<ComponentGroupRef Id="examples"/>
</Feature>
<Feature Id="i3nt" Level="1" Title="Chez Scheme 32-bit nonthreaded">
<ComponentGroupRef Id="i3nt"/>
</Feature>
<Feature Id="ti3nt" Level="1" Title="Chez Scheme 32-bit threaded">
<ComponentGroupRef Id="ti3nt"/>
</Feature>
<Feature Id="a6nt" Level="1" Title="Chez Scheme 64-bit nonthreaded">
<ComponentGroupRef Id="a6nt"/>
<Condition Level="0">NOT VersionNT64</Condition>
</Feature>
<Feature Id="ta6nt" Level="1" Title="Chez Scheme 64-bit threaded">
<ComponentGroupRef Id="ta6nt"/>
<Condition Level="0">NOT VersionNT64</Condition>
</Feature>

<?if $(sys.BUILDARCH)="x86"?>
<Feature Id="i3nt" Level="1" Title="Chez Scheme 32-bit nonthreaded">
<ComponentGroupRef Id="i3nt"/>
</Feature>
<Feature Id="ti3nt" Level="1" Title="Chez Scheme 32-bit threaded">
<ComponentGroupRef Id="ti3nt"/>
</Feature>
<FeatureRef Id="VCRedist32"/>
<?endif?>

<?if $(sys.BUILDARCH)="x64"?>
<Feature Id="a6nt" Level="1" Title="Chez Scheme 64-bit nonthreaded">
<ComponentGroupRef Id="a6nt"/>
</Feature>
<Feature Id="ta6nt" Level="1" Title="Chez Scheme 64-bit threaded">
<ComponentGroupRef Id="ta6nt"/>
</Feature>
<FeatureRef Id="VCRedist64"/>
<?endif?>

<Icon Id="cs.ico" SourceFile="../c/cs.ico"/>
<Property Id="VCRUNTIME_X86_DLL">
<ComponentSearch
Id="vcruntime_x86"
Guid="E8E39D3B-4F35-36D8-B892-4B28336FE041"/>
</Property>
<Property Id="VCRUNTIME_X64_DLL">
<ComponentSearch
Id="vcruntime_x64"
Guid="B33258FD-750C-3B42-8BE4-535B48E97DB4"/>
</Property>
<Binary Id="vcredist_x86" SourceFile="vc_redist.x86.exe"/>
<CustomAction
Id="vcredist_x86_CA"
BinaryKey="vcredist_x86"
Impersonate="yes"
Execute="deferred"
ExeCommand="/quiet"
Return="check"/>
<Binary Id="vcredist_x64" SourceFile="vc_redist.x64.exe"/>
<CustomAction
Id="vcredist_x64_CA"
BinaryKey="vcredist_x64"
Impersonate="yes"
Execute="deferred"
ExeCommand="/quiet"
Return="check"/>
<InstallExecuteSequence>
<Custom Action="vcredist_x86_CA" Before="InstallFinalize">
NOT VCRUNTIME_X86_DLL
</Custom>
<Custom Action="vcredist_x64_CA" Before="InstallFinalize">
NOT VCRUNTIME_X64_DLL AND VersionNT64
</Custom>
</InstallExecuteSequence>
<Property Id="ARPPRODUCTICON" Value="cs.ico"/>
<UIRef Id="WixUI_Advanced"/>
<WixVariable Id="WixUILicenseRtf" Value="license.rtf"/>
<Property Id="ApplicationFolderName" Value="$(var.ProductName)"/>
<Property Id="WixAppFolder" Value="WixPerMachineFolder"/>

<UIRef Id="SimpleUI"/>
</Product>
</Wix>
59 changes: 59 additions & 0 deletions wininstall/ui.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<UI Id="SimpleUI">
<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="Minimal" />

<DialogRef Id="ErrorDlg" />
<DialogRef Id="FatalError" />
<DialogRef Id="FilesInUse" />
<DialogRef Id="MsiRMFilesInUse" />
<DialogRef Id="PrepareDlg" />
<DialogRef Id="ProgressDlg" />
<DialogRef Id="ResumeDlg" />
<DialogRef Id="UserExit" />

<Dialog Id="SimpleWelcomeDlg" Width="370" Height="270" Title="!(loc.WelcomeDlg_Title)">
<Control Id="Next" Type="PushButton" ElevationShield="yes" X="236" Y="243" Width="56" Height="17" Default="yes" Text="&amp;Install" >
<Publish Property="WixUI_InstallMode" Value="Update">Installed AND PATCH</Publish>
</Control>
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
<Control Id="Bitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="234" TabSkip="no" Text="!(loc.WelcomeDlgBitmap)" />
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Disabled="yes" Text="!(loc.WixUIBack)" />
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<Control Id="Description" Type="Text" X="135" Y="80" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="The Setup Wizard will install [ProductName] on your computer. Click Install to continue or Cancel to exit the Setup Wizard." >
<Condition Action="show">NOT Installed OR NOT PATCH</Condition>
<Condition Action="hide">Installed AND PATCH</Condition>
</Control>
<Control Id="PatchDescription" Type="Text" X="135" Y="80" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="!(loc.WelcomeUpdateDlgDescriptionUpdate)" >
<Condition Action="show">Installed AND PATCH</Condition>
<Condition Action="hide">NOT Installed OR NOT PATCH</Condition>
</Control>
<Control Id="Title" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="!(loc.WelcomeDlgTitle)" />
</Dialog>

<InstallUISequence>
<Show Dialog="SimpleWelcomeDlg" Before="ProgressDlg" Overridable="yes">NOT Installed OR PATCH</Show>
</InstallUISequence>

<Publish Dialog="SimpleWelcomeDlg" Control="Next" Event="NewDialog" Value="PrepareDlg">1</Publish>
<Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
<Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg">1</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>

<Property Id="ARPNOMODIFY" Value="1" />
</UI>
<UIRef Id="WixUI_ErrorProgressText" />
<UIRef Id="WixUI_Common" />
</Fragment>
</Wix>
Binary file removed wininstall/vc_redist.x64.exe
Binary file not shown.
Binary file removed wininstall/vc_redist.x86.exe
Binary file not shown.

0 comments on commit a886774

Please sign in to comment.