Ver Fonte

Add gdk-pixbuf (#787)

Kelvin Zhang há 3 anos atrás
pai
commit
7fb549c6bf

+ 80 - 0
packages/g/gdk-pixbuf/patches/2.42.6/macosx.patch

@@ -0,0 +1,80 @@
+diff --git a/gdk-pixbuf/meson.build b/gdk-pixbuf/meson.build
+index 54ff9dda3..ec0d902a9 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
+                    gdkpixbuf_enum_h,
+                    dependencies: gdk_pixbuf_deps + [ 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',

+ 44 - 0
packages/g/gdk-pixbuf/xmake.lua

@@ -0,0 +1,44 @@
+package("gdk-pixbuf")
+
+    set_homepage("https://gitlab.gnome.org/GNOME/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_versions("2.42.6", "c4f3a84a04bc7c5f4fbd97dce7976ab648c60628f72ad4c7b79edce2bbdb494d")
+
+    add_deps("meson", "ninja")
+    add_deps("libpng", "libjpeg", "glib")
+    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")
+    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",
+                         "-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"}})
+    end)
+
+    on_test(function (package)
+        assert(package:has_cfuncs("gdk_pixbuf_get_type", {includes = "gdk-pixbuf/gdk-pixbuf.h"}))
+    end)

+ 4 - 3
packages/g/glib/xmake.lua

@@ -22,13 +22,13 @@ package("glib")
     end
 
     add_includedirs("include/glib-2.0", "lib/glib-2.0/include")
-    add_links("gobject-2.0", "glib-2.0", "gio-2.0", "gthread-2.0", "gmodule-2.0", "intl")
+    add_links("gio-2.0", "gobject-2.0", "gthread-2.0", "gmodule-2.0", "glib-2.0", "intl")
     if is_plat("macosx") then
         add_syslinks("iconv")
         add_frameworks("Foundation", "CoreFoundation")
         add_extsources("brew::glib")
     elseif is_plat("linux") then
-        add_syslinks("pthread", "dl")
+        add_syslinks("pthread", "dl", "resolv")
         add_extsources("apt::libglib2.0-dev")
     end
 
@@ -36,7 +36,7 @@ package("glib")
         on_fetch("macosx", "linux", function (package, opt)
             if opt.system and package.find_package then
                 local result
-                for _, name in ipairs({"gobject-2.0", "glib-2.0", "gio-2.0", "gmodule-2.0", "gthread-2.0"}) do
+                for _, name in ipairs({"gio-2.0", "gobject-2.0", "gthread-2.0", "gmodule-2.0", "glib-2.0"}) do
                     local pkginfo = package.find_package and package:find_package("pkgconfig::" .. name, opt)
                     if pkginfo then
                         if not result then
@@ -78,6 +78,7 @@ package("glib")
         io.gsub("meson.build", "subdir%('tests'%)", "")
         io.gsub("meson.build", "subdir%('fuzzing'%)", "")
         io.gsub("gio/meson.build", "subdir%('tests'%)", "")
+        io.replace("meson.build", "glib_conf.set('HAVE_SELINUX', selinux_dep.found())", "", {plain = true})
         if package:is_plat("windows") then
             io.gsub("meson.build", "dependency%('libffi',", "dependency('libffi', modules: ['libffi::ffi'],")
         end