Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 11 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,15 @@ jobs:

steps:
- uses: actions/checkout@v6
with:
submodules: recursive

- uses: pypa/cibuildwheel@v3.4.0
env:
CIBW_BUILD: cp312-*
CIBW_SKIP: cp312-musllinux*
CIBW_CONFIG_SETTINGS: setup-args="-Db_lto=true"
CIBW_BUILD: cp314-*
CIBW_SKIP: cp314-musllinux*
CIBW_BUILD_FRONTEND: uv
CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=15
CIBW_BEFORE_ALL_LINUX: >
dnf -y install nasm &&
dnf -y install libass-devel nasm &&
git clone https://git.ffmpeg.org/ffmpeg.git --branch n8.1 --depth 1 &&
cd ffmpeg &&
./configure --enable-gpl --enable-version3 --disable-programs --disable-doc --disable-avdevice --disable-swresample --disable-swscale --disable-avfilter --disable-encoders --disable-muxers --enable-pic --disable-debug &&
Expand All @@ -40,7 +38,7 @@ jobs:
cd .. &&
rm -rf ffmpeg
CIBW_BEFORE_ALL_MACOS: >
brew install nasm &&
brew install libass nasm &&
git clone https://git.ffmpeg.org/ffmpeg.git --branch n8.1 --depth 1 &&
cd ffmpeg &&
./configure --enable-gpl --enable-version3 --disable-programs --disable-doc --disable-avdevice --disable-swresample --disable-swscale --disable-avfilter --disable-encoders --disable-muxers --enable-pic --disable-debug &&
Expand All @@ -50,6 +48,7 @@ jobs:
rm -rf ffmpeg
with:
output-dir: dist
extras: uv

- name: Fix tag
run: |
Expand All @@ -72,8 +71,6 @@ jobs:

steps:
- uses: actions/checkout@v6
with:
submodules: recursive

- uses: msys2/setup-msys2@v2
with:
Expand All @@ -82,11 +79,11 @@ jobs:
install: >-
mingw-w64-clang-x86_64-autotools
mingw-w64-clang-x86_64-git
mingw-w64-clang-x86_64-libass
mingw-w64-clang-x86_64-nasm
mingw-w64-clang-x86_64-meson
mingw-w64-clang-x86_64-python-build
mingw-w64-clang-x86_64-python-wheel
mingw-w64-clang-x86_64-ninja
mingw-w64-clang-x86_64-toolchain
mingw-w64-clang-x86_64-uv

- name: Install FFmpeg
run: |
Expand All @@ -99,13 +96,13 @@ jobs:

- name: Build
run: |
python -m build -Csetup-args="-Dprefer_static=true" -Csetup-args="-Db_lto=true" -Csetup-args="-Dcpp_link_args=-static"
uv build -Csetup-args="-Dprefer_static=true" -Csetup-args="-Dcpp_link_args=-static"

- name: Fix tag
run: |
cd dist
for whl in *.whl; do
wheel tags --remove --python-tag py3 --abi-tag none --platform-tag win_amd64 $whl
uvx wheel tags --remove --python-tag py3 --abi-tag none $whl
done

- uses: actions/upload-artifact@v7
Expand Down
34 changes: 33 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
*.gch
*.pch

# Linker files
*.ilk

# Debugger Files
*.pdb

# Compiled Dynamic libraries
*.so
*.dylib
Expand All @@ -31,4 +37,30 @@
*.out
*.app

/build
# debug information files
*.dwo

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[codz]
*$py.class

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
38 changes: 19 additions & 19 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,27 +1,20 @@
project('SubText', 'c', 'cpp',
default_options: ['buildtype=release', 'warning_level=2', 'b_lto=true', 'b_ndebug=if-release', 'cpp_std=c++17'],
default_options: [
'buildtype=release', 'warning_level=2', 'b_lto=true', 'b_ndebug=if-release', 'c_std=c99', 'cpp_std=c++17',
],
license: 'MIT',
license_files: 'LICENSE',
meson_version: '>=1.2.3',
version: '6.0',
)

sources = [
'src/common.c',
'src/common.h',
'src/image.cpp',
'src/text.c',
'src/toass.cpp',
'src/toutf8.c'
deps = [
dependency('libass', version: '>=0.12.0'),
dependency('libavcodec'),
dependency('libavformat'),
dependency('libavutil'),
]

libass_dep = dependency('libass', version: '>=0.12.0')
libavcodec_dep = dependency('libavcodec')
libavutil_dep = dependency('libavutil')
libavformat_dep = dependency('libavformat')

deps = [libass_dep, libavcodec_dep, libavutil_dep, libavformat_dep]

incdir = include_directories(
run_command(
find_program('python', 'python3'),
Expand All @@ -31,14 +24,21 @@ incdir = include_directories(
).stdout().strip(),
)

link_args = []

py = import('python').find_installation(pure: false)

shared_module('dmetrics',
sources,
dependencies : deps,
if meson.get_compiler('cpp').get_linker_id() in ['ld.bfd', 'ld.gold', 'ld.mold']
link_args += '-Wl,-Bsymbolic'
endif

shared_module('subtext',
files('src/common.c', 'src/image.cpp', 'src/text.c', 'src/toass.cpp', 'src/toutf8.c'),
dependencies: deps,
gnu_symbol_visibility: 'hidden',
include_directories: incdir,
install: true,
install_dir: py.get_install_dir() / 'vapoursynth/plugins',
link_args: link_args,
name_prefix: '',
)
)
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["meson-python", "vapoursynth"]
requires = ["meson-python", "VapourSynth>=74"]
build-backend = "mesonpy"

[project]
Expand All @@ -24,12 +24,12 @@ classifiers = [
"Programming Language :: C++",
"Topic :: Multimedia :: Video",
]
dependencies = ["VapourSynth"]
dependencies = ["VapourSynth>=74"]
dynamic = ["version"]

[project.urls]
Repository = "https://github.com/vapoursynth/subtext.git"
Issues = "https://github.com/vapoursynth/subtext/issues"

[tool.meson-python.wheel]
exclude = ["*/*.dll.a", "*/*.lib"]
exclude = ["*.dll.a", "*.lib"]