BitRock Tip: Determination of Architecture + Platform

In BitRock InstallBuilder, defining folders specific to 32-bit and/or 64-bit architectures and Linux and/or Windows is simple but not entirely obvious. Here are some recipes.

Platform + Architecture Detection (for Folders)

The <folder/> construct takes a <platforms/> child, but only with a limited range of values.

Amongst the values are

  • linux — meaning ”any” Linux
  • linux-x64
  • windows — meaning ”any” Windows

but not

  • linux-x86
  • windows-x86
  • windows-x64

However, the <folder/> construct can also accept <ruleList/> which can accept <platformTest/> (see the BitRock knowledge base for the full list of platforms).

Even that does not accept

  • linux-x86

Therefore, it is possible to express the various platforms as follows

Linux x86 and x86-64

<folder name="...">
  <platforms>linux</platforms>
</folder>

Linux x86

<folder name="...">
  <platforms>linux</platforms>
  <ruleList>
    <platformTest type="linux"/>
    <platformTest negate="1" type="linux-x64"/>
  </ruleList>
</folder>

Linux x86-64

<folder name="...">
  <platforms>linux-x64</platforms>
</folder>

Windows x86 and x86-64

<folder name="...">
  <platforms>windows</platforms>
</folder>

Windows x86

<folder name="...">
  <platforms>windows</platforms>
  <ruleList>
    <platformTest type="windows-x86"/>
  </ruleList>
</folder>

Windows x86-64

<folder name="...">
  <platforms>windows</platforms>
  <ruleList>
    <platformTest type="windows-x64"/>
  </ruleList>
</folder>

Architecture Detection (for Folders)

It is possible to combine these to express achitectures as follows.

x86 and x86_64 (Linux or Windows)

<folder name="...">
  <platforms>linux windows</platforms>
</folder>

x86 (Linux or Windows)

<folder name="...">
  <platforms>linux windows</platforms>
  <ruleList>
    <ruleGroup ruleEvaluationLogic="or">
      <ruleList>
        <ruleGroup ruleEvaluationLogic="and">
          <ruleList>
            <platformTest type="linux"/>
            <platformTest negate="1" type="linux-x64"/>
          </ruleList>
        </ruleGroup>
        <ruleGroup ruleEvaluationLogic="and">
          <ruleList>
            <platformTest type="windows-x86"/>
          </ruleList>
        </ruleGroup>
      </ruleList>
    </ruleGroup>
  </ruleList>
</folder>

x86_64 (Linux or Windows)

<folder name="...">
  <platforms>linux windows</platforms>
  <ruleList>
    <ruleGroup ruleEvaluationLogic="or">
      <ruleList>
        <platformTest type="linux-x64"/>
        <platformTest type="windows-x64"/>
      </ruleList>
    </ruleGroup>
  </ruleList>
</folder>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: