[gdk-pixbuf/macos-ci] Pass glib-compile-resources's path to gen-resources.py



commit 2839b5ce73e385956cb3b7ea7a8317871ce30502
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Mon Jan 4 00:40:53 2021 +0000

    Pass glib-compile-resources's path to gen-resources.py
    
    Since the gen-resources.py needs to call glib-compile-resources, we need
    to figure out where the binary is, and tell gen-resources.py to use
    that, instead of relying on it being in the PATH.

 meson.build       |  3 ++
 tests/meson.build | 86 ++++++++++++++++++++++++++-----------------------------
 2 files changed, 43 insertions(+), 46 deletions(-)
---
diff --git a/meson.build b/meson.build
index ecb745186..1cef125a3 100644
--- a/meson.build
+++ b/meson.build
@@ -371,6 +371,9 @@ gen_resources = find_program('build-aux/gen-resources.py')
 gen_installed_test = find_program('build-aux/gen-installed-test.py')
 gen_thumbnailer = find_program('build-aux/gen-thumbnailer.py')
 
+# Needed by gen-resources.py
+glib_compile_resources = find_program('glib-compile-resources')
+
 gnome = import('gnome')
 
 subdir('gdk-pixbuf')
diff --git a/tests/meson.build b/tests/meson.build
index 9cac916ab..8475f5f5c 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -1,53 +1,47 @@
 # Resources contain PNG and BMP files, so we need these two loaders
 # enabled in order to build them
 if enabled_loaders.contains('png')
-  if glib_dep.type_name() == 'internal'
-    # The gen_resources script does not work if we use glib as a subproject,
-    # since it won't find glib-compile-resources in the path
-    resources_c = []
-    resources_h = []
-    no_resources = true
-  else
-    # Resources; we cannot use gnome.compile_resources() here, because we need to
-    # override the environment in order to use the utilities we just built instead
-    # of the system ones
-    resources_c = custom_target('resources.c',
-      input: 'resources.gresource.xml',
-      output: 'resources.c',
-      command: [
-        gen_resources,
-        '--pixdata=@0@'.format(gdk_pixbuf_pixdata.full_path()),
-        '--loaders=@0@'.format(loaders_cache.full_path()),
-        '--sourcedir=@0@'.format(meson.current_source_dir()),
-        '--source',
-        '@INPUT@',
-        '@OUTPUT@',
-      ],
-      depends: [
-        gdk_pixbuf_pixdata,
-        loaders_cache,
-      ],
-    )
+  # Resources; we cannot use gnome.compile_resources() here, because we need to
+  # override the environment in order to use the utilities we just built instead
+  # of the system ones
+  resources_c = custom_target('resources.c',
+    input: 'resources.gresource.xml',
+    output: 'resources.c',
+    command: [
+      gen_resources,
+      '--glib-compile-resources=@0@'.format(glib_compile_resources.full_path()),
+      '--pixdata=@0@'.format(gdk_pixbuf_pixdata.full_path()),
+      '--loaders=@0@'.format(loaders_cache.full_path()),
+      '--sourcedir=@0@'.format(meson.current_source_dir()),
+      '--source',
+      '@INPUT@',
+      '@OUTPUT@',
+    ],
+    depends: [
+      gdk_pixbuf_pixdata,
+      loaders_cache,
+    ],
+  )
 
-    resources_h = custom_target('resources.h',
-      input: 'resources.gresource.xml',
-      output: 'resources.h',
-      command: [
-        gen_resources,
-        '--pixdata=@0@'.format(gdk_pixbuf_pixdata.full_path()),
-        '--loaders=@0@'.format(loaders_cache.full_path()),
-        '--sourcedir=@0@'.format(meson.current_source_dir()),
-        '--header',
-        '@INPUT@',
-        '@OUTPUT@',
-      ],
-      depends: [
-        gdk_pixbuf_pixdata,
-        loaders_cache,
-      ],
-    )
-    no_resources = false
-  endif
+  resources_h = custom_target('resources.h',
+    input: 'resources.gresource.xml',
+    output: 'resources.h',
+    command: [
+      gen_resources,
+      '--glib-compile-resources=@0@'.format(glib_compile_resources.full_path()),
+      '--pixdata=@0@'.format(gdk_pixbuf_pixdata.full_path()),
+      '--loaders=@0@'.format(loaders_cache.full_path()),
+      '--sourcedir=@0@'.format(meson.current_source_dir()),
+      '--header',
+      '@INPUT@',
+      '@OUTPUT@',
+    ],
+    depends: [
+      gdk_pixbuf_pixdata,
+      loaders_cache,
+    ],
+  )
+  no_resources = false
 else
   resources_c = []
   resources_h = []


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