[gdk-pixbuf/fix-generating-pc-files] build: Fix generating .pc file when using builtin loader(s)



commit e132d67abce0f8717ff163b8faebbd7425349103
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Thu Aug 1 09:14:32 2019 +0800

    build: Fix generating .pc file when using builtin loader(s)
    
    The current Meson build files define built-in loader(s) as a dependency to
    libgdkpixbuf, which has an undesired side effect of making them required
    by GDK-Pixbuf's pkg-config file, which renders build systems that consume
    this pkg-config file output bad build files.
    
    This fixes this by:
    -Make libgdkpixbuf depend on the objects that are built for those loader(s),
     when the loader(s) are built into libgdkpixbuf.
    -Include the external dependencies of these built-in loaders, if applicable,
     such as libpng etc., as dependencies of libgdkpixbuf.

 gdk-pixbuf/meson.build |  8 ++++----
 meson.build            | 20 ++++++++++++++++++--
 2 files changed, 22 insertions(+), 6 deletions(-)
---
diff --git a/gdk-pixbuf/meson.build b/gdk-pixbuf/meson.build
index 8c944ba71..6e035905a 100644
--- a/gdk-pixbuf/meson.build
+++ b/gdk-pixbuf/meson.build
@@ -110,7 +110,7 @@ endif
 
 # Check if we need to build loaders as built-in functionality
 included_loaders_cflags = []
-included_loaders_deps = []
+included_loaders_objs = []
 
 foreach l: loaders
   name = l[0]
@@ -129,7 +129,7 @@ foreach l: loaders
                          include_directories: [ root_inc, gdk_pixbuf_inc ],
                          c_args: common_cflags + gdk_pixbuf_cflags + cflags + cflag_for_included_loader)
 
-    included_loaders_deps += declare_dependency(link_with: mod)
+    included_loaders_objs += mod.extract_all_objects()
   endif
 endforeach
 
@@ -154,7 +154,7 @@ if native_windows_loaders
                          include_directories: [ root_inc, gdk_pixbuf_inc ],
                          c_args: common_cflags + gdk_pixbuf_cflags + cflag_for_included_loader)
 
-    included_loaders_deps += declare_dependency(link_with: mod)
+    included_loaders_objs += mod.extract_all_objects()
   endif
 endif
 
@@ -167,6 +167,7 @@ gdkpixbuf = library('gdk_pixbuf-2.0',
                       gdkpixbuf_marshals,
                       gdkpixdata_sources,
                     ],
+                    objects: included_loaders_objs,
                     soversion: soversion,
                     version: libversion,
                     c_args: common_cflags + gdk_pixbuf_cflags + included_loaders_cflags,
@@ -177,7 +178,6 @@ gdkpixbuf = library('gdk_pixbuf-2.0',
                     ],
                     dependencies: [
                       gdk_pixbuf_deps,
-                      included_loaders_deps,
                     ],
                     install: true)
 
diff --git a/meson.build b/meson.build
index 45d878c07..7c23b46cd 100644
--- a/meson.build
+++ b/meson.build
@@ -288,6 +288,9 @@ if get_option('png')
         loaders_deps += png_dep
       endif
     endif
+    if png_dep.found() and (builtin_loaders.contains('png') or builtin_all_loaders)
+      gdk_pixbuf_deps += png_dep
+    endif
   endif
 endif
 
@@ -302,9 +305,13 @@ else
 endif
 
 if native_windows_loaders
-  loaders_deps += cc.find_library('gdiplus')
-  loaders_deps += cc.find_library('ole32')
+  gdip_lib = cc.find_library('gdiplus')
+  ole32_lib = cc.find_library('ole32')
+  loaders_deps += [gdip_lib, ole32_lib]
   enabled_loaders += 'gdiplus'
+  if builtin_loaders.contains('gdiplus') or builtin_all_loaders
+    gdk_pixbuf_deps += [gdip_lib, ole32_lib]
+  endif
 endif
 
 # Don't check and build the jpeg loader if native_windows_loaders is true
@@ -323,6 +330,9 @@ if get_option('jpeg') and not native_windows_loaders
       gdk_pixbuf_conf.set('HAVE_PROGRESSIVE_JPEG',
                           cc.has_function('jpeg_simple_progression',
                                           dependencies: jpeg_dep))
+      if builtin_loaders.contains('jpeg') or builtin_all_loaders
+        gdk_pixbuf_deps += jpeg_dep
+      endif
     endif
   endif
 endif
@@ -346,6 +356,9 @@ if get_option('tiff') and not native_windows_loaders
   if tiff_dep.found()
     enabled_loaders += 'tiff'
     loaders_deps += tiff_dep
+    if builtin_loaders.contains('tiff') or builtin_all_loaders
+      gdk_pixbuf_deps += tiff_dep
+    endif
   endif
 endif
 
@@ -375,6 +388,9 @@ if get_option('jasper')
     if jasper_dep.found() and cc.has_function('jas_init', dependencies: jasper_dep)
       enabled_loaders += 'jasper'
       loaders_deps += jasper_dep
+      if builtin_loaders.contains('jasper') or builtin_all_loaders
+        gdk_pixbuf_deps += jasper_dep
+      endif
     endif
   endif
 endif


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