[gimp/wip/Jehan/win32-distrib-job] WIP: testing a Win32 distribution job for our CI.




commit 7dc02ec71608bfba44f10abe5c5742af74c768f1
Author: Jehan <jehan girinstud io>
Date:   Tue Sep 29 19:38:23 2020 +0200

    WIP: testing a Win32 distribution job for our CI.

 .gitlab-ci.yml                                     | 59 +++++++++++++-
 build/windows/crossbuild-gitlab-ci/dll_link.py     | 90 ++++++++++++++++++++++
 .../windows/crossbuild-gitlab-ci/gimp-wrapper.cmd  |  6 +-
 3 files changed, 150 insertions(+), 5 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d6e46690fc..4280ce051a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -237,7 +237,6 @@ gimp-win64:
               -Dgtk-doc=false
               -Dpython=always -Dlua=always
               -Djavascript=always && ninja install &&
-            cp ../build/windows/crossbuild-gitlab-ci/gimp-wrapper.cmd $CROSSROAD_PREFIX/bin/ &&
             cp -fr $CROSSROAD_PREFIX/ ../gimp-prefix/
             ' |
       crossroad w64 gimp --run="-"
@@ -299,7 +298,6 @@ gimp-win32:
               -Dwmf=disabled  -Dgtk-doc=false
               -Dpython=always -Dlua=always
               -Djavascript=always && ninja install &&
-            cp ../build/windows/crossbuild-gitlab-ci/gimp-wrapper.cmd $CROSSROAD_PREFIX/bin/ &&
             cp -fr $CROSSROAD_PREFIX/ ../gimp-prefix/
             ' |
       crossroad w32 gimp --run="-"
@@ -345,3 +343,60 @@ sources:
     - mv _build/gimp-*.tar.* .
     - sha256sum gimp-*.tar.* > SHA256SUMS
   needs: ["gimp-distcheck-debian"]
+
+win64-nightly:
+  stage: distribution
+  dependencies:
+    - gimp-win64
+  variables:
+    GIMP_PREFIX: "gimp-prefix"
+    GIMP_DISTRIB: "gimp"
+  artifacts:
+    when: always
+    paths:
+    - gimp
+  script:
+    # Package ressources
+    - cp -fr ${GIMP_PREFIX}/etc ${GIMP_DISTRIB}
+    - cp -fr ${GIMP_PREFIX}/include/ ${GIMP_DISTRIB}
+    - cp -fr ${GIMP_PREFIX}/ssl ${GIMP_DISTRIB}
+    - cp -fr ${GIMP_PREFIX}/share ${GIMP_DISTRIB}
+
+    # Package executable
+    - mkdir $(GIMP_DISTRIB)/bin
+    - cp -fr ${GIMP_PREFIX}/bin/gimp*.exe ${GIMP_DISTRIB}/bin/
+    - cp -fr ${GIMP_PREFIX}/bin/gdbus.exe ${GIMP_DISTRIB}/bin/
+    - cp -fr ${GIMP_PREFIX}/bin/glib-compile-schemas.exe ${GIMP_DISTRIB}/bin/
+    - cp -fr ${GIMP_PREFIX}/bin/gdk-pixbuf-query-loaders.exe ${GIMP_DISTRIB}/bin/
+    - cp -fr ${GIMP_PREFIX}/bin/gdk-pixbuf-pixdata.exe ${GIMP_DISTRIB}/bin/
+    - cp -fr ${GIMP_PREFIX}/bin/gdk-pixbuf-thumbnailer.exe ${GIMP_DISTRIB}/bin/
+    - cp -fr ${GIMP_PREFIX}/bin/gspawn-win64-helper.exe ${GIMP_DISTRIB}/bin/
+    - cp -fr ${GIMP_PREFIX}/bin/gspawn-win64-helper-console.exe ${GIMP_DISTRIB}/bin/
+
+    - cp build/windows/crossbuild-gitlab-ci/gimp-wrapper.cmd ${GIMP_DISTRIB}/
+
+    - mkdir $(GIMP_DISTRIB)/libexec
+    - cp -fr ${GIMP_PREFIX}/libexec/gimp*.exe ${GIMP_DISTRIB}/libexec/
+
+    # Package lib
+    - mkdir ${GIMP_DISTRIB}/lib/
+    - cp -fr ${GIMP_PREFIX}/lib/gimp ${GIMP_DISTRIB}/lib/
+    - cp -fr ${GIMP_PREFIX}/lib/gio ${GIMP_DISTRIB}/lib/
+    - cp -fr ${GIMP_PREFIX}/lib/gdk-pixbuf-2.0 ${GIMP_DISTRIB}/lib/
+    - cp -fr ${GIMP_PREFIX}/lib/gegl-0.4 ${GIMP_DISTRIB}/lib/
+    - cp -fr ${GIMP_PREFIX}/lib/babl-0.1 ${GIMP_DISTRIB}/lib/
+    - cp -fr ${GIMP_PREFIX}/lib/girepository-1.0 ${GIMP_DISTRIB}/lib/
+    - glib-compile-schemas --targetdir=${GIMP_DISTRIB}/share/glib-2.0/schemas 
${GIMP_PREFIX}/share/glib-2.0/schemas
+
+    # Package dll with a Python script using objdump
+    - python3 build/windows/crossbuild-gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/gimp-2.99.exe 
${GIMP_PREFIX}/ ${GIMP_DISTRIB}
+    - python3 build/windows/crossbuild-gitlab-ci/dll_link.py ${GIMP_DISTRIB}/bin/gdbus.exe ${GIMP_PREFIX}/ 
${GIMP_DISTRIB}
+    - python3 build/windows/crossbuild-gitlab-ci/dll_link.py ${GIMP_PREFIX}/bin/gdk-pixbuf-query-loaders.exe 
${GIMP_PREFIX}/ ${GIMP_DISTRIB}
+    - python3 build/windows/crossbuild-gitlab-ci/dll_link.py ${GIMP_PREFIX}/bin/gdk-pixbuf-pixdata.exe 
${GIMP_PREFIX}/ ${GIMP_DISTRIB}
+    - python3 build/windows/crossbuild-gitlab-ci/dll_link.py ${GIMP_PREFIX}/bin/gdk-pixbuf-thumbnailer.exe 
${GIMP_PREFIX}/ ${GIMP_DISTRIB}
+    - python3 build/windows/crossbuild-gitlab-ci/dll_link.py ${GIMP_PREFIX}/bin/gspawn-win64-helper.exe 
${GIMP_PREFIX}/ ${GIMP_DISTRIB}
+    - python3 build/windows/crossbuild-gitlab-ci/dll_link.py 
${GIMP_PREFIX}/bin/gspawn-win64-helper-console.exe ${GIMP_PREFIX}/ ${GIMP_DISTRIB}
+    - python3 build/windows/crossbuild-gitlab-ci/dll_link.py ${GIMP_PREFIX}/bin/glib-compile-schemas.exe 
${GIMP_PREFIX}/ ${GIMP_DISTRIB}
+    - python3 build/windows/crossbuild-gitlab-ci/dll_link.py 
${GIMP_PREFIX}/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-svg.dll ${GIMP_PREFIX}/ ${GIMP_DISTRIB}
+
+  needs: ["gimp-win64"]
diff --git a/build/windows/crossbuild-gitlab-ci/dll_link.py b/build/windows/crossbuild-gitlab-ci/dll_link.py
new file mode 100755
index 0000000000..4e1abe0ed3
--- /dev/null
+++ b/build/windows/crossbuild-gitlab-ci/dll_link.py
@@ -0,0 +1,90 @@
+#!/usr/bin/python3
+
+################################################################################
+# Small python script to retrieve DLL depencies with objdump
+################################################################################
+
+################################################################################
+# Usage example
+#
+# python3 dll_link.py /path/to/run.exe /winenv/ /path/install
+#
+# In this case, the DLL depencies for executable run.exe will be extracted and
+# copied into /path/install/bin folder. To copy the DLL, the root path to
+# Windows environnement should be passed, here /winenv/.
+
+import sys
+import os
+import subprocess
+import re
+import string
+import shutil
+from pathlib import Path
+
+################################################################################
+# Global variables
+
+# Sets for executable and system DLL
+dll_siril_set = set()
+dll_sys_set = set()
+
+# Install prefix
+prefix = ''
+
+# Windows environement root
+basedir = ''
+
+# Common paths
+binary_dir = '/bin/'
+lib_dir = '/lib/'
+etc_dir = '/etc/'
+share_dir = '/share/'
+
+################################################################################
+# Functions
+
+# Main function
+def main():
+  global basedir
+  global prefix
+
+  if len(sys.argv) < 4:
+    exit(1)
+
+  filename = sys.argv[1]
+  basedir = sys.argv[2]
+  prefix = sys.argv[3]
+
+  recursive(filename)
+  copy_dll(dll_siril_set-dll_sys_set)
+
+# List DLL of an executable file in a recursive way
+def recursive(filename):
+  # Check if DLL exist in /bin folder, if true extract depencies too.
+  if os.path.exists(filename):
+    result = subprocess.run(
+        ['x86_64-w64-mingw32-objdump', '-p', filename], stdout=subprocess.PIPE)
+    out = result.stdout.decode('utf-8')
+    # Parse lines with DLL Name instead of lib*.dll directly
+    items = re.findall(r"DLL Name: \S+.dll", out, re.MULTILINE)
+    for x in items:
+      x = x.split(' ')[2]
+      l = len(dll_siril_set)
+      dll_siril_set.add(x)
+      if len(dll_siril_set) > l:
+        new_dll = basedir + binary_dir + x
+        recursive(new_dll)
+  # Otherwise, it is a system DLL 
+  else:
+    dll_sys_set.add(os.path.basename(filename))
+
+# Copy a DLL set into the /prefix/bin directory
+def copy_dll(dll_list):
+  for file in dll_list:
+    full_file_name = os.path.join(basedir + binary_dir, file)
+    if os.path.isfile(full_file_name):
+      shutil.copy(full_file_name, prefix+binary_dir)
+
+
+if __name__ == "__main__":
+  main()
diff --git a/build/windows/crossbuild-gitlab-ci/gimp-wrapper.cmd 
b/build/windows/crossbuild-gitlab-ci/gimp-wrapper.cmd
index 957537c520..4875b17e4e 100644
--- a/build/windows/crossbuild-gitlab-ci/gimp-wrapper.cmd
+++ b/build/windows/crossbuild-gitlab-ci/gimp-wrapper.cmd
@@ -1,3 +1,3 @@
-glib-compile-schemas.exe ..\share\glib-2.0\schemas
-gdk-pixbuf-query-loaders.exe --update-cache
-gimp-2.99.exe
+bin\glib-compile-schemas.exe share\glib-2.0\schemas
+bin\gdk-pixbuf-query-loaders.exe --update-cache
+bin\gimp-2.99.exe


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