Browse Source

enable pango on windows (#2848)

Hoildkv 1 year ago
parent
commit
f6a4a46152

+ 8 - 9
packages/c/cairo/xmake.lua

@@ -12,6 +12,8 @@ package("cairo")
 
     add_patches("1.18.0", path.join(os.scriptdir(), "patches", "1.18.0", "alloca.patch"), "55f8577929537d43eed9f74241560821001b6c8613d6a7a21cff83f8431c6a70")
 
+    add_configs("fontconfig", {description = "Enable fontconfig support.", default = true, type = "boolean"})
+
     add_deps("meson", "ninja")
     add_deps("libpng", "pixman", "zlib", "freetype", "glib")
     if is_plat("windows") then
@@ -22,7 +24,6 @@ package("cairo")
 
     if is_plat("linux", "macosx") then
         add_syslinks("pthread")
-        add_deps("fontconfig")
     end
 
     if is_plat("windows") then
@@ -31,10 +32,13 @@ package("cairo")
         add_frameworks("CoreGraphics", "CoreFoundation", "CoreText", "Foundation")
     end
 
-    on_load("windows", function (package)
-        if not package:config("shared") then
+    on_load("windows|x64", "windows|x86", "macosx", "linux", function (package)
+        if package:is_plat("windows") and not package:config("shared") then
             package:add("defines", "CAIRO_WIN32_STATIC_BUILD=1")
         end
+        if package:config("fontconfig") then
+            package:add("deps", "fontconfig")
+        end
     end)
 
     on_install("windows|x64", "windows|x86", "macosx", "linux", function (package)
@@ -50,13 +54,8 @@ package("cairo")
             "-Dzlib=enabled",
             "-Dglib=enabled"
         }
-        if package:is_plat("macosx") or package:is_plat("linux") then
-            table.insert(configs, "-Dfontconfig=enabled")
-        else
-            table.insert(configs, "-Dfontconfig=disabled")
-        end
-        table.insert(configs, "-Ddebug=" .. (package:debug() and "true" or "false"))
         table.insert(configs, "-Ddefault_library=" .. (package:config("shared") and "shared" or "static"))
+        table.insert(configs, "-Dfontconfig=" .. (package:config("fontconfig") 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})

+ 5 - 7
packages/g/glib/xmake.lua

@@ -4,19 +4,15 @@ package("glib")
     set_description("Low-level core library that forms the basis for projects such as GTK+ and GNOME.")
     set_license("LGPL-2.1")
 
-    add_urls("https://download.gnome.org/sources/glib/2.78/glib-2.78.1.tar.xz", {alias = "home", version = function (version)
+    add_urls("https://download.gnome.org/sources/glib/$(version).tar.xz", {alias = "home", version = function (version)
         return format("%d.%d/glib-%s", version:major(), version:minor(), version)
-    end})
+    end, excludes = {"*/COPYING"}})
     add_urls("https://gitlab.gnome.org/GNOME/glib/-/archive/$(version)/glib-$(version).tar.gz", {alias = "gitlab"})
     add_urls("https://gitlab.gnome.org/GNOME/glib.git")
     add_versions("home:2.71.0", "926816526f6e4bba9af726970ff87be7dac0b70d5805050c6207b7bb17ea4fca")
     add_versions("home:2.78.1", "915bc3d0f8507d650ead3832e2f8fb670fce59aac4d7754a7dab6f1e6fed78b2")
     add_patches("2.71.0", path.join(os.scriptdir(), "patches", "2.71.0", "macosx.patch"), "a0c928643e40f3a3dfdce52950486c7f5e6f6e9cfbd76b20c7c5b43de51d6399")
 
-    if is_plat("windows") then
-        add_configs("shared", {description = "Build shared library.", default = true, type = "boolean", readonly = true})
-    end
-
     add_deps("meson", "ninja", "libffi", "zlib")
     if is_plat("linux") then
         add_deps("libiconv")
@@ -29,7 +25,9 @@ package("glib")
 
     add_includedirs("include/glib-2.0", "lib/glib-2.0/include")
     add_links("gio-2.0", "gobject-2.0", "gthread-2.0", "gmodule-2.0", "glib-2.0")
-    if is_plat("macosx") then
+    if is_plat("windows") then
+        add_syslinks("user32", "shell32", "ole32", "ws2_32", "shlwapi")
+    elseif is_plat("macosx") then
         add_frameworks("Foundation", "CoreFoundation")
         add_extsources("brew::glib")
     elseif is_plat("linux") then

+ 1 - 0
packages/m/meson/xmake.lua

@@ -6,6 +6,7 @@ package("meson")
 
     add_urls("https://github.com/mesonbuild/meson/releases/download/$(version)/meson-$(version).tar.gz",
              "https://github.com/mesonbuild/meson.git")
+    add_versions("1.3.0",  "4ba253ef60e454e23234696119cbafa082a0aead0bd3bbf6991295054795f5dc")
     add_versions("1.1.1",  "d04b541f97ca439fb82fab7d0d480988be4bd4e62563a5ca35fadb5400727b1c")
     add_versions("1.1.0",  "d9616c44cd6c53689ff8f05fc6958a693f2e17c3472a8daf83cee55dabff829f")
     add_versions("1.0.0",  "aa50a4ba4557c25e7d48446abfde857957dcdf58385fffbe670ba0e8efacce05")

+ 12 - 8
packages/p/pango/xmake.lua

@@ -4,14 +4,16 @@ package("pango")
     set_description("Framework for layout and rendering of i18n text")
     set_license("LGPL-2.0")
 
-    set_urls("https://gitlab.gnome.org/GNOME/pango/-/archive/$(version)/pango-$(version).tar.gz")
+    add_urls("https://gitlab.gnome.org/GNOME/pango/-/archive/$(version)/pango-$(version).tar.gz")
     add_urls("https://gitlab.gnome.org/GNOME/pango.git")
-
+    add_versions("1.51.1", "ea92cd570cdba62ca52cc0a7c9ea3cd311b6da3f0328a5aa8a4a81b0a74944a5")
     add_versions("1.50.3", "4a8b0cf33d5f9ecaa9cd99dd72703d5c4c53bc58df64dd9538493bb4356ab691")
 
     add_deps("meson", "ninja")
-    add_deps("fontconfig", "freetype", "harfbuzz", "fribidi", "cairo", "glib")
-    if is_plat("macosx") then
+    add_deps("fontconfig", "freetype", "harfbuzz", "fribidi", "cairo", "glib", "pcre2")
+    if is_plat("windows") then
+        add_deps("libintl")
+    elseif is_plat("macosx") then
         add_extsources("brew::pango")
         add_frameworks("CoreFoundation")
     elseif is_plat("linux") then
@@ -20,11 +22,10 @@ package("pango")
     end
     add_includedirs("include", "include/pango-1.0")
 
-    on_install("macosx", "linux", function (package)
+    on_install("windows|x64", "windows|x86", "macosx", "linux", function (package)
         import("package.tools.meson")
         local configs = {"-Dintrospection=disabled", "-Dgtk_doc=false", "-Dfontconfig=enabled"}
-        
-        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'%)", "")
@@ -42,7 +43,10 @@ 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})
 
-        meson.install(package, configs, {packagedeps = {"fontconfig", "freetype", "harfbuzz", "fribidi", "cairo", "glib"}})
+        local envs = meson.buildenvs(package, {packagedeps = {"fontconfig", "freetype", "harfbuzz", "fribidi", "cairo", "glib", "pcre2", "libintl"}})
+        -- workaround for https://github.com/xmake-io/xmake/issues/4412
+        envs.LDFLAGS = string.gsub(envs.LDFLAGS, "%-libpath:", "/libpath:")
+        meson.install(package, configs, {envs = envs})
     end)
 
     on_test(function (package)

+ 6 - 5
packages/p/pcre2/xmake.lua

@@ -4,6 +4,7 @@ package("pcre2")
     set_description("A Perl Compatible Regular Expressions Library")
 
     set_urls("https://github.com/PhilipHazel/pcre2/releases/download/pcre2-$(version)/pcre2-$(version).tar.gz")
+    add_versions("10.42", "c33b418e3b936ee3153de2c61cc638e7e4fe3156022a5c77d0711bcbb9d64f1f")
     add_versions("10.40", "ded42661cab30ada2e72ebff9e725e745b4b16ce831993635136f2ef86177724")
     add_versions("10.39", "0781bd2536ef5279b1943471fdcdbd9961a2845e1d2c9ad849b9bd98ba1a9bd4")
 
@@ -20,11 +21,8 @@ package("pcre2")
         if package:is_plat("windows") and package:debug() then
             suffix = "d"
         end
-        if package:version():ge("10.39") and package:is_plat("windows") and not package:config("shared") then
-            package:add("links", "pcre2-" .. bitwidth .. "-static" .. suffix)
-        else
-            package:add("links", "pcre2-" .. bitwidth .. suffix)
-        end
+        package:add("links", "pcre2-posix" .. suffix)
+        package:add("links", "pcre2-" .. bitwidth .. suffix)
         package:add("defines", "PCRE2_CODE_UNIT_WIDTH=" .. bitwidth)
         if not package:config("shared") then
             package:add("defines", "PCRE2_STATIC")
@@ -35,9 +33,12 @@ package("pcre2")
         if package:version():lt("10.21") then
             io.replace("CMakeLists.txt", [[SET(CMAKE_C_FLAGS -I${PROJECT_SOURCE_DIR}/src)]], [[SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${PROJECT_SOURCE_DIR}/src")]], {plain = true})
         end
+        io.replace("CMakeLists.txt", "OUTPUT_NAME pcre2%-(%w-)%-static", "OUTPUT_NAME pcre2-%1")
         local configs = {"-DPCRE2_BUILD_TESTS=OFF", "-DPCRE2_BUILD_PCRE2GREP=OFF"}
+        table.insert(configs, "-DBUILD_STATIC_LIBS=" .. (package:config("shared") and "OFF" or "ON"))
         table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
         table.insert(configs, "-DPCRE2_SUPPORT_JIT=" .. (package:config("jit") and "ON" or "OFF"))
+        table.insert(configs, "-DPCRE2_STATIC_PIC=" .. (package:config("pic") and "ON" or "OFF"))
         local bitwidth = package:config("bitwidth") or "8"
         if bitwidth ~= "8" then
             table.insert(configs, "-DPCRE2_BUILD_PCRE2_8=OFF")

+ 4 - 1
packages/p/pkgconf/xmake.lua

@@ -3,18 +3,21 @@ package("pkgconf")
     set_homepage("http://pkgconf.org")
     set_description("A program which helps to configure compiler and linker flags for development frameworks.")
 
-    add_urls("https://distfiles.ariadne.space/pkgconf/pkgconf-$(version).tar.xz", {alias = "tarball"})
+    add_urls("https://distfiles.dereferenced.org/pkgconf/pkgconf-$(version).tar.xz",
+             "https://distfiles.ariadne.space/pkgconf/pkgconf-$(version).tar.xz", {alias = "tarball"})
     add_urls("https://github.com/pkgconf/pkgconf.git", {alias = "git"})
     add_versions("tarball:1.7.4", "d73f32c248a4591139a6b17777c80d4deab6b414ec2b3d21d0a24be348c476ab")
     add_versions("tarball:1.8.0", "ef9c7e61822b7cb8356e6e9e1dca58d9556f3200d78acab35e4347e9d4c2bbaf")
     add_versions("tarball:1.9.3", "5fb355b487d54fb6d341e4f18d4e2f7e813a6622cf03a9e87affa6a40565699d")
     add_versions("tarball:1.9.4", "daccf1bbe5a30d149b556c7d2ffffeafd76d7b514e249271abdd501533c1d8ae")
     add_versions("tarball:1.9.5", "1ac1656debb27497563036f7bffc281490f83f9b8457c0d60bcfb638fb6b6171")
+    add_versions("tarball:2.0.3", "cabdf3c474529854f7ccce8573c5ac68ad34a7e621037535cbc3981f6b23836c")
     add_versions("git:1.7.4", "pkgconf-1.7.4")
     add_versions("git:1.8.0", "pkgconf-1.8.0")
     add_versions("git:1.9.3", "pkgconf-1.9.3")
     add_versions("git:1.9.4", "pkgconf-1.9.4")
     add_versions("git:1.9.5", "pkgconf-1.9.5")
+    add_versions("git:2.0.3", "pkgconf-2.0.3")
 
     on_load(function (package)
         if not package:is_precompiled() and is_host("windows") then