Skip to content

Instantly share code, notes, and snippets.

@ivucica
Created June 16, 2021 18:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivucica/c1893db015f4347659b96eb55b8c97c2 to your computer and use it in GitHub Desktop.
Save ivucica/c1893db015f4347659b96eb55b8c97c2 to your computer and use it in GitHub Desktop.
GNOME msitools with GUI

msitools with GUI

As of June 2021, this is only available as a work-in-progress pull request on GNOME msitools's GitLab.

(Done by @brendonj, who might be the same @brendonj as on Github.)

Here are my notes, so I don't forget how to build it. It would be really cool to migrate GNUstep's installers to MSI, and to build the Windows MinGW binaries as part of the release process.

Install dependencies

apt install libgirepository1.0-dev \
libgcab-dev \
libgsf-1-dev \
bison \
valac \
meson

Get the code

Clone the main repo:

git clone https://gitlab.gnome.org/GNOME/msitools
cd msitools

Patch in the pull request:

git fetch "https://gitlab.gnome.org/brendonj/msitools.git" wixl-minimal-ui
git checkout -b "brendonj/msitools-wixl-minimal-ui" FETCH_HEAD

Fetch dependencies:

git submodule init
git submodule update

Build the code

mkdir build
cd build
meson ..
ninja

Create the directory tree

In the msitools git root, create subdir _example.

cat .git/config # confirm you're in the correct place
mkdir _example
cd _example

Store this as sample.wxs:

<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
  <Product Name='Foobar 1.0' Id='ABCDDCBA-86C7-4D14-AEC0-86416A69ABDE' UpgradeCode='ABCDDCBA-7349-453F-94F6-BCB5110BA4FD'
    Language='1033' Codepage='1252' Version='1.0.0' Manufacturer='Acme Ltd.'>

    <Package Id='*' Keywords='Installer' Description="Acme's Foobar 1.0 Installer"
      Comments='Foobar is a registered trademark of Acme Ltd.' Manufacturer='Acme Ltd.'
      InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' />

    <Media Id='1' Cabinet='Sample.cab' EmbedCab='yes' DiskPrompt="CD-ROM #1" />
    <Property Id='DiskPrompt' Value="Acme's Foobar 1.0 Installation [1]" />

    <Directory Id='TARGETDIR' Name='SourceDir'>
      <Directory Id='ProgramFilesFolder' Name='PFiles'>
        <Directory Id='Acme' Name='Acme'>
          <Directory Id='INSTALLDIR' Name='Foobar 1.0'>

            <Component Id='MainExecutable' Guid='ABCDDCBA-83F1-4F22-985B-FDB3C8ABD471'>
              <File Id='FoobarEXE' Name='FoobarAppl10.exe' DiskId='1' Source='FoobarAppl10.exe' KeyPath='yes'/>
            </Component>

          </Directory>
        </Directory>
      </Directory>
    </Directory>

    <Feature Id='Complete' Level='1' Display='expand' ConfigurableDirectory='INSTALLDIR' AllowAdvertise='yes' InstallDefault='local'>
      <ComponentRef Id='MainExecutable' />
    </Feature>

    <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
    <UIRef Id="WixUI_Minimal" />

  </Product>
</Wix>

(The above is derived from the gnome.org Wiki's "How to Create MSI" doc, and the firegiant.com wix tutorial for UI.)

Touch the required files:

touch FoobarAppl10.exe
touch License.rtf

Expose ui subdir via a symlink:

ln -s ../data/ext/ui ui

Build the MSI

Because we never installed this, update your PATH to include the built binaries:

PATH="${PATH}":"${PWD}"/../build/tools/wixl:"${PWD}"/../build/tools

Build away:

wixl -v --ext ui sample.wxs

The --ext argument is different than WiX light's -ext. It also accepts only the enum values listed in Vala source code in tools/wixl/builder.vala in the definition of enum Extension; this is currently only UI which needs to be spelled lowercase in the CLI.

Testing

apt install wine
msiexec /i sample.msi

To get some logs in ~/.wine/drive_c/package.log:

msiexec /i sample.msi /L'*' 'C:\package.log'
@ivucica
Copy link
Author

ivucica commented Jun 16, 2021

cc @brendonj

I've just put these notes together for my own use. I'll mention this on the issue and PR on GNOME Gitlab.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment