From 63e39757b542af74fdc6d40aa99155b6828e6e9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8F=9C=E5=A7=AC?= Date: Fri, 20 May 2022 05:14:39 +0800 Subject: [PATCH] [libass] update to 0.16.0 (#24749) * [libass] update to 0.16.0 * [libass] Add to versions file --- ports/libass/CMakeLists.txt | 64 +++++++++++++++++++++++++------------ ports/libass/config.h.in | 2 +- ports/libass/portfile.cmake | 10 +++--- ports/libass/vcpkg.json | 13 ++++---- versions/baseline.json | 2 +- versions/l-/libass.json | 5 +++ 6 files changed, 63 insertions(+), 33 deletions(-) diff --git a/ports/libass/CMakeLists.txt b/ports/libass/CMakeLists.txt index b2331d3257..9fb8548cb1 100644 --- a/ports/libass/CMakeLists.txt +++ b/ports/libass/CMakeLists.txt @@ -1,38 +1,63 @@ cmake_minimum_required(VERSION 3.9) project(libass C CXX) -set(LIBASS_VERSION 0.15.1) +set(LIBASS_VERSION 0.16.0) configure_file (${CMAKE_CURRENT_SOURCE_DIR}/config.h.in config.h) include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) -if(WIN32) - add_compile_definitions(CONFIG_DIRECTWRITE) -elseif(APPLE) - add_compile_definitions(CONFIG_CORETEXT) -else() - add_compile_definitions(CONFIG_FONTCONFIG) -endif() - add_compile_definitions(CONFIG_FREETYPE) add_compile_definitions(CONFIG_FRIBIDI) add_compile_definitions(CONFIG_HARFBUZZ) file (GLOB_RECURSE SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/libass/*.c) -set(FONTCONFIG_LIBRARY) + +include(CheckCSourceCompiles) +set(PKG_REQUIRES_LIBASS "harfbuzz >= 1.2.3, fribidi >= 0.19.1, freetype2 >= 9.17.3") +set(PKG_LIBS_LIBASS) if(WIN32) + add_compile_definitions(CONFIG_DIRECTWRITE) list(FILTER SOURCES EXCLUDE REGEX ".*ass_coretext.c$") list(FILTER SOURCES EXCLUDE REGEX ".*ass_fontconfig.c$") + + #dependency fribidi does not support uwp builds, link gdi32 directly + set(FONT_LIBRARY gdi32) + set(PKG_LIBS_LIBASS -lgdi32) elseif(APPLE) + add_compile_definitions(CONFIG_CORETEXT) list(FILTER SOURCES EXCLUDE REGEX ".*ass_directwrite.c$") list(FILTER SOURCES EXCLUDE REGEX ".*ass_fontconfig.c$") + + check_c_source_compiles( + " + #include + int main(void){ + CTFontDescriptorCopyAttribute(NULL, kCTFontURLAttribute); + return 0; + } + " + CHECK_OLD_OSX + ) + if (CHECK_OLD_OSX) + set(FONT_LIBRARY "-framework ApplicationServices -framework CoreFoundation") + set(PKG_LIBS_LIBASS "-framework ApplicationServices -framework CoreFoundation") + else() + set(FONT_LIBRARY "-framework CoreText -framework CoreFoundation") + set(PKG_LIBS_LIBASS "-framework CoreText -framework CoreFoundation") + endif() else() + add_compile_definitions(CONFIG_FONTCONFIG) list(FILTER SOURCES EXCLUDE REGEX ".*ass_coretext.c$") list(FILTER SOURCES EXCLUDE REGEX ".*ass_directwrite.c$") find_package(Fontconfig REQUIRED) - set(FONTCONFIG_LIBRARY Fontconfig::Fontconfig) + set(FONT_LIBRARY Fontconfig::Fontconfig) + set(PKG_REQUIRES_LIBASS "fontconfig >= 2.10.92, ${PKG_REQUIRES_LIBASS}") +endif() + +if (NOT WIN32) + set(PKG_LIBS_LIBASS "${PKG_LIBS_LIBASS} -lm") endif() find_package(Freetype REQUIRED) @@ -45,8 +70,8 @@ find_path(HARFBUZZ_INCLUDE_DIR NAMES hb.h PATH_SUFFIXES harfbuzz) -find_path(DIRENT_INCLUDE_DIR - NAMES dirent.h) +# libass use win32 api to open files on windows since https://github.com/libass/libass/commit/f664ced049394e2a5d4300ba526e206df73ec729 +# so remove dependency dirent. find_library(FRIBIDI_LIBRARY NAMES libfribidi fribidi) find_library(HARFBUZZ_LIBRARY NAMES harfbuzz) @@ -64,7 +89,7 @@ target_link_libraries(ass PRIVATE Freetype::Freetype ${FRIBIDI_LIBRARY} ${HARFBUZZ_LIBRARY} - ${FONTCONFIG_LIBRARY}) + ${FONT_LIBRARY}) install(TARGETS ass RUNTIME DESTINATION bin @@ -77,13 +102,12 @@ set(exec_prefix ${CMAKE_INSTALL_PREFIX}) set(libdir ${CMAKE_INSTALL_PREFIX}/lib) set(includedir ${CMAKE_INSTALL_PREFIX}/include) set(PACKAGE_VERSION ${LIBASS_VERSION}) -if(WIN32 OR APPLE) - set(PKG_REQUIRES_PRIVATE "harfbuzz >= 1.2.3, fribidi >= 0.19.0, freetype2 >= 9.10.3") +if(BUILD_SHARED_LIBS) + set(PKG_REQUIRES_PRIVATE ${PKG_REQUIRES_LIBASS}) + set(PKG_LIBS_PRIVATE ${PKG_LIBS_LIBASS}) else() - set(PKG_REQUIRES_PRIVATE "fontconfig >= 2.10.92, harfbuzz >= 1.2.3, fribidi >= 0.19.0, freetype2 >= 9.10.3") -endif() -if (NOT WIN32) - set(PKG_LIBS_PRIVATE -lm) + set(PKG_REQUIRES_PUBLIC ${PKG_REQUIRES_LIBASS}) + set(PKG_LIBS_PUBLIC ${PKG_LIBS_LIBASS}) endif() configure_file(libass.pc.in libass.pc @ONLY) install(FILES diff --git a/ports/libass/config.h.in b/ports/libass/config.h.in index b1e5b4b6b9..ffc4c1b494 100644 --- a/ports/libass/config.h.in +++ b/ports/libass/config.h.in @@ -1 +1 @@ -#define CONFIG_SOURCEVERSION "tarball: 0.15.1" +#define CONFIG_SOURCEVERSION "tarball: 0.16.0" diff --git a/ports/libass/portfile.cmake b/ports/libass/portfile.cmake index e1a185a381..45cf6ad539 100644 --- a/ports/libass/portfile.cmake +++ b/ports/libass/portfile.cmake @@ -1,8 +1,8 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO libass/libass - REF 0.15.2 - SHA512 ae3ea533e57ab3c386ce457dbaa39a256801b7340649d5ff80a51410481e73ab194724744b97d85cb6d111798e45eee594bb22da2f1f3c547fe8e331e0690127 + REF 0.16.0 + SHA512 fea93b36d05cd69a5920b603951dd63f46b2434e0dcbb12414bf6e1e584bacc2743fbfc03682d0a672bbfe9bcc057452a942f9967d95a30e535bd3694e40fc7d HEAD_REF master ) @@ -15,11 +15,11 @@ file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH}) file(COPY ${SOURCE_PATH}/libass/ass.h ${SOURCE_PATH}/libass/ass_types.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/ass) -vcpkg_configure_cmake( +vcpkg_cmake_configure( SOURCE_PATH ${SOURCE_PATH} - PREFER_NINJA) +) -vcpkg_install_cmake() +vcpkg_cmake_install() vcpkg_copy_pdbs() vcpkg_fixup_pkgconfig() diff --git a/ports/libass/vcpkg.json b/ports/libass/vcpkg.json index f4b2821676..31d51e293b 100644 --- a/ports/libass/vcpkg.json +++ b/ports/libass/vcpkg.json @@ -1,19 +1,20 @@ { "name": "libass", - "version": "0.15.2", + "version": "0.16.0", "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": "dirent", - "platform": "windows" - }, { "name": "fontconfig", "platform": "linux" }, "freetype", "fribidi", - "harfbuzz" + "harfbuzz", + { + "name": "vcpkg-cmake", + "host": true + } ] } diff --git a/versions/baseline.json b/versions/baseline.json index 98000cfabe..f1cca4b7fd 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -3409,7 +3409,7 @@ "port-version": 0 }, "libass": { - "baseline": "0.15.2", + "baseline": "0.16.0", "port-version": 0 }, "libassuan": { diff --git a/versions/l-/libass.json b/versions/l-/libass.json index ba86206563..1ab96ad462 100644 --- a/versions/l-/libass.json +++ b/versions/l-/libass.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "b5dfc84a884c525317deec9d8e62df51d64a8e3d", + "version": "0.16.0", + "port-version": 0 + }, { "git-tree": "358f5ebe2b07d2c3043f1397a7caa51fcf7ebdce", "version": "0.15.2",