add gtk4 build (#2880)

* add libdrm

* update nasm

* update libxi

* fix build with static glib

* add gtk4 on_install script

* disable media
pull/2837/head
Hoildkv 1 year ago committed by GitHub
parent 850b0d315e
commit 4008de5036
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 22
      packages/c/cairo/xmake.lua
  2. 6
      packages/g/gdk-pixbuf/xmake.lua
  3. 17
      packages/g/glib/xmake.lua
  4. 21
      packages/g/graphene/xmake.lua
  5. 80
      packages/g/gtk4/xmake.lua
  6. 38
      packages/h/harfbuzz/xmake.lua
  7. 20
      packages/l/libdrm/xmake.lua
  8. 9
      packages/l/libepoxy/xmake.lua
  9. 4
      packages/l/libjpeg-turbo/xmake.lua
  10. 7
      packages/l/libxi/xmake.lua
  11. 6
      packages/n/nasm/xmake.lua
  12. 8
      packages/p/pango/xmake.lua

@ -12,12 +12,18 @@ package("cairo")
add_patches("1.18.0", path.join(os.scriptdir(), "patches", "1.18.0", "alloca.patch"), "55f8577929537d43eed9f74241560821001b6c8613d6a7a21cff83f8431c6a70")
add_configs("freetype", {description = "Enable freetype support.", default = true, type = "boolean"})
add_configs("fontconfig", {description = "Enable fontconfig support.", default = true, type = "boolean"})
add_configs("xlib", {description = "Enable x11 surface backend.", default = is_plat("linux"), type = "boolean"})
add_deps("meson", "ninja")
add_deps("libpng", "pixman", "zlib", "freetype", "glib")
add_deps("libpng", "pixman", "zlib", "glib")
if is_plat("windows") then
add_deps("pkgconf")
add_deps("pkgconf", "libintl")
elseif is_plat("macosx") then
add_deps("libiconv", {system = true})
elseif is_plat("linux") then
add_deps("libiconv")
end
add_includedirs("include", "include/cairo")
@ -36,9 +42,15 @@ package("cairo")
if package:is_plat("windows") and not package:config("shared") then
package:add("defines", "CAIRO_WIN32_STATIC_BUILD=1")
end
if package:config("freetype") then
package:add("deps", "freetype")
end
if package:config("fontconfig") then
package:add("deps", "fontconfig")
end
if package:config("xlib") then
package:add("deps", "libx11", "libxrender", "libxext")
end
end)
on_install("windows|x64", "windows|x86", "macosx", "linux", function (package)
@ -48,19 +60,19 @@ package("cairo")
"--wrap-mode=nopromote",
"-Dtests=disabled",
"-Dgtk_doc=false",
"-Dfreetype=enabled",
"-Dgtk2-utils=disabled",
"-Dpng=enabled",
"-Dzlib=enabled",
"-Dglib=enabled"
}
table.insert(configs, "-Ddefault_library=" .. (package:config("shared") and "shared" or "static"))
table.insert(configs, "-Dfreetype=" .. (package:config("freetype") and "enabled" or "disabled"))
table.insert(configs, "-Dfontconfig=" .. (package:config("fontconfig") and "enabled" or "disabled"))
table.insert(configs, "-Dxlib=" .. (package:config("xlib") and "enabled" or "disabled"))
io.replace("meson.build", "subdir('fuzzing')", "", {plain = true})
io.replace("meson.build", "subdir('docs')", "", {plain = true})
io.replace("meson.build", "subdir('util')", "", {plain = true})
io.replace("meson.build", "'CoreFoundation'", "'CoreFoundation', 'Foundation'", {plain = true})
local envs = meson.buildenvs(package)
local envs = meson.buildenvs(package, {packagedeps = {"libintl", "libiconv"}})
if package:is_plat("windows") then
envs.PATH = package:dep("pkgconf"):installdir("bin") .. path.envsep() .. envs.PATH
end

@ -6,7 +6,7 @@ package("gdk-pixbuf")
add_urls("https://download.gnome.org/sources/gdk-pixbuf/$(version).tar.xz", {alias = "home", version = function (version)
return format("%d.%d/gdk-pixbuf-%s", version:major(), version:minor(), version)
end})
end, excludes = "*/tests/*"})
add_urls("https://gitlab.gnome.org/GNOME/gdk-pixbuf/-/archive/$(version)/gdk-pixbuf-$(version).tar.gz",
"https://gitlab.gnome.org/GNOME/gdk-pixbuf.git")
add_versions("home:2.42.10", "ee9b6c75d13ba096907a2e3c6b27b61bcd17f5c7ebeab5a5b439d2f2e39fe44b")
@ -24,8 +24,10 @@ package("gdk-pixbuf")
elseif is_plat("macosx") then
add_frameworks("Foundation", "CoreFoundation", "AppKit")
add_extsources("brew::gdk-pixbuf")
add_deps("libiconv", {system = true})
add_syslinks("resolv")
elseif is_plat("linux") then
add_deps("libiconv")
add_extsources("pacman::gdk-pixbuf2")
end
@ -48,7 +50,7 @@ package("gdk-pixbuf")
"-Dtests=false",
"-Dinstalled_tests=false"}
table.insert(configs, "-Ddefault_library=" .. (package:config("shared") and "shared" or "static"))
import("package.tools.meson").install(package, configs, {packagedeps = {"libjpeg-turbo", "libpng", "libtiff", "glib", "pcre2", "libintl"}})
import("package.tools.meson").install(package, configs, {packagedeps = {"libjpeg-turbo", "libpng", "libtiff", "glib", "pcre2", "libintl", "libiconv"}})
end)
on_test(function (package)

@ -67,7 +67,6 @@ package("glib")
end)
on_install("windows", "macosx", "linux", "cross", function (package)
import("package.tools.meson")
local configs = {"-Dbsymbolic_functions=false",
"-Ddtrace=false",
"-Dman=false",
@ -92,21 +91,7 @@ package("glib")
if package:is_plat("windows") then
io.gsub("meson.build", "dependency%('libffi',", "dependency('libffi', modules: ['libffi::ffi'],")
end
local envs = meson.buildenvs(package)
if package:is_plat("windows") then
for _, dep in ipairs(package:orderdeps()) do
local fetchinfo = dep:fetch()
if fetchinfo then
for _, includedir in ipairs(fetchinfo.includedirs or fetchinfo.sysincludedirs) do
envs.INCLUDE = (envs.INCLUDE or "") .. path.envsep() .. includedir
end
for _, linkdir in ipairs(fetchinfo.linkdirs) do
envs.LIB = (envs.LIB or "") .. path.envsep() .. linkdir
end
end
end
end
meson.install(package, configs, {envs = envs})
import("package.tools.meson").install(package, configs, {packagedeps = {"libintl", "libiconv", "libffi", "zlib"}})
package:addenv("PATH", "bin")
end)

@ -7,12 +7,29 @@ package("graphene")
add_urls("https://github.com/ebassi/graphene/releases/download/$(version)/graphene-$(version).tar.xz")
add_versions("1.10.6", "80ae57723e4608e6875626a88aaa6f56dd25df75024bd16e9d77e718c3560b25")
add_configs("gobject", {description = "Enable GObject types", default = true, type = "boolean"})
add_deps("meson", "ninja")
add_includedirs("include/graphene-1.0", "lib/graphene-1.0/include")
on_load(function (package)
if package:config("gobject") then
package:add("deps", "glib")
if package:is_plat("windows") then
package:add("deps", "pkgconf", "libintl")
elseif package:is_plat("macosx") then
package:add("deps", "libintl")
package:add("deps", "libiconv", {system = true})
elseif package:is_plat("linux") then
package:add("deps", "libiconv")
end
end
end)
on_install("windows", "macosx", "linux", function (package)
local configs = {"-Dinstalled_tests=false", "-Dgobject_types=false", "-Dintrospection=disabled"}
local configs = {"-Dtests=false", "-Dinstalled_tests=false", "-Dintrospection=disabled"}
table.insert(configs, "-Ddefault_library=" .. (package:config("shared") and "shared" or "static"))
import("package.tools.meson").install(package, configs)
table.insert(configs, "-Dgobject_types=" .. (package:config("gobject") and "true" or "false"))
import("package.tools.meson").install(package, configs, {packagedeps = {"libintl", "libiconv"}})
end)
on_test(function (package)

@ -4,11 +4,79 @@ package("gtk4")
set_description("Toolkit for creating graphical user interfaces")
set_license("LGPL-2.0-or-later")
if on_fetch then
on_fetch("linux", function (package, opt)
if opt.system and package.find_package then
return package:find_package("pkgconfig::gtk4")
end
end)
add_urls("https://download.gnome.org/sources/gtk/$(version).tar.xz", {version = function (version)
return format("%d.%d/gtk-%s", version:major(), version:minor(), version)
end})
add_versions("4.13.3", "4f04a43e7c287360473f34fc27b629f64875795f3bc7ec2781df449c5e72f312")
add_configs("shared", {description = "Build shared library.", default = true, type = "boolean", readonly = true})
add_configs("x11", {description = "Enable the X11 gdk backend.", default = is_plat("linux"), type = "boolean"})
add_configs("wayland", {description = "Enable the wayland gdk backend.", default = false, type = "boolean"})
on_fetch("windows", "macosx", "linux", function (package, opt)
if opt.system then
return package:find_package("pkgconfig::gtk4")
end
end)
if is_plat("linux") then
add_extsources("apt::libgtk-4-dev")
end
add_deps("meson", "ninja")
add_deps("glib", "pango", "cairo", "gdk-pixbuf", "libepoxy", "graphene", "fribidi", "pcre2")
add_deps("harfbuzz", {configs = {glib = true}})
if is_plat("linux") then
add_deps("libdrm")
add_deps("libiconv")
elseif is_plat("macosx") then
add_deps("libiconv", {system = true})
add_deps("libintl")
elseif is_plat("windows") then
add_deps("libintl")
end
add_includedirs("include/gtk-4.0")
on_load("windows|x64", "windows|x86", "macosx", "linux", function (package)
if package:config("x11") then
package:add("deps", "libx11", "libxrandr", "libxi", "libxcursor", "libxext", "libxdamage", "libxfixes", "libxinerama")
end
if package:config("wayland") then
package:add("deps", "wayland", "libxkbcommon")
end
end)
on_install("windows|x64", "windows|x86", "macosx", "linux", function (package)
local mesondir = package:dep("meson"):installdir()
local gnomemod = path.join(mesondir, "mesonbuild", "modules", "gnome.py")
if package:is_plat("windows") then
-- workaround https://github.com/mesonbuild/meson/issues/6710
io.replace(gnomemod, "absolute_paths=True,", "absolute_paths=False,#x", {plain = true})
end
io.replace("meson.build", "xext_dep,", "[x11_dep, xext_dep],", {plain = true})
io.replace("meson.build", "xi_dep)", "[x11_dep, xext_dep, xi_dep])", {plain = true})
local configs = {"-Dintrospection=disabled",
"-Dbuild-tests=false",
"-Dbuild-testsuite=false",
"-Dbuild-examples=false",
"-Dbuild-demos=false",
"-Dmedia-gstreamer=disabled",
"-Dmedia-ffmpeg=disabled"}
table.insert(configs, "-Dx11-backend=" .. (package:config("x11") and "true" or "false"))
table.insert(configs, "-Dwayland-backend=" .. (package:config("wayland") and "true" or "false"))
import("package.tools.meson").install(package, configs, {packagedeps = {"libintl", "libiconv", "pcre2"}})
if package:is_plat("windows") then
io.replace(gnomemod, "absolute_paths=False,#x", "absolute_paths=True,", {plain = true})
end
package:addenv("PATH", "bin")
end)
on_test(function (package)
assert(package:check_csnippets({test = [[
int test(int argc, char *argv[]) {
GtkApplication *app =
gtk_application_new("xmake.app", G_APPLICATION_DEFAULT_FLAGS);
return g_application_run(G_APPLICATION(app), argc, argv);
}
]]}, {includes = "gtk/gtk.h"}))
end)

@ -4,8 +4,8 @@ package("harfbuzz")
set_description("HarfBuzz is a text shaping library.")
set_license("MIT")
add_urls("https://github.com/harfbuzz/harfbuzz/archive/refs/tags/$(version).tar.gz",
"https://github.com/harfbuzz/harfbuzz.git")
add_urls("https://github.com/harfbuzz/harfbuzz/archive/refs/tags/$(version).tar.gz", {excludes = "README"})
add_urls("https://github.com/harfbuzz/harfbuzz.git")
add_versions("2.8.1", "b3f17394c5bccee456172b2b30ddec0bb87e9c5df38b4559a973d14ccd04509d")
add_versions("2.9.0", "bf5d5bad69ee44ff1dd08800c58cb433e9b3bf4dad5d7c6f1dec5d1cf0249d04")
add_versions("3.0.0", "55f7e36671b8c5569b6438f80efed2fd663298f785ad2819e115b35b5587ef69")
@ -22,6 +22,7 @@ package("harfbuzz")
add_configs("icu", {description = "Enable ICU library unicode functions.", default = false, type = "boolean"})
add_configs("freetype", {description = "Enable freetype interop helpers.", default = true, type = "boolean"})
add_configs("glib", {description = "Enable glib unicode functions.", default = false, type = "boolean"})
if is_plat("android") then
add_deps("cmake")
@ -47,6 +48,17 @@ package("harfbuzz")
if package:config("freetype") then
package:add("deps", "freetype")
end
if package:config("glib") then
package:add("deps", "glib", "pcre2")
if package:is_plat("windows") then
package:add("deps", "libintl")
elseif package:is_plat("macosx") then
package:add("deps", "libintl")
package:add("deps", "libiconv", {system = true})
elseif package:is_plat("linux") then
package:add("deps", "libiconv")
end
end
end)
on_install("android", function (package)
@ -59,30 +71,16 @@ package("harfbuzz")
end)
on_install(function (package)
import("package.tools.meson")
local configs = {"-Dtests=disabled", "-Ddocs=disabled", "-Dbenchmark=disabled", "-Dcairo=disabled", "-Dglib=disabled", "-Dgobject=disabled"}
local configs = {"-Dtests=disabled", "-Ddocs=disabled", "-Dbenchmark=disabled", "-Dcairo=disabled"}
if package:is_plat("macosx") then
table.insert(configs, "-Dcoretext=enabled")
end
table.insert(configs, "-Ddefault_library=" .. (package:config("shared") and "shared" or "static"))
table.insert(configs, "-Dicu=" .. (package:config("icu") and "enabled" or "disabled"))
table.insert(configs, "-Dfreetype=" .. (package:config("freetype") and "enabled" or "disabled"))
local envs = meson.buildenvs(package)
if package:is_plat("windows") then
for _, dep in ipairs(package:orderdeps()) do
local fetchinfo = dep:fetch()
if fetchinfo then
for _, includedir in ipairs(fetchinfo.includedirs or fetchinfo.sysincludedirs) do
envs.INCLUDE = (envs.INCLUDE or "") .. path.envsep() .. includedir
end
for _, linkdir in ipairs(fetchinfo.linkdirs) do
envs.LIB = (envs.LIB or "") .. path.envsep() .. linkdir
end
end
end
end
meson.install(package, configs, {envs = envs})
table.insert(configs, "-Dglib=" .. (package:config("glib") and "enabled" or "disabled"))
table.insert(configs, "-Dgobject=" .. (package:config("glib") and "enabled" or "disabled"))
import("package.tools.meson").install(package, configs, {packagedeps = {"libintl", "libiconv", "pcre2"}})
end)
on_test(function (package)

@ -0,0 +1,20 @@
package("libdrm")
set_homepage("https://gitlab.freedesktop.org/mesa/drm")
set_description("libdrm - userspace library for drm (direct rendering manager)")
add_urls("https://dri.freedesktop.org/libdrm/libdrm-$(version).tar.xz")
add_versions("2.4.118", "a777bd85f2b5fc9c57f886c82058300578317cafdbc77d0a769d7e9a9567ab88")
add_deps("meson", "ninja")
add_includedirs("include", "include/libdrm")
add_extsources("pkgconfig::libdrm", "pacman::libdrm", "apt::libdrm-dev")
on_install("linux", function (package)
local configs = {"-Dudev=true", "-Dvalgrind=disabled", "-Dman-pages=disabled", "-Dtests=false", "-Dcairo-tests=disabled", "-Dinstall-test-programs=false"}
table.insert(configs, "-Ddefault_library=" .. (package:config("shared") and "shared" or "static"))
import("package.tools.meson").install(package, configs)
end)
on_test(function (package)
assert(package:has_cfuncs("drmAvailable", {includes = "xf86drm.h"}))
end)

@ -10,8 +10,6 @@ package("libepoxy")
add_versions("1.5.9", "d168a19a6edfdd9977fef1308ccf516079856a4275cf876de688fb7927e365e4")
add_versions("1.5.10", "072cda4b59dd098bba8c2363a6247299db1fa89411dc221c8b81b8ee8192e623")
add_configs("shared", {description = "Build shared library.", default = true, type = "boolean", readonly = true})
if is_plat("linux") then
add_extsources("apt::libepoxy-dev")
add_deps("libx11", "pkg-config")
@ -19,7 +17,12 @@ package("libepoxy")
add_deps("meson", "ninja")
on_install("windows", "macosx", "linux", function (package)
import("package.tools.meson").install(package)
if package:is_plat("windows") and not package:config("shared") then
io.replace("include/epoxy/common.h", "__declspec(dllimport)", "", {plain = true})
end
local configs = {"-Dtests=false"}
table.insert(configs, "-Ddefault_library=" .. (package:config("shared") and "shared" or "static"))
import("package.tools.meson").install(package, configs)
end)
on_test(function (package)

@ -29,6 +29,10 @@ package("libjpeg-turbo")
end)
on_install("windows", "linux", "macosx", "android", "mingw", function (package)
if package:is_plat("windows") and not package:config("shared") then
io.replace("release/libjpeg.pc.in", "-ljpeg", "-ljpeg-static", {plain = true})
io.replace("release/libturbojpeg.pc.in", "-lturbojpeg", "-lturbojpeg-static", {plain = true})
end
local configs = {}
local jpeg = package:config("jpeg")
if jpeg == "7" then

@ -3,9 +3,10 @@ package("libxi")
set_homepage("https://www.x.org/")
set_description("X.Org: Library for the X Input Extension")
set_urls("https://www.x.org/archive/individual/lib/libXi-$(version).tar.bz2")
add_versions("1.7.10", "36a30d8f6383a72e7ce060298b4b181fd298bc3a135c8e201b7ca847f5f81061")
add_versions("1.8", "2ed181446a61c7337576467870bc5336fc9e222a281122d96c4d39a3298bba00")
set_urls("https://www.x.org/archive/individual/lib/libXi-$(version).tar.gz")
add_versions("1.7.10", "b51e106c445a49409f3da877aa2f9129839001b24697d75a54e5c60507e9a5e3")
add_versions("1.8", "c80fd200a1190e4406bb4cc6958839d9651638cb47fa546a595d4bebcd3b9e2d")
add_versions("1.8.1", "3b5f47c223e4b63d7f7fe758886b8bf665b20a7edb6962c423892fd150e326ea")
if is_plat("linux") then
add_extsources("apt::libxi-dev")

@ -7,16 +7,22 @@ package("nasm")
if is_host("windows") then
if os.arch() == "x64" then
add_urls("https://www.nasm.us/pub/nasm/releasebuilds/$(version)/win64/nasm-$(version)-win64.zip")
add_urls("https://github.com/xmake-mirror/nasm/releases/download/nasm-$(version)/nasm-$(version)-win64.zip")
add_versions("2.15.05", "f5c93c146f52b4f1664fa3ce6579f961a910e869ab0dae431bd871bdd2584ef2")
add_versions("2.16.01", "029eed31faf0d2c5f95783294432cbea6c15bf633430f254bb3c1f195c67ca3a")
else
add_urls("https://www.nasm.us/pub/nasm/releasebuilds/$(version)/win32/nasm-$(version)-win32.zip")
add_urls("https://github.com/xmake-mirror/nasm/releases/download/nasm-$(version)/nasm-$(version)-win32.zip")
add_versions("2.15.05", "258c7d1076e435511cf2fdf94e2281eadbdb9e3003fd57f356f446e2bce3119e")
add_versions("2.16.01", "e289fa70c88594b092c916344bb8bfcd6896b604bfab284ab57b1372997c820c")
end
else
add_urls("https://www.nasm.us/pub/nasm/releasebuilds/$(version)/nasm-$(version).tar.xz")
add_urls("https://github.com/xmake-mirror/nasm/releases/download/nasm-$(version)/nasm-$(version).tar.xz")
add_versions("2.13.03", "812ecfb0dcbc5bd409aaa8f61c7de94c5b8752a7b00c632883d15b2ed6452573")
add_versions("2.15.05", "3caf6729c1073bf96629b57cee31eeb54f4f8129b01902c73428836550b30a3f")
add_versions("2.16.01", "c77745f4802375efeee2ec5c0ad6b7f037ea9c87c92b149a9637ff099f162558")
end
on_install("@windows", "@mingw", "@msys", function (package)

@ -10,13 +10,17 @@ package("pango")
add_versions("1.50.3", "4a8b0cf33d5f9ecaa9cd99dd72703d5c4c53bc58df64dd9538493bb4356ab691")
add_deps("meson", "ninja")
add_deps("fontconfig", "freetype", "harfbuzz", "fribidi", "cairo", "glib", "pcre2")
add_deps("fontconfig", "freetype", "fribidi", "cairo", "glib", "pcre2")
add_deps("harfbuzz", {configs = {glib = true}})
if is_plat("windows") then
add_deps("libintl")
elseif is_plat("macosx") then
add_deps("libintl")
add_deps("libiconv", {system = true})
add_extsources("brew::pango")
add_frameworks("CoreFoundation")
elseif is_plat("linux") then
add_deps("libiconv")
add_deps("xorgproto")
add_extsources("apt::libpango-1.0-0", "pacman::pango")
end
@ -43,7 +47,7 @@ package("pango")
-- fix unexpected -Werror=array-bounds errors, see https://gitlab.gnome.org/GNOME/pango/-/issues/740
io.replace("meson.build", "'-Werror=array-bounds',", "", {plain = true})
local envs = meson.buildenvs(package, {packagedeps = {"fontconfig", "freetype", "harfbuzz", "fribidi", "cairo", "glib", "pcre2", "libintl"}})
local envs = meson.buildenvs(package, {packagedeps = {"fontconfig", "freetype", "harfbuzz", "fribidi", "cairo", "glib", "pcre2", "libintl", "libiconv"}})
-- workaround for https://github.com/xmake-io/xmake/issues/4412
envs.LDFLAGS = string.gsub(envs.LDFLAGS, "%-libpath:", "/libpath:")
meson.install(package, configs, {envs = envs})

Loading…
Cancel
Save