<?xml version="1.0" encoding="utf-8"?>

<!-- Part of Scheme 48 1.9.  See file COPYING for notices and license. -->

<!-- Authors: Mike Sperber -->

<!-- WiX 3.0 source file for building a Windows .msi installer for Scheme 48 -->

<!-- To build, fire up Cygwin, cd to the source directory, and do:
     build/generate-scheme48-files-wxi.sh ./scheme48vm -i scheme48.image
     candle build/scheme48.wxs
     light -ext WixUIExtension -cultures:en-us scheme48.wixobj
        [expect 2 "LGHT1076:ICE69" warnings]
-->
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <!-- TODO:
     - user-definable location for shortcut
   -->
    <Product Id="444FE3E9-7460-4CD7-AF52-7639921953A1" Name="Scheme 48 1.9" Version="1.9" Manufacturer="The Scheme 48 Maintainers, s48-info@s48.org" Codepage="1252" Language="1033" UpgradeCode="BBF191A9-FEC9-4029-8E3A-230C0348E65C">
        <Package Description="Scheme 48" Comments="Scheme 48 Development System" Manufacturer="The Scheme 48 Maintainers" InstallerVersion="110" Platform="x86" Languages="1033" Compressed="yes" />
        <Condition Message="This software only runs on Windows NT 4.0/2000/XP.">
      VersionNT
    </Condition>
        <Media Id="1" EmbedCab="yes" Cabinet="scheme48.cab" />
        <Directory Id="TARGETDIR" Name="SourceDir">
            <Directory Id="ProgramFilesFolder" Name="PFiles">
                <Directory Id="Scheme48" Name="Scheme 48">
                    <Directory Id="INSTALLDIR" Name="Scheme 48 1.9">
                        <Component Id="Main" Guid="8CCDB7ED-4BB9-48FA-A25E-E84A68831ABC">
                            <File Id="Scheme48VM" Name="scheme48vm.exe" DiskId="1" Source="scheme48vm.exe" Vital="yes" />
                            <File Id="Scheme48VM.lib" Name="scheme48vm.lib" DiskId="1" Source="scheme48vm.lib" Vital="yes" />
                            <File Id="COPYING" Name="COPYING" DiskId="1" Source="COPYING" Vital="yes" />
                            <!-- install null files to make sure the generated files get uninstalled again -->
                            <File Id="Scheme48Image" Name="scheme48.image" Source="build/dummy" DiskId="1" Vital="yes" />
                            <File Id="Scheme48BAT" Name="scheme48.bat" Source="build/dummy" DiskId="1" Vital="yes" />
                        </Component>
                        <?include scheme48-files.wxi ?>
                        <Directory Id="include" Name="include">
                            <Component Id="include_component" Guid="F3D5EB41-E135-4423-BAAB-842BD4D2459B">
                                <File Id="include_scheme48.h" Name="scheme48.h" Source="c/scheme48.h" DiskId="1" Vital="yes" />
                                <File Id="include_scheme48write_barrier.h" Name="scheme48write-barrier.h" Source="c/scheme48write-barrier.h" DiskId="1" Vital="yes" />
                                <File Id="include_scheme48arch.h" Name="scheme48arch.h" Source="c/win32/scheme48arch.h" DiskId="1" Vital="yes" />
                            </Component>
                        </Directory>
                        <Directory Id="external" Name="external">
                            <Component Id="external_component" Guid="0610EF36-8C72-4ECA-B953-B8E18DA412F9">
                                <File Id="external_srfi_27.dll" Name="srfi-27.dll" Source="srfi-27.dll" DiskId="1" Vital="yes" />
                                <File Id="external_r6rs.dll" Name="r6rs.dll" Source="r6rs.dll" DiskId="1" Vital="yes" />
                            </Component>
                        </Directory>
                        <Directory Id="build" Name="build">
                            <Component Id="build_component" Guid="5E0CA4B9-6D91-4C38-AB29-B3CF8F044595">
                                <File Id="build_initial.image" Name="initial.image-32" DiskId="1" Source="build/initial.image-32" Vital="yes" />
                                <File Id="build_initial.debug" Name="initial.debug" DiskId="1" Source="build/initial.debug" Vital="yes" />
                                <File Id="build_initial.scm" Name="initial.scm" DiskId="1" Source="build/initial.scm" Vital="yes" />
                                <File Id="build_build_usual_image.bat" Name="build-usual-image.bat" Source="build/build-usual-image.bat" DiskId="1" Vital="yes" />
                                <!--- install a null file so it will be deleted again by rollback and uninstall -->
                                <File Id="build_usual_image.input" Name="build-usual-image.input" Source="build/dummy" DiskId="1" Vital="yes" />
                                <File Id="generate_go.bat" Name="generate-go.bat" Source="build/generate-go.bat" DiskId="1" Vital="yes" />
                            </Component>
                        </Directory>
                    </Directory>
                </Directory>
            </Directory>
            <Directory Id="ProgramMenuFolder" Name="Programs">
                <Directory Id="ProgramMenuDir" Name="Scheme 48" />
            </Directory>
            <Directory Id="DesktopFolder" Name="Desktop" />
        </Directory>
	<DirectoryRef Id="ProgramMenuDir">
	    <Component Id="short_cut_component" Guid="EF5096B5-127E-4E6A-9C88-194997535BCB">
	        <Shortcut Id="start_menu_entry" Directory="ProgramMenuDir" Description="Scheme 48 Console" Name="Scheme 48 1.9" Target="[INSTALLDIR]scheme48" WorkingDirectory="INSTALLDIR" Icon="scheme48.ico" IconIndex="0" Show="normal" />
                <Shortcut Id="doc_html_menu_entry" Directory="ProgramMenuDir" Description="Scheme 48 HTML Documentation" Name="Scheme 48 1.9 HTML Documentation" Target="[#doc_html_manual.html]" Show="normal" />
                <Shortcut Id="doc_pdf_menu_entry" Directory="ProgramMenuDir" Description="Scheme 48 PDF Documentation" Name="Scheme 48 1.9 PDF Documentation" Target="[#doc_manual.pdf]" Show="normal" />
	        <RemoveFolder Id="ProgramMenuDir" On="uninstall"/>
   	        <RegistryValue Root="HKCU" Key="Software\Scheme 48\Scheme 48 1.9" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
	    </Component>
	</DirectoryRef>
	
        <!-- declare building of scheme48.image -->
        <!-- /v:off needed to avoid mangling !s on some systems -->
        <CustomAction Id="build_usual_image" Directory="INSTALLDIR" ExeCommand="[SystemFolder]cmd.exe /v:off /c build\build-usual-image.bat &quot;[INSTALLDIR]&quot; &quot;[INSTALLDIR]scheme&quot; &quot;[INSTALLDIR]external&quot; &quot;[INSTALLDIR]scheme48.image&quot; &quot;[INSTALLDIR]scheme48vm.exe&quot; &quot;[INSTALLDIR]build\initial.image-32&quot;" Execute="deferred" Impersonate="no" Return="check" />
        <!-- declare generation of front end -->
        <CustomAction Id="generate_go" FileKey="generate_go.bat" ExeCommand="&quot;[INSTALLDIR]scheme48.bat&quot; &quot;[INSTALLDIR]scheme48vm.exe&quot; &quot;[INSTALLDIR]scheme48.image&quot;" Execute="deferred" Impersonate="no" Return="check" />
        <Icon Id="scheme48.ico" SourceFile="build/scheme48.ico" />
        <Feature Id="Complete" Level="1" Title="Scheme 48 1.9" Description="Scheme 48 1.9 main installation" ConfigurableDirectory="INSTALLDIR">
            <ComponentRef Id="Main" />
            <ComponentRef Id="include_component" />
            <ComponentRef Id="build_component" />
            <ComponentRef Id="scheme_component" />
            <ComponentRef Id="scheme_env_component" />
            <ComponentRef Id="scheme_big_component" />
            <ComponentRef Id="scheme_sort_component" />
            <ComponentRef Id="scheme_misc_component" />
            <ComponentRef Id="scheme_cml_component" />
            <ComponentRef Id="scheme_srfi_component" />
            <ComponentRef Id="scheme_rts_component" />
            <ComponentRef Id="scheme_r6rs_component" />
            <ComponentRef Id="scheme_net_component" />
            <ComponentRef Id="scheme_posix_component" />
            <ComponentRef Id="external_component" />
            <ComponentRef Id="doc_component" />
            <ComponentRef Id="doc_html_component" />
	    <ComponentRef Id="short_cut_component" />
        </Feature>
        <!-- schedule the building of scheme48.image -->
        <InstallExecuteSequence>
            <Custom Action="build_usual_image" Before="InstallFinalize"><![CDATA[(NOT Installed) OR (INSTALLMODE = "Repair")]]></Custom>
            <Custom Action="generate_go" Before="InstallFinalize"><![CDATA[(NOT Installed) OR (INSTALLMODE = "Repair")]]></Custom>
        </InstallExecuteSequence>
	<WixVariable Id="WixUILicenseRtf" Value="COPYING.rtf" />
	<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
	<Property Id="ARPPRODUCTICON" Value="scheme48.ico" />
	<UIRef Id="WixUI_InstallDir" />
    </Product>
</Wix>
