[gimp-help/wip/Jehan/ci-2-10-split: 7/8] build: add CI scripts to build a Windows installer for documentation.




commit 0895991a852e704d505656ba7cf5001c3ae36b2d
Author: Jehan <jehan girinstud io>
Date:   Fri Mar 18 20:53:20 2022 +0100

    build: add CI scripts to build a Windows installer for documentation.
    
    The installation script takes most of its code (for installation of
    Unofficial lang files, etc.) from the CI script for GIMP installer.

 .gitlab-ci.yml                                     | 22 +++++++-
 .../windows/installer/installer-gimp-help-msys2.sh | 66 ++++++++++++++++++++++
 2 files changed, 87 insertions(+), 1 deletion(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index fcfd4c5fe..48f72d743 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -3,6 +3,7 @@ image: debian:testing
 stages:
   - prepare
   - build
+  - www
   - distribution
 
 variables:
@@ -75,7 +76,7 @@ build-debian-4:
     PDF_DIR: "_pdf4"
 
 www-debian:
-  stage: distribution
+  stage: www
   image: $CI_REGISTRY_IMAGE:build-debian-latest
   dependencies:
     - build-debian-1
@@ -104,3 +105,22 @@ www-debian:
     - mv _html2/* htdocs/2.10/
     - mv _html3/* htdocs/2.10/
     - mv _html4/* htdocs/2.10/
+
+win-installer:
+  variables:
+    CHERE_INVOKING: "yes"
+  tags:
+    - win32-ps
+  stage: distribution
+  dependencies:
+    - www-debian
+  artifacts:
+    name: "${CI_JOB_NAME}-${CI_COMMIT_REF_SLUG}"
+    when: always
+    expire_in: 1 week
+    paths:
+    - build/windows/installer/_Output
+    - installer.log
+  script:
+    - C:\msys64\usr\bin\pacman --noconfirm -Syyuu
+    - C:\msys64\usr\bin\bash -lc "bash -x ./build/windows/installer/installer-gimp-help-msys2.sh > 
installer.log 2>&1"
diff --git a/build/windows/installer/installer-gimp-help-msys2.sh 
b/build/windows/installer/installer-gimp-help-msys2.sh
new file mode 100644
index 000000000..8a1395b90
--- /dev/null
+++ b/build/windows/installer/installer-gimp-help-msys2.sh
@@ -0,0 +1,66 @@
+# Install Inno Setup.
+wget https://jrsoftware.org/download.php/is.exe
+./is.exe //SILENT //SUPPRESSMSGBOXES //CURRENTUSER //SP- //LOG="innosetup.log"
+
+# Install unofficial language files. These are translations of "unknown
+# translation quality or might not be maintained actively".
+# Cf. https://jrsoftware.org/files/istrans/
+ISCCDIR=`grep "Dest filename:.*ISCC.exe" innosetup.log | sed 's/.*Dest filename: *\|ISCC.exe//g'`
+ISCCDIR=`cygpath -u "$ISCCDIR"`
+mkdir -p "${ISCCDIR}/Languages/Unofficial"
+cd "${ISCCDIR}/Languages/Unofficial"
+
+download_lang ()
+{
+  langfile="$1"
+  rm -f "$langfile"
+  wget "https://raw.githubusercontent.com/jrsoftware/issrc/main/Files/Languages/Unofficial/$langfile";
+  downloaded="$?"
+  if [ $downloaded -ne 0 ]; then
+    echo "Download of '$langfile' failed."
+    exit 1
+  fi
+}
+
+add_bom ()
+{
+  langfile="$1"
+  file "$langfile" |grep "with BOM" 2>&1 > /dev/null
+  has_bom="$?"
+  if [ $has_bom -ne 0 ]; then
+    sed -i "1s/^/\xEF\xBB\xBF/" "$langfile"
+  fi
+}
+
+download_lang ChineseSimplified.isl
+download_lang Croatian.isl
+download_lang EnglishBritish.isl
+download_lang Greek.isl
+download_lang Korean.isl
+download_lang Lithuanian.isl
+download_lang NorwegianNynorsk.isl
+download_lang Romanian.isl
+download_lang Swedish.isl
+cd -
+
+# Copy generated language files into the source directory.
+#cp _build-w64/build/windows/installer/lang/*isl build/windows/installer/lang
+
+# Construct now the installer.
+MAJOR_VERSION=`grep 'm4_define(\[help_major_version' configure.ac |sed 
's/m4_define(\[help_major_version.*\[\([0-9]*\)\].*/\1/'`
+MINOR_VERSION=`grep 'm4_define(\[help_minor_version' configure.ac |sed 
's/m4_define(\[help_minor_version.*\[\([0-9]*\)\].*/\1/'`
+MICRO_VERSION=`grep 'm4_define(\[help_micro_version' configure.ac |sed 
's/m4_define(\[help_micro_version.*\[\([0-9]*\)\].*/\1/'`
+cd build/windows/installer
+./build.bat ${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}
+
+# Test if the installer was created and return success/failure.
+if [ -f "_Output/gimp-help-${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}-en-setup.exe" ]; then
+  cd _Output/
+  # TODO: do all langs.
+  INSTALLER="gimp-${MAJOR_VERSION}.${MINOR_VERSION}.${MICRO_VERSION}-en-setup.exe"
+  sha256sum $INSTALLER > ${INSTALLER}.SHA256SUMS
+  sha512sum $INSTALLER > ${INSTALLER}.SHA512SUMS
+  exit 0
+else
+  exit 1
+fi


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]