Skip to content

rust/language.rs: add full BCP 47 compliant pipeline #16051

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
70 changes: 55 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ jobs:
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_MAXSIZE: 500M
TARGET: ${{ matrix.arch }}-w64-mingw32
RUST_TARGET: ${{ matrix.arch }}-pc-windows-gnu
strategy:
fail-fast: false
matrix:
include:
- target: i686-w64-mingw32
- arch: i686
wine: wine32
- target: x86_64-w64-mingw32
- arch: x86_64
wine: wine64
steps:
- uses: actions/checkout@v4
Expand All @@ -55,32 +57,32 @@ jobs:
uses: actions/cache/restore@v4
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ matrix.target }}-${{ steps.get_time.outputs.timestamp }}
restore-keys: ${{ matrix.target }}-
key: ${{ env.TARGET }}-${{ steps.get_time.outputs.timestamp }}
restore-keys: ${{ env.TARGET }}-

- name: Install dependencies
run: |
rustup target add ${{ env.RUST_TARGET }}
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install --no-install-recommends -y ccache g++-mingw-w64 gcc-multilib meson nasm ninja-build pkgconf ${{ matrix.wine }} wine
sudo apt-get install --no-install-recommends -y ccache g++-mingw-w64 gcc-multilib python3-pip nasm ninja-build pkgconf ${{ matrix.wine }} wine
# TODO: Switch to release version when this is available https://github.com/mesonbuild/meson/commit/5d9b9739ddc34a9db966a0034ab5ffb652ec4f56
python -m pip install git+https://github.com/mesonbuild/meson

- name: Install Meson Wraps
run: |
mkdir subprojects -p
meson wrap install mujs
meson subprojects download

- name: Build libraries
run: |
./ci/build-mingw64.sh
env:
TARGET: ${{ matrix.target }}

- name: Build with meson
id: build
run: |
./ci/build-mingw64.sh meson pack
env:
TARGET: ${{ matrix.target }}

- name: Print meson log
if: ${{ failure() && steps.build.outcome == 'failure' }}
Expand All @@ -105,15 +107,15 @@ jobs:

- uses: actions/upload-artifact@v4
with:
name: mpv-${{ matrix.target }}
name: mpv-${{ env.TARGET }}
path: mpv-git-*.zip

- name: Save Cache
uses: actions/cache/save@v4
if: always()
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ matrix.target }}-${{ steps.get_time.outputs.timestamp }}
key: ${{ env.TARGET }}-${{ steps.get_time.outputs.timestamp }}

win32:
runs-on: ${{ matrix.os }}
Expand All @@ -131,9 +133,11 @@ jobs:
VS: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise"
CC: "ccache clang"
CXX: "ccache clang++"
CC_LD: "lld"
CXX_LD: "lld"
CC_LD: "lld-link"
CXX_LD: "lld-link"
WINDRES: "llvm-rc"
RUST_LD: "lld-link"
RUSTC: "rustc --target ${{ matrix.target }}"
CCACHE_BASEDIR: ${{ github.workspace }}
CCACHE_DIR: "${{ github.workspace }}\\.ccache"
CCACHE_MAXSIZE: 500M
Expand All @@ -159,9 +163,25 @@ jobs:

- name: Install dependencies
run: |
python -m pip install meson
# TODO: Switch to release version when this is available https://github.com/mesonbuild/meson/commit/e574889f68c5a9c6d94344db731405809843ed37
python -m pip install git+https://github.com/mesonbuild/meson
choco install ccache nasm

- name: Install Rustup
# TODO: Remove after https://github.com/actions/partner-runner-images/issues/77
if: ${{ matrix.os == 'windows-11-arm' }}
run: |
Invoke-WebRequest -Uri "https://win.rustup.rs/aarch64" -OutFile "$env:TEMP\rustup-init.exe"
& "$env:TEMP\rustup-init.exe" --default-toolchain none --profile=minimal -y
"$env:USERPROFILE\.cargo\bin" | Out-File -Append -Encoding ascii $env:GITHUB_PATH
"CARGO_HOME=$env:USERPROFILE\.cargo" | Out-File -Append -Encoding ascii $env:GITHUB_ENV

- name: Update Rust toolchain
if: ${{ matrix.os == 'windows-11-arm' }}
run: |
rustup update --no-self-update stable
rustup default stable

- name: Update Meson WrapDB
run: |
meson wrap update-db
Expand Down Expand Up @@ -259,7 +279,7 @@ jobs:
run: |
brew update
brew install -q autoconf automake pkgconf libtool python freetype fribidi little-cms2 \
luajit libass ffmpeg meson uchardet mujs libplacebo molten-vk vulkan-loader vulkan-headers
luajit libass ffmpeg meson rust uchardet mujs libplacebo molten-vk vulkan-loader vulkan-headers

- name: Build with meson
id: build
Expand Down Expand Up @@ -317,6 +337,10 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install dependencies
run: |
zypper --non-interactive install rust

- name: Build with meson
id: build
run: |
Expand All @@ -333,6 +357,10 @@ jobs:
export LSAN_OPTIONS="suppressions=${GITHUB_WORKSPACE}/.lsan_suppressions"
meson test -C build

- name: Lint Rust
run: |
ninja -C build clippy

- name: Print meson test log
if: ${{ failure() && steps.tests.outcome == 'failure' }}
run: |
Expand All @@ -348,6 +376,10 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Install dependencies
run: |
zypper --non-interactive install rust

- name: Build with meson
id: build
run: |
Expand Down Expand Up @@ -391,6 +423,7 @@ jobs:
libxscrnsaver-dev \
meson \
musl-dev \
rust \
samurai

- name: Build with meson
Expand Down Expand Up @@ -444,6 +477,7 @@ jobs:
pulseaudio \
python3 \
rubberband \
rust \
sdl2 \
shaderc \
spirv-cross \
Expand Down Expand Up @@ -498,6 +532,7 @@ jobs:
pulseaudio \
python3 \
rubberband \
rust \
sekrit-twc-zimg \
sdl2 \
sndio \
Expand Down Expand Up @@ -560,6 +595,7 @@ jobs:
python:p
rst2pdf:p
rubberband:p
rust:p
shaderc:p
spirv-cross:p
uchardet:p
Expand All @@ -583,6 +619,10 @@ jobs:
run: |
meson test -C build

- name: Lint Rust
run: |
ninja -C build clippy

- name: Print meson test log
if: ${{ failure() && steps.tests.outcome == 'failure' }}
run: |
Expand Down
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ repos:
hooks:
- id: codespell
args: ["--ignore-words-list", "datas,DNE,enew,HDA,numer,ontop,optionA,Paeth,pathc,inout"]
exclude: ^misc/language.c$
1 change: 0 additions & 1 deletion ci/build-linux-old.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ set -e
. ./ci/build-common.sh

# clone exactly the oldest libplacebo we want to support
rm -rf subprojects
mkdir -p subprojects
git clone https://code.videolan.org/videolan/libplacebo.git \
--recurse-submodules --shallow-submodules \
Expand Down
3 changes: 2 additions & 1 deletion ci/build-mingw64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@ fam=x86_64
cat >"$prefix_dir/crossfile" <<EOF
[built-in options]
buildtype = 'release'
wrap_mode = 'nofallback'
wrap_mode = 'nodownload'
[binaries]
c = ['ccache', '${CC}']
cpp = ['ccache', '${CXX}']
rust = ['rustc', '--target', '${RUST_TARGET}']
ar = '${AR}'
strip = '${TARGET}-strip'
pkgconfig = 'pkg-config'
Expand Down
1 change: 0 additions & 1 deletion ci/build-openbsd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ set -e
. ./ci/build-common.sh

# FFmpeg on openBSD (4.4.4) is too old; use a subproject
rm -rf subprojects
mkdir -p subprojects
cat <<EOF > subprojects/ffmpeg.wrap
[wrap-git]
Expand Down
5 changes: 4 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ project('mpv',
'cpp_std=c++20',
'cpp_eh=default',
'warning_level=2',
'rust_std=2021',
'build.rust_std=2021',
]
)

Expand Down Expand Up @@ -140,7 +142,6 @@ sources = files(
'misc/dispatch.c',
'misc/io_utils.c',
'misc/json.c',
'misc/language.c',
'misc/natural_sort.c',
'misc/node.c',
'misc/path_utils.c',
Expand Down Expand Up @@ -1764,6 +1765,8 @@ major = client_h_define.split('|')[0].split('<<')[0].strip('() ')
minor = client_h_define.split('|')[1].strip('() ')
client_api_version = major + '.' + minor + '.0'

subdir('rust')

libmpv = library('mpv', sources, dependencies: dependencies, gnu_symbol_visibility: 'hidden',
include_directories: incdir_public,
link_args: cc.get_supported_link_arguments(['-Wl,-Bsymbolic']),
Expand Down
Loading
Loading