[gimp/wip/Jehan/gitlab-ci-win-32-bit: 19/19] gitlab-ci, build: construct the Windows installer from CI.




commit 1b0eea2fc84d062a707f3314ad94246ba58c47a2
Author: Jehan <jehan girinstud io>
Date:   Mon May 10 21:50:49 2021 +0200

    gitlab-ci, build: construct the Windows installer from CI.
    
    Run InnoSetup in the Windows CI to build the installer from both the 32
    and 64-bit builds. We test the installer existence at the end for return
    value (otherwise even if installer construction fails, the compile.bat
    script does not forward well the error status).
    
    Current limitations:
    - No installer signature yet.
    - Dependencies will have to be checked more thoroughly.
    - Apart from babl and GEGL, we may want to make custom builds of any
      package which has a patch in build/windows/patches/ (Windows-specific
      patches) and build/patches/ (all platform patches).
    - Plug-in interpreters (Python, Lua…) don't work. This will need to be
      looked at in detail.
    
    Globally this first automated installer build works fine though, as I
    could install it in a Windows 10 VM and GIMP ran fine! So it's a first
    step towards fully automated releases for Windows!

 .gitlab-ci.yml                                  | 53 +++++++------------------
 build/windows/gitlab-ci/build-deps-msys2.sh     |  4 +-
 build/windows/gitlab-ci/build-gimp-msys2.sh     | 10 +++--
 build/windows/gitlab-ci/installer-gimp-msys2.sh | 32 +++++++++++++++
 build/windows/gitlab-ci/package-gimp-msys2.sh   |  4 +-
 5 files changed, 58 insertions(+), 45 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 1c68ad1208..7e68522838 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -215,9 +215,6 @@ deps-win64-native:
     CHERE_INVOKING: "yes"
   tags:
     - win32-ps
-  cache:
-    paths:
-    - _install/
   script:
     - C:\msys64\usr\bin\pacman --noconfirm -Syyuu
     - C:\msys64\usr\bin\bash -lc "bash -x ./build/windows/gitlab-ci/build-deps-msys2.sh"
@@ -226,7 +223,7 @@ deps-win64-native:
     when: always
     expire_in: 2 hours
     paths:
-      - _install
+      - _install-w64
   needs: []
 
 gimp-win64-native:
@@ -246,8 +243,8 @@ gimp-win64-native:
     when: always
     expire_in: 1 day
     paths:
-    - _install
-    - _build
+    - _install-w64
+    - build/windows/installer/lang/
   cache:
     paths:
     - _ccache/
@@ -264,9 +261,6 @@ deps-win32-native:
     CHERE_INVOKING: "yes"
   tags:
     - win32-ps
-  cache:
-    paths:
-    - _install/
   script:
     - C:\msys64\usr\bin\pacman --noconfirm -Syyuu
     - C:\msys64\usr\bin\bash -lc "bash -x ./build/windows/gitlab-ci/build-deps-msys2.sh"
@@ -275,7 +269,7 @@ deps-win32-native:
     when: always
     expire_in: 2 hours
     paths:
-      - _install
+      - _install-w32
   needs: []
 
 gimp-win32-native:
@@ -295,8 +289,7 @@ gimp-win32-native:
     when: always
     expire_in: 1 day
     paths:
-    - _install
-    - _build
+    - _install-w32
   cache:
     paths:
     - _ccache/
@@ -453,49 +446,31 @@ cppcheck:
 
 ## Ready-to-distribute ##
 
-win64-native-nightly:
+win-installer-nightly:
   rules:
-    - if: '$CI_COMMIT_TAG == null && $CI_PIPELINE_SOURCE == "schedule" && $SCHEDULE_NATIVE_WIN64 != null'
+    - if: '$CI_COMMIT_TAG == null && $CI_PIPELINE_SOURCE == "schedule" && $SCHEDULE_NATIVE_WIN64 != null && 
$SCHEDULE_NATIVE_WIN32 != null'
   variables:
-    MSYSTEM: "MINGW64"
     CHERE_INVOKING: "yes"
   tags:
     - win32-ps
   stage: distribution
   dependencies:
     - gimp-win64-native
-  artifacts:
-    name: "${CI_JOB_NAME}-${CI_COMMIT_REF_SLUG}"
-    when: always
-    expire_in: 2 days
-    paths:
-    - gimp-w64
-  script:
-    - C:\msys64\usr\bin\pacman --noconfirm -Syyuu
-    - C:\msys64\usr\bin\bash -lc "bash -x ./build/windows/gitlab-ci/package-gimp-msys2.sh"
-  needs: ["gimp-win64-native"]
-
-win32-native-nightly:
-  rules:
-    - if: '$CI_COMMIT_TAG == null && $CI_PIPELINE_SOURCE == "schedule" && $SCHEDULE_NATIVE_WIN32 != null'
-  variables:
-    MSYSTEM: "MINGW32"
-    CHERE_INVOKING: "yes"
-  tags:
-    - win32-ps
-  stage: distribution
-  dependencies:
     - gimp-win32-native
   artifacts:
     name: "${CI_JOB_NAME}-${CI_COMMIT_REF_SLUG}"
     when: always
     expire_in: 2 days
     paths:
-    - gimp-w32
+    - build/windows/installer/_Output
+    #- gimp-w64
   script:
     - C:\msys64\usr\bin\pacman --noconfirm -Syyuu
-    - C:\msys64\usr\bin\bash -lc "bash -x ./build/windows/gitlab-ci/package-gimp-msys2.sh"
-  needs: ["gimp-win32-native"]
+    - C:\msys64\usr\bin\bash -lc "MSYSTEM=MINGW64 bash -x ./build/windows/gitlab-ci/package-gimp-msys2.sh"
+    - C:\msys64\usr\bin\bash -lc "MSYSTEM=MINGW32 bash -x ./build/windows/gitlab-ci/package-gimp-msys2.sh"
+    - C:\msys64\usr\bin\bash -lc "bash -x ./build/windows/gitlab-ci/installer-gimp-msys2.sh"
+    - [ -f "build/windows/installer/_Output/gimp-2.99.6-setup.exe" ]
+  needs: ["gimp-win32-native", "gimp-win64-native"]
 
 sources:
   except:
diff --git a/build/windows/gitlab-ci/build-deps-msys2.sh b/build/windows/gitlab-ci/build-deps-msys2.sh
index a7f667ae3b..d9470b1159 100644
--- a/build/windows/gitlab-ci/build-deps-msys2.sh
+++ b/build/windows/gitlab-ci/build-deps-msys2.sh
@@ -3,12 +3,14 @@
 set -e
 
 if [[ "$MSYSTEM" == "MINGW32" ]]; then
+    export ARTIFACTS_SUFFIX="-w32"
     export MSYS2_ARCH="i686"
     # vapi build fails on 32-bit, with no error output. Let's just drop
     # it for this architecture.
     export BABL_OPTIONS="-Denable-vapi=false"
     export GEGL_OPTIONS="-Dvapigen=disabled"
 else
+    export ARTIFACTS_SUFFIX="-w64"
     export MSYS2_ARCH="x86_64"
     export BABL_OPTIONS=""
     export GEGL_OPTIONS=""
@@ -52,7 +54,7 @@ pacman --noconfirm -S --needed \
     mingw-w64-$MSYS2_ARCH-vala
 
 export GIT_DEPTH=1
-export GIMP_PREFIX=`realpath ./_install`
+export GIMP_PREFIX="`realpath ./_install`${ARTIFACTS_SUFFIX}"
 export PATH="$GIMP_PREFIX/bin:$PATH"
 export PKG_CONFIG_PATH="${GIMP_PREFIX}/lib/pkgconfig:$PKG_CONFIG_PATH"
 export PKG_CONFIG_PATH="${GIMP_PREFIX}/share/pkgconfig:$PKG_CONFIG_PATH"
diff --git a/build/windows/gitlab-ci/build-gimp-msys2.sh b/build/windows/gitlab-ci/build-gimp-msys2.sh
index d22678ae40..42ae685b08 100644
--- a/build/windows/gitlab-ci/build-gimp-msys2.sh
+++ b/build/windows/gitlab-ci/build-gimp-msys2.sh
@@ -3,11 +3,13 @@
 set -e
 
 if [[ "$MSYSTEM" == "MINGW32" ]]; then
+    export ARTIFACTS_SUFFIX="-w32"
     export MSYS2_ARCH="i686"
     export ACLOCAL_FLAGS="-I/c/msys64/mingw32/share/aclocal"
     export PATH="/c/msys64/mingw32/bin:$PATH"
     export GIMP_OPTIONS="--with-vala=no --enable-vala=no"
 else
+    export ARTIFACTS_SUFFIX="-w64"
     export MSYS2_ARCH="x86_64"
     export ACLOCAL_FLAGS="-I/c/msys64/mingw64/share/aclocal"
     export PATH="/c/msys64/mingw64/bin:$PATH"
@@ -78,9 +80,9 @@ pacman --noconfirm -S --needed \
 # XXX We've got a weird error when the prefix is in the current dir.
 # Until we figure it out, this trick seems to work, even though it's
 # completely ridiculous.
-mv _install ~
+mv "_install${ARTIFACTS_SUFFIX}" ~
 
-export GIMP_PREFIX=`realpath ~/_install`
+export GIMP_PREFIX="`realpath ~/_install`${ARTIFACTS_SUFFIX}"
 export PATH="$GIMP_PREFIX/bin:$PATH"
 export PKG_CONFIG_PATH="${GIMP_PREFIX}/lib/pkgconfig:$PKG_CONFIG_PATH"
 export PKG_CONFIG_PATH="${GIMP_PREFIX}/share/pkgconfig:$PKG_CONFIG_PATH"
@@ -96,8 +98,8 @@ export CC="ccache gcc"
 ccache --zero-stats
 ccache --show-stats
 
-mkdir _build
-cd _build
+mkdir "_build${ARTIFACTS_SUFFIX}"
+cd "_build${ARTIFACTS_SUFFIX}"
 ../autogen.sh --prefix="${GIMP_PREFIX}" --enable-windows-installer ${GIMP_OPTIONS}
 make -j4
 make install
diff --git a/build/windows/gitlab-ci/installer-gimp-msys2.sh b/build/windows/gitlab-ci/installer-gimp-msys2.sh
new file mode 100644
index 0000000000..8ac89e6645
--- /dev/null
+++ b/build/windows/gitlab-ci/installer-gimp-msys2.sh
@@ -0,0 +1,32 @@
+# 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"
+
+wget https://raw.githubusercontent.com/jrsoftware/issrc/main/Files/Languages/Unofficial/Basque.isl
+wget https://raw.githubusercontent.com/jrsoftware/issrc/main/Files/Languages/Unofficial/ChineseSimplified.isl
+wget 
https://raw.githubusercontent.com/jrsoftware/issrc/main/Files/Languages/Unofficial/ChineseTraditional.isl
+wget https://raw.githubusercontent.com/jrsoftware/issrc/main/Files/Languages/Unofficial/EnglishBritish.isl
+wget https://raw.githubusercontent.com/jrsoftware/issrc/main/Files/Languages/Unofficial/Esperanto.isl
+wget https://raw.githubusercontent.com/jrsoftware/issrc/main/Files/Languages/Unofficial/Greek.isl
+wget https://raw.githubusercontent.com/jrsoftware/issrc/main/Files/Languages/Unofficial/Hungarian.isl
+wget https://raw.githubusercontent.com/jrsoftware/issrc/main/Files/Languages/Unofficial/Indonesian.isl
+wget https://raw.githubusercontent.com/jrsoftware/issrc/main/Files/Languages/Unofficial/Korean.isl
+wget https://raw.githubusercontent.com/jrsoftware/issrc/main/Files/Languages/Unofficial/Latvian.isl
+wget https://raw.githubusercontent.com/jrsoftware/issrc/main/Files/Languages/Unofficial/Malaysian.isl
+wget https://raw.githubusercontent.com/jrsoftware/issrc/main/Files/Languages/Unofficial/Marathi.islu
+wget https://raw.githubusercontent.com/jrsoftware/issrc/main/Files/Languages/Unofficial/Romanian.isl
+wget https://raw.githubusercontent.com/jrsoftware/issrc/main/Files/Languages/Unofficial/Swedish.isl
+wget https://raw.githubusercontent.com/jrsoftware/issrc/main/Files/Languages/Unofficial/Vietnamese.isl
+cd -
+
+# Construct now the installer.
+cd build/windows/installer
+./compile.bat 2.99.6 ../../.. gimp-w32 gimp-w64 ../../.. gimp-w32 gimp-w64
diff --git a/build/windows/gitlab-ci/package-gimp-msys2.sh b/build/windows/gitlab-ci/package-gimp-msys2.sh
index 3d181bda24..8227bebff6 100644
--- a/build/windows/gitlab-ci/package-gimp-msys2.sh
+++ b/build/windows/gitlab-ci/package-gimp-msys2.sh
@@ -3,11 +3,13 @@
 set -e
 
 if [[ "$MSYSTEM" == "MINGW32" ]]; then
+    export ARTIFACTS_SUFFIX="-w32"
     export MSYS2_ARCH="i686"
     export MSYS_PREFIX="/c/msys64/mingw32/"
     export PATH="/mingw32/bin:$PATH"
     export GIMP_DISTRIB=`realpath ./gimp-w32`
 else
+    export ARTIFACTS_SUFFIX="-w64"
     export MSYS2_ARCH="x86_64"
     export MSYS_PREFIX="/c/msys64/mingw64/"
     export PATH="/mingw64/bin:$PATH"
@@ -76,7 +78,7 @@ pacman --noconfirm -S --needed \
     mingw-w64-$MSYS2_ARCH-vala \
     mingw-w64-$MSYS2_ARCH-xpm-nox
 
-export GIMP_PREFIX=`realpath ./_install`
+export GIMP_PREFIX="`realpath ./_install`${ARTIFACTS_SUFFIX}"
 export PATH="$GIMP_PREFIX/bin:$PATH"
 
 # Package ressources.


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