diff --git a/overlays/ports/libass/arm64-windows-asm.patch b/overlays/ports/libass/arm64-windows-asm.patch new file mode 100644 index 0000000..8828f8d --- /dev/null +++ b/overlays/ports/libass/arm64-windows-asm.patch @@ -0,0 +1,59 @@ +diff --git a/libass/meson.build b/libass/meson.build +index 5251c2f..a3429bb 100644 +--- a/libass/meson.build ++++ b/libass/meson.build +@@ -70,6 +70,28 @@ if enable_asm + + if asm_is_nasm + libass_src += asm_sources ++ elif asm_is_clang ++ clang = find_program('clang') ++ foreach asm_source : asm_sources ++ asm_output = fs.stem(asm_source.full_path()) + '.obj' ++ libass_src += custom_target( ++ asm_output, ++ input: asm_source, ++ output: asm_output, ++ depends: config_h, ++ command: [ ++ clang, ++ ] + asm_clang_args + [ ++ '-I' + meson.project_build_root(), ++ '-I' + meson.current_source_dir(), ++ ] + asm_args + [ ++ '-c', ++ '@INPUT@', ++ '-o', ++ '@OUTPUT@', ++ ], ++ ) ++ endforeach + else + asm_lib = static_library( + 'libass_asm', +diff --git a/meson.build b/meson.build +index 4b1c24e..b82233e 100644 +--- a/meson.build ++++ b/meson.build +@@ -207,7 +207,9 @@ endif + enable_asm = false + # used in libass/meson.build + asm_is_nasm = false ++asm_is_clang = false + asm_args = [] ++asm_clang_args = [] + + # ASM architecture variables + asm_option = get_option('asm') +@@ -276,6 +278,10 @@ if not asm_option.disabled() + enable_asm = true + conf.set('ARCH_AARCH64', 1) + if host_system == 'darwin' + asm_args += '-DPREFIX' ++ elif host_system == 'windows' and cc.get_argument_syntax() == 'msvc' and cc.get_id() != 'clang-cl' ++ # MSVC cannot compile GNU-style AArch64 .S sources. ++ asm_is_clang = true ++ asm_clang_args += '--target=arm64-pc-windows-msvc' + endif + else + warning( diff --git a/overlays/ports/libass/portfile.cmake b/overlays/ports/libass/portfile.cmake new file mode 100644 index 0000000..4ac9259 --- /dev/null +++ b/overlays/ports/libass/portfile.cmake @@ -0,0 +1,61 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO libass/libass + REF ${VERSION} + SHA512 08762623dd09e3034699ba9d11b70d1f6cc6b2e3b38aa897b07efef1364e76141df484e70ed27888cf3595b77d072cdb5e8abbbfa560e33ca21f87872e24df8d + HEAD_REF master + PATCHES + arm64-windows-asm.patch +) + +vcpkg_find_acquire_program(PKGCONFIG) +get_filename_component(PKGCONFIG_EXE_PATH "${PKGCONFIG}" DIRECTORY) +vcpkg_add_to_path("${PKGCONFIG_EXE_PATH}") + +list(APPEND options + -Dcheckasm=disabled + -Dcompare=disabled + -Dfuzz=disabled + -Dprofile=disabled + -Dtest=disabled +) + +if(NOT VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_OSX AND NOT VCPKG_TARGET_IS_LINUX) + # On non-desktop targets (e.g. Android, iOS, Emscripten) there is no + # system font provider and fontconfig headers are not available, so + # disable both the system-font-provider requirement and the fontconfig + # integration to prevent meson from compiling ass_fontconfig.c. + list(APPEND options -Drequire-system-font-provider=false -Dfontconfig=disabled) +endif() + +set(asm_option disabled) +set(additional_binaries "") +if(VCPKG_TARGET_ARCHITECTURE MATCHES "^(x86|x64|arm64)$") + set(asm_option enabled) + if(VCPKG_TARGET_ARCHITECTURE MATCHES "^(x86|x64)$") + vcpkg_find_acquire_program(NASM) + get_filename_component(NASM_EXE_PATH "${NASM}" DIRECTORY) + vcpkg_add_to_path("${NASM_EXE_PATH}") + elseif(VCPKG_TARGET_IS_WINDOWS AND VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") + vcpkg_find_acquire_program(CLANG) + list(APPEND additional_binaries "clang = ['${CLANG}']") + endif() +else() + message(WARNING "Assembly optimizations are not supported on ${VCPKG_TARGET_ARCHITECTURE}; disabling assembly optimizations.") +endif() +list(APPEND options -Dasm=${asm_option}) + +vcpkg_configure_meson( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + ${options} + ADDITIONAL_BINARIES + ${additional_binaries} +) + +vcpkg_install_meson() +vcpkg_copy_pdbs() +vcpkg_fixup_pkgconfig() + +# Handle copyright +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING") diff --git a/overlays/ports/libass/vcpkg.json b/overlays/ports/libass/vcpkg.json new file mode 100644 index 0000000..8ffa242 --- /dev/null +++ b/overlays/ports/libass/vcpkg.json @@ -0,0 +1,21 @@ +{ + "name": "libass", + "version": "0.17.4", + "port-version": 1, + "description": "libass is a portable subtitle renderer for the ASS/SSA (Advanced Substation Alpha/Substation Alpha) subtitle format", + "homepage": "https://github.com/libass/libass", + "license": "ISC", + "dependencies": [ + { + "name": "fontconfig", + "platform": "linux | osx" + }, + "freetype", + "fribidi", + "harfbuzz", + { + "name": "vcpkg-tool-meson", + "host": true + } + ] +}