├── .github ├── dependabot.yml └── workflows │ ├── clean.yml │ ├── llvm.yml │ ├── toolchain.yml │ └── mpv.yml ├── patch ├── 0003-openssl-reset-to-working-commit.patch ├── 0000-libarchive-pass-correct-cflags.patch ├── 0001-mpv-copy-mpv-register-and-mpv-unregister-helpers.patch └── 0002-openssl-use-winstore-by-default.patch ├── use-librempeg.patch ├── patch_pr └── 0000-mpv-add-patch.patch ├── LICENSE ├── prunetags.sh ├── action ├── build_toolchain │ └── action.yml └── resave_cache │ └── action.yml ├── compile-lgpl-libmpv.patch └── README.md /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # Set update schedule for GitHub Actions 2 | 3 | version: 2 4 | updates: 5 | 6 | - package-ecosystem: "github-actions" 7 | directory: "/" 8 | schedule: 9 | # Check for updates to GitHub Actions every weekday 10 | interval: "weekly" 11 | -------------------------------------------------------------------------------- /.github/workflows/clean.yml: -------------------------------------------------------------------------------- 1 | name: Delete old workflow runs 2 | on: 3 | schedule: 4 | - cron: '0 0 1 * *' 5 | # Run monthly, at 00:00 on the 1st day of month. 6 | workflow_dispatch: 7 | 8 | jobs: 9 | del_runs: 10 | runs-on: ubuntu-latest 11 | permissions: 12 | actions: write 13 | steps: 14 | - name: Delete workflow runs 15 | uses: Mattraks/delete-workflow-runs@main 16 | with: 17 | token: ${{ secrets.GITHUB_TOKEN }} 18 | repository: ${{ github.repository }} 19 | retain_days: 30 20 | keep_minimum_runs: 0 21 | -------------------------------------------------------------------------------- /patch/0003-openssl-reset-to-working-commit.patch: -------------------------------------------------------------------------------- 1 | From cbc7a374f0898d64c6710f66534ebefd2a2c4922 Mon Sep 17 00:00:00 2001 2 | From: zhongfly <11155705+zhongfly@users.noreply.github.com> 3 | Date: Thu, 18 Dec 2025 21:20:38 +0800 4 | Subject: [PATCH] openssl: reset to working commit 5 | 6 | --- 7 | packages/openssl.cmake | 1 + 8 | 1 file changed, 1 insertion(+) 9 | 10 | diff --git a/packages/openssl.cmake b/packages/openssl.cmake 11 | index 5d0e763..5e079fa 100644 12 | --- a/packages/openssl.cmake 13 | +++ b/packages/openssl.cmake 14 | @@ -7,6 +7,7 @@ ExternalProject_Add(openssl 15 | SOURCE_DIR ${SOURCE_LOCATION} 16 | GIT_CLONE_FLAGS "--sparse --filter=tree:0" 17 | GIT_CLONE_POST_COMMAND "sparse-checkout set --no-cone /* !test" 18 | + GIT_RESET 6255955 19 | GIT_SUBMODULES "" 20 | UPDATE_COMMAND "" 21 | CONFIGURE_COMMAND ${EXEC} CONF=1 /Configure 22 | -- 23 | 2.52.0.windows.1 24 | 25 | -------------------------------------------------------------------------------- /use-librempeg.patch: -------------------------------------------------------------------------------- 1 | From 37362d0ace60392f0b76d3c11027ecbeb478aec9 Mon Sep 17 00:00:00 2001 2 | From: zhongfly <11155705+zhongfly@users.noreply.github.com> 3 | Date: Sat, 10 May 2025 23:11:21 +0800 4 | Subject: [PATCH] ffmpeg: use librempeg fork 5 | 6 | --- 7 | packages/ffmpeg.cmake | 2 +- 8 | 1 file changed, 1 insertion(+), 1 deletion(-) 9 | 10 | diff --git a/packages/ffmpeg.cmake b/packages/ffmpeg.cmake 11 | index 252c687..def2367 100644 12 | --- a/packages/ffmpeg.cmake 13 | +++ b/packages/ffmpeg.cmake 14 | @@ -46,7 +46,7 @@ ExternalProject_Add(ffmpeg 15 | rubberband 16 | libva 17 | openal-soft 18 | - GIT_REPOSITORY https://github.com/FFmpeg/FFmpeg.git 19 | + GIT_REPOSITORY https://github.com/librempeg/librempeg.git 20 | SOURCE_DIR ${SOURCE_LOCATION} 21 | GIT_CLONE_FLAGS "--sparse --filter=tree:0" 22 | GIT_CLONE_POST_COMMAND "sparse-checkout set --no-cone /* !tests/ref/fate" 23 | -- 24 | 25 | -------------------------------------------------------------------------------- /patch_pr/0000-mpv-add-patch.patch: -------------------------------------------------------------------------------- 1 | From d233e9e07d41056ab74fd04634144fc1f99f0c63 Mon Sep 17 00:00:00 2001 2 | From: zhongfly <11155705+zhongfly@users.noreply.github.com> 3 | Date: Thu, 3 Aug 2023 07:38:57 +0800 4 | Subject: [PATCH] mpv: add patch 5 | 6 | --- 7 | packages/mpv.cmake | 3 ++- 8 | 1 file changed, 2 insertions(+), 1 deletion(-) 9 | 10 | diff --git a/packages/mpv.cmake b/packages/mpv.cmake 11 | index 983719f..49dc235 100644 12 | --- a/packages/mpv.cmake 13 | +++ b/packages/mpv.cmake 14 | @@ -24,7 +24,8 @@ ExternalProject_Add(mpv 15 | libsdl2 16 | GIT_REPOSITORY https://github.com/mpv-player/mpv.git 17 | SOURCE_DIR ${SOURCE_LOCATION} 18 | - GIT_CLONE_FLAGS "--filter=tree:0" 19 | + GIT_CLONE_FLAGS "" 20 | + PATCH_COMMAND ${EXEC} git am --3way ${CMAKE_CURRENT_SOURCE_DIR}/mpv-*.patch 21 | UPDATE_COMMAND "" 22 | CONFIGURE_COMMAND ${EXEC} CONF=1 meson setup 23 | --prefix=${MINGW_INSTALL_PREFIX} 24 | -- 25 | 2.43.0 26 | 27 | -------------------------------------------------------------------------------- /patch/0000-libarchive-pass-correct-cflags.patch: -------------------------------------------------------------------------------- 1 | From 7fe3924c859b247a030642cd436cc4611d1f25a0 Mon Sep 17 00:00:00 2001 2 | From: zhongfly <11155705+zhongfly@users.noreply.github.com> 3 | Date: Mon, 14 Apr 2025 22:51:33 +0800 4 | Subject: [PATCH] libarchive: pass correct cflags 5 | 6 | --- 7 | packages/libarchive.cmake | 1 + 8 | 1 file changed, 1 insertion(+) 9 | 10 | diff --git a/packages/libarchive.cmake b/packages/libarchive.cmake 11 | index 0d7fa80..ae1c0fa 100644 12 | --- a/packages/libarchive.cmake 13 | +++ b/packages/libarchive.cmake 14 | @@ -37,6 +37,7 @@ ExternalProject_Add(libarchive 15 | -DENABLE_TEST=OFF 16 | -DWINDOWS_VERSION=WIN10 17 | -DCMAKE_POLICY_VERSION_MINIMUM=3.5 18 | + "-DCMAKE_C_FLAGS='-lxml2 -lbz2 -llzo2 -lz -lbrotlienc -lbrotlidec -lbrotlicommon -lzstd -lws2_32 -lgdi32 -lcrypt32 -liconv -lbcrypt'" 19 | BUILD_COMMAND ${EXEC} ninja -C 20 | INSTALL_COMMAND ${EXEC} ninja -C install 21 | LOG_DOWNLOAD 1 LOG_UPDATE 1 LOG_CONFIGURE 1 LOG_BUILD 1 LOG_INSTALL 1 22 | -- 23 | 2.48.1.windows.1 24 | 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 zhongfly 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /patch/0001-mpv-copy-mpv-register-and-mpv-unregister-helpers.patch: -------------------------------------------------------------------------------- 1 | From 3d63d6e03cc38bacec069169498f0ca679d56690 Mon Sep 17 00:00:00 2001 2 | From: zhongfly <11155705+zhongfly@users.noreply.github.com> 3 | Date: Tue, 16 Sep 2025 21:27:25 +0800 4 | Subject: [PATCH] mpv: copy mpv-register and mpv-unregister helpers 5 | 6 | --- 7 | packages/mpv.cmake | 2 ++ 8 | 1 file changed, 2 insertions(+) 9 | 10 | diff --git a/packages/mpv.cmake b/packages/mpv.cmake 11 | index 874ee95..1014cc7 100644 12 | --- a/packages/mpv.cmake 13 | +++ b/packages/mpv.cmake 14 | @@ -69,6 +69,8 @@ ExternalProject_Add_Step(mpv copy-binary 15 | DEPENDEES strip-binary 16 | COMMAND ${CMAKE_COMMAND} -E copy /mpv.exe ${CMAKE_CURRENT_BINARY_DIR}/mpv-package/mpv.exe 17 | COMMAND ${CMAKE_COMMAND} -E copy /mpv.com ${CMAKE_CURRENT_BINARY_DIR}/mpv-package/mpv.com 18 | + COMMAND ${CMAKE_COMMAND} -E copy /etc/mpv-register.bat ${CMAKE_CURRENT_BINARY_DIR}/mpv-package/mpv-register.bat 19 | + COMMAND ${CMAKE_COMMAND} -E copy /etc/mpv-unregister.bat ${CMAKE_CURRENT_BINARY_DIR}/mpv-package/mpv-unregister.bat 20 | COMMAND ${CMAKE_COMMAND} -E copy /mpv.pdf ${CMAKE_CURRENT_BINARY_DIR}/mpv-package/doc/manual.pdf 21 | COMMAND ${CMAKE_COMMAND} -E copy ${MINGW_INSTALL_PREFIX}/etc/fonts/fonts.conf ${CMAKE_CURRENT_BINARY_DIR}/mpv-package/mpv/fonts.conf 22 | ${mpv_copy_debug} 23 | -- 24 | 2.51.0.windows.1 25 | 26 | -------------------------------------------------------------------------------- /prunetags.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # source: https://github.com/BtbN/FFmpeg-Builds/blob/master/util/prunetags.sh 3 | # Copyright 2020-2021 BtbN 4 | # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 5 | # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 7 | 8 | set -e 9 | git fetch --tags 10 | TAGS=( $(git tag | sort -r) ) 11 | 12 | KEEP_DAILY=30 13 | 14 | DAILY_TAGS=() 15 | KEEP_TAGS=() 16 | 17 | CUR_MONTH="-1" 18 | CUR_DAY="-1" 19 | 20 | for TAG in ${TAGS[@]}; do 21 | if [[ ${#DAILY_TAGS[@]} -lt ${KEEP_DAILY} ]]; then 22 | TAG_MONTH="$(echo $TAG | cut -d- -f2)" 23 | TAG_DAY="$(echo $TAG | cut -d- -f3)" 24 | KEEP_TAGS+=( "$TAG" ) 25 | if [[ ${TAG_MONTH} != ${CUR_MONTH} ]]; then 26 | CUR_MONTH="${TAG_MONTH}" 27 | CUR_DAILY="-1" 28 | fi 29 | if [[ ${TAG_DAY} != ${CUR_DAY} ]]; then 30 | CUR_DAY="${TAG_DAY}" 31 | DAILY_TAGS+=( "$TAG" ) 32 | fi 33 | fi 34 | done 35 | 36 | for TAG in ${KEEP_TAGS[@]}; do 37 | echo "Keep ${TAG}" 38 | TAGS=( "${TAGS[@]/$TAG}" ) 39 | done 40 | 41 | for TAG in ${TAGS[@]}; do 42 | echo "Deleting ${TAG}" 43 | gh release delete "${TAG}" || true 44 | git tag -d "${TAG}" 45 | done 46 | 47 | git push --tags --prune 48 | -------------------------------------------------------------------------------- /action/build_toolchain/action.yml: -------------------------------------------------------------------------------- 1 | name: 'Build toolchain' 2 | description: 'Build toolchain' 3 | inputs: 4 | bit: 5 | description: "target bit" 6 | required: false 7 | default: "64-v3" 8 | compiler: 9 | description: "target bit" 10 | required: false 11 | default: "clang" 12 | command: 13 | description: "build command" 14 | required: true 15 | extra_option: 16 | description: "extra cmake option" 17 | required: false 18 | 19 | 20 | runs: 21 | using: "composite" 22 | steps: 23 | - name: Apply patch 24 | shell: bash 25 | run: | 26 | set -x 27 | cd mpv-winbuild-cmake 28 | if [[ "$(ls -A ../patch/*.patch)" ]]; then 29 | for patch in ../patch/*.patch ; do 30 | git am --3way "$patch" || git am --abort 31 | done 32 | fi 33 | 34 | - name: Build 35 | shell: bash 36 | run: | 37 | cd mpv-winbuild-cmake 38 | bit="${{ inputs.bit }}" 39 | compiler="${{ inputs.compiler }}" 40 | gitdir=$(pwd) 41 | clang_root=$(pwd)/clang_root 42 | buildroot=$(pwd) 43 | srcdir=$(pwd)/src_packages 44 | 45 | if [ $bit == "32" ]; then 46 | arch="i686" 47 | elif [ $bit == "64" ]; then 48 | arch="x86_64" 49 | elif [ $bit == "64-v3" ]; then 50 | arch="x86_64" 51 | gcc_arch=-DGCC_ARCH=x86-64-v3 52 | x86_64_level=-v3 53 | elif [ $bit == "aarch64" ]; then 54 | arch="aarch64" 55 | fi 56 | set -x 57 | if [ "$compiler" == "clang" ]; then 58 | clang_option="-DCMAKE_INSTALL_PREFIX=$clang_root -DMINGW_INSTALL_PREFIX=$buildroot/build$bit/install/$arch-w64-mingw32" 59 | fi 60 | cmake -Wno-dev --fresh -DTARGET_ARCH=$arch-w64-mingw32 $gcc_arch -DCOMPILER_TOOLCHAIN=$compiler $clang_option ${{ inputs.extra_option }} -DSINGLE_SOURCE_LOCATION=$srcdir -G Ninja -H$gitdir -B$buildroot/build$bit 61 | set +x 62 | stdbuf -oL bash -c "${{ inputs.command }}" | 63 | while IFS= read -r line 64 | do 65 | echo "$line" 66 | if grep -q "ninja: build stopped" <<< "$line"; then 67 | exit 1 68 | fi 69 | done -------------------------------------------------------------------------------- /patch/0002-openssl-use-winstore-by-default.patch: -------------------------------------------------------------------------------- 1 | From ac9e54cbd96b605950711f3be8831dd8147ae432 Mon Sep 17 00:00:00 2001 2 | From: zhongfly <11155705+zhongfly@users.noreply.github.com> 3 | Date: Sun, 10 Aug 2025 18:14:05 +0800 4 | Subject: [PATCH] openssl: use winstore by default 5 | 6 | --- 7 | ...openssl-0001-use-winstore-by-default.patch | 27 +++++++++++++++++++ 8 | packages/openssl.cmake | 1 + 9 | 2 files changed, 28 insertions(+) 10 | create mode 100644 packages/openssl-0001-use-winstore-by-default.patch 11 | 12 | diff --git a/packages/openssl-0001-use-winstore-by-default.patch b/packages/openssl-0001-use-winstore-by-default.patch 13 | new file mode 100644 14 | index 0000000..e68e66d 15 | --- /dev/null 16 | +++ b/packages/openssl-0001-use-winstore-by-default.patch 17 | @@ -0,0 +1,27 @@ 18 | +From c1545fdcf3637b8025c27530b6c5242903e089b6 Mon Sep 17 00:00:00 2001 19 | +From: Andarwinux 20 | +Date: Fri, 8 Aug 2025 00:00:00 +0000 21 | +Subject: [PATCH] use winstore by default 22 | + 23 | +--- 24 | + crypto/x509/by_store.c | 4 ++++ 25 | + 1 file changed, 4 insertions(+) 26 | + 27 | +diff --git a/crypto/x509/by_store.c b/crypto/x509/by_store.c 28 | +index a969e3aa05..0d5a29f32d 100644 29 | +--- a/crypto/x509/by_store.c 30 | ++++ b/crypto/x509/by_store.c 31 | +@@ -133,6 +133,10 @@ static int by_store_ctrl_ex(X509_LOOKUP *ctx, int cmd, const char *argp, 32 | + { 33 | + switch (cmd) { 34 | + case X509_L_ADD_STORE: 35 | ++#ifdef _WIN32 36 | ++ if (argp == NULL) 37 | ++ argp = "org.openssl.winstore://"; 38 | ++#endif 39 | + if (argp != NULL) { 40 | + STACK_OF(CACHED_STORE) *stores = X509_LOOKUP_get_method_data(ctx); 41 | + CACHED_STORE *store = OPENSSL_zalloc(sizeof(*store)); 42 | +-- 43 | +2.50.1 44 | + 45 | diff --git a/packages/openssl.cmake b/packages/openssl.cmake 46 | index 5d0e763..d9b5f3c 100644 47 | --- a/packages/openssl.cmake 48 | +++ b/packages/openssl.cmake 49 | @@ -9,6 +9,7 @@ ExternalProject_Add(openssl 50 | GIT_CLONE_POST_COMMAND "sparse-checkout set --no-cone /* !test" 51 | GIT_SUBMODULES "" 52 | UPDATE_COMMAND "" 53 | + PATCH_COMMAND ${EXEC} git am --3way ${CMAKE_CURRENT_SOURCE_DIR}/openssl-*.patch 54 | CONFIGURE_COMMAND ${EXEC} CONF=1 /Configure 55 | --cross-compile-prefix=${TARGET_ARCH}- 56 | --prefix=${MINGW_INSTALL_PREFIX} 57 | -- 58 | 2.51.0.windows.1 59 | 60 | -------------------------------------------------------------------------------- /action/resave_cache/action.yml: -------------------------------------------------------------------------------- 1 | name: 'Resave cache' 2 | description: 'Resave cache' 3 | inputs: 4 | repository: 5 | description: 'The repository to use for the cache. The default is the current repository.' 6 | required: false 7 | default: ${{ github.repository }} 8 | ref: 9 | description: 'The ref to use for the cache. The default is the current ref.' 10 | required: false 11 | default: ${{ github.ref }} 12 | path: 13 | description: 'A list of files, directories, and wildcard patterns to cache and restore' 14 | required: true 15 | key: 16 | description: 'An explicit key for restoring and saving the cache' 17 | required: true 18 | restore-keys: 19 | description: 'An ordered multiline string listing the prefix-matched keys, that are used for restoring stale cache if no cache hit occurred for key. Note `cache-hit` returns false in this case.' 20 | required: false 21 | token: 22 | description: 'The token used to read/write the cache. The default is the GITHUB_TOKEN secret.' 23 | required: false 24 | default: ${{ github.token }} 25 | 26 | outputs: 27 | cache-hit: 28 | description: 'A boolean value to indicate an exact match was found for the primary key' 29 | value: ${{ steps.restore.outputs.cache-hit }} 30 | cache-primary-key: 31 | description: 'A resolved cache key for which cache match was attempted' 32 | value: ${{ steps.restore.outputs.cache-primary-key }} 33 | cache-matched-key: 34 | description: 'Key of the cache that was restored, it could either be the primary key on cache-hit or a partial/complete match of one of the restore keys' 35 | value: ${{ steps.restore.outputs.cache-matched-key }} 36 | 37 | runs: 38 | using: "composite" 39 | steps: 40 | - name: Restore cache 41 | id: restore 42 | uses: actions/cache/restore@v5 43 | with: 44 | path: ${{ inputs.path }} 45 | key: ${{ inputs.key }} 46 | restore-keys: ${{ inputs.restore-keys }} 47 | 48 | - name: Delete cache 49 | id: delete 50 | if: ${{ steps.restore.outputs.cache-matched-key != '' }} 51 | shell: bash 52 | run: | 53 | response=$(curl -L -w "%{http_code}" -o response_body.txt \ 54 | -X DELETE \ 55 | -H "Accept: application/vnd.github+json" \ 56 | -H "Authorization: Bearer ${{ inputs.token }}" \ 57 | -H "X-GitHub-Api-Version: 2022-11-28" \ 58 | "https://api.github.com/repos/${{ inputs.repository }}/actions/caches?key=${{ steps.restore.outputs.cache-matched-key }}&ref=${{ inputs.ref }}") 59 | if [ "$response" -ne 200 ]; then 60 | echo "Error: Failed to delete cache with status code $response" 61 | echo "Response body:" 62 | cat response_body.txt 63 | echo "result=false" >> "$GITHUB_OUTPUT" 64 | else 65 | echo "result=true" >> "$GITHUB_OUTPUT" 66 | fi 67 | rm -f response_body.txt 68 | 69 | - name: Save cache 70 | if: ${{ steps.restore.outputs.cache-matched-key != '' && steps.delete.outputs.result == 'true' }} 71 | uses: actions/cache/save@v5 72 | with: 73 | path: ${{ inputs.path }} 74 | key: ${{ steps.restore.outputs.cache-matched-key }} 75 | -------------------------------------------------------------------------------- /.github/workflows/llvm.yml: -------------------------------------------------------------------------------- 1 | name: LLVM 2 | run-name: "${{ inputs.run_name != '' && inputs.run_name || github.workflow }}" 3 | 4 | on: 5 | workflow_dispatch: 6 | inputs: 7 | pgo: 8 | description: "Build llvm with PGO" 9 | required: false 10 | default: false 11 | type: boolean 12 | no_save_cache: 13 | description: "Don't save caches after success build" 14 | required: false 15 | default: false 16 | type: boolean 17 | trigger_toolchain: 18 | description: "Trigger toolchain build action after success build" 19 | required: false 20 | default: true 21 | type: boolean 22 | build_target: 23 | description: "Toolchain build target" 24 | required: false 25 | default: "all-64bit" 26 | type: choice 27 | options: 28 | - 32bit 29 | - 64bit 30 | - 64bit-v3 31 | - aarch64 32 | - all-64bit 33 | - all 34 | trigger_build: 35 | description: "Trigger mpv build action after toolchain build" 36 | required: false 37 | default: true 38 | type: boolean 39 | release: 40 | description: "Publish a release after mpv build" 41 | required: false 42 | default: false 43 | type: boolean 44 | run_name: 45 | description: 'The name displayed in the list of workflow runs' 46 | required: false 47 | 48 | jobs: 49 | build_llvm: 50 | name: Build LLVM 51 | runs-on: ubuntu-latest 52 | container: 53 | image: ghcr.io/archlinux/archlinux:base-devel 54 | steps: 55 | - name: suffix 56 | id: suffix 57 | run: | 58 | cache_suffix="$(date "+%Y-%m-%d")-${{ github.run_id }}-${{ github.run_attempt }}" 59 | echo "cache_suffix=$cache_suffix" >> "$GITHUB_OUTPUT" 60 | - name: Install Dependencies 61 | run: | 62 | sudo pacman-key --init 63 | sudo pacman-key --populate archlinux 64 | sudo pacman -Syu --noconfirm 65 | sudo pacman -S --noconfirm --needed git ninja cmake meson wget mimalloc go 7zip unzip 66 | sudo pacman -U --noconfirm https://archive.archlinux.org/packages/m/meson/meson-1.9.2-1-any.pkg.tar.zst 67 | git config --global user.name "github-actions[bot]" 68 | git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" 69 | git config --global pull.rebase true 70 | git config --global rebase.autoStash true 71 | git config --global fetch.prune true 72 | sudo GOBIN=/usr/bin go install go.chromium.org/luci/cipd/client/cmd/...@latest 73 | sudo cipd install fuchsia/third_party/clang/linux-amd64 latest -root /usr/local/fuchsia-clang 74 | echo "PATH=/usr/local/fuchsia-clang/bin:$PATH" >> $GITHUB_ENV 75 | - uses: actions/checkout@v6 76 | - name: Checkout toolchain 77 | uses: actions/checkout@v6 78 | with: 79 | repository: shinchiro/mpv-winbuild-cmake 80 | path: mpv-winbuild-cmake 81 | fetch-depth: 0 82 | 83 | - name: Build LLVM 84 | uses: ./action/build_toolchain 85 | with: 86 | bit: "64-v3" 87 | compiler: "clang" 88 | command: "ninja -C $buildroot/build$bit llvm" 89 | extra_option: "${{ inputs.pgo && '-DLLVM_ENABLE_PGO=GEN -DLLVM_PROFILE_DATA_DIR=$PWD/profiles/'}}" 90 | 91 | - name: Training LLVM 92 | uses: ./action/build_toolchain 93 | if: ${{ inputs.pgo }} 94 | with: 95 | bit: "64-v3" 96 | compiler: "clang" 97 | command: "ninja -C $buildroot/build$bit rebuild_cache && cmake --build $buildroot/build$bit --target llvm-download && ninja -C $buildroot/build$bit llvm-clang" 98 | extra_option: "-DLLVM_ENABLE_PGO=GEN -DLLVM_PROFILE_DATA_DIR=$buildroot/profiles/" 99 | 100 | - name: Merging profdata 101 | if: ${{ inputs.pgo }} 102 | run: | 103 | shopt -s globstar 104 | cd mpv-winbuild-cmake/profiles/ 105 | ls -R 106 | llvm-profdata merge *.profraw -o ../llvm.profdata 107 | rm -rf ./{*,.*} || true 108 | 109 | - name: Build LLVM with PGO 110 | uses: ./action/build_toolchain 111 | if: ${{ inputs.pgo }} 112 | with: 113 | bit: "64-v3" 114 | compiler: "clang" 115 | command: "ninja -C $buildroot/build$bit llvm && rm -rf clang_root/llvm-thinlto || true" 116 | extra_option: "-DLLVM_ENABLE_PGO=USE -DLLVM_ENABLE_LTO=Thin -DLLVM_PROFDATA_FILE=$buildroot/llvm.profdata" 117 | 118 | - name: Save llvm cache 119 | uses: actions/cache/save@v5.0.1 120 | if: ${{ !inputs.no_save_cache }} 121 | with: 122 | path: | 123 | mpv-winbuild-cmake/clang_root 124 | key: llvm-${{ steps.suffix.outputs.cache_suffix }} 125 | 126 | - name: Collect logs 127 | if: ${{ always() }} 128 | run: | 129 | sudo 7z a logs.7z $(find mpv-winbuild-cmake -type f -iname "*-*.log") 130 | - name: upload logs 131 | uses: actions/upload-artifact@v6 132 | if: ${{ always() }} 133 | with: 134 | name: llvm_logs 135 | path: logs.7z 136 | 137 | 138 | trigger: 139 | needs: [build_llvm] 140 | if: ${{ always() && inputs.trigger_toolchain && !inputs.no_save_cache && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }} 141 | runs-on: ubuntu-latest 142 | permissions: 143 | actions: write 144 | 145 | steps: 146 | - name: Trigger Toolchain build workflow 147 | uses: actions/github-script@v8 148 | with: 149 | retries: 3 150 | script: | 151 | const repo="${{github.repository}}".split('/')[1]; 152 | await github.rest.actions.createWorkflowDispatch({ 153 | owner: '${{github.repository_owner}}', 154 | repo, 155 | ref: '${{github.ref}}', 156 | workflow_id: 'toolchain.yml', 157 | inputs: { 158 | build_target: "${{ inputs.build_target }}", 159 | compiler: "clang", 160 | trigger_build: ${{ inputs.trigger_build }}, 161 | release: ${{ inputs.release }}, 162 | run_name: `CI Build: llvm update` 163 | } 164 | }) 165 | -------------------------------------------------------------------------------- /compile-lgpl-libmpv.patch: -------------------------------------------------------------------------------- 1 | From e6bf7f8db6d41538ed703e9e8767ab47c9d828c6 Mon Sep 17 00:00:00 2001 2 | From: zhongfly <11155705+zhongfly@users.noreply.github.com> 3 | Date: Wed, 29 Oct 2025 23:03:04 +0800 4 | Subject: [PATCH] packages: compile lgpl libmpv 5 | 6 | --- 7 | cmake/packages_check.cmake | 6 +----- 8 | packages/ffmpeg.cmake | 23 ----------------------- 9 | packages/libarchive.cmake | 3 +-- 10 | packages/mpv.cmake | 30 ++++++++---------------------- 11 | 4 files changed, 10 insertions(+), 52 deletions(-) 12 | 13 | diff --git a/cmake/packages_check.cmake b/cmake/packages_check.cmake 14 | index acf8ccb..f843cce 100644 15 | --- a/cmake/packages_check.cmake 16 | +++ b/cmake/packages_check.cmake 17 | @@ -7,11 +7,7 @@ if(COMPILER_TOOLCHAIN STREQUAL "gcc") 18 | set(ffmpeg_extra_libs "-lstdc++") 19 | set(libjxl_unaligned_vector "-Wa,-muse-unaligned-vector-move") # fix crash on AVX2 proc (64bit) due to unaligned stack memory 20 | set(mpv_copy_debug COMMAND ${CMAKE_COMMAND} -E copy /mpv.debug ${CMAKE_CURRENT_BINARY_DIR}/mpv-debug/mpv.debug) 21 | - set(mpv_add_debuglink COMMAND ${EXEC} ${TARGET_ARCH}-objcopy --only-keep-debug /mpv.exe /mpv.debug 22 | - COMMAND ${EXEC} ${TARGET_ARCH}-strip -s /mpv.exe 23 | - COMMAND ${EXEC} ${TARGET_ARCH}-objcopy --add-gnu-debuglink=/mpv.debug /mpv.exe 24 | - COMMAND ${EXEC} ${TARGET_ARCH}-strip -s /mpv.com 25 | - COMMAND ${EXEC} ${TARGET_ARCH}-strip -s /libmpv-2.dll) 26 | + set(mpv_add_debuglink COMMAND ${EXEC} ${TARGET_ARCH}-strip -s /libmpv-2.dll) 27 | elseif(COMPILER_TOOLCHAIN STREQUAL "clang") 28 | set(rust_target "gnullvm") 29 | set(vapoursynth_pkgconfig_libs "-lVapourSynth -Wl,-delayload=VapourSynth.dll") 30 | diff --git a/packages/ffmpeg.cmake b/packages/ffmpeg.cmake 31 | index 252c687..1c666b3 100644 32 | --- a/packages/ffmpeg.cmake 33 | +++ b/packages/ffmpeg.cmake 34 | @@ -1,18 +1,13 @@ 35 | ExternalProject_Add(ffmpeg 36 | DEPENDS 37 | amf-headers 38 | - avisynth-headers 39 | ${nvcodec_headers} 40 | bzip2 41 | lame 42 | lcms2 43 | openssl 44 | - libssh 45 | - libsrt 46 | libass 47 | libbluray 48 | - libdvdnav 49 | - libdvdread 50 | libmodplug 51 | libpng 52 | libsoxr 53 | @@ -26,24 +21,18 @@ ExternalProject_Add(ffmpeg 54 | opus 55 | speex 56 | vorbis 57 | - x264 58 | - ${ffmpeg_x265} 59 | - xvidcore 60 | libxml2 61 | libvpl 62 | libopenmpt 63 | libjxl 64 | shaderc 65 | libplacebo 66 | - libzvbi 67 | libaribcaption 68 | aom 69 | svtav1 70 | dav1d 71 | vapoursynth 72 | ${ffmpeg_uavs3d} 73 | - ${ffmpeg_davs2} 74 | - rubberband 75 | libva 76 | openal-soft 77 | GIT_REPOSITORY https://github.com/FFmpeg/FFmpeg.git 78 | @@ -59,14 +48,10 @@ ExternalProject_Add(ffmpeg 79 | --pkg-config-flags=--static 80 | --enable-cross-compile 81 | --enable-runtime-cpudetect 82 | - --enable-gpl 83 | --enable-version3 84 | - --enable-avisynth 85 | --enable-vapoursynth 86 | --enable-libass 87 | --enable-libbluray 88 | - --enable-libdvdnav 89 | - --enable-libdvdread 90 | --enable-libfreetype 91 | --enable-libfribidi 92 | --enable-libfontconfig 93 | @@ -80,28 +65,20 @@ ExternalProject_Add(ffmpeg 94 | --enable-libspeex 95 | --enable-libvorbis 96 | --enable-libbs2b 97 | - --enable-librubberband 98 | --enable-libvpx 99 | --enable-libwebp 100 | - --enable-libx264 101 | - --enable-libx265 102 | --enable-libaom 103 | --enable-libsvtav1 104 | --enable-libdav1d 105 | - ${ffmpeg_davs2_cmd} 106 | ${ffmpeg_uavs3d_cmd} 107 | - --enable-libxvid 108 | --enable-libzimg 109 | --enable-openssl 110 | --enable-libxml2 111 | --enable-libmysofa 112 | - --enable-libssh 113 | - --enable-libsrt 114 | --enable-libvpl 115 | --enable-libjxl 116 | --enable-libplacebo 117 | --enable-libshaderc 118 | - --enable-libzvbi 119 | --enable-libaribcaption 120 | ${ffmpeg_cuda} 121 | --enable-amf 122 | diff --git a/packages/libarchive.cmake b/packages/libarchive.cmake 123 | index 390e685..1ef119d 100644 124 | --- a/packages/libarchive.cmake 125 | +++ b/packages/libarchive.cmake 126 | @@ -2,7 +2,6 @@ ExternalProject_Add(libarchive 127 | DEPENDS 128 | bzip2 129 | expat 130 | - lzo 131 | xz 132 | zlib 133 | zstd 134 | @@ -27,7 +26,7 @@ ExternalProject_Add(libarchive 135 | -DENABLE_ICONV=ON 136 | -DENABLE_LIBXML2=ON 137 | -DENABLE_EXPAT=ON 138 | - -DENABLE_LZO=ON 139 | + -DENABLE_LZO=OFF 140 | -DENABLE_LZMA=ON 141 | -DENABLE_CPIO=OFF 142 | -DENABLE_CAT=OFF 143 | diff --git a/packages/mpv.cmake b/packages/mpv.cmake 144 | index 8624aec..2b94844 100644 145 | --- a/packages/mpv.cmake 146 | +++ b/packages/mpv.cmake 147 | @@ -6,15 +6,11 @@ ExternalProject_Add(mpv 148 | lcms2 149 | libarchive 150 | libass 151 | - libdvdnav 152 | - libdvdread 153 | libiconv 154 | libjpeg 155 | libpng 156 | luajit 157 | - rubberband 158 | uchardet 159 | - openal-soft 160 | mujs 161 | vulkan 162 | shaderc 163 | @@ -32,23 +28,25 @@ ExternalProject_Add(mpv 164 | --cross-file=${MESON_CROSS} 165 | --default-library=shared 166 | --prefer-static 167 | + -Dgpl=false 168 | -Ddebug=true 169 | -Db_ndebug=true 170 | -Doptimization=3 171 | -Db_lto=true 172 | ${mpv_lto_mode} 173 | + -Dcplayer=false 174 | -Dlibmpv=true 175 | - -Dpdf-build=enabled 176 | + -Dpdf-build=disabled 177 | -Dlua=enabled 178 | -Djavascript=enabled 179 | -Dsdl2-gamepad=enabled 180 | -Dlibarchive=enabled 181 | -Dlibbluray=enabled 182 | - -Ddvdnav=enabled 183 | + -Ddvdnav=disabled 184 | -Duchardet=enabled 185 | - -Drubberband=enabled 186 | + -Drubberband=disabled 187 | -Dlcms2=enabled 188 | - -Dopenal=enabled 189 | + -Dopenal=disabled 190 | -Dspirv-cross=enabled 191 | -Dvulkan=enabled 192 | -Dvapoursynth=enabled 193 | @@ -67,13 +65,6 @@ ExternalProject_Add_Step(mpv strip-binary 194 | 195 | ExternalProject_Add_Step(mpv copy-binary 196 | DEPENDEES strip-binary 197 | - COMMAND ${CMAKE_COMMAND} -E copy /mpv.exe ${CMAKE_CURRENT_BINARY_DIR}/mpv-package/mpv.exe 198 | - COMMAND ${CMAKE_COMMAND} -E copy /mpv.com ${CMAKE_CURRENT_BINARY_DIR}/mpv-package/mpv.com 199 | - COMMAND ${CMAKE_COMMAND} -E copy /etc/mpv-register.bat ${CMAKE_CURRENT_BINARY_DIR}/mpv-package/mpv-register.bat 200 | - COMMAND ${CMAKE_COMMAND} -E copy /etc/mpv-unregister.bat ${CMAKE_CURRENT_BINARY_DIR}/mpv-package/mpv-unregister.bat 201 | - COMMAND ${CMAKE_COMMAND} -E copy /mpv.pdf ${CMAKE_CURRENT_BINARY_DIR}/mpv-package/doc/manual.pdf 202 | - COMMAND ${CMAKE_COMMAND} -E copy ${MINGW_INSTALL_PREFIX}/etc/fonts/fonts.conf ${CMAKE_CURRENT_BINARY_DIR}/mpv-package/mpv/fonts.conf 203 | - ${mpv_copy_debug} 204 | COMMAND ${CMAKE_COMMAND} -E copy /libmpv-2.dll ${CMAKE_CURRENT_BINARY_DIR}/mpv-dev/libmpv-2.dll 205 | COMMAND ${CMAKE_COMMAND} -E copy /libmpv.dll.a ${CMAKE_CURRENT_BINARY_DIR}/mpv-dev/libmpv.dll.a 206 | COMMAND ${CMAKE_COMMAND} -E copy /include/mpv/client.h ${CMAKE_CURRENT_BINARY_DIR}/mpv-dev/include/mpv/client.h 207 | @@ -93,14 +84,9 @@ mv $2 $2-git-\${GIT}") 208 | ExternalProject_Add_Step(mpv copy-package-dir 209 | DEPENDEES copy-binary 210 | COMMAND chmod 755 ${RENAME} 211 | - COMMAND mv ${CMAKE_CURRENT_BINARY_DIR}/mpv-package ${CMAKE_BINARY_DIR}/mpv-${TARGET_CPU}${x86_64_LEVEL}-${BUILDDATE} 212 | - COMMAND ${RENAME} ${CMAKE_BINARY_DIR}/mpv-${TARGET_CPU}${x86_64_LEVEL}-${BUILDDATE} 213 | 214 | - COMMAND mv ${CMAKE_CURRENT_BINARY_DIR}/mpv-debug ${CMAKE_BINARY_DIR}/mpv-debug-${TARGET_CPU}${x86_64_LEVEL}-${BUILDDATE} 215 | - COMMAND ${RENAME} ${CMAKE_BINARY_DIR}/mpv-debug-${TARGET_CPU}${x86_64_LEVEL}-${BUILDDATE} 216 | - 217 | - COMMAND mv ${CMAKE_CURRENT_BINARY_DIR}/mpv-dev ${CMAKE_BINARY_DIR}/mpv-dev-${TARGET_CPU}${x86_64_LEVEL}-${BUILDDATE} 218 | - COMMAND ${RENAME} ${CMAKE_BINARY_DIR}/mpv-dev-${TARGET_CPU}${x86_64_LEVEL}-${BUILDDATE} 219 | + COMMAND mv ${CMAKE_CURRENT_BINARY_DIR}/mpv-dev ${CMAKE_BINARY_DIR}/mpv-dev-lgpl-${TARGET_CPU}${x86_64_LEVEL}-${BUILDDATE} 220 | + COMMAND ${RENAME} ${CMAKE_BINARY_DIR}/mpv-dev-lgpl-${TARGET_CPU}${x86_64_LEVEL}-${BUILDDATE} 221 | COMMENT "Moving mpv package folder" 222 | LOG 1 223 | ) 224 | -- 225 | 2.51.2.windows.1 226 | 227 | -------------------------------------------------------------------------------- /.github/workflows/toolchain.yml: -------------------------------------------------------------------------------- 1 | name: toolchain 2 | run-name: "${{ inputs.run_name != '' && format('{0} ({1})', inputs.run_name, inputs.compiler) || format('{0} ({1})', github.workflow, inputs.compiler) }}" 3 | 4 | on: 5 | # schedule: 6 | # - cron: '0 12 * * *' 7 | workflow_dispatch: 8 | inputs: 9 | build_target: 10 | description: "Build target" 11 | required: false 12 | default: "all-64bit" 13 | type: choice 14 | options: 15 | - 32bit 16 | - 64bit 17 | - 64bit-v3 18 | - aarch64 19 | - all-64bit 20 | - all 21 | compiler: 22 | required: false 23 | default: "clang" 24 | type: choice 25 | options: 26 | - gcc 27 | - clang 28 | no_save_cache: 29 | description: "Don't save caches after success build" 30 | required: false 31 | default: false 32 | type: boolean 33 | trigger_build: 34 | description: "Trigger mpv build action after success build" 35 | required: false 36 | default: true 37 | type: boolean 38 | release: 39 | description: "Publish a release" 40 | required: false 41 | default: false 42 | type: boolean 43 | run_name: 44 | description: 'The name displayed in the list of workflow runs' 45 | required: false 46 | 47 | jobs: 48 | params: 49 | runs-on: ubuntu-latest 50 | outputs: 51 | matrix: ${{ steps.script.outputs.matrix }} 52 | cache_suffix: ${{ steps.suffix.outputs.cache_suffix }} 53 | steps: 54 | - id: script 55 | uses: actions/github-script@v8 56 | with: 57 | script: | 58 | let matrix = {}; 59 | let build_target = "${{ inputs.build_target }}" 60 | switch ( build_target ) { 61 | case "32bit": 62 | matrix.bit = ["32"]; 63 | break; 64 | case "64bit": 65 | matrix.bit = ["64"]; 66 | break; 67 | case "64bit-v3": 68 | matrix.bit = ["64-v3"]; 69 | break; 70 | case "aarch64": 71 | matrix.bit = ["aarch64"]; 72 | break; 73 | case "all-64bit": 74 | matrix.bit = ["64","64-v3","aarch64"]; 75 | break; 76 | case "all": 77 | matrix.bit = ["32","64","64-v3","aarch64"]; 78 | break; 79 | default: 80 | matrix.bit = ["64","64-v3","aarch64"]; 81 | break; 82 | } 83 | core.setOutput("matrix",JSON.stringify(matrix)); 84 | 85 | - id: suffix 86 | run: | 87 | cache_suffix="$(date "+%Y-%m-%d")-${{ github.run_id }}-${{ github.run_attempt }}" 88 | echo "cache_suffix=$cache_suffix" >> "$GITHUB_OUTPUT" 89 | 90 | build: 91 | name: Build Toolchain 92 | needs: [params] 93 | runs-on: ubuntu-latest 94 | container: 95 | image: ghcr.io/archlinux/archlinux:base-devel 96 | continue-on-error: true 97 | strategy: 98 | matrix: ${{ fromJson(needs.params.outputs.matrix) }} 99 | 100 | steps: 101 | - name: Install Dependencies 102 | run: | 103 | sudo echo -e "[multilib]\nInclude = /etc/pacman.d/mirrorlist" | sudo tee -a /etc/pacman.conf >/dev/null 104 | sudo pacman-key --init 105 | sudo pacman-key --populate archlinux 106 | sudo pacman -Syu --noconfirm 107 | sudo pacman -S --noconfirm --needed git ninja cmake meson wget mimalloc 7zip unzip 108 | sudo pacman -U --noconfirm https://archive.archlinux.org/packages/m/meson/meson-1.9.2-1-any.pkg.tar.zst 109 | git config --global user.name "github-actions[bot]" 110 | git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" 111 | git config --global pull.rebase true 112 | git config --global rebase.autoStash true 113 | git config --global fetch.prune true 114 | - uses: actions/checkout@v6 115 | 116 | - name: Checkout toolchain 117 | uses: actions/checkout@v6 118 | with: 119 | repository: shinchiro/mpv-winbuild-cmake 120 | path: mpv-winbuild-cmake 121 | fetch-depth: 0 122 | 123 | - name: Restore llvm cache 124 | if: ${{ inputs.compiler =='clang' }} 125 | uses: actions/cache/restore@v5.0.1 126 | with: 127 | fail-on-cache-miss: true 128 | path: | 129 | mpv-winbuild-cmake/clang_root 130 | key: llvm-${{ needs.params.outputs.cache_suffix }} 131 | restore-keys: | 132 | llvm- 133 | 134 | - name: Build GCC Toolchain 135 | uses: ./action/build_toolchain 136 | if: ${{ inputs.compiler =='gcc' }} 137 | with: 138 | bit: "${{ matrix.bit }}" 139 | compiler: "gcc" 140 | command: "ninja -C $buildroot/build$bit gcc" 141 | 142 | - name: Build Clang Toolchain 143 | uses: ./action/build_toolchain 144 | if: ${{ inputs.compiler =='clang' }} 145 | with: 146 | bit: "${{ matrix.bit }}" 147 | compiler: "clang" 148 | command: "ninja -C $buildroot/build$bit rebuild_cache && cmake --build $buildroot/build$bit --target llvm-download && ninja -C $buildroot/build$bit llvm-clang" 149 | 150 | - name: Save Toolchain Cache 151 | if: ${{ inputs.no_save_cache != true }} 152 | uses: actions/cache/save@v5.0.1 153 | with: 154 | path: ${{ github.workspace }}/mpv-winbuild-cmake/build${{ matrix.bit }} 155 | key: toolchain-${{ inputs.compiler }}-build${{ matrix.bit }}-${{ needs.params.outputs.cache_suffix }} 156 | 157 | - name: Save clang_root cache 158 | if: ${{ inputs.compiler =='clang' && inputs.no_save_cache != true }} 159 | uses: actions/cache/save@v5.0.1 160 | with: 161 | path: ${{ github.workspace }}/mpv-winbuild-cmake/clang_root 162 | key: ${{ matrix.bit }}-clang_root-${{ needs.params.outputs.cache_suffix }} 163 | 164 | - name: Collect logs 165 | if: ${{ always() }} 166 | run: | 167 | sudo 7z a logs.7z $(find mpv-winbuild-cmake -type f -iname "*-*.log" -or -wholename "*/ffbuild/config.log") 168 | - name: upload logs 169 | uses: actions/upload-artifact@v6 170 | if: ${{ always() }} 171 | with: 172 | name: ${{ matrix.bit }}_logs 173 | path: logs.7z 174 | 175 | rust: 176 | name: Install Rust Toolchain 177 | needs: [params] 178 | if: ${{ false }} 179 | runs-on: ubuntu-latest 180 | container: 181 | image: ghcr.io/archlinux/archlinux:base-devel 182 | continue-on-error: true 183 | 184 | steps: 185 | - name: Install Dependencies 186 | run: | 187 | sudo pacman -Syu --noconfirm 188 | sudo pacman -S --noconfirm --needed git ninja cmake meson wget 189 | git config --global user.name "github-actions[bot]" 190 | git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" 191 | git config --global pull.rebase true 192 | git config --global rebase.autoStash true 193 | git config --global fetch.prune true 194 | - uses: actions/checkout@v6 195 | 196 | - name: Checkout toolchain 197 | uses: actions/checkout@v6 198 | with: 199 | repository: shinchiro/mpv-winbuild-cmake 200 | path: mpv-winbuild-cmake 201 | fetch-depth: 0 202 | 203 | - name: Install Rust Toolchain 204 | uses: ./action/build_toolchain 205 | with: 206 | bit: "64-v3" 207 | command: "ninja -C $buildroot/build$bit rustup && ninja -C $buildroot/build$bit cargo-clean" 208 | 209 | - name: Save Rust Cache 210 | if: ${{ inputs.no_save_cache != true }} 211 | uses: actions/cache/save@v5.0.1 212 | with: 213 | path: ${{ github.workspace }}/mpv-winbuild-cmake/install_rustup 214 | key: rust-${{ needs.params.outputs.cache_suffix }} 215 | 216 | trigger: 217 | needs: [build,params] 218 | if: ${{ always() && inputs.trigger_build != false && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') }} 219 | runs-on: ubuntu-latest 220 | permissions: 221 | actions: write 222 | 223 | steps: 224 | - name: Trigger mpv build workflow 225 | uses: actions/github-script@v8 226 | with: 227 | retries: 3 228 | script: | 229 | let build_target=new Set(); 230 | const release = ${{ inputs.release }}; 231 | const targets = {"build64-v3":"64bit-v3","build64":"64bit","build32":"32bit","buildaarch64":"aarch64"} 232 | const repo="${{github.repository}}".split('/')[1]; 233 | const cache_suffix="${{ needs.params.outputs.cache_suffix }}"; 234 | const cache = await github.rest.actions.getActionsCacheList({ 235 | owner: '${{github.repository_owner}}', 236 | repo, 237 | ref: '${{github.ref}}', 238 | key: 'toolchain-${{ inputs.compiler }}-', 239 | sort: 'created_at', 240 | per_page: 20, 241 | }) 242 | if(cache?.data?.actions_caches){ 243 | let success=cache.data.actions_caches.filter((i) => i.key.endsWith(cache_suffix)); 244 | for(const i of success){ 245 | for(const [key, value] of Object.entries(targets)){ 246 | if (i.key.includes(key)) { 247 | build_target.add(value); 248 | core.info(`Found success ${value} build cache: ${i.key}.`) 249 | break; 250 | } 251 | } 252 | } 253 | } 254 | if(build_target.size>0){ 255 | if(build_target.has("64bit-v3") && build_target.has("64bit") && build_target.has("aarch64")) { 256 | build_target.delete("64bit-v3"); 257 | build_target.delete("64bit"); 258 | build_target.delete("aarch64"); 259 | build_target.add("all-64bit"); 260 | } 261 | if(build_target.has("all-64bit") && build_target.has("32bit")) { 262 | build_target.delete("all-64bit"); 263 | build_target.delete("32bit"); 264 | build_target.add("all"); 265 | } 266 | for (const t of build_target){ 267 | await github.rest.actions.createWorkflowDispatch({ 268 | owner: '${{github.repository_owner}}', 269 | repo, 270 | ref: '${{github.ref}}', 271 | workflow_id: 'mpv.yml', 272 | inputs: { 273 | build_target: t, 274 | compiler: "${{ inputs.compiler }}", 275 | needclean: true, 276 | release: release, 277 | run_name: `CI Build: ${t} toolchain cache update` 278 | } 279 | }) 280 | } 281 | } else { 282 | core.setFailed("Don't find any success build cache"); 283 | } 284 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # mpv-winbuild 2 | 3 | [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/zhongfly/mpv-winbuild/mpv.yml?branch=main&cacheSeconds=1800)](https://github.com/zhongfly/mpv-winbuild/actions) 4 | [![releases](https://img.shields.io/github/v/release/zhongfly/mpv-winbuild?cacheSeconds=1800)](https://github.com/zhongfly/mpv-winbuild/releases/latest) 5 | [![downloads](https://img.shields.io/github/downloads/zhongfly/mpv-winbuild/total?cacheSeconds=1800)](https://github.com/zhongfly/mpv-winbuild/releases) 6 | 7 | Use Github Action to build mpv for Windows with latest commit. 8 | 9 | Based on . 10 | 11 | ## Auto-Builds 12 | 13 | Checks the mpv repository every hour for updates. If there is an update and it is relevant to the windows build, it will automatically run the compilation and **release it on success**. 14 | 15 | This repo only provides 64-bit version. If you need a 32-bit version, you can fork this repo and run `MPV` workflow by yourself. 16 | 17 | > [!NOTE] 18 | > `mpv-dev-xxxx.7z` is libmpv, including the `libmpv-2.dll` file. 19 | > 20 | > Some media players based on libmpv use `libmpv-2.dll` or `mpv-2.dll`.You can upgrade their libmpv by overwriting this dll. 21 | > 22 | > `mpv-dev-lgpl-xxxx.7z` is libmpv under LGPLv2.1+ license, which disables LGPLv2.1+ incompatible packages and statically links to ffmpeg under LGPLv3. 23 | > 24 | > I'm not a lawyer and can't guarantee that I've disabled all LGPL-incompatible packages, use at your own risk. 25 | 26 | ### Release Retention Policy 27 | 28 | - The last 30 days of builds will be retained. 29 | 30 | ## Information about packages 31 | 32 | same as [shinchiro](https://github.com/shinchiro/mpv-winbuild-cmake/blob/master/README.md#information-about-packages) [![](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Fshinchiro%2Fmpv-winbuild-cmake&cacheSeconds=1800)](https://github.com/shinchiro/mpv-winbuild-cmake) 33 | 34 | - Git/Hg 35 | - amf-headers [![amf-headers](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2FGPUOpen-LibrariesAndSDKs%2FAMF&cacheSeconds=1800)](https://github.com/GPUOpen-LibrariesAndSDKs/AMF/tree/master/amf/public/include) 36 | - ANGLE [![ANGLE](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Fgoogle%2Fangle%2Fmain&cacheSeconds=1800)](https://github.com/google/angle) 37 | - aom [![aom](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Fm-ab-s%2Faom&cacheSeconds=1800)](https://aomedia.googlesource.com/aom) 38 | - avisynth-headers [![avisynth-headers](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2FAviSynth%2FAviSynthPlus&cacheSeconds=1800)](https://github.com/AviSynth/AviSynthPlus) 39 | - bzip2 [![bzip2](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgitlab%2Fgitlab.com%2Fbzip2%2Fbzip2&cacheSeconds=1800)](https://gitlab.com/bzip2/bzip2) 40 | - dav1d [![dav1d](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgitlab%2Fcode.videolan.org%2Fvideolan%2Fdav1d&cacheSeconds=1800)](https://code.videolan.org/videolan/dav1d/) 41 | - davs2 [![davs2](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Fpkuvcl%2Fdavs2&cacheSeconds=1800)](https://github.com/pkuvcl/davs2) 42 | - expat [![expat](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Flibexpat%2Flibexpat&cacheSeconds=1800)](https://github.com/libexpat/libexpat) 43 | - FFmpeg [![FFmpeg](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2FFFmpeg%2FFFmpeg&cacheSeconds=1800)](https://github.com/FFmpeg/FFmpeg) 44 | - fontconfig [![fontconfig](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgitlab%2Fgitlab.freedesktop.org%2Ffontconfig%2Ffontconfig&cacheSeconds=1800)](https://gitlab.freedesktop.org/fontconfig/fontconfig) 45 | - freetype2 [![freetype2](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Ffreetype%2Ffreetype&cacheSeconds=1800)](https://github.com/freetype/freetype) 46 | - fribidi [![fribidi](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Ffribidi%2Ffribidi&cacheSeconds=1800)](https://github.com/fribidi/fribidi) 47 | - harfbuzz [![harfbuzz](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Fharfbuzz%2Fharfbuzz%2Fmain&cacheSeconds=1800)](https://github.com/harfbuzz/harfbuzz) 48 | - lame [![lame](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgitlab%2Fgitlab.com%2Fshinchiro%2F%2Flame&cacheSeconds=1800)](https://gitlab.com/shinchiro/lame) 49 | - lcms2 [![lcms2](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Fmm2%2FLittle-CMS&cacheSeconds=1800)](https://github.com/mm2/Little-CMS) 50 | - libarchive [![libarchive](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Flibarchive%2Flibarchive&cacheSeconds=1800)](https://github.com/libarchive/libarchive) 51 | - libaribcaption [![libaribcaption](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Fxqq%2Flibaribcaption&cacheSeconds=1800)](https://github.com/xqq/libaribcaption) 52 | - libass [![libass](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Flibass%2Flibass&cacheSeconds=1800)](https://github.com/libass/libass) 53 | - libbluray [![libbluray](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgitlab%2Fcode.videolan.org%2Fvideolan%2Flibbluray&cacheSeconds=1800)](https://code.videolan.org/videolan/libbluray) 54 | - libbs2b [![libbs2b](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Falexmarsev%2Flibbs2b&cacheSeconds=1800)](https://github.com/alexmarsev/libbs2b) 55 | - libdvdcss [![libdvdcss](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgitlab%2Fcode.videolan.org%2Fvideolan%2Flibdvdcss&cacheSeconds=1800)](https://code.videolan.org/videolan/libdvdcss) 56 | - libdvdnav [![libdvdnav](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgitlab%2Fcode.videolan.org%2Fvideolan%2Flibdvdnav&cacheSeconds=1800)](https://code.videolan.org/videolan/libdvdnav) 57 | - libdvdread [![libdvdread](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgitlab%2Fcode.videolan.org%2Fvideolan%2Flibdvdread&cacheSeconds=1800)](https://code.videolan.org/videolan/libdvdread) 58 | - libjpeg [![libjpeg](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Flibjpeg-turbo%2Flibjpeg-turbo%2Fmain&cacheSeconds=1800)](https://github.com/libjpeg-turbo/libjpeg-turbo) 59 | - libjxl (with [brotli](https://github.com/google/brotli), [highway](https://github.com/google/highway)) [![libjxl](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Flibjxl%2Flibjxl%2Fmain&cacheSeconds=1800)](https://github.com/libjxl/libjxl) 60 | - libmodplug [![libmodplug](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2FKonstanty%2Flibmodplug&cacheSeconds=1800)](https://github.com/Konstanty/libmodplug) 61 | - libmysofa [![libmysofa](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Fhoene%2Flibmysofa%2Fmain&cacheSeconds=1800)](https://github.com/hoene/libmysofa) 62 | - libplacebo (with [glad](https://github.com/Dav1dde/glad), [fast_float](https://github.com/fastfloat/fast_float), [xxhash](https://github.com/Cyan4973/xxHash)) [![libplacebo](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Fhaasn%2Flibplacebo&cacheSeconds=1800)](https://github.com/haasn/libplacebo) 63 | - libpng [![libpng](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Fglennrp%2Flibpng&cacheSeconds=1800)](https://github.com/glennrp/libpng) 64 | - libsdl2 [![libpng](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Flibsdl-org%2FSDL%2FSDL2&style=flat-square&cacheSeconds=1800)](https://github.com/libsdl-org/SDL) 65 | - libsoxr [![libsoxr](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgitlab%2Fgitlab.com%2Fshinchiro%2Fsoxr&cacheSeconds=1800)](https://gitlab.com/shinchiro/soxr) 66 | - libsrt [![libsrt](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2FHaivision%2Fsrt&cacheSeconds=1800)](https://github.com/Haivision/srt) 67 | - libssh [![libssh](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgitlab%2Fgitlab.com%2Flibssh%2Flibssh-mirror&cacheSeconds=1800)](https://git.libssh.org/projects/libssh.git) 68 | - libudfread [![libdvdcss](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgitlab%2Fcode.videolan.org%2Fvideolan%2Flibudfread&cacheSeconds=1800)](https://code.videolan.org/videolan/libudfread) 69 | - libunibreak [![libunibreak](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Fadah1972%2Flibunibreak&cacheSeconds=1800)](https://github.com/adah1972/libunibreak) 70 | - libva [![libva](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Fintel%2Flibva&cacheSeconds=1800)](https://github.com/intel/libva) 71 | - libvpl [![libvpl](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Fintel%2Flibvpl&cacheSeconds=1800)](https://github.com/intel/libvpl) 72 | - libvpx [![libvpx](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Fwebmproject%2Flibvpx%2Fmain&cacheSeconds=1800)](https://chromium.googlesource.com/webm/libvpx) 73 | - libwebp [![libwebp](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Fwebmproject%2Flibwebp%2Fmain&cacheSeconds=1800)](https://chromium.googlesource.com/webm/libwebp) 74 | - libxml2 [![libxml2](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgitlab%2Fgitlab.gnome.org%2FGNOME%2Flibxml2&cacheSeconds=1800)](https://gitlab.gnome.org/GNOME/libxml2) 75 | - libzimg (with [graphengine](https://github.com/sekrit-twc/graphengine)) [![libzimg](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Fsekrit-twc%2Fzimg&cacheSeconds=1800)](https://github.com/sekrit-twc/zimg) 76 | - libzvbi [![libzvbi](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Fzapping-vbi%2Fzvbi%2Fmain&cacheSeconds=1800)](https://github.com/zapping-vbi/zvbi) 77 | - luajit [![luajit](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Fopenresty%2Fluajit2%2Fv2.1-agentzh&cacheSeconds=1800)](https://github.com/openresty/luajit2) 78 | - mpv [![mpv](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Fmpv-player%2Fmpv&cacheSeconds=1800)](https://github.com/mpv-player/mpv) 79 | - mujs [![mujs](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fcodeberg%2Fccxvii%2Fmujs&cacheSeconds=1800)](https://codeberg.org/ccxvii/mujs) 80 | - nvcodec-headers [![nvcodec-headers](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2FFFmpeg%2Fnv-codec-headers&cacheSeconds=1800)](https://git.videolan.org/?p=ffmpeg/nv-codec-headers.git) 81 | - ogg [![ogg](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Fxiph%2Fogg&cacheSeconds=1800)](https://github.com/xiph/ogg) 82 | - openal-soft [![openal-soft](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Fkcat%2Fopenal-soft&cacheSeconds=1800)](https://github.com/kcat/openal-soft) 83 | - openssl [![openssl](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Fopenssl%2Fopenssl&cacheSeconds=1800)](https://github.com/openssl/openssl) 84 | - opus [![opus](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Fxiph%2Fopus&cacheSeconds=1800)](https://github.com/xiph/opus) 85 | - rubberband (with [libsamplerate](https://github.com/libsndfile/libsamplerate.git)) [![rubberband](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Fbreakfastquay%2Frubberband%2Fdefault&cacheSeconds=1800)](https://github.com/breakfastquay/rubberband) 86 | - shaderc (with [spirv-headers](https://github.com/KhronosGroup/SPIRV-Headers), [spirv-tools](https://github.com/KhronosGroup/SPIRV-Tools), [glslang](https://github.com/KhronosGroup/glslang)) [![shaderc](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Fgoogle%2Fshaderc%2Fmain&cacheSeconds=1800)](https://github.com/google/shaderc) 87 | - speex [![speex](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Fxiph%2Fspeex&cacheSeconds=1800)](https://github.com/xiph/speex) 88 | - spirv-cross [![spirv-cross](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2FKhronosGroup%2FSPIRV-Cross%2Fmain&cacheSeconds=1800)](https://github.com/KhronosGroup/SPIRV-Cross) 89 | - svtav1 [![svtav1](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgitlab%2Fgitlab.com%2FAOMediaCodec%2FSVT-AV1&cacheSeconds=1800)](https://gitlab.com/AOMediaCodec/SVT-AV1) 90 | - uavs3d [![uavs3d](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Fuavs3%2Fuavs3d&cacheSeconds=1800)](https://github.com/uavs3/uavs3d) 91 | - uchardet [![uchardet](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgitlab%2Fgitlab.freedesktop.org%2Fuchardet%2Fuchardet&cacheSeconds=1800)](https://gitlab.freedesktop.org/uchardet/uchardet) 92 | - vorbis [![vorbis](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Fxiph%2Fvorbis&cacheSeconds=1800)](https://github.com/xiph/vorbis) 93 | - vulkan [![Vulkan](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2FKhronosGroup%2FVulkan-Loader%2Fmain&cacheSeconds=1800)](https://github.com/KhronosGroup/Vulkan-Loader) 94 | - vulkan-header [![Vulkan-Headers](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2FKhronosGroup%2FVulkan-Headers%2Fmain&cacheSeconds=1800)](https://github.com/KhronosGroup/Vulkan-Headers) 95 | - x264 [![x264](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgitlab%2Fcode.videolan.org%2Fvideolan%2Fx264&cacheSeconds=1800)](https://code.videolan.org/videolan/x264) 96 | - x265 (multilib) [![x265](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fbitbucket%2Fmulticoreware%2Fx265_git&cacheSeconds=1800)](https://bitbucket.org/multicoreware/x265_git) 97 | - xz [![xz](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Ftukaani-project%2Fxz&cacheSeconds=1800)](https://github.com/tukaani-project/xz) 98 | - zlib [![zlib](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Fzlib-ng%2Fzlib-ng&cacheSeconds=1800)](https://github.com/zlib-ng/zlib-ng) 99 | - zstd [![zstd](https://img.shields.io/endpoint?url=https%3A%2F%2Flatest-commit-badgen.vercel.app%2Fgithub%2Ffacebook%2Fzstd%2Fdev&cacheSeconds=1800)](https://github.com/facebook/zstd) 100 | 101 | - Zip 102 | - [xvidcore](https://labs.xvid.com/source/) (1.3.7) 103 | - [lzo](https://fossies.org/linux/misc/) (2.10) 104 | - [libopenmpt](https://lib.openmpt.org/libopenmpt/download/) (0.7.12) 105 | - [libiconv](https://ftp.gnu.org/pub/gnu/libiconv/) (1.18) 106 | - [vapoursynth](https://github.com/vapoursynth/vapoursynth) ![](https://img.shields.io/github/v/release/vapoursynth/vapoursynth?style=flat-square&cacheSeconds=1800) 107 | 108 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /.github/workflows/mpv.yml: -------------------------------------------------------------------------------- 1 | name: MPV 2 | run-name: "${{ inputs.run_name != '' && format('{0} ({1})', inputs.run_name, inputs.compiler) || inputs.prs != '' && format('{0}[{2}] ({1})', github.workflow, inputs.compiler, inputs.prs) || format('{0} ({1})', github.workflow, inputs.compiler) }}" 3 | 4 | permissions: 5 | actions: write 6 | attestations: write 7 | contents: write 8 | 9 | on: 10 | workflow_dispatch: 11 | inputs: 12 | build_target: 13 | description: "Build target" 14 | required: false 15 | default: "all-64bit" 16 | type: choice 17 | options: 18 | - 32bit 19 | - 64bit 20 | - 64bit-v3 21 | - aarch64 22 | - all-64bit 23 | - all 24 | lgpl: 25 | description: "Also build lgpl libmpv" 26 | required: false 27 | default: false 28 | type: boolean 29 | compiler: 30 | required: false 31 | default: "clang" 32 | type: choice 33 | options: 34 | - gcc 35 | - clang 36 | needclean: 37 | description: 'Build without cache' 38 | required: false 39 | default: false 40 | type: boolean 41 | no_save_cache: 42 | description: "Don't save caches after success build" 43 | required: false 44 | default: false 45 | type: boolean 46 | release: 47 | description: "Publish a release" 48 | required: false 49 | default: false 50 | type: boolean 51 | command: 52 | description: 'input command you want to run before build' 53 | required: false 54 | prs: 55 | description: "Input the pr numbers of mpv,split items by comma(',')" 56 | required: false 57 | run_name: 58 | description: 'The name displayed in the list of workflow runs' 59 | required: false 60 | 61 | jobs: 62 | params: 63 | runs-on: ubuntu-latest 64 | outputs: 65 | sha: ${{ steps.script.outputs.sha }} 66 | matrix: ${{ steps.script.outputs.matrix }} 67 | matrix_bit: ${{ steps.script.outputs.matrix_bit }} 68 | patch_note: ${{ steps.script.outputs.patch_note }} 69 | steps: 70 | - id: script 71 | uses: actions/github-script@v8 72 | with: 73 | script: | 74 | const commit = await github.rest.repos.getCommit({ 75 | owner: 'mpv-player', 76 | repo: 'mpv', 77 | ref: `master` 78 | }) 79 | core.setOutput('sha', String(commit.data.sha)) 80 | 81 | let matrix = {}; 82 | let build_target = "${{ inputs.build_target }}" 83 | switch ( build_target ) { 84 | case "32bit": 85 | matrix.bit = ["32"]; 86 | break; 87 | case "64bit": 88 | matrix.bit = ["64"]; 89 | break; 90 | case "64bit-v3": 91 | matrix.bit = ["64-v3"]; 92 | break; 93 | case "aarch64": 94 | matrix.bit = ["aarch64"]; 95 | break; 96 | case "all-64bit": 97 | matrix.bit = ["64","64-v3","aarch64"]; 98 | break; 99 | case "all": 100 | matrix.bit = ["32","64","64-v3","aarch64"]; 101 | break; 102 | default: 103 | matrix.bit = ["64","64-v3","aarch64"]; 104 | break; 105 | } 106 | core.setOutput("matrix_bit",JSON.stringify(matrix)); 107 | matrix.lgpl=[false]; 108 | if ("${{ inputs.lgpl}}" == "true") { 109 | matrix.lgpl.push(true) 110 | } 111 | core.setOutput("matrix",JSON.stringify(matrix)); 112 | 113 | const fs = require('fs/promises'); 114 | const sleep = ms => new Promise(res => setTimeout(res, ms)); 115 | const waitingMergeability = async(o)=>{ 116 | let count = 0; 117 | while (count<5) { 118 | count = count + 1; 119 | const res = await github.rest.pulls.get(o); 120 | // If the 'mergeable' is 'null', waiting for GitHub to compute the mergeability 121 | if (res.data.merged || res.data.mergeable != null) return res; 122 | if (count<5) await sleep(300*2**count); 123 | } 124 | }; 125 | let prs = "${{ inputs.prs }}".split(',').map(e=>e.trim()); 126 | let i = 1; 127 | let patch_note = ""; 128 | 129 | for (const pr of prs) { 130 | let pr_number = parseInt(pr); 131 | if (isNaN(pr_number)) { 132 | console.warn(`'${pr}' is not a number.`); 133 | continue; 134 | } 135 | 136 | try { 137 | const res = await waitingMergeability({ 138 | owner: "mpv-player", 139 | repo: "mpv", 140 | pull_number: pr_number, 141 | }); 142 | if( res === undefined || res.data.merged || !res.data.mergeable ) { 143 | console.warn(`Pr#${pr_number} can't merged because it has been merged or has conflicts with the base branch.`); 144 | continue; 145 | } 146 | const {status,data:content} = await github.request(res.data.patch_url); 147 | const name = res.data.title.replace(/[/\\?%*:|`'"<> ]/g,'-').replace(/--+/g,'-'); 148 | await fs.writeFile(`mpv-${String(i).padStart(4,'0')}-#${pr_number}-${name}.patch`, content) 149 | .then( ()=>{ i++; patch_note+=`- [#${pr_number}](${res.data.html_url}): ${res.data.title.replace(/`/g, '\\`')}\n`; }) 150 | .catch(err => console.log(err)); 151 | console.log(`Download patch of #${pr_number}: ${res.data.title}.`) 152 | } catch(error) { 153 | if (error?.response) { 154 | console.warn(`Get pr#${pr_number} failed: ${error.response.data.message}.`); 155 | } else { 156 | console.warn(error); 157 | } 158 | continue; 159 | }; 160 | } 161 | 162 | core.setOutput("patch_note",patch_note.trim()); 163 | 164 | - name: upload patch 165 | uses: actions/upload-artifact@v6 166 | if: ${{ steps.script.outputs.patch_note }} 167 | with: 168 | name: mpv-patch 169 | path: "*.patch" 170 | 171 | build_mpv: 172 | name: Build MPV 173 | needs: params 174 | runs-on: ubuntu-latest 175 | container: 176 | image: ghcr.io/archlinux/archlinux:base-devel 177 | continue-on-error: true 178 | strategy: 179 | matrix: ${{ fromJson(needs.params.outputs.matrix) }} 180 | 181 | steps: 182 | - name: Install Dependencies 183 | run: | 184 | sudo echo -e "[multilib]\nInclude = /etc/pacman.d/mirrorlist" | sudo tee -a /etc/pacman.conf >/dev/null 185 | sudo pacman-key --init 186 | sudo pacman-key --populate archlinux 187 | sudo pacman -Syu --noconfirm 188 | sudo pacman -S --noconfirm --needed git ninja cmake meson clang lld libc++ unzip ragel yasm nasm gperf rst2pdf lib32-gcc-libs lib32-glib2 python-cairo curl wget mimalloc ccache python-pip 7zip 189 | sudo pacman -U --noconfirm https://archive.archlinux.org/packages/m/meson/meson-1.9.2-1-any.pkg.tar.zst 190 | sudo python -m pip install --break-system-packages roman 191 | git config --global user.name "github-actions[bot]" 192 | git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" 193 | git config --global pull.rebase true 194 | git config --global rebase.autoStash true 195 | git config --global fetch.prune true 196 | - uses: actions/checkout@v6 197 | - name: Checkout toolchain 198 | uses: actions/checkout@v6 199 | with: 200 | repository: shinchiro/mpv-winbuild-cmake 201 | path: mpv-winbuild-cmake 202 | fetch-depth: 0 203 | - name: Prepare 204 | run: | 205 | echo "sha=${{ needs.params.outputs.sha }}" >> $GITHUB_ENV 206 | echo "short_time=$(date "+%Y-%m-%d")" >> $GITHUB_ENV 207 | echo "cache_suffix=$(date "+%Y-%m-%d")-${{ github.run_id }}-${{ github.run_attempt }}" >> $GITHUB_ENV 208 | sed -i '/ccache_conf.in/d' mpv-winbuild-cmake/CMakeLists.txt 209 | sed -i '/ccache/d' mpv-winbuild-cmake/exec.in 210 | 211 | - name: Lookup Toolchain Cache 212 | id: lookup_toolchain 213 | uses: actions/cache/restore@v5.0.1 214 | with: 215 | path: ${{ github.workspace }}/mpv-winbuild-cmake/build${{ matrix.bit }} 216 | key: toolchain-${{ inputs.compiler }}-build${{ matrix.bit }}-${{ env.cache_suffix }} 217 | restore-keys: | 218 | toolchain-${{ inputs.compiler }}-build${{ matrix.bit }}- 219 | lookup-only: true 220 | - name: Lookup Build Cache 221 | id: lookup_build 222 | uses: actions/cache/restore@v5.0.1 223 | with: 224 | path: ${{ github.workspace }}/mpv-winbuild-cmake/build${{ matrix.bit }} 225 | key: ${{ inputs.compiler }}-build${{ matrix.bit }}-${{ env.cache_suffix }} 226 | restore-keys: | 227 | ${{ inputs.compiler }}-build${{ matrix.bit }}- 228 | lookup-only: true 229 | 230 | - name: Generate cache key 231 | id: generate_key 232 | uses: actions/github-script@v8 233 | with: 234 | script: | 235 | let toolchain_restore_key="${{ steps.lookup_toolchain.outputs.cache-matched-key }}"; 236 | let build_restore_key="${{ steps.lookup_build.outputs.cache-matched-key }}"; 237 | let build_save_key="${{ inputs.compiler }}-build${{ matrix.bit }}-${{ env.cache_suffix }}"; 238 | let key_suffix= "${{ env.cache_suffix }}" 239 | let restore_suffix= ""; // if only want to match primaryKey, set a value which make restore-keys can't hit 240 | 241 | // If toolchain cache exist, compare version of toolchain and build 242 | if (toolchain_restore_key) { 243 | const toolchain_version = toolchain_restore_key.split("-build${{ matrix.bit }}-").at(-1); 244 | core.exportVariable( `toolchain_version`, toolchain_version ); 245 | 246 | build_save_key += `(${toolchain_version})`; 247 | // If build cache version is not same as toolchain or needclean=true, don't restore build cache. 248 | // Else, don't restore toolchain cache and use build cache. 249 | if ( !build_restore_key.includes(toolchain_version) || ${{ inputs.needclean }} ) { 250 | build_restore_key=""; 251 | key_suffix=toolchain_version; // only use same version cache as toolchain-version 252 | restore_suffix="-only-use-primaryKey-"; // make restore-keys can't hit 253 | } else { 254 | toolchain_restore_key=""; 255 | } 256 | } 257 | core.exportVariable( `toolchain_restore_key`, toolchain_restore_key ); 258 | core.exportVariable( `build_restore_key`, build_restore_key ); 259 | core.exportVariable( `build_save_key`, build_save_key ); 260 | core.exportVariable( `key_suffix`, key_suffix ); 261 | core.exportVariable( `restore_suffix`, restore_suffix ); 262 | 263 | 264 | - name: Restore clang sysroot cache 265 | if: ${{ inputs.compiler =='clang' }} 266 | uses: actions/cache/restore@v5.0.1 267 | with: 268 | path: ${{ github.workspace }}/mpv-winbuild-cmake/clang_root 269 | key: ${{ matrix.bit }}-clang_root-${{ env.key_suffix }} 270 | restore-keys: | 271 | ${{ matrix.bit }}-clang_root-${{ env.restore_suffix }} 272 | 273 | - name: Restore Rust Cache 274 | if: ${{ false }} 275 | uses: actions/cache/restore@v5.0.1 276 | id: cache_rust 277 | with: 278 | path: ${{ github.workspace }}/mpv-winbuild-cmake/install_rustup 279 | key: rust-${{ env.key_suffix }} 280 | restore-keys: | 281 | rust-${{ env.restore_suffix }} 282 | - name: Restore Source Cache 283 | uses: actions/cache/restore@v5.0.1 284 | with: 285 | path: ${{ github.workspace }}/mpv-winbuild-cmake/src_packages 286 | key: source-${{ env.key_suffix }} 287 | restore-keys: | 288 | source-${{ env.restore_suffix }} 289 | - name: Restore Toolchain Cache 290 | if: ${{ env.toolchain_restore_key != '' }} 291 | uses: actions/cache/restore@v5.0.1 292 | with: 293 | path: ${{ github.workspace }}/mpv-winbuild-cmake/build${{ matrix.bit }} 294 | key: ${{ env.toolchain_restore_key }} 295 | - name: Restore Build Cache 296 | if: ${{ inputs.needclean != true && env.build_restore_key != '' }} 297 | uses: actions/cache/restore@v5.0.1 298 | with: 299 | path: ${{ github.workspace }}/mpv-winbuild-cmake/build${{ matrix.bit }} 300 | key: ${{ env.build_restore_key }} 301 | 302 | - name: Set up ccache 303 | uses: Chocobo1/setup-ccache-action@v1 304 | with: 305 | update_packager_index: false 306 | install_ccache: false 307 | store_cache: ${{ matrix.lgpl != true && inputs.no_save_cache != true }} 308 | override_cache_key: ccache-build${{ matrix.bit }}-${{ inputs.compiler }} 309 | ccache_options: | 310 | cache_dir=${{ github.workspace }}/.ccache 311 | max_size=500M 312 | sloppiness=locale,time_macros 313 | compiler_check=none 314 | 315 | - name: Download mpv patch 316 | if: ${{ needs.params.outputs.patch_note }} 317 | uses: actions/download-artifact@v7 318 | with: 319 | name: mpv-patch 320 | path: mpv-patch 321 | - name: Apply mpv pr releated patch 322 | if: ${{ needs.params.outputs.patch_note }} 323 | continue-on-error: true 324 | run: | 325 | shopt -s globstar 326 | cp mpv-patch/*.patch mpv-winbuild-cmake/packages 327 | ls mpv-winbuild-cmake/packages/mpv-*.patch 328 | cd mpv-winbuild-cmake 329 | if [[ "$(ls -A ../patch_pr/0000-*.patch)" ]]; then 330 | for patch in ../patch_pr/0000-*.patch ; do 331 | git am --3way "$patch" || git am --abort 332 | done 333 | fi 334 | for patch in packages/mpv-*.patch ; do 335 | pr="$(echo ${patch#*#} | cut -d- -f1)" 336 | if [[ "$(ls -A ../patch_pr/#${pr}-*.patch)" ]]; then 337 | for p in ../patch_pr/#${pr}-*.patch ; do 338 | git am --3way "$p" || git am --abort 339 | done 340 | fi 341 | done 342 | 343 | - name: Running custom command 344 | if: ${{ inputs.command != '' }} 345 | shell: bash 346 | continue-on-error: true 347 | run: | 348 | cd mpv-winbuild-cmake 349 | bit="${{ matrix.bit }}" 350 | compiler="${{ inputs.compiler }}" 351 | gitdir=$(pwd) 352 | clang_root=$(pwd)/clang_root 353 | buildroot=$(pwd) 354 | srcdir=$(pwd)/src_packages 355 | 356 | builddir=$buildroot/build$bit 357 | if [ $bit == "32" ]; then 358 | arch="i686" 359 | elif [ $bit == "64" ]; then 360 | arch="x86_64" 361 | elif [ $bit == "64-v3" ]; then 362 | arch="x86_64" 363 | gcc_arch=-DGCC_ARCH=x86-64-v3 364 | x86_64_level=-v3 365 | elif [ $bit == "aarch64" ]; then 366 | arch="aarch64" 367 | fi 368 | retry-tool() { 369 | local RETRY_COUNTER=0 370 | local MAX_RETRY=3 371 | while [[ $RETRY_COUNTER -lt $MAX_RETRY ]]; do 372 | $@ && break || sleep 2 373 | RETRY_COUNTER=$(( $RETRY_COUNTER + 1 )) 374 | echo "Retry $RETRY_COUNTER..." 375 | done 376 | if [[ $RETRY_COUNTER -ge $MAX_RETRY ]]; then 377 | echo "Max retry count exceeded." 378 | fi 379 | } 380 | set -x 381 | ${{ inputs.command }} 382 | - name: Build 383 | id: build 384 | shell: bash 385 | run: | 386 | chmod +x build.sh 387 | cd mpv-winbuild-cmake 388 | if [[ "$(ls -A ../patch/*.patch)" ]]; then 389 | for patch in ../patch/*.patch ; do 390 | git am --3way "$patch" || git am --abort 391 | done 392 | fi 393 | if [ "${{ matrix.lgpl }}" = "true" ]; then 394 | git am --3way ../compile-lgpl-libmpv.patch 395 | fi 396 | bash ../build.sh -t '${{ matrix.bit }}' -c '${{ inputs.compiler }}' -s "${{ matrix.lgpl == true && 'true' || 'false' }}" 397 | - name: Collect logs 398 | if: ${{ always() }} 399 | run: | 400 | sudo 7z a logs.7z $(find mpv-winbuild-cmake/build${{ matrix.bit }} -type f -iname "*-*.log" -or -wholename "*/ffbuild/config.log") 401 | - name: upload logs 402 | uses: actions/upload-artifact@v6 403 | if: ${{ always() }} 404 | with: 405 | name: ${{ matrix.bit }}${{ matrix.lgpl == true && '-lgpl' || '' }}_logs 406 | path: logs.7z 407 | 408 | - name: "Get artifacts' name and path" 409 | id: get_files 410 | uses: actions/github-script@v8 411 | with: 412 | script: | 413 | const path = require('path'); 414 | const types = ["mpv-debug", "mpv-dev", "mpv"]; 415 | const lgpl = ${{ matrix.lgpl }} ? "-lgpl" : ""; 416 | let arch=""; 417 | switch ( "${{ matrix.bit }}" ) { 418 | case "32": 419 | arch = "i686"; 420 | break; 421 | case "64": 422 | arch = "x86_64"; 423 | break; 424 | case "64-v3": 425 | arch = "x86_64-v3"; 426 | break; 427 | case "aarch64": 428 | arch = "aarch64"; 429 | break; 430 | } 431 | for (let type of types) { 432 | const globber = await glob.create(`mpv-winbuild-cmake/release/${type}${lgpl}-${arch}-*.7z`); 433 | const files = await globber.glob(); 434 | if ( files.length > 0 ) { 435 | const file = files[0]; 436 | core.exportVariable( `${type}_name`, path.basename(file) ); 437 | core.exportVariable( `${type}_path`, file ); 438 | } 439 | } 440 | 441 | let { stdout: ffmpeg_hash } = await exec.getExecOutput("git -C mpv-winbuild-cmake/src_packages/ffmpeg rev-parse --short HEAD"); 442 | ffmpeg_hash = ffmpeg_hash.trim(); 443 | const ffmpeg_name = `ffmpeg${lgpl}-${arch}-git-${ffmpeg_hash}`; 444 | core.exportVariable( 'ffmpeg_name', ffmpeg_name ); 445 | const globber = await glob.create(`./mpv-winbuild-cmake/build${{ matrix.bit }}/**/ffmpeg.exe`); 446 | const ffmpeg_path = (await globber.glob())[0] 447 | await exec.exec(`7z a -m0=lzma2 -mx=9 -ms=on mpv-winbuild-cmake/release/${ffmpeg_name}.7z ${ffmpeg_path}`) 448 | 449 | - name: upload mpv-debug 450 | uses: actions/upload-artifact@v6 451 | if: ${{ env.mpv-debug_name && env.mpv-debug_path }} 452 | with: 453 | name: ${{ env.mpv-debug_name }} 454 | path: ${{ env.mpv-debug_path }} 455 | - name: upload mpv-dev 456 | uses: actions/upload-artifact@v6 457 | if: ${{ env.mpv-dev_name && env.mpv-dev_path }} 458 | with: 459 | name: ${{ env.mpv-dev_name }} 460 | path: ${{ env.mpv-dev_path }} 461 | - name: upload mpv 462 | uses: actions/upload-artifact@v6 463 | if: ${{ env.mpv_name && env.mpv_path }} 464 | with: 465 | name: ${{ env.mpv_name }} 466 | path: ${{ env.mpv_path }} 467 | 468 | - name: upload ffmpeg 469 | uses: actions/upload-artifact@v6 470 | if: ${{ env.ffmpeg_name }} 471 | with: 472 | name: ${{ env.ffmpeg_name }} 473 | path: mpv-winbuild-cmake/release/${{ env.ffmpeg_name }}.7z 474 | 475 | - name: Save clang sysroot cache 476 | if: ${{ inputs.compiler =='clang' && inputs.no_save_cache != true && matrix.lgpl != true }} 477 | uses: actions/cache/save@v5.0.1 478 | with: 479 | path: ${{ github.workspace }}/mpv-winbuild-cmake/clang_root 480 | key: ${{ matrix.bit }}-clang_root-${{ env.cache_suffix }} 481 | - name: Save Sources Cache 482 | if: ${{ inputs.no_save_cache != true && matrix.lgpl != true }} 483 | uses: actions/cache/save@v5.0.1 484 | with: 485 | path: ${{ github.workspace }}/mpv-winbuild-cmake/src_packages 486 | key: source-${{ env.cache_suffix }} 487 | - name: Save Rust Cache 488 | if: ${{ false && inputs.no_save_cache != true && matrix.lgpl != true }} 489 | uses: actions/cache/save@v5.0.1 490 | with: 491 | path: ${{ github.workspace }}/mpv-winbuild-cmake/install_rustup 492 | key: rust-${{ env.cache_suffix }} 493 | - name: Save Build Cache 494 | if: ${{ inputs.no_save_cache != true && matrix.lgpl != true }} 495 | uses: actions/cache/save@v5.0.1 496 | with: 497 | path: ${{ github.workspace }}/mpv-winbuild-cmake/build${{ matrix.bit }} 498 | key: ${{ env.build_save_key }} 499 | 500 | - name: "Job summary" 501 | uses: actions/github-script@v8 502 | continue-on-error: true 503 | if: ${{ always() }} 504 | with: 505 | script: | 506 | const path = require('path'); 507 | const { readdirSync,existsSync } = require('fs'); 508 | const myExec = async (command, args = null) => await exec.getExecOutput(command,args,{silent: true}).then(result => result.stdout.trim()).catch(err => ''); 509 | 510 | const upstreamDir = path.resolve("mpv-winbuild-cmake"); 511 | const workdir = path.resolve(upstreamDir,"src_packages"); 512 | const isGitSync = dirname => existsSync(path.join(workdir, dirname, '.git')); 513 | 514 | const getGithubUrl = (hash,remote) => remote.replace(/\.git$/,"") + `/commit/${hash}`; 515 | const getGitlabUrl = (hash,remote) => remote.replace(/\.git$/,"") + `/-/commit/${hash}`; 516 | const getBitbucketUrl = (hash,remote) => remote.replace(/\.git$/,"") + `/commits/${hash}`; 517 | const getGoogleSourceUrl = (hash,remote) => remote + `/+/${hash}`; 518 | const gethGitVideolanUrl = (hash,remote) => remote.replace(/\/git\//,"/?p=") + `;a=commit;h=${hash}`; 519 | const getCgitUrl = (hash,remote) => remote + `/commit/?id=${hash}`; 520 | const getCodebergUrl = (hash,remote) => remote.replace(/\.git$/,"") + `/commit/${hash}`; 521 | function getCommitUrl(hash,remote) { 522 | let url = ""; 523 | switch (true) { 524 | case /github\.com/.test(remote): 525 | url = getGithubUrl(hash,remote); 526 | break; 527 | case /(gitlab\.com|code\.videolan\.org|gitlab\.(gnome|freedesktop)\.org)/.test(remote): 528 | url = getGitlabUrl(hash,remote); 529 | break; 530 | case /bitbucket\.org/.test(remote): 531 | url = getBitbucketUrl(hash,remote); 532 | break; 533 | case /googlesource\.com/.test(remote): 534 | url = getGoogleSourceUrl(hash,remote); 535 | break; 536 | case /git\.videolan\.org/.test(remote): 537 | url = gethGitVideolanUrl(hash,remote); 538 | break; 539 | case /git\.libssh\.org/.test(remote): 540 | url = getCgitUrl(hash,remote); 541 | break; 542 | case /codeberg\.org/.test(remote): 543 | url = getCodebergUrl(hash,remote); 544 | break; 545 | default: 546 | url = remote; 547 | break; 548 | } 549 | return url; 550 | } 551 | async function repo_info(dir){ 552 | let local_hash = await myExec(`git -C ${dir} rev-parse --short=7 HEAD`); 553 | let remote_branch = await myExec(`git -C ${dir} rev-parse --abbrev-ref HEAD@{upstream}`); 554 | let remote_hash = await myExec(`git -C ${dir} rev-parse ${remote_branch}`); 555 | let status = await myExec(`git -C ${dir} status -sb`).then(s => s.split("\n",1)[0].replace(/^## */,"")); 556 | let remote = await myExec(`git -C ${dir} config --get remote.origin.url`); 557 | return [local_hash, remote_hash, status, remote] 558 | } 559 | 560 | async function generateGitInfoTable(targetDir){ 561 | const dirs = readdirSync(targetDir, { withFileTypes: true }) 562 | .filter(dirent => dirent.isDirectory() && isGitSync(dirent.name) ) 563 | .map(dirent => path.join(targetDir, dirent.name)); 564 | let info_table = [[{data: 'Package', header: true}, {data: 'Local commit', header: true}, {data: 'Status', header: true}, {data: 'Remote commit', header: true}]]; 565 | for (let dir of dirs) { 566 | [local_hash, remote_hash, status, remote] = await repo_info(dir) 567 | let url = getCommitUrl(remote_hash, remote); 568 | let package_name = path.basename(dir); 569 | info_table.push([package_name, local_hash, status, `${remote_hash.slice(0,7)}`]); 570 | } 571 | return info_table; 572 | } 573 | 574 | await core.summary.clear(); 575 | let packages_table = await generateGitInfoTable(workdir); 576 | packages_table = core.summary.addTable(packages_table).stringify(); 577 | await core.summary.clear(); 578 | 579 | [upstream_local_hash, upstream_remote_hash, upstream_status, upstream_remote] = await repo_info(upstreamDir) 580 | const upstream_url = getCommitUrl(upstream_remote_hash, upstream_remote); 581 | 582 | const exec_path = path.join(upstreamDir,'build${{ matrix.bit }}','exec'); 583 | const compiler_version = (await myExec(`${exec_path}`,["cross-gcc","--version","||","clang","--version"])).split('\n')[0]; 584 | 585 | core.summary 586 | .addRaw(`mpv-winbuild-cmake: ${upstream_status} (remote:${upstream_remote_hash.slice(0,7)})`,true) 587 | .addRaw(`Compiler: ${compiler_version}`,true); 588 | const patch_note = `${{ needs.params.outputs.patch_note }}`; 589 | if (patch_note) { 590 | core.summary.addHeading('Merged Prs'); 591 | core.summary.addList(patch_note.replace(/- \[(?#\d+)\]\((?.*)\)/g,"$").replace(/`(?[^`]+)`/g, '$').split('\n')); 592 | } 593 | await core.summary.addDetails('Packages Version',packages_table).write(); 594 | 595 | 596 | publish_release: 597 | name: Publish release 598 | needs: [build_mpv,params] 599 | if: ${{ inputs.release == true }} 600 | runs-on: ubuntu-latest 601 | permissions: 602 | id-token: write 603 | attestations: write 604 | contents: write 605 | 606 | steps: 607 | - name: Checkout 608 | uses: actions/checkout@v6 609 | - name: Download artifacts 610 | uses: actions/download-artifact@v7 611 | with: 612 | path: artifacts 613 | pattern: '{mpv,ffmpeg}*' 614 | merge-multiple: true 615 | 616 | - name: "Check artifacts" 617 | uses: actions/github-script@v8 618 | with: 619 | script: | 620 | const globber = await glob.create(`artifacts/mpv*.7z`); 621 | const files = await globber.glob(); 622 | if ( files.length == 0 ) { 623 | core.setFailed("Artifact does not exist!"); 624 | } 625 | 626 | - name: Get current time 627 | run: | 628 | echo "long_time=$(date "+%Y-%m-%d %H:%M")" >> $GITHUB_ENV 629 | echo "short_time=$(date "+%Y-%m-%d")" >> $GITHUB_ENV 630 | echo "tag_name=$(date "+%Y-%m-%d")-$(head -c 7 <<< "${{needs.params.outputs.sha}}")" >> $GITHUB_ENV 631 | 632 | - name: Commit version & remove existing tag 633 | env: 634 | tag_name: ${{ env.tag_name }} 635 | GH_TOKEN: ${{ github.token }} 636 | shell: bash 637 | run: | 638 | git fetch --tags 639 | git checkout version || git checkout -b version origin/version || ( git checkout --orphan version && git rm -rf . ) 640 | echo -e "${tag_name}" > version 641 | git config --global user.name "github-actions[bot]" 642 | git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" 643 | git add version 644 | git diff-index --quiet HEAD || ( git commit -m "${tag_name}" && git push origin version ) 645 | if [ $(git tag -l "${tag_name}") ] ;then 646 | gh release delete "${tag_name}" || true 647 | git push --delete origin "${tag_name}" || true 648 | git tag -d "${tag_name}" || true 649 | fi 650 | git checkout main 651 | 652 | - name: "Generate release note & sha256" 653 | id: note 654 | uses: actions/github-script@v8 655 | with: 656 | script: | 657 | const sha = `${{ needs.params.outputs.sha }}`; 658 | let note = `**MPV Git commit**: https://github.com/mpv-player/mpv/commit/${sha}\n`; 659 | note+="**Build Time**: ${{ env.long_time }}\n"; 660 | note+="**Compiler**: ${{ inputs.compiler }}\n"; 661 | note+="**Build Details**: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}\n"; 662 | const patch_note = `${{ needs.params.outputs.patch_note }}` ; 663 | if (patch_note) { 664 | note+=`Merged Prs:\n${patch_note}\n`; 665 | } 666 | note+="**Download Tips:**\n"; 667 | const path = require('path'); 668 | const tips = { 669 | "i686": "for 32 bit system", 670 | "x86_64": "for 64 bit system", 671 | "x86_64-v3": "for 64 bit system with cpu not older than Intel Haswell or AMD Excavator", 672 | "aarch64": "for ARM64(aarch64)" 673 | } 674 | async function getTips(arch){ 675 | const globber = await glob.create(`artifacts/mpv-${arch}-[0-9]*.7z`); 676 | const files = await globber.glob(); 677 | if ( files.length > 0 ) { 678 | const name = path.basename(files[0]); 679 | return `[${name}](https://github.com/${{github.repository}}/releases/download/${{ env.tag_name }}/${name}): ${tips[arch]}\n` 680 | } else { 681 | return "" 682 | } 683 | } 684 | for(const arch of Object.keys(tips)){ 685 | note += await getTips(arch); 686 | } 687 | note+="**Downloads**: ![downloads](https://img.shields.io/github/downloads/${{github.repository}}/${{ env.tag_name }}/total?cacheSeconds=300)"; 688 | core.setOutput("note",note); 689 | 690 | const os = require('os'); 691 | const { basename } = require('path'); 692 | const { createHash } = require('crypto'); 693 | const { readFileSync,writeFileSync } = require('fs'); 694 | const globber = await glob.create([`artifacts/mpv*.7z`,`artifacts/ffmpeg*.7z`].join('\n')); 695 | const files = await globber.glob(); 696 | if ( files.length > 0 ) { 697 | let sha256=""; 698 | for (let file of files) { 699 | const buff = readFileSync(file); 700 | const hash = createHash("sha256").update(buff).digest("hex"); 701 | sha256+=`${hash} ${basename(file)}${os.EOL}`; 702 | } 703 | writeFileSync('sha256.txt', sha256.trim(), { flag: 'w+' }); 704 | } 705 | 706 | - name: Create release 707 | uses: ncipollo/release-action@v1 708 | with: 709 | artifacts: "artifacts/mpv*.7z,artifacts/ffmpeg*.7z,sha256.txt" 710 | commit: version 711 | name: "${{ env.long_time }}" 712 | body: "${{ steps.note.outputs.note }}" 713 | tag: "${{ env.tag_name }}" 714 | allowUpdates: true 715 | artifactErrorsFailBuild: true 716 | prerelease: false 717 | makeLatest: true 718 | - name: Attest 719 | uses: actions/attest-build-provenance@v3 720 | continue-on-error: true 721 | with: 722 | subject-path: 'artifacts/*.7z' 723 | - name: Prune old releases 724 | shell: bash 725 | env: 726 | GH_TOKEN: ${{ github.token }} 727 | run: | 728 | git checkout main 729 | bash prunetags.sh 730 | 731 | cache: 732 | name: keep cache alive 733 | needs: [params,build_mpv] 734 | if: ${{ inputs.no_save_cache != true }} 735 | runs-on: ubuntu-latest 736 | container: 737 | image: ghcr.io/archlinux/archlinux:base-devel 738 | continue-on-error: true 739 | strategy: 740 | matrix: ${{ fromJson(needs.params.outputs.matrix_bit) }} 741 | 742 | steps: 743 | - name: Prepare 744 | run: | 745 | sudo pacman -Syu --noconfirm 746 | sudo pacman -S --noconfirm --needed git curl 747 | - uses: actions/checkout@v6 748 | 749 | - name: Resave Toolchain Cache 750 | id: toolchain 751 | uses: ./action/resave_cache 752 | with: 753 | path: ${{ github.workspace }}/mpv-winbuild-cmake/build${{ matrix.bit }} 754 | key: toolchain-${{ inputs.compiler }}-build${{ matrix.bit }}- 755 | restore-keys: toolchain-${{ inputs.compiler }}-build${{ matrix.bit }}- 756 | 757 | - name: Generate cache key 758 | id: generate_key 759 | uses: actions/github-script@v8 760 | with: 761 | script: | 762 | let toolchain_restore_key="${{ steps.toolchain.outputs.cache-matched-key }}"; 763 | 764 | if (toolchain_restore_key) { 765 | const toolchain_version = toolchain_restore_key.split("-build${{ matrix.bit }}-").at(-1); 766 | core.exportVariable( `toolchain_version`, toolchain_version ); 767 | } 768 | 769 | - name: Resave inital clang sysroot cache 770 | id: clang_root 771 | if: ${{ inputs.compiler =='clang' && env.toolchain_version }} 772 | uses: ./action/resave_cache 773 | with: 774 | path: ${{ github.workspace }}/mpv-winbuild-cmake/clang_root 775 | key: ${{ matrix.bit }}-clang_root-${{ env.toolchain_version }} 776 | restore-keys: ${{ matrix.bit }}-clang_root-${{ env.toolchain_version }} 777 | 778 | cache_llvm: 779 | name: keep llvm cache alive 780 | needs: [params,build_mpv] 781 | if: ${{ inputs.no_save_cache != true && inputs.compiler =='clang' }} 782 | runs-on: ubuntu-latest 783 | container: 784 | image: ghcr.io/archlinux/archlinux:base-devel 785 | continue-on-error: true 786 | 787 | steps: 788 | - name: Prepare 789 | run: | 790 | sudo pacman -Syu --noconfirm 791 | sudo pacman -S --noconfirm --needed git curl 792 | - uses: actions/checkout@v6 793 | 794 | - name: Resave llvm cache 795 | id: llvm 796 | continue-on-error: true 797 | uses: ./action/resave_cache 798 | with: 799 | path: mpv-winbuild-cmake/clang_root 800 | key: llvm- 801 | restore-keys: llvm- 802 | --------------------------------------------------------------------------------