Selaa lähdekoodia

Fix gdk-pixbuf include dir (#823)

* Fix gdk-pixbuf include dir

* Update xmake.lua

* Update xmake.lua

Co-authored-by: ruki <[email protected]>
Kelvin Zhang 3 vuotta sitten
vanhempi
commit
559c34deae
2 muutettua tiedostoa jossa 48 lisäystä ja 82 poistoa
  1. 31 73
      packages/g/gdk-pixbuf/patches/2.42.6/macosx.patch
  2. 17 9
      packages/g/gdk-pixbuf/xmake.lua

+ 31 - 73
packages/g/gdk-pixbuf/patches/2.42.6/macosx.patch

@@ -1,80 +1,38 @@
+commit 0b873aab346559416d37573672f49141d345ff02
+Author: Kelvin Zhang <[email protected]>
+Date:   Fri Dec 31 11:57:52 2021 -0800
+
+    Fix gir scan linker error
+    
+    Need to link gdk-pixbuf as a dependency, otherwise build for static
+    library will fail due to missing libpng/libgjpeg
+
 diff --git a/gdk-pixbuf/meson.build b/gdk-pixbuf/meson.build
-index 54ff9dda3..ec0d902a9 100644
+index 8b0590b..45546ad 100644
 --- a/gdk-pixbuf/meson.build
 +++ b/gdk-pixbuf/meson.build
-@@ -75,7 +75,7 @@ gdk_pixbuf_cflags = [
-   '-DBUILT_MODULES_DIR="@0@"'.format(meson.current_build_dir()),
- ]
- 
--gdk_pixbuf_api_path = join_paths(gdk_pixbuf_api_name, 'gdk-pixbuf')
-+gdk_pixbuf_api_path = join_paths('gdk-pixbuf')
- 
- gdkpixbuf_features_conf = configuration_data()
- gdkpixbuf_features_conf.set('GDK_PIXBUF_MAJOR', gdk_pixbuf_version_major)
-@@ -340,6 +340,7 @@ foreach bin: gdkpixbuf_bin
+@@ -241,6 +241,7 @@ if build_gir
+     identifier_prefix: 'Gdk',
+     symbol_prefix: 'gdk',
+     export_packages: 'gdk-pixbuf-2.0',
++    dependencies: loaders_deps,
+     includes: [ 'GModule-2.0', 'Gio-2.0', ],
+     header: 'gdk-pixbuf/gdk-pixbuf.h',
+     install: true,
+@@ -255,6 +256,7 @@ if build_gir
+     identifier_prefix: 'Gdk',
+     symbol_prefix: 'gdk',
+     export_packages: 'gdk-pixbuf-2.0',
++    dependencies: loaders_deps,
+     includes: [ gdkpixbuf_gir[0] ],
+     header: 'gdk-pixbuf/gdk-pixdata.h',
+     install: true,
+@@ -338,7 +340,7 @@ foreach bin: gdkpixbuf_bin
+ 
+   bin = executable(bin_name, bin_source,
                     gdkpixbuf_enum_h,
-                    dependencies: gdk_pixbuf_deps + [ gdkpixbuf_dep ],
+-                   dependencies: gdk_pixbuf_deps + [ gdkpixbuf_dep ],
++                   dependencies: [ gdkpixbuf_dep ],
                     include_directories: [ root_inc, gdk_pixbuf_inc ],
-+                   link_args: ['-framework', 'CoreFoundation', '-framework', 'Foundation', '-framework', 'CoreServices', '-framework', 'AppKit'],
                     c_args: common_cflags + gdk_pixbuf_cflags,
                     install: true)
-   meson.override_find_program(bin_name, bin)
-diff --git a/gdk-pixbuf/pixops/meson.build b/gdk-pixbuf/pixops/meson.build
-index 101fbf669..718767ba4 100644
---- a/gdk-pixbuf/pixops/meson.build
-+++ b/gdk-pixbuf/pixops/meson.build
-@@ -8,6 +8,7 @@ pixops = static_library('pixops',
- pixops_dep = declare_dependency(
-   link_with: pixops,
-   include_directories: [ root_inc, include_directories('.') ],
-+  link_args: ['-framework', 'CoreFoundation', '-framework', 'Foundation', '-framework', 'CoreServices', '-framework', 'AppKit'],
-   dependencies: gdk_pixbuf_deps,
- )
- 
-diff --git a/meson.build b/meson.build
-index 33044e820..f73bb9bd7 100644
---- a/meson.build
-+++ b/meson.build
-@@ -116,7 +116,7 @@ gdk_pixbuf_conf.set('HAVE_SIGSETJMP',
- 
- # Common compiler and linker flags
- common_cflags = []
--common_ldflags = []
-+common_ldflags = ['-framework', 'CoreFoundation', '-framework', 'Foundation', '-framework', 'CoreServices', '-framework', 'AppKit']
- 
- if cc.get_id() == 'msvc'
-   # For Visual Studio, just force-include msvc_reommended_pragmas.h
-@@ -414,13 +414,11 @@ subdir('gdk-pixbuf')
- subdir('po')
- 
- if not meson.is_cross_build()
--  subdir('tests')
-   subdir('thumbnailer')
- endif
- 
- # Documentation
- build_docs = get_option('gtk_doc') or get_option('docs')
--subdir('docs')
- 
- if not meson.is_cross_build()
-   meson.add_install_script('build-aux/post-install.py',
-diff --git a/thumbnailer/meson.build b/thumbnailer/meson.build
-index b6a206d5b..ba905c812 100644
---- a/thumbnailer/meson.build
-+++ b/thumbnailer/meson.build
-@@ -4,6 +4,7 @@ bin = executable('gdk-pixbuf-thumbnailer',
-              '-DTHUMBNAILER_RETURNS_PIXBUF',
-              '-DTHUMBNAILER_USAGE="Thumbnail images"',
-            ],
-+		   link_args: ['-framework', 'CoreFoundation', '-framework', 'Foundation', '-framework', 'CoreServices', '-framework', 'AppKit'],
-            dependencies: gdk_pixbuf_deps + [ gdkpixbuf_dep ],
-            install: true)
- meson.override_find_program('gdk-pixbuf-thumbnailer', bin)
-@@ -11,6 +12,7 @@ meson.override_find_program('gdk-pixbuf-thumbnailer', bin)
- gdk_pixbuf_print_mime_types = executable('gdk-pixbuf-print-mime-types',
-                                          'gdk-pixbuf-print-mime-types.c',
-                                          c_args: common_cflags,
-+										 link_args: ['-framework', 'CoreFoundation', '-framework', 'Foundation', '-framework', 'CoreServices', '-framework', 'AppKit'],
-                                          dependencies: gdk_pixbuf_deps + [ gdkpixbuf_dep ])
- 
- custom_target('thumbnailer',

+ 17 - 9
packages/g/gdk-pixbuf/xmake.lua

@@ -4,39 +4,47 @@ package("gdk-pixbuf")
     set_description("GdkPixbuf is a library that loads image data in various formats and stores it as linear buffers in memory. The buffers can then be scaled, composited, modified, saved, or rendered.")
     set_license("LGPL-2.0")
 
-    set_urls("https://gitlab.gnome.org/GNOME/gdk-pixbuf/-/archive/$(version)/gdk-pixbuf-$(version).tar.gz")
-    add_urls("https://gitlab.gnome.org/GNOME/gdk-pixbuf.git")
+    add_urls("https://github.com/GNOME/gdk-pixbuf/archive/refs/tags/$(version).tar.gz",
+             "https://gitlab.gnome.org/GNOME/gdk-pixbuf/-/archive/$(version)/gdk-pixbuf-$(version).tar.gz",
+             "https://gitlab.gnome.org/GNOME/gdk-pixbuf.git")
 
     add_versions("2.42.6", "c4f3a84a04bc7c5f4fbd97dce7976ab648c60628f72ad4c7b79edce2bbdb494d")
+    add_includedirs("include", "include/gdk-pixbuf-2.0")
 
     add_deps("meson", "ninja")
-    add_deps("libpng", "libjpeg", "glib")
+    add_deps("libpng", "libjpeg")
     if is_plat("macosx") then
         add_frameworks("Foundation", "CoreFoundation", "AppKit")
         add_extsources("brew::gdk-pixbuf")
         add_syslinks("resolv")
-        add_patches("2.42.6", path.join(os.scriptdir(), "patches", "2.42.6", "macosx.patch"), "52ab09e9811d14673413a950074262b825261971ff7bb3aa0d152446a7381e71")
+        add_patches("2.42.6", path.join(os.scriptdir(), "patches", "2.42.6", "macosx.patch"), "ad2705a5a9aa4b90fb4588bb567e95f5d82fccb6a5d463cd07462180e2e418eb")
     end
 
+    on_load(function (package)
+        if package:config("shared") then
+            -- fix gobject conflict error: assertion failed: (type == G_TYPE_CHAR)
+            package:add("deps", "glib", {configs = {shared = true}})
+        else
+            package:add("deps", "glib")
+        end
+    end)
+
     on_install("macosx", "linux", function (package)
-        import("package.tools.meson")
         local configs = {"-Dman=false",
                          "-Dgtk_doc=false",
                          "-Dpng=true",
                          "-Dtiff=true",
                          "-Dnative_windows_loaders=false",
                          "-Dgio_sniffing=false",
+                         "-Drelocatable=true",
                          "-Djpeg=true",
-                         "-Dintrospection=disabled",
                          "-Dinstalled_tests=false"}
-        
         table.insert(configs, "-Ddebug=" .. (package:debug() and "true" or "false"))
         table.insert(configs, "-Ddefault_library=" .. (package:config("shared") and "shared" or "static"))
         io.gsub("meson.build", "subdir%('tests'%)", "")
         io.gsub("meson.build", "subdir%('fuzzing'%)", "")
         io.gsub("meson.build", "subdir%('docs'%)", "")
-        io.replace("gdk-pixbuf/meson.build", "join_paths(gdk_pixbuf_api_name,", "join_paths(", {plain = true})
-        meson.install(package, configs, {packagedeps = {"libpng", "libjpeg", "glib"}})
+        import("package.tools.meson").install(package, configs, {packagedeps = {"libpng", "libjpeg", "glib"}})
     end)
 
     on_test(function (package)