Produce a basic Windows installer package
We're very early adopters of msitools' new UI feature, so this doesn't work on MSYS2 directly yet due to an old version.
This commit is contained in:
parent
19913a5e48
commit
089c90004b
@ -65,14 +65,15 @@ Windows
|
||||
~~~~~~~
|
||||
'fiv' can be cross-compiled for Windows, provided that you install a bunch of
|
||||
dependencies listed at the beginning of 'msys2-configure.sh',
|
||||
plus rsvg-convert from librsvg2, and icotool from icoutils.
|
||||
plus rsvg-convert from librsvg2, icotool from icoutils, and msitools ≥ 0.102.
|
||||
Beware that the build will take up about a gigabyte of disk space.
|
||||
|
||||
$ sh -e msys2-configure.sh builddir
|
||||
$ meson install -C builddir
|
||||
|
||||
If everything succeeds, you will find a portable build of the application
|
||||
in the 'builddir/package' subdirectory. No installer is provided yet.
|
||||
in the 'builddir/package' subdirectory, and a very basic MSI installation
|
||||
package in 'builddir'.
|
||||
|
||||
Faster colour management
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
69
fiv.wxs.in
Normal file
69
fiv.wxs.in
Normal file
@ -0,0 +1,69 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
|
||||
<?define FullName = "@ProjectName@ @ProjectVersion@" ?>
|
||||
<?if $(sys.BUILDARCH) = x64 ?>
|
||||
<?define ProgramFilesFolder = "ProgramFiles64Folder" ?>
|
||||
<?else?>
|
||||
<?define ProgramFilesFolder = "ProgramFilesFolder" ?>
|
||||
<?endif?>
|
||||
|
||||
<Product Id='*'
|
||||
Name='$(var.FullName)'
|
||||
UpgradeCode='a3e64e2d-4310-4c5f-8562-bb0e0b3e0a53'
|
||||
Language='1033'
|
||||
Codepage='1252'
|
||||
Version='@ProjectVersion@'
|
||||
Manufacturer='Premysl Eric Janouch'>
|
||||
|
||||
<Package Id='*'
|
||||
Keywords='Installer,Image,Viewer'
|
||||
Description='$(var.FullName) Installer'
|
||||
Manufacturer='Premysl Eric Janouch'
|
||||
InstallerVersion='200'
|
||||
Compressed='yes'
|
||||
Languages='1033'
|
||||
SummaryCodepage='1252' />
|
||||
|
||||
<Media Id='1' Cabinet='data.cab' EmbedCab='yes' />
|
||||
<Icon Id='fiv.ico' SourceFile='fiv.ico' />
|
||||
<Property Id='ARPPRODUCTICON' Value='fiv.ico' />
|
||||
<Property Id='ARPURLINFOABOUT' Value='https://git.janouch.name/p/fiv' />
|
||||
|
||||
<UIRef Id='WixUI_Minimal' />
|
||||
<!-- This isn't supported by msitools, but is necessary for WiX.
|
||||
<WixVariable Id='WixUILicenseRtf' Value='License.rtf' />
|
||||
-->
|
||||
|
||||
<Directory Id='TARGETDIR' Name='SourceDir'>
|
||||
<Directory Id='$(var.ProgramFilesFolder)' Name='Files'>
|
||||
<Directory Id='INSTALLDIR' Name='$(var.FullName)' />
|
||||
</Directory>
|
||||
|
||||
<Directory Id='ProgramMenuFolder' Name='Programs'>
|
||||
<Directory Id='ProgramMenuDir' Name='$(var.FullName)'>
|
||||
<Component Id='ProgramMenuDir' Guid='*'>
|
||||
<Shortcut Id='ProgramsMenuShortcut'
|
||||
Name='@ProjectName@'
|
||||
Target='[INSTALLDIR]\fiv.exe'
|
||||
WorkingDirectory='INSTALLDIR'
|
||||
Arguments='"%USERPROFILE%"'
|
||||
Icon='fiv.ico' />
|
||||
<RemoveFolder Id='ProgramMenuDir' On='uninstall' />
|
||||
<RegistryValue Root='HKCU'
|
||||
Key='Software\[Manufacturer]\[ProductName]'
|
||||
Type='string'
|
||||
Value=''
|
||||
KeyPath='yes' />
|
||||
</Component>
|
||||
</Directory>
|
||||
</Directory>
|
||||
|
||||
<Directory Id='DesktopFolder' Name='Desktop' />
|
||||
</Directory>
|
||||
|
||||
<Feature Id='Complete' Level='1'>
|
||||
<ComponentGroupRef Id='CG.fiv' />
|
||||
<ComponentRef Id='ProgramMenuDir' />
|
||||
</Feature>
|
||||
</Product>
|
||||
</Wix>
|
13
meson.build
13
meson.build
@ -338,6 +338,19 @@ elif meson.is_cross_build()
|
||||
msys2_root = meson.get_external_property('msys2_root')
|
||||
meson.add_install_script('msys2-install.sh', msys2_root)
|
||||
|
||||
# TODO: If we used DESTDIR instead of the prefix, this could probably
|
||||
# be a custom target that invokes "meson install --destdir $(pwd)/package"
|
||||
# through "meson compile -C builddir msi". Try it out, also in MSYS2.
|
||||
meson.add_install_script('msys2-package.sh', host_machine.cpu())
|
||||
configure_file(
|
||||
input : 'fiv.wxs.in',
|
||||
output : 'fiv.wxs',
|
||||
configuration : configuration_data({
|
||||
'ProjectName' : meson.project_name(),
|
||||
'ProjectVersion' : meson.project_version(),
|
||||
}),
|
||||
)
|
||||
|
||||
# This is the minimum to run targets from msys2-configure.sh builds.
|
||||
meson.add_devenv({
|
||||
'WINEPATH' : msys2_root / 'bin',
|
||||
|
@ -19,7 +19,7 @@ then
|
||||
wine64() { "$@"; }
|
||||
awk() { command awk -v RS='\r?\n' "$@"; }
|
||||
pacman -S --needed libarchive $pkg-ca-certificates $pkg-gcc $pkg-icoutils \
|
||||
$pkg-librsvg $pkg-meson $pkg-pkgconf
|
||||
$pkg-librsvg $pkg-meson $pkg-msitools $pkg-pkgconf
|
||||
fi
|
||||
|
||||
status() {
|
||||
|
30
msys2-package.sh
Executable file
30
msys2-package.sh
Executable file
@ -0,0 +1,30 @@
|
||||
#!/bin/sh -e
|
||||
export LC_ALL=C.UTF-8
|
||||
cd "$MESON_BUILD_ROOT"
|
||||
|
||||
txt2rtf() {
|
||||
iconv -f utf-8 -t ascii//translit "$@" | awk 'BEGIN {
|
||||
print "{\\rtf1\\ansi\\ansicpg1252\\deff0{\\fonttbl{\\f0 Tahoma;}}"
|
||||
print "\\f0\\fs24{\\pard\\sa240"
|
||||
} {
|
||||
gsub(/\\/, "\\\\"); gsub(/{/, "\\{"); gsub(/}/, "\\}")
|
||||
if (!$0) { print "\\par}{\\pard\\sa240"; prefix = "" }
|
||||
else { print prefix $0; prefix = " " }
|
||||
} END {
|
||||
print "\\par}}"
|
||||
}'
|
||||
}
|
||||
|
||||
# We're being passed host_machine.cpu(), which will be either x86 or x86_64.
|
||||
[ "$1" = "x86" ] && arch=x86 || arch=x64
|
||||
|
||||
wxs=fiv.wxs files=fiv-files.wxs msi=fiv.msi
|
||||
|
||||
txt2rtf "$MESON_SOURCE_ROOT/LICENSE" > License.rtf
|
||||
find "$MESON_INSTALL_DESTDIR_PREFIX" -type f \
|
||||
| wixl-heat --prefix "$MESON_INSTALL_DESTDIR_PREFIX/" \
|
||||
--directory-ref INSTALLDIR --component-group CG.fiv \
|
||||
--var var.SourceDir > "$files"
|
||||
|
||||
wixl --verbose --arch "$arch" -D SourceDir="$MESON_INSTALL_DESTDIR_PREFIX" \
|
||||
--ext ui --output "$msi" "$wxs" "$files"
|
Loading…
Reference in New Issue
Block a user