How does InstallBuilder know Mac OS X 10.5 (32-bit) vs 10.6 (64-bit)

Comments

1 comment

  • Avatar
    wojciechka

    For detecting version of OSX, you can use <compareVersions> and ${osx_major_version} variable to check the version. For example:

    <compareVersions>
        <logic>greater_or_equal</logic>
        <version1>${osx_major_version}</version1>
        <version2>10.6</version2>
    </compareVersions>
    

    It is also possible to use uname -m command to detect if OSX is running in 32-bit or 64-bit mode. You can first check it at initialization:

    <initializationActionList>
        <setInstallerVariable>
            <name>osx_64bit</name>
            <value>0</value>
        </setInstallerVariable>
        <actionGroup>
            <actionList>
                <runProgram>
                    <program>uname</program>
                    <programArguments>-m</programArguments>
                </runProgram>
                <setInstallerVariable>
                    <name>osx_64bit</name>
                    <value>1</value>
                    <ruleList>
                        <compareText>
                            <logic>contains</logic>
                            <text>${program_stdout}</text>
                            <value>x86_64</value>
                        </compareText>
                    </ruleList>
                </setInstallerVariable>
            </actionList>
            <ruleList>
                <platformTest>
                    <type>osx</type>
                </platformTest>
            </ruleList>
        </actionGroup>
    </initializationActionList>
    

    The ${osx_64bit} variable will now be set to 1 if system is running in 64bit mode. You can then use folder's rules to determine which file(s) will get installed:

    <folder>
        <description>Library 32bit</description>
        <destination>${installdir}</destination>
        <name>library32</name>
        <platforms>osx</platforms>
        <ruleList>
            <isFalse>
                <value>${osx_64bit}</value>
            </isFalse>
        </ruleList>
    </folder>
    <folder>
        <description>Library 64bit</description>
        <destination>${installdir}</destination>
        <name>library64</name>
        <platforms>osx</platforms>
        <ruleList>
            <isTrue>
                <value>${osx_64bit}</value>
            </isTrue>
        </ruleList>
    </folder>
    

Please sign in to leave a comment.