win32: port to WIX to create the installer

parent 1725d075
This diff is collapsed.
<Include>
<?if $(sys.BUILDARCH) = x64 ?>
<?define ProductName = "gedit Text Editor (64 bit)" ?>
<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
<?else ?>
<?define ProductName = "gedit Text Editor" ?>
<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
<?endif ?>
<?define ProductVersion = "@VERSION@"?>
<?define Manufacturer = "GNOME"?>
<?define TopDir = "..\..\"?>
<?define LicenseFile = "$(var.TopDir)\win32\installer\COPYING.rtf"?>
<?define UpgradeCode = "{090D042C-A0F7-A6BD-A4FA-A1783C491F5A}"?>
</Include>
<?xml version="1.0" encoding="UTF-8"?>
<?include .\defines.wxi ?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="$(var.ProductName)" Language="1033" Version="$(var.ProductVersion)" Manufacturer="$(var.Manufacturer)" UpgradeCode="$(var.UpgradeCode)">
<Package Id="*" Description="$(var.ProductName)" Comments="Contact: your local administrator" InstallerVersion="405" Compressed="yes" Keywords="TEXT,EDITOR,GNOME" Languages="1033" Manufacturer="$(var.Manufacturer)" InstallScope="perMachine"/>
<Icon Id="icon.ico" SourceFile="$(var.TopDir)\gedit\resources\pixmaps\gedit.ico"/>
<Property Id="ARPPRODUCTICON" Value="icon.ico" />
<Media Id="1" Cabinet="data.cab" EmbedCab="yes" />
<!-- Features -->
<Feature Id="gedit" Title="gedit" Level="1">
<ComponentGroupRef Id="binaries" />
<ComponentGroupRef Id="startMenuShortcuts" />
<ComponentGroupRef Id="licenseFiles" />
</Feature>
<!-- UI -->
<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
<WixVariable Id="WixUILicenseRtf" Value="$(var.LicenseFile)" />
<Condition Message="[ProductName] requires that your computer is running at least Windows 7">VersionNT&gt;=601</Condition>
<UI>
<UIRef Id="WixUI_InstallDir" />
</UI>
<!-- Installer actions -->
<CustomAction Id="SetCompileSchemasCommand" Property="CompileSchemas" Value="&quot;[INSTALLDIR]\bin\glib-compile-schemas.exe&quot; &quot;[INSTALLDIR]\share\glib-2.0\schemas&quot;"/>
<CustomAction Id="CompileSchemas" BinaryKey="WixCA" DllEntry="CAQuietExec" Return="ignore" Execute="deferred" Impersonate="no" />
<CustomAction Id="SetUpdateIconCacheCommand" Property="UpdateIconCache" Value="&quot;[INSTALLDIR]\bin\gtk-update-icon-cache-3.0.exe&quot; &quot;[INSTALLDIR]\share\icons\hicolor&quot;"/>
<CustomAction Id="UpdateIconCache" BinaryKey="WixCA" DllEntry="CAQuietExec" Return="ignore" Execute="deferred" Impersonate="no" />
<InstallExecuteSequence>
<RemoveExistingProducts Before="InstallInitialize" />
<Custom Action="SetCompileSchemasCommand" After="InstallFiles" />
<Custom Action="CompileSchemas" After="SetCompileSchemasCommand" />
<Custom Action="SetUpdateIconCacheCommand" After="CompileSchemas" />
<Custom Action="UpdateIconCache" After="SetUpdateIconCacheCommand" />
</InstallExecuteSequence>
</Product>
<!-- Directory Tree -->
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="$(var.PlatformProgramFilesFolder)" Name="$(var.PlatformProgramFilesFolder)">
<Directory Name="gedit" Id="gedit_dir">
<Directory Id="INSTALLDIR">
<Directory Name="license" Id="gedit_license" />
</Directory>
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="ProgramMenuDir" Name="gedit Text Editor" />
</Directory>
</Directory>
</Fragment>
<!-- Components -->
<Fragment>
<ComponentGroup Id="startMenuShortcuts">
<Component Id="programShortcuts" Guid="{A071C7AE-C657-4FAD-B0CC-11A6D794D0D3}" Directory="ProgramMenuDir">
<RegistryValue Key="Software\[Manufacturer]\[ProductName]" Root="HKCU" Type="string" Value="[INSTALLDIR]" Name="InstallPath" />
<Shortcut Id="geditExec" Name="gedit Text Editor" Description="gedit Text Editor" Target="[INSTALLDIR]\bin\gedit.exe" />
<Shortcut Id="uninstallProduct" Name="Uninstall gedit Text Editor" Arguments="/x [ProductCode]" Description="Uninstall gedit Text Editor" Target="[System64Folder]msiexec.exe" />
<RemoveFolder Id="ProgramMenuDir" On="uninstall" />
</Component>
</ComponentGroup>
<ComponentGroup Id="licenseFiles" Directory="gedit_license">
<Component Id="COPYING.rtf" Guid="*">
<File Id="COPYING.rtf" Name="COPYING.rtf" Source="$(var.LicenseFile)" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
#!/usr/bin/env bash
_wixdir="/c/Program Files (x86)/WiX Toolset v3.8"
_thisdir="$(dirname $0)"
test "${_thisdir}" = "." && _thisdir=${PWD}
_ifwroot="${_thisdir}"/qt-ifw
_installer_root="${_thisdir}"/installer
_arch=$(uname -m)
_date=$(date +'%Y%m%d')
_dateqif=$(date +'%Y-%m-%d')
_version=@VERSION@
_filename=gedit-${_arch}-${_version}.exe
_filename=gedit-${_arch}-${_version}.msi
_log=/tmp/installer.log
if [ "${_arch}" = "x86_64" ]; then
_bitness=64
......@@ -52,93 +53,84 @@ exit_cleanly() {
}
do_seds() {
find "${_ifwroot}" \( -name "package.xml" -or -name "config.xml" \) -exec sed -i "s|@DATE@|${_dateqif}|g" "{}" \;
find "${_ifwroot}" \( -name "package.xml" -or -name "config.xml" \) -exec sed -i "s|@VERSION@|${_version}|g" "{}" \;
find "${_installer_root}" \( -name "defines.wxi" \) -exec sed -i "s|@VERSION@|${_version}|g" "{}" \;
undo_commands+=("undo_seds")
}
undo_seds() {
find "${_ifwroot}" \( -name "package.xml" -or -name "config.xml" \) -exec sed -i "s|<ReleaseDate>${_dateqif}<|<ReleaseDate>@DATE@<|g" "{}" \;
find "${_ifwroot}" \( -name "package.xml" -or -name "config.xml" \) -exec sed -i "s|<Version>${_version}<|<Version>@VERSION@<|g" "{}" \;
find "${_installer_root}" \( -name "defines.wxi" \) -exec sed -i "s|ProductVersion = \"${_version}\"|ProductVersion = \"@VERSION@\"|g" "{}" \;
}
# Add -v to get more information.
make_installer() {
"${_binarycreator}" \
-t "${_installerbase}" \
-p "${_ifwroot}/packages" \
-c "${_ifwroot}/config/config.xml" \
--offline-only \
"${_filename}" \
-v
}
trap exit_with_undo 1 2 15
_archivegen=/mingw${_bitness}/bin/archivegen.exe
_binarycreator=/mingw${_bitness}/bin/binarycreator.exe
_installerbase=/mingw${_bitness}/bin/installerbase.exe
_newgedit=/tmp/gedit
create_archive() {
local _data="${_ifwroot}"/packages/org.gnome.gedit.root.package/data
[ -d "${_data}" ] && rm -rf "${_data}"
remove_useless_stuff() {
# remove .a files not needed for the installer
find ${_newgedit} -name "*.a" -exec rm -f {} \;
find installer/SourceDir -name "*.a" -exec rm -f {} \;
# remove unneeded binaries
find ${_newgedit}/mingw${_bitness} -not -name "g*.exe" -name "*.exe" -exec rm -f {} \;
rm -rf ${_newgedit}/mingw${_bitness}/bin/py*
rm -rf ${_newgedit}/mingw${_bitness}/bin/*-config
find installer/SourceDir -not -name "g*.exe" -name "*.exe" -exec rm -f {} \;
rm -rf installer/SourceDir/bin/gtk3-demo*.exe
rm -rf installer/SourceDir/bin/gdbm*.exe
rm -rf installer/SourceDir/bin/py*
rm -rf installer/SourceDir/bin/*-config
# remove other useless folders
rm -rf ${_newgedit}/mingw${_bitness}/share/man
rm -rf ${_newgedit}/mingw${_bitness}/share/readline
rm -rf ${_newgedit}/mingw${_bitness}/share/info
rm -rf ${_newgedit}/mingw${_bitness}/share/aclocal
rm -rf ${_newgedit}/mingw${_bitness}/share/gnome-common
rm -rf ${_newgedit}/mingw${_bitness}/share/glade
rm -rf ${_newgedit}/mingw${_bitness}/share/gettext
rm -rf ${_newgedit}/mingw${_bitness}/share/terminfo
rm -rf ${_newgedit}/mingw${_bitness}/share/tabset
rm -rf ${_newgedit}/mingw${_bitness}/share/pkgconfig
rm -rf ${_newgedit}/mingw${_bitness}/share/bash-completion
rm -rf ${_newgedit}/mingw${_bitness}/share/appdata
rm -rf ${_newgedit}/mingw${_bitness}/share/gdb
rm -rf installer/SourceDir/var
rm -rf installer/SourceDir/ssl
rm -rf installer/SourceDir/include
rm -rf installer/SourceDir/share/man
rm -rf installer/SourceDir/share/readline
rm -rf installer/SourceDir/share/info
rm -rf installer/SourceDir/share/aclocal
rm -rf installer/SourceDir/share/gnome-common
rm -rf installer/SourceDir/share/glade
rm -rf installer/SourceDir/share/gettext
rm -rf installer/SourceDir/share/terminfo
rm -rf installer/SourceDir/share/tabset
rm -rf installer/SourceDir/share/pkgconfig
rm -rf installer/SourceDir/share/bash-completion
rm -rf installer/SourceDir/share/appdata
rm -rf installer/SourceDir/share/gdb
# on windows we show the online help
rm -rf ${_newgedit}/mingw${_bitness}/share/help
rm -rf ${_newgedit}/mingw${_bitness}/share/gtk-doc
rm -rf ${_newgedit}/mingw${_bitness}/share/doc
rm -rf installer/SourceDir/share/help
rm -rf installer/SourceDir/share/gtk-doc
rm -rf installer/SourceDir/share/doc
# remove on the lib folder
rm -rf ${_newgedit}/mingw${_bitness}/lib/terminfo
rm -rf ${_newgedit}/mingw${_bitness}/lib/python2*
rm -rf ${_newgedit}/mingw${_bitness}/lib/pkgconfig
rm -rf ${_newgedit}/mingw${_bitness}/lib/peas-demo
mkdir -p "${_data}"
_dirs=
for curr_dir in /bin /etc /lib /share; do
if [[ -d ${_newgedit}/mingw${_bitness}/$curr_dir || -f ${_newgedit}/mingw${_bitness}/$curr_dir ]]; then
_dirs="${_dirs} ${_newgedit}/mingw${_bitness}/$curr_dir"
fi
done
rm -rf installer/SourceDir/lib/terminfo
rm -rf installer/SourceDir/lib/python2*
rm -rf installer/SourceDir/lib/pkgconfig
rm -rf installer/SourceDir/lib/peas-demo
# strip the binaries to reduce the size
find installer/SourceDir -name *.dll | xargs strip
find installer/SourceDir -name *.exe | xargs strip
# remove some translation which seem to add a lot of size
find installer/SourceDir/share/locale/ -type f | grep -v atk10.mo | grep -v gtk30.mo | grep -v libpeas.mo | grep -v gsettings-desktop-schemas.mo | grep -v json-glib-1.0.mo | grep -v glib20.mo | grep -v gedit.mo | grep -v gedit-plugins.mo | grep -v gdk-pixbuf.mo | grep -v gtk30.mo | grep -v gtk30-properties.mo | grep -v gtksourceview-3.0.mo | grep -v iso_*.mo | xargs rm
find installer/SourceDir/share/locale -type d | xargs rmdir -p --ignore-fail-on-non-empty
}
setup_source_dir() {
cp -R "${_newgedit}/mingw${_bitness}" "installer/SourceDir"
remove_useless_stuff
}
if [ -n "$_dirs" ]; then
_compress_cmd="${_archivegen} ${_data}/gedit.7z ${_dirs}"
pushd / > /dev/null
eval ${_compress_cmd} | tee $_log 2>&1
_result=$?
if [ "$_result" -eq "0" ]; then
echo " archivegen succeeded. Created ${_data}/gedit.7z"
else
exit_cleanly "3" "archivegen failed. See $_log"
fi
popd > /dev/null
# Add -v to get more information.
make_installer() {
setup_source_dir
_platform="x86"
if [ "${_arch}" = "x86_64" ]; then
_platform="x64"
fi
# copy the license
cp ../COPYING "${_ifwroot}"/packages/org.gnome.gedit.root/meta/gpl2.txt
pushd "installer" > /dev/null
"${_wixdir}/bin/heat.exe" dir SourceDir -gg -dr INSTALLDIR -cg binaries -sfrag -sreg -srd -suid -template fragment -out binaries.wxs
"${_wixdir}/bin/candle.exe" -arch ${_platform} gedit.wxs binaries.wxs
"${_wixdir}/bin/light.exe" -ext WixUtilExtension -ext WixUIExtension gedit.wixobj binaries.wixobj -o "/tmp/${_filename}"
popd
}
trap exit_with_undo 1 2 15
create_chroot_system() {
[ -d ${_newgedit} ] && rm -rf ${_newgedit}
mkdir -p "${_newgedit}"
......@@ -169,14 +161,6 @@ install_gedit_packages() {
pacman -Rdd mingw-w64-${_arch}-gtk2 --noconfirm --root "${_newgedit}"
}
if [ ! -f "${_archivegen}" ]; then
eval "pacman -S --noconfirm mingw${_bitness}/mingw-w64-${_arch}-qt-installer-framework-git" | tee $_log 2>&1
fi
if [ ! -f "${_archivegen}" ]; then
exit_cleanly "2" "installation of qt installer framework failed. See $_log"
fi
if [ "${_stage}" = "stage1" ]; then
echo "Creating gedit chroot system ${_newgedit}"
create_chroot_system
......@@ -190,6 +174,5 @@ echo "Creating gedit installer /tmp/$_filename"
[ -f /tmp/$_filename ] && rm -f /tmp/$_filename
do_seds
create_archive
make_installer
exit_cleanly "0" "All done, see ${_filename}"
<?xml version="1.0" encoding="UTF-8"?>
<Installer>
<Name>gedit Text Editor</Name>
<Version>@VERSION@</Version>
<Title>gedit Text Editor</Title>
<Publisher>The gedit Developers</Publisher>
<ProductUrl>http://www.gedit.org</ProductUrl>
<Logo>../../../pixmaps/gedit-logo.png</Logo>
<StartMenuDir>gedit Text Editor</StartMenuDir>
<RunProgram>@TargetDir@/bin/gedit.exe</RunProgram>
<RunProgramArguments></RunProgramArguments>
<InstallerApplicationIcon>../../../gedit/resources/pixmaps/gedit.ico</InstallerApplicationIcon>
<InstallerWindowIcon>../../../gedit/resources/pixmaps/gedit.ico</InstallerWindowIcon>
</Installer>
function Component()
{
// constructor
}
Component.prototype.isDefault = function()
{
// select the component by default
return true;
}
function createShortcuts()
{
var windir = installer.environmentVariable("WINDIR");
if (windir === "") {
QMessageBox["warning"]( "Error" , "Error", "Could not find windows installation directory");
return;
}
var cmdLocation = windir + "\\system32\\cmd.exe";
component.addOperation("CreateShortcut",
cmdLocation,
"@StartMenuDir@/gedit.exe",
"/A /Q /K " + installer.value("TargetDir") + "\\bin\\gedit.exe");
component.addOperation("Execute",
["@TargetDir@\\bin\\gdk-pixbuf-query-loaders.exe",
"--update-cache"]);
component.addOperation("Execute",
["@TargetDir@\\bin\\glib-compile-schemas.exe",
"@TargetDir@\\share\\glib-2.0\\schemas"]);
}
Component.prototype.createOperations = function()
{
component.createOperations();
createShortcuts();
}
<?xml version="1.0"?>
<Package>
<DisplayName>gedit Text Editor package</DisplayName>
<Description>gedit is the official text editor of the GNOME desktop environment</Description>
<Version>@VERSION@</Version>
<ReleaseDate>@DATE@</ReleaseDate>
<Default>true</Default>
<Script>installscript.js</Script>
</Package>
function Component() {
installer.setValue("TargetDir", installer.value("ApplicationsDir") + "\\gedit");
installer.setDefaultPageVisible(QInstaller.Introduction, false);
installer.setDefaultPageVisible(QInstaller.TargetDirectory, true);
installer.setDefaultPageVisible(QInstaller.ComponentSelection, false);
installer.setDefaultPageVisible(QInstaller.ReadyForInstallation, false);
installer.setDefaultPageVisible(QInstaller.StartMenuSelection, true);
installer.setDefaultPageVisible(QInstaller.LicenseCheck, true);
}
<?xml version="1.0"?>
<Package>
<DisplayName>gedit Text Editor</DisplayName>
<Description>gedit is the official text editor of the GNOME desktop environment</Description>
<Version>@VERSION@</Version>
<ReleaseDate>@DATE@</ReleaseDate>
<Licenses>
<License name="GNU GENERAL PUBLIC LICENSE Version 2" file="gpl2.txt" />
</Licenses>
<Script>installscript.js</Script>
</Package>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment