Step One: Directory Structure
Place all msm files into wix directory. And then create one build.wxs file.
├── tauri.conf.json
└── wix
├── base-system-1.0-msvc-x86_64-1.22.5.msm
├── build.wxs
├── gstreamer-1.0-codecs-msvc-x86_64-1.22.5.msm
├── gstreamer-1.0-core-msvc-x86_64-1.22.5.msm
├── gstreamer-1.0-devtools-msvc-x86_64-1.22.5.msm
├── gstreamer-1.0-editing-msvc-x86_64-1.22.5.msm
├── gstreamer-1.0-effects-msvc-x86_64-1.22.5.msm
├── gstreamer-1.0-encoding-msvc-x86_64-1.22.5.msm
├── gstreamer-1.0-net-msvc-x86_64-1.22.5.msm
├── gstreamer-1.0-playback-msvc-x86_64-1.22.5.msm
└── gstreamer-1.0-system-msvc-x86_64-1.22.5.msm
Step Two: build.wxs File Content
The gstreamer runtime will be installed under TARGETDIR/gstreamer/ directory. Add bin path to system environment variable make sure the App can find gstreamer libs.
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<DirectoryRef Id="TARGETDIR">
<Directory Id="GstreamerFolder" Name="gstreamer">
<Directory Id="BaseSystemFolder">
<Merge Id="BaseSystem" SourceFile="../../../../wix/base-system-1.0-msvc-x86_64-1.22.5.msm" DiskId="1" Language="1033"/>
</Directory>
<Directory Id="EditingFolder">
<Merge Id="Editing" SourceFile="../../../../wix/gstreamer-1.0-editing-msvc-x86_64-1.22.5.msm" DiskId="1" Language="1033"/>
</Directory>
<Directory Id="SystemFolder">
<Merge Id="System" SourceFile="../../../../wix/gstreamer-1.0-system-msvc-x86_64-1.22.5.msm" DiskId="1" Language="1033"/>
</Directory>
<Directory Id="CoreFolder">
<Merge Id="Core" SourceFile="../../../../wix/gstreamer-1.0-core-msvc-x86_64-1.22.5.msm" DiskId="1" Language="1033"/>
</Directory>
<Directory Id="DevtoolsFolder">
<Merge Id="Devtools" SourceFile="../../../../wix/gstreamer-1.0-devtools-msvc-x86_64-1.22.5.msm" DiskId="1" Language="1033"/>
</Directory>
<Directory Id="CodecsFolder">
<Merge Id="Codecs" SourceFile="../../../../wix/gstreamer-1.0-codecs-msvc-x86_64-1.22.5.msm" DiskId="1" Language="1033"/>
</Directory>
<Directory Id="EncodingFolder">
<Merge Id="Encoding" SourceFile="../../../../wix/gstreamer-1.0-encoding-msvc-x86_64-1.22.5.msm" DiskId="1" Language="1033"/>
</Directory>
<Directory Id="EffectsFolder">
<Merge Id="Effects" SourceFile="../../../../wix/gstreamer-1.0-effects-msvc-x86_64-1.22.5.msm" DiskId="1" Language="1033"/>
</Directory>
<Directory Id="NetFolder">
<Merge Id="Net" SourceFile="../../../../wix/gstreamer-1.0-net-msvc-x86_64-1.22.5.msm" DiskId="1" Language="1033"/>
</Directory>
<Directory Id="PlaybackFolder">
<Merge Id="Playback" SourceFile="../../../../wix/gstreamer-1.0-playback-msvc-x86_64-1.22.5.msm" DiskId="1" Language="1033"/>
</Directory>
</Directory>
<!-- Add to System Environment Variable -->
<Component Id="EnvironmentComponent" Guid="d0b40f4a-7e94-471c-b434-30ad0a69a47c">
<Environment
Id="PATH"
Name="PATH"
Value="[TARGETDIR]gstreamer\bin\"
Permanent="no"
Part="last"
Action="set"
System="yes" />
</Component>
</DirectoryRef>
<Feature Id="FeatureGroup1" Title="Gstreamer" Description="Gstreamer Runtime" Display="hidden" InstallDefault="local">
<MergeRef Id="BaseSystem"/>
<MergeRef Id="Core"/>
<MergeRef Id="System"/>
<MergeRef Id="Codecs"/>
<MergeRef Id="Encoding"/>
<MergeRef Id="Editing"/>
<MergeRef Id="Devtools"/>
<MergeRef Id="Effects"/>
<MergeRef Id="Net"/>
<MergeRef Id="Playback"/>
</Feature>
</Fragment>
</Wix>
Step Three: Modify tauri.conf.json
Let Tauri know where to build our build.wxs script.
{
"tauri": {
"bundle": {
// Only use wix to pack our app
"targets": ["msi"],
// Wix setting
"windows": {
"wix": {
"fragmentPaths": ["wix\\build.wxs"],
"componentRefs": ["EnvironmentComponent"],
"featureRefs": ["FeatureGroup1"]
}
}
}
}
}
Last Step: Resolving File Conflicts when Using Multiple Merge Modules
If you pack most of gstreamer merge modules in your App, you may meet ICE30 error.
ICE30: The target file '...' is installed in '...' by two different components on an LFN system: ... This breaks component reference counting.
This is because one or more merge modules contain same file but with different component id. The file _ca_certificatescrt.0C91CD49_7DD2_4B48_AA7A_3F71D17C09B4 is one of the duplicate files.
Use tools of WiX Toolset can solve the problem. Manual add WiX Toolset path to System Environment Variable, then you can use these tools in anywhere.
# Extract playback wxs file
> dark gstreamer-1.0-playback-msvc-x86_64-1.22.5.msm
# Unpack playback merge modules file to playback folder. The folder name must be same with merge modules name. playback is the merge modules name in this case.
> dark gstreamer-1.0-playback-msvc-x86_64-1.22.5.msm -x playback
Then, modify the gstreamer-1.0-playback-msvc-x86_64-1.22.5.wxs file, and delete the duplicate file component. Finally, we use the tools to pack merge modules.
# wxs file to wixobj file
> candle -arch x64 gstreamer-1.0-playback-msvc-x86_64-1.22.5.wxs
# wixobj file to mem file
> light gstreamer-1.0-playback-msvc-x86_64-1.22.5.wixobj
You may do the same operation on other merge modules. The ICE30 error will tell you which file is duplicate. Or you can just ask me for these modified merge modules, version 1.22.5 only.