Skip to content

Commit 1e3e521

Browse files
committed
feat: switch build sytem to meson, asm optimization as a feature
1 parent 522253c commit 1e3e521

8 files changed

Lines changed: 109 additions & 184 deletions

File tree

ports/libass/CMakeLists.txt

Lines changed: 0 additions & 106 deletions
This file was deleted.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
diff --git a/libass/meson.build b/libass/meson.build
2+
index 5251c2f..a3429bb 100644
3+
--- a/libass/meson.build
4+
+++ b/libass/meson.build
5+
@@ -70,6 +70,28 @@ if enable_asm
6+
7+
if asm_is_nasm
8+
libass_src += asm_sources
9+
+ elif asm_is_clang
10+
+ clang = find_program('clang')
11+
+ foreach asm_source : asm_sources
12+
+ asm_output = fs.stem(asm_source.full_path()) + '.obj'
13+
+ libass_src += custom_target(
14+
+ asm_output,
15+
+ input: asm_source,
16+
+ output: asm_output,
17+
+ depends: config_h,
18+
+ command: [
19+
+ clang,
20+
+ ] + asm_clang_args + [
21+
+ '-I' + meson.project_build_root(),
22+
+ '-I' + meson.current_source_dir(),
23+
+ ] + asm_args + [
24+
+ '-c',
25+
+ '@INPUT@',
26+
+ '-o',
27+
+ '@OUTPUT@',
28+
+ ],
29+
+ )
30+
+ endforeach
31+
else
32+
asm_lib = static_library(
33+
'libass_asm',
34+
diff --git a/meson.build b/meson.build
35+
index 4b1c24e..b82233e 100644
36+
--- a/meson.build
37+
+++ b/meson.build
38+
@@ -207,7 +207,9 @@ endif
39+
enable_asm = false
40+
# used in libass/meson.build
41+
asm_is_nasm = false
42+
+asm_is_clang = false
43+
asm_args = []
44+
+asm_clang_args = []
45+
46+
# ASM architecture variables
47+
asm_option = get_option('asm')
48+
@@ -276,6 +278,10 @@ if not asm_option.disabled()
49+
enable_asm = true
50+
conf.set('ARCH_AARCH64', 1)
51+
if host_system == 'darwin'
52+
asm_args += '-DPREFIX'
53+
+ elif host_system == 'windows' and cc.get_argument_syntax() == 'msvc' and cc.get_id() != 'clang-cl'
54+
+ # MSVC cannot compile GNU-style AArch64 .S sources.
55+
+ asm_is_clang = true
56+
+ asm_clang_args += '--target=arm64-pc-windows-msvc'
57+
endif
58+
else
59+
warning(

ports/libass/config.h.in

Lines changed: 0 additions & 14 deletions
This file was deleted.

ports/libass/libass.def

Lines changed: 0 additions & 47 deletions
This file was deleted.

ports/libass/portfile.cmake

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,48 @@ vcpkg_from_github(
44
REF ${VERSION}
55
SHA512 08762623dd09e3034699ba9d11b70d1f6cc6b2e3b38aa897b07efef1364e76141df484e70ed27888cf3595b77d072cdb5e8abbbfa560e33ca21f87872e24df8d
66
HEAD_REF master
7+
PATCHES
8+
arm64-windows-asm.patch
79
)
810

9-
file(COPY ${CMAKE_CURRENT_LIST_DIR}/config.h.in DESTINATION ${SOURCE_PATH})
10-
11-
file(COPY ${CMAKE_CURRENT_LIST_DIR}/libass.def DESTINATION ${SOURCE_PATH})
12-
13-
# Since libass uses automake, make and configure, we use a custom CMake file
14-
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
15-
16-
file(COPY ${SOURCE_PATH}/libass/ass.h ${SOURCE_PATH}/libass/ass_types.h DESTINATION ${CURRENT_PACKAGES_DIR}/include/ass)
17-
1811
vcpkg_find_acquire_program(PKGCONFIG)
1912
get_filename_component(PKGCONFIG_EXE_PATH ${PKGCONFIG} DIRECTORY)
2013
vcpkg_add_to_path(${PKGCONFIG_EXE_PATH})
2114

22-
vcpkg_cmake_configure(
23-
OPTIONS -DLIBASS_VERSION=${VERSION}
24-
SOURCE_PATH ${SOURCE_PATH}
15+
list(APPEND options
16+
-Dcheckasm=disabled
17+
-Dcompare=disabled
18+
-Dfuzz=disabled
19+
-Dprofile=disabled
20+
-Dtest=disabled
21+
)
22+
23+
set(additional_binaries "")
24+
if("asm" IN_LIST FEATURES)
25+
list(APPEND options -Dasm=enabled)
26+
if(VCPKG_TARGET_ARCHITECTURE MATCHES "^(x86|x64)$")
27+
vcpkg_find_acquire_program(NASM)
28+
get_filename_component(NASM_EXE_PATH "${NASM}" DIRECTORY)
29+
vcpkg_add_to_path("${NASM_EXE_PATH}")
30+
elseif(VCPKG_TARGET_IS_WINDOWS AND VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
31+
vcpkg_find_acquire_program(CLANG)
32+
list(APPEND additional_binaries "clang = ['${CLANG}']")
33+
endif()
34+
else()
35+
list(APPEND options -Dasm=disabled)
36+
endif()
37+
38+
vcpkg_configure_meson(
39+
SOURCE_PATH "${SOURCE_PATH}"
40+
OPTIONS
41+
${options}
42+
ADDITIONAL_BINARIES
43+
${additional_binaries}
2544
)
2645

27-
vcpkg_cmake_install()
46+
vcpkg_install_meson()
2847
vcpkg_copy_pdbs()
2948
vcpkg_fixup_pkgconfig()
3049

3150
# Handle copyright
32-
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
51+
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")

ports/libass/vcpkg.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "libass",
33
"version": "0.17.4",
4+
"port-version": 1,
45
"description": "libass is a portable subtitle renderer for the ASS/SSA (Advanced Substation Alpha/Substation Alpha) subtitle format",
56
"homepage": "https://github.com/libass/libass",
67
"license": "ISC",
@@ -13,8 +14,16 @@
1314
"fribidi",
1415
"harfbuzz",
1516
{
16-
"name": "vcpkg-cmake",
17+
"name": "vcpkg-tool-meson",
1718
"host": true
1819
}
19-
]
20+
],
21+
"default-features": [
22+
"asm"
23+
],
24+
"features": {
25+
"asm": {
26+
"description": "Enable assembly optimizations"
27+
}
28+
}
2029
}

versions/baseline.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4694,7 +4694,7 @@
46944694
},
46954695
"libass": {
46964696
"baseline": "0.17.4",
4697-
"port-version": 0
4697+
"port-version": 1
46984698
},
46994699
"libassert": {
47004700
"baseline": "2.2.1",

versions/l-/libass.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
{
22
"versions": [
3+
{
4+
"git-tree": "eb2f8e390cf39d20ab5ba8e955c91470cb6efda4",
5+
"version": "0.17.4",
6+
"port-version": 1
7+
},
38
{
49
"git-tree": "a6cabb21ea77d49d7cc9bb55b53fcf7fe4f28e72",
510
"version": "0.17.4",

0 commit comments

Comments
 (0)