Skip to content

WiX: Port installer generation to Ninja and fix associated issues

amyspark requested to merge amyspark/cerbero:wix-update into main

Hi all,

I've been preparing some test packages here, and I noticed that my box takes way too long time to generate the MSIs (some half hour or so). Upon further research, I realised that in its current inception, the process is done completely serially and monolithically, i.e. single CAB per component/MSM. This prevented even the most basic of optimizations, as the components themselves are completely independent.

This PR reimplements the package generator class to generate a Ninja project. Now, all manifest files will be generated in a temporary directory within the given output folder, along with the requisite build.ninja ruleset. Then, Ninja is called, letting it handle parallelization and output file placement. Finally, the requested artifacts are moved to the final output folder, and the temporary directory is reaped. This change lowers the MSI assembling time to just 4m2s in my box.

Included with this MR are some changes to the original class -- namely, I've ensured we do not shell out to MSYS unnecessarily whenever conducting operations. This accounted for quite a bit of time, with this change I had the compilation time lowered to ~11m. Also, I changed the templates so that WiX is now allowed to shard the cabinets if they surpass 50MB (this change also applies to the Ninja project).

There are some places for improvements that may be addressed at a later date:

  • More structuring in the temporary directory -- src, _builddir instead of tossing MSM, MSI and manifest files in the same folder (the object files do are written to separate folders, as several components use utils.wxs and thus naturally conflict with each other)
  • Fix TMP/TMPDIR to use the real OS's folder (on Windows it targets the MSYS64 temporary folder, which on my box is on an HDD)
    • I implemented this indirectly by running Ninja under a temporary TMP directory, so that WiX's temporary files are clobbered upon return
  • Lower the cabinet sharding threshold if needed, and conduct further profiling about this
  • Update to WiX Toolkit v5 to receive the latest improvements

cc @dabrain34 -- I'm told you could be able to test this on Wine. If so, would you test this, and let me know if there are any issues?

Edited by amyspark

Merge request reports