summaryrefslogtreecommitdiffstats
path: root/libass
diff options
context:
space:
mode:
authorRyan Lucia <ryan@luciaonline.net>2019-02-02 01:32:43 -0500
committerOneric <oneric@oneric.stub>2024-04-20 03:21:57 +0200
commit342a0d2e767c33ff28a39794813294c67c9e7312 (patch)
treeb49bada328f1afa7132e5a584f28999cca4a8f02 /libass
parent2cea926568f0a06c2ec38b30bfb83714a6e259f1 (diff)
downloadlibass-342a0d2e767c33ff28a39794813294c67c9e7312.tar.bz2
libass-342a0d2e767c33ff28a39794813294c67c9e7312.tar.xz
Add meson as a secondary build system
This will bring back a first-party buildsystem for MSVC after the previous solution https://github.com/libass/libass-msvc was retired and make it easier to use libass as a subproject in other meson projects. It does not currently support all of our utilities nor testing and fuzzing infrastructure and x86_32 assembly is always built in PIC mode. Due to meson deficiencies shared libraries lack symbol export control and it is not possible to build x32 assembly. However, for packaging and downstream use it is feature complete on Windows and static-only builds are sufficient for subproject use on any platform, so it brings a net positive and keeping this level of support up alongside autotools is expected to be barely any effort. And ofc future meson versions and patches to this build setup might improve it further. The port was initially brought up by Ryan Lucia (CoffeeFlux) and later further adapted and polished for merge by arch1t3cht and torque, but several more people contributed bits and pieces. They are listed in the following. Reviewed-by: Eli Schwartz <eschwartz93@gmail.com> Reviewed-by: Oneric <oneric@oneric.stub> Co-authored-by: arch1t3cht <arch1t3cht@gmail.com> Co-authored-by: torque <torque@users.noreply.github.com> Co-authored-by: Luni-4 <luni-4@hotmail.it> Co-authored-by: Funami580 <Funami580@users.noreply.github.com> Co-authored-by: woclass <5158738+inkydragon@users.noreply.github.com> Co-authored-by: line0 <line0@inbox.lv> Co-authored-by: Myaamori <myaamori1993@gmail.com> Co-authored-by: Xavier Claessens <xavier.claessens@collabora.com>
Diffstat (limited to 'libass')
-rw-r--r--libass/ass/meson.build13
-rw-r--r--libass/meson.build134
2 files changed, 147 insertions, 0 deletions
diff --git a/libass/ass/meson.build b/libass/ass/meson.build
new file mode 100644
index 0000000..6b4de1f
--- /dev/null
+++ b/libass/ass/meson.build
@@ -0,0 +1,13 @@
+# See: https://github.com/mesonbuild/meson/issues/2546
+# This hack is needed because the install directory of the libass public headers
+# ('ass') is different than the name of the directory ('libass') that they live under
+# in the source tree. In the scenario where the libass meson build system is being used
+# as a subproject of some parent project, that parent project will need the libass
+# headers to be copied into the appropriate 'ass' directory either before or during the
+# build process so that they are in an appropriate include path prior to the time that
+# the build system starts trying to build the parent project that needs to include
+# them.
+fs = import('fs')
+foreach header : libass_headers
+ fake_installed_headers += fs.copyfile(header, fs.name(header))
+endforeach
diff --git a/libass/meson.build b/libass/meson.build
new file mode 100644
index 0000000..55a04fc
--- /dev/null
+++ b/libass/meson.build
@@ -0,0 +1,134 @@
+libass_lt_current = 11
+libass_lt_revision = 1
+libass_lt_age = 2
+
+libass_so_version = '@0@.@1@.@2@'.format(
+ libass_lt_current - libass_lt_age,
+ libass_lt_age,
+ libass_lt_revision,
+)
+
+src_x86 = files(
+ 'x86/be_blur.asm',
+ 'x86/blend_bitmaps.asm',
+ 'x86/blur.asm',
+ 'x86/cpuid.asm',
+ 'x86/rasterizer.asm',
+)
+src_aarch64 = files(
+ 'aarch64/asm.S',
+ 'aarch64/be_blur.S',
+ 'aarch64/blend_bitmaps.S',
+ 'aarch64/blur.S',
+ 'aarch64/rasterizer.S',
+)
+src_fontconfig = files('ass_fontconfig.c')
+src_directwrite = files('ass_directwrite.c')
+src_coretext = files('ass_coretext.c')
+
+libass_src = files(
+ 'c/c_be_blur.c',
+ 'c/c_blend_bitmaps.c',
+ 'c/c_blur.c',
+ 'c/c_rasterizer.c',
+ 'ass.c',
+ 'ass_bitmap.c',
+ 'ass_bitmap_engine.c',
+ 'ass_blur.c',
+ 'ass_cache.c',
+ 'ass_drawing.c',
+ 'ass_filesystem.c',
+ 'ass_font.c',
+ 'ass_fontselect.c',
+ 'ass_library.c',
+ 'ass_outline.c',
+ 'ass_parse.c',
+ 'ass_rasterizer.c',
+ 'ass_render.c',
+ 'ass_render_api.c',
+ 'ass_shaper.c',
+ 'ass_string.c',
+ 'ass_strtod.c',
+ 'ass_utils.c',
+)
+
+libass_link_with = []
+
+libass_headers = files('ass.h', 'ass_types.h')
+
+if fontconfig
+ libass_src += src_fontconfig
+endif
+if directwrite
+ libass_src += src_directwrite
+endif
+if coretext
+ libass_src += src_coretext
+endif
+
+if enable_asm
+ asm_sources = []
+ if cpu_family == 'x86'
+ asm_sources = src_x86
+ elif cpu_subfamily == 'aarch64'
+ asm_sources = src_aarch64
+ endif
+
+ if asm_is_nasm
+ libass_src += asm_sources
+ else
+ asm_lib = static_library(
+ 'libass_asm',
+ config_h,
+ sources: asm_sources,
+ c_args: asm_args,
+ include_directories: incs,
+ )
+ libass_link_with += asm_lib
+ endif
+endif
+
+if host_system == 'windows'
+ gen_defs = find_program('../gen_defs.py')
+ libass_def = custom_target(
+ 'libass.def',
+ input: ['libass.sym'],
+ output: ['libass.def'],
+ command: [gen_defs, '@INPUT@', '@OUTPUT@'],
+ )
+ kwargs = {'vs_module_defs': libass_def}
+else
+ kwargs = {}
+endif
+
+# this is a list of custom targets for copying the libass public headers into the build
+# directory. These targets are passed as part of the libass library build step in order
+# to enforce the desired build sequence.
+fake_installed_headers = []
+subdir('ass')
+
+libass = library(
+ 'ass',
+ libass_src,
+ config_h,
+ link_with: libass_link_with,
+ version: libass_so_version,
+ # This emulates the GNU libtool compat/current versioning computation
+ darwin_versions: [
+ '@0@'.format(libass_lt_current + 1),
+ '@0@.@1@'.format(libass_lt_current + 1, libass_lt_revision),
+ ],
+ install: true,
+ include_directories: incs,
+ dependencies: deps,
+ kwargs: kwargs,
+)
+
+libass_dep = declare_dependency(
+ link_with: libass,
+ include_directories: incs,
+ dependencies: deps,
+ sources: fake_installed_headers,
+)
+
+install_headers(libass_headers, subdir: 'ass')