diff --git a/packages/f/freetype/xmake.lua b/packages/f/freetype/xmake.lua index 93a648277..27cc85f28 100644 --- a/packages/f/freetype/xmake.lua +++ b/packages/f/freetype/xmake.lua @@ -5,7 +5,8 @@ package("freetype") add_urls("https://downloads.sourceforge.net/project/freetype/freetype2/$(version)/freetype-$(version).tar.gz", "https://download.savannah.gnu.org/releases/freetype/freetype-$(version).tar.gz", {alias="archive"}) - add_urls("https://gitlab.freedesktop.org/freetype/freetype.git", {alias = "git"}) + add_urls("https://gitlab.freedesktop.org/freetype/freetype.git", + "https://github.com/freetype/freetype.git", {alias = "git"}) add_versions("archive:2.13.1", "0b109c59914f25b4411a8de2a506fdd18fa8457eb86eca6c7b15c19110a92fa5") add_versions("archive:2.13.0", "a7aca0e532a276ea8d85bd31149f0a74c33d19c8d287116ef8f5f8357b4f1f80") @@ -72,7 +73,11 @@ package("freetype") table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) local function add_dep(opt) if package:config(opt.conf) then - table.insert(configs, "-DFT_WITH_" .. opt.cmakewith .. "=ON") + if package:version():ge("2.11.1") then + table.insert(configs, "-DFT_REQUIRE_" .. opt.cmakewith .. "=ON") + else + table.insert(configs, "-DFT_WITH_" .. opt.cmakewith .. "=ON") + end local lib = package:dep(opt.pkg or opt.conf) if lib and not lib:is_system() then @@ -85,7 +90,11 @@ package("freetype") end end else - table.insert(configs, "-DCMAKE_DISABLE_FIND_PACKAGE_" .. (opt.cmakedisable or opt.cmakewith) .. "=ON") + if package:version():ge("2.11.1") then + table.insert(configs, "-DFT_DISABLE_" .. opt.cmakewith .. "=ON") + else + table.insert(configs, "-DCMAKE_DISABLE_FIND_PACKAGE_" .. (opt.cmakedisable or opt.cmakewith) .. "=ON") + end end end add_dep({conf = "bzip2", cmakewith = "BZIP2", cmakedisable = "BZip2", cmakeinclude = "BZIP2_INCLUDE_DIR"}) diff --git a/packages/f/fribidi/xmake.lua b/packages/f/fribidi/xmake.lua index c2dc30f01..15c951cfe 100644 --- a/packages/f/fribidi/xmake.lua +++ b/packages/f/fribidi/xmake.lua @@ -8,26 +8,26 @@ package("fribidi") add_versions("1.0.10", "7f1c687c7831499bcacae5e8675945a39bacbad16ecaa945e9454a32df653c01") add_versions("1.0.11", "30f93e9c63ee627d1a2cedcf59ac34d45bf30240982f99e44c6e015466b4e73d") add_versions("1.0.12", "0cd233f97fc8c67bb3ac27ce8440def5d3ffacf516765b91c2cc654498293495") + add_versions("1.0.13", "7fa16c80c81bd622f7b198d31356da139cc318a63fc7761217af4130903f54a2") - if is_plat("windows") then + if not is_plat("macosx", "linux", "bsd") then add_deps("meson", "ninja") elseif is_plat("linux") then add_extsources("apt::libfribidi-dev", "pacman::fribidi") end + if is_plat("wasm") then + add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true}) + end + + add_includedirs("include", "include/fribidi") on_load("windows", function (package) if not package:config("shared") then package:add("defines", "FRIBIDI_LIB_STATIC") end end) - on_install("windows", function (package) - local configs = {"-Ddocs=false", "-Dtests=false"} - table.insert(configs, "-Ddefault_library=" .. (package:config("shared") and "shared" or "static")) - import("package.tools.meson").install(package, configs) - end) - - on_install("macosx", "linux", function (package) + on_install("macosx", "linux", "bsd", function (package) local configs = {} table.insert(configs, "--enable-shared=" .. (package:config("shared") and "yes" or "no")) table.insert(configs, "--enable-static=" .. (package:config("shared") and "no" or "yes")) @@ -37,6 +37,12 @@ package("fribidi") import("package.tools.autoconf").install(package, configs) end) + on_install(function (package) + local configs = {"-Ddocs=false", "-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) assert(package:has_cfuncs("fribidi_debug_status", {includes = "fribidi/fribidi-common.h"})) end) diff --git a/packages/h/harfbuzz/xmake.lua b/packages/h/harfbuzz/xmake.lua index 3e03b8737..c55624e88 100644 --- a/packages/h/harfbuzz/xmake.lua +++ b/packages/h/harfbuzz/xmake.lua @@ -10,16 +10,36 @@ package("harfbuzz") add_versions("2.9.0", "bf5d5bad69ee44ff1dd08800c58cb433e9b3bf4dad5d7c6f1dec5d1cf0249d04") add_versions("3.0.0", "55f7e36671b8c5569b6438f80efed2fd663298f785ad2819e115b35b5587ef69") add_versions("3.1.1", "5283c7f5f1f06ddb5e2e88319f6946ea37d2eb3a574e0f73f6000de8f9aa34e6") + add_versions("4.4.1", "1a95b091a40546a211b6f38a65ccd0950fa5be38d95c77b5c4fa245130b418e1") + add_versions("5.3.1", "77c8c903f4539b050a6d3a5be79705c7ccf7b1cb66d68152a651486e261edbd2") + add_versions("6.0.0", "6d753948587db3c7c3ba8cc4f8e6bf83f5c448d2591a9f7ec306467f3a4fe4fa") + add_versions("7.3.0", "7cefc6cc161e9d5c88210dafc43bc733ca3e383fd3dd4f1e6178f81bd41cfaae") + add_versions("8.0.0", "a8e8ec6f0befce0bd5345dd741d2f88534685a798002e343a38b7f9b2e00c884") + add_versions("8.0.1", "d54ca67b6a0bf732b66a343566446d7f93df2bb850133f886c0082fb618a06b2") + add_versions("8.1.0", "8d544f1b74797b7b4d88f586e3b9202528b3e8c17968d28b7cdde02041bff5a0") + add_versions("8.1.1", "b16e6bc0fc7e6a218583f40c7d201771f2e3072f85ef6e9217b36c1dc6b2aa25") 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_deps("meson") + if is_plat("android") then + add_deps("cmake") + else + add_deps("meson", "ninja") + if is_plat("windows") then + add_deps("pkgconf") + end + end add_includedirs("include", "include/harfbuzz") if is_plat("macosx") then add_frameworks("CoreText", "CoreFoundation", "CoreGraphics") + elseif is_plat("bsd", "android") then + add_configs("freetype", {description = "Enable freetype interop helpers.", default = false, type = "boolean", readonly = true}) + elseif is_plat("wasm") then + add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true}) end - on_load("windows", "linux", "macosx", function (package) + + on_load(function (package) if package:config("icu") then package:add("deps", "icu4c") end @@ -28,7 +48,16 @@ package("harfbuzz") end end) - on_install("windows", "linux", "macosx", function (package) + on_install("android", function (package) + local configs = {"-DHB_HAVE_GLIB=OFF", "-DHB_HAVE_GOBJECT=OFF"} + table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) + table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) + table.insert(configs, "-DHB_HAVE_FREETYPE=" .. (package:config("freetype") and "ON" or "OFF")) + table.insert(configs, "-DHB_HAVE_ICU=" .. (package:config("icu") and "ON" or "OFF")) + import("package.tools.cmake").install(package, configs) + end) + + on_install(function (package) import("package.tools.meson") local configs = {"-Dtests=disabled", "-Ddocs=disabled", "-Dbenchmark=disabled", "-Dcairo=disabled", "-Dglib=disabled", "-Dgobject=disabled"} diff --git a/packages/l/libass/port/config.h.in b/packages/l/libass/port/config.h.in new file mode 100644 index 000000000..f09e8906f --- /dev/null +++ b/packages/l/libass/port/config.h.in @@ -0,0 +1,12 @@ +/* found CoreText framework */ +#undef CONFIG_CORETEXT + +/* found DirectWrite and GDI (Win32) */ +#undef CONFIG_DIRECTWRITE + +/* found libpng via pkg-config */ +#undef CONFIG_LIBPNG +#define CONFIG_SOURCEVERSION "commit: ${GIT_TAG}${GIT_COMMIT_LONG}" +${define HAVE_STRDUP} +${define HAVE_STRNDUP} + diff --git a/packages/l/libass/port/xmake.lua b/packages/l/libass/port/xmake.lua new file mode 100644 index 000000000..b59682374 --- /dev/null +++ b/packages/l/libass/port/xmake.lua @@ -0,0 +1,98 @@ +set_project("libass") +add_requires("freetype", "fribidi", "harfbuzz") + +includes("check_cfuncs.lua") +add_rules("mode.debug", "mode.release") +if is_plat("windows") and is_kind("shared") then + add_rules("utils.symbols.export_all") +end + +option("asm") + set_default(true) + set_description("compiling with ASM") + add_defines("CONFIG_ASM") +option("large-tiles") + set_default(false) + set_description("use larger tiles in the rasterizer (better performance, slightly worse quality)") + add_defines("CONFIG_LARGE_TILES") +option("system-font-provider") + on_check(function (option) + option:enable(not is_plat("wasm")) + end) + set_description("enable checking for system fonts provider") + +target("ass") + set_kind("$(kind)") + add_options("asm", "large-tiles", "system-font-provider") + add_packages("freetype", "fribidi", "harfbuzz") + add_files("libass/*.c|ass_fontconfig.c|ass_directwrite.c|ass_coretext.c", + "libass/c/*.c") + add_includedirs("libass", "libass/c", "$(buildir)") + if not is_plat("windows") then + add_syslinks("m") + end + add_configfiles("config.h.in") + configvar_check_cfuncs("HAVE_STRDUP", "strdup", {includes = "string.h"}) + configvar_check_cfuncs("HAVE_STRNDUP", "strndup", {includes = "string.h"}) + if has_config("asm") then + if is_arch("x64", "x86", "x86_64") then + set_toolchains("nasm") + add_files("libass/x86/*.asm|utils.asm|x86inc.asm") + add_includedirs("libass/x86") + add_defines("ARCH_X86=1", "private_prefix=ass") + if is_arch("x86") then + add_defines("ARCH_X86_64=0", "BITMODE=32") + else + add_defines("ARCH_X86_64=1", "BITMODE=64") + end + if is_plat("windows") and is_arch("x86") then + add_defines("PREFIX") + elseif is_plat("macosx") then + add_defines("PREFIX", "STACK_ALIGNMENT=16") + elseif is_plat("linux") then + add_defines("STACK_ALIGNMENT=16") + end + elseif is_arch("arm64.*", "aarch64") then + add_files("libass/aarch64/*.S") + add_defines("ARCH_AARCH64") + end + end + if has_config("system-font-provider") then + on_config(function (target) + -- directwrite + if target:is_plat("windows", "mingw") and target:has_cincludes("dwrite_c.h") then + if target:check_csnippets([[#include + #if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) + #error Win32 desktop APIs are available + #endif]]) then + target:add("syslinks", "dwrite") + else + target:add("syslinks", "gdi32") + end + if target:kind() == "shared" then + target:add("syslinks", "user32") + end + target:add("files", "libass/ass_directwrite.c") + target:add("defines", "CONFIG_DIRECTWRITE") + end + -- coretext + if target:is_plat("macosx") then + if target:has_cfuncs("CTFontDescriptorCopyAttribute", {includes = "ApplicationServices/ApplicationServices.h"}) then + target:add("frameworks", "ApplicationServices", "CoreFoundation") + target:add("files", "libass/ass_coretext.c") + target:add("defines", "CONFIG_CORETEXT=1") + elseif target:has_cincludes("CoreText/CoreText.h") then + target:add("frameworks", "CoreText", "CoreFoundation") + target:add("files", "libass/ass_coretext.c") + target:add("defines", "CONFIG_CORETEXT=1") + end + end + -- fontconfig + if target:has_cincludes("fontconfig/fontconfig.h") then + target:add("files", "libass/ass_fontconfig.c") + target:add("defines", "CONFIG_FONTCONFIG") + target:add("syslinks", "fontconfig") + end + end) + end + add_headerfiles("libass/ass.h", "libass/ass_types.h", {prefix = "include/libass"}) diff --git a/packages/l/libass/xmake.lua b/packages/l/libass/xmake.lua new file mode 100644 index 000000000..06e407085 --- /dev/null +++ b/packages/l/libass/xmake.lua @@ -0,0 +1,32 @@ +package("libass") + set_homepage("https://github.com/libass/libass") + set_description("libass is a portable subtitle renderer for the ASS/SSA (Advanced Substation Alpha/Substation Alpha) subtitle format.") + set_license("ISC") + + add_urls("https://github.com/libass/libass/releases/download/$(version)/libass-$(version).tar.gz", + "https://github.com/libass/libass.git") + + add_versions("0.15.2", "1b2a54dda819ef84fa2dee3069cf99748a886363d2adb630fde87fe046e2d1d5") + add_versions("0.16.0", "fea8019b1887cab9ab00c1e58614b4ec2b1cee339b3f7e446f5fab01b032d430") + add_versions("0.17.0", "72b9ba5d9dd1ac6d30b5962f38cbe7aefb180174f71d8b65c5e3c3060dbc403f") + add_versions("0.17.1", "d653be97198a0543c69111122173c41a99e0b91426f9e17f06a858982c2fb03d") + + add_deps("freetype", "fribidi", "harfbuzz", "nasm") + + if is_plat("wasm") then + add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true}) + end + + on_install(function (package) + os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua") + os.cp(path.join(package:scriptdir(), "port", "config.h.in"), "config.h.in") + local configs = {} + if package:config("shared") then + configs.kind = "shared" + end + import("package.tools.xmake").install(package, configs) + end) + + on_test(function (package) + assert(package:has_cfuncs("ass_library_init", {includes = "ass.h"})) + end) diff --git a/packages/m/meson/xmake.lua b/packages/m/meson/xmake.lua index cc7a9e730..948d408e3 100644 --- a/packages/m/meson/xmake.lua +++ b/packages/m/meson/xmake.lua @@ -24,7 +24,7 @@ package("meson") -- https://github.com/xmake-io/xmake-repo/issues/1937 set_policy("package.precompiled", false) - on_install("@macosx", "@linux", "@windows", "@msys", function (package) + on_install("@macosx", "@linux", "@bsd", "@windows", "@msys", function (package) local envs = {PYTHONPATH = package:installdir()} local python = package:is_plat("windows") and "python" or "python3" os.vrunv(python, {"-m", "pip", "install", "--target=" .. package:installdir(), "."}, {envs = envs})