[gedit/wip/wininstaller] win32: add scripts to create the new QT based installer
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit/wip/wininstaller] win32: add scripts to create the new QT based installer
- Date: Mon, 28 Jul 2014 14:28:11 +0000 (UTC)
commit 5ee33b0e0430655e748f18404d699f0d11d1bce0
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Mon Jul 28 15:38:44 2014 +0200
win32: add scripts to create the new QT based installer
configure.ac | 1 -
win32/build-installer.sh | 260 --------------------
win32/gedit.iss.in | 60 -----
win32/make-gedit-installer | 131 ++++++++++
win32/make-gedit-installer.bat | 9 +
win32/qt-ifw/config/config.xml | 12 +
.../meta/installscript.js | 31 +++
.../org.gnome.gedit.root.package/meta/package.xml | 9 +
.../org.gnome.gedit.root/meta/installscript.js | 13 +
.../packages/org.gnome.gedit.root/meta/package.xml | 8 +
win32/querymodules.bat | 3 -
11 files changed, 213 insertions(+), 324 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 07230f6..2bd8bd0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -442,7 +442,6 @@ plugins/filebrowser/org.gnome.gedit.plugins.filebrowser.gschema.xml.in
plugins/pythonconsole/org.gnome.gedit.plugins.pythonconsole.gschema.xml.in
plugins/time/org.gnome.gedit.plugins.time.gschema.xml.in
po/Makefile.in
-win32/gedit.iss
osx/Info.plist])
AC_OUTPUT
diff --git a/win32/make-gedit-installer b/win32/make-gedit-installer
new file mode 100644
index 0000000..0ccd780
--- /dev/null
+++ b/win32/make-gedit-installer
@@ -0,0 +1,131 @@
+#!/usr/bin/env bash
+
+_thisdir="$(dirname $0)"
+test "${_thisdir}" = "." && _thisdir=${PWD}
+_ifwroot="${_thisdir}"/qt-ifw
+_arch=$(uname -m)
+_date=$(date +'%Y%m%d')
+_dateqif=$(date +'%Y-%m-%d')
+_version= VERSION@
+_filename=gedit-${_arch}-${_version}.exe
+_log=/tmp/installer.log
+if [ "${_arch}" = "x86_64" ]; then
+ _bitness=64
+else
+ _bitness=32
+fi
+
+declare -a undo_commands
+
+_exitcode=5
+
+usage() {
+ echo "Usage: $0 stage#"
+ exit 1
+}
+
+if [ "$#" != "1" ]; then
+ usage
+fi
+
+_stage="$1"
+case "${_stage}" in
+ stage1 | stage2)
+ ;;
+ *)
+ usage
+ ;;
+esac
+
+exit_with_undo() {
+ for _cmd in ${undo_commands[ ]}; do
+ eval "$_cmd"
+ done
+ exit ${_exitcode}
+}
+
+exit_cleanly() {
+ _exitcode=$1; shift;
+ local _message=$1; shift;
+ echo "${_message}"
+ exit_with_undo
+}
+
+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" "{}" \;
+ 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" "{}" \;
+}
+
+# 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_chroot_system() {
+ [ -d ${_newgedit} ] && rm -rf ${_newgedit}
+ mkdir -p "${_newgedit}"
+ pushd "${_newgedit}" > /dev/null
+
+ mkdir -p var/lib/pacman
+ mkdir -p var/log
+ mkdir -p tmp
+
+ pacman -Syu --root "${_newgedit}"
+ pacman -S filesystem bash pacman --noconfirm --root "${_newgedit}"
+ _result=$?
+ if [ "$_result" -ne "0" ]; then
+ exit_cleanly "1" "failed to create base data via command 'pacman -S filesystem bash pacman --noconfirm
--root ${_newgedit}'"
+ fi
+ popd > /dev/null
+}
+
+install_gedit_packages() {
+ pacman -S mingw-w64-${_arch}-librsvg mingw-w64-${_arch}-gedit mingw-w64-${_arch}-gedit-plugins
mingw-w64-${_arch}-adwaita-icon-theme --noconfirm --root "${_newgedit}"
+ _result=$?
+ if [ "$_result" -ne "0" ]; then
+ exit_cleanly "1" "failed to create newgedit via command 'pacman -S gedit --noconfirm --root
${_newgedit}'"
+ fi
+}
+
+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
+ exit 0
+fi
+
+echo "Installing gedit packages into ${_newgedit}"
+install_gedit_packages
+
+echo "Creating gedit installer /tmp/$_filename"
+[ -f /tmp/$_filename ] && rm -f /tmp/$_filename
+
+do_seds
+make_installer
+exit_cleanly "0" "All done, see ${_filename}"
diff --git a/win32/make-gedit-installer.bat b/win32/make-gedit-installer.bat
new file mode 100644
index 0000000..8638058
--- /dev/null
+++ b/win32/make-gedit-installer.bat
@@ -0,0 +1,9 @@
+C:/msys64/usr/bin/bash.exe -c "./make-gedit-installer stage1"
+if errorlevel 1 (
+exit /b %errorlevel%
+)
+
+C:/msys64/tmp/newgedit/msys64/usr/bin/bash.exe -c "./make-gedit-installer stage2"
+if errorlevel 1 (
+exit /b %errorlevel%
+)
diff --git a/win32/qt-ifw/config/config.xml b/win32/qt-ifw/config/config.xml
new file mode 100644
index 0000000..ef4631a
--- /dev/null
+++ b/win32/qt-ifw/config/config.xml
@@ -0,0 +1,12 @@
+<?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>
+ <StartMenuDir>gedit Text Editor</StartMenuDir>
+ <RunProgram>@TargetDir@/bin/gedit.exe</RunProgram>
+ <RunProgramArguments></RunProgramArguments>
+ <InstallerApplicationIcon>../../pixmaps</InstallerApplicationIcon>
+ <InstallerWindowIcon>../../pixmaps</InstallerWindowIcon>
+</Installer>
diff --git a/win32/qt-ifw/packages/org.gnome.gedit.root.package/meta/installscript.js
b/win32/qt-ifw/packages/org.gnome.gedit.root.package/meta/installscript.js
new file mode 100644
index 0000000..4fe04bd
--- /dev/null
+++ b/win32/qt-ifw/packages/org.gnome.gedit.root.package/meta/installscript.js
@@ -0,0 +1,31 @@
+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 Text Editor",
+ "/A /Q /K " + installer.value("TargetDir") + "\\bin\\gedit.exe");
+}
+
+Component.prototype.createOperations = function()
+{
+ component.createOperations();
+ createShortcuts();
+}
diff --git a/win32/qt-ifw/packages/org.gnome.gedit.root.package/meta/package.xml
b/win32/qt-ifw/packages/org.gnome.gedit.root.package/meta/package.xml
new file mode 100644
index 0000000..7c68e4e
--- /dev/null
+++ b/win32/qt-ifw/packages/org.gnome.gedit.root.package/meta/package.xml
@@ -0,0 +1,9 @@
+<?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>
diff --git a/win32/qt-ifw/packages/org.gnome.gedit.root/meta/installscript.js
b/win32/qt-ifw/packages/org.gnome.gedit.root/meta/installscript.js
new file mode 100644
index 0000000..e26bb5d
--- /dev/null
+++ b/win32/qt-ifw/packages/org.gnome.gedit.root/meta/installscript.js
@@ -0,0 +1,13 @@
+function Component() {
+ var systemDrive = installer.environmentVariable("SystemDrive");
+ // Use C: as a default for messed up systems.
+ if (systemDrive === "") {
+ systemDrive = "C:";
+ }
+ 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, false);
+}
diff --git a/win32/qt-ifw/packages/org.gnome.gedit.root/meta/package.xml
b/win32/qt-ifw/packages/org.gnome.gedit.root/meta/package.xml
new file mode 100644
index 0000000..7a90be9
--- /dev/null
+++ b/win32/qt-ifw/packages/org.gnome.gedit.root/meta/package.xml
@@ -0,0 +1,8 @@
+<?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>
+ <Script>installscript.js</Script>
+</Package>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]