<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<!--
    The outer definition for the TG Spaces macOS installer.

    Two component packages, one per plugin format, presented as two tick boxes.
    A Logic-only user has no use for the VST3 and a Reaper-only user has no use
    for the Audio Unit, and an installer that silently drops both formats on a
    machine gives neither of them a way to say so.

    Everything the installer displays is plain text rather than RTF. VoiceOver
    reads a plain text pane straight through; an RTF pane it reads as a styled
    document, stopping on formatting runs.
-->
<installer-gui-script minSpecVersion="2">
    <title>TG Spaces 1.0</title>
    <welcome file="welcome.txt" mime-type="text/plain"/>
    <license file="license.txt" mime-type="text/plain"/>
    <conclusion file="conclusion.txt" mime-type="text/plain"/>
    <!--
        customize="always" so the format list is always shown rather than hidden
        behind a Customise button. It costs one extra pane and removes the need
        to know the button is there.

        Both architectures declared, so this installer runs natively on Apple
        silicon and on Intel instead of asking for Rosetta.
    -->
    <options customize="always" require-scripts="false" hostArchitectures="arm64,x86_64"/>
    <!--
        Both destinations offered, because the difference between them is an
        administrator password prompt.

        A system install writes to /Library/Audio/Plug-Ins and needs that
        password. A home install writes the same payload to
        ~/Library/Audio/Plug-Ins, which both Reaper and Logic already scan, and
        needs no elevation at all. An administrator prompt is a modal system
        dialog, and a modal system dialog is exactly the kind of thing this
        plugin exists to spare people - so it should not be the price of
        installing when there is a route that avoids it.

        The old objection to a home install was that Logic would not see it
        until its Audio Unit cache was rebuilt. That is true, and the
        postinstall script rebuilds that cache on every install, in either
        destination - so it no longer costs anything.

        Anywhere stays off: an install onto a second volume lands somewhere no
        host looks.
    -->
    <domains enable_localSystem="true" enable_anywhere="false" enable_currentUserHome="true"/>
    <installation-check script="checkSystem();"/>
    <script><![CDATA[
        function checkSystem ()
        {
            if (! (system.compareVersions (system.version.ProductVersion, '10.13') >= 0))
            {
                my.result.title   = 'macOS 10.13 or later required';
                my.result.message = 'TG Spaces needs macOS 10.13 High Sierra or '
                                  + 'later. This Mac is running '
                                  + system.version.ProductVersion + '.';
                my.result.type    = 'Fatal';
                return false;
            }
            return true;
        }
    ]]></script>
    <choices-outline>
        <line choice="choice_au"/>
        <line choice="choice_vst3"/>
    </choices-outline>
    <choice id="choice_au" title="Audio Unit, for Logic Pro and GarageBand" description="Installs TG Spaces.component into /Library/Audio/Plug-Ins/Components. This is the format Logic Pro uses. Leave this ticked if you use Logic Pro, Logic Pro X, GarageBand or MainStage.">
        <pkg-ref id="app.tgstudios.spaces.au"/>
    </choice>
    <choice id="choice_vst3" title="VST3, for Reaper and other VST3 hosts" description="Installs TG Spaces.vst3 into /Library/Audio/Plug-Ins/VST3. This is the format Reaper uses. Leave this ticked if you use Reaper, Live, Cubase, Studio One or Bitwig.">
        <pkg-ref id="app.tgstudios.spaces.vst3"/>
    </choice>
    <pkg-ref id="app.tgstudios.spaces.au" version="1.0.0" onConclusion="none" installKBytes="19694" updateKBytes="0">#au.pkg</pkg-ref>
    <pkg-ref id="app.tgstudios.spaces.vst3" version="1.0.0" onConclusion="none" installKBytes="20267" updateKBytes="0">#vst3.pkg</pkg-ref>
    <pkg-ref id="app.tgstudios.spaces.au">
        <bundle-version>
            <bundle CFBundleShortVersionString="1.0.0" CFBundleVersion="1.0.0" id="app.tgstudios.spaces" path="TG Spaces.component"/>
        </bundle-version>
    </pkg-ref>
    <pkg-ref id="app.tgstudios.spaces.vst3">
        <bundle-version>
            <bundle CFBundleShortVersionString="1.0.0" CFBundleVersion="1.0.0" id="app.tgstudios.spaces" path="TG Spaces.vst3"/>
        </bundle-version>
    </pkg-ref>
</installer-gui-script>