Skip to content
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

ci: Add Windows Clang builder #412

Merged
merged 29 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
a1dcffb
ci: add clang builder for windows
gnattu Jul 8, 2024
1d0cf5d
configure: Disable inline assembly with nonlocal labels with LTO on C…
gnattu Jul 8, 2024
5f70748
configure: use thin lto for clang
gnattu Jul 8, 2024
1f1ce5e
ci: don't use matrix for windows to select compiler
gnattu Jul 8, 2024
e7d0029
ci: don't install dependencies twice
gnattu Jul 8, 2024
f39247b
ci: create the folder if not exist
gnattu Jul 8, 2024
00fb01a
ci: fix pkg path
gnattu Jul 8, 2024
2ad75e0
ci: disable autocrlf
gnattu Jul 8, 2024
452a4a6
ci: also disable for runner internal git
gnattu Jul 8, 2024
d409d92
ci: fix windows path
gnattu Jul 8, 2024
46bb615
ci: apply more config to force line ending
gnattu Jul 8, 2024
29ded39
ci: fix command
gnattu Jul 8, 2024
989d80e
ci: never convert line endings
gnattu Jul 8, 2024
e1f142a
ci: force lf
gnattu Jul 8, 2024
7aebcd8
pkgbuild: fix path
gnattu Jul 8, 2024
8a63843
ci: use .gitattributes instead
gnattu Jul 8, 2024
a769994
pkgbuild: prefix with ff
gnattu Jul 8, 2024
16e04fe
pkgbuild: prefix all path with ff
gnattu Jul 8, 2024
93ecddc
pkgbuild: delay libpng build
gnattu Jul 8, 2024
5654bb7
pkgconfig: export pkgbuild path
gnattu Jul 8, 2024
582ce2f
pkgbuild: fix chromaprint search path
gnattu Jul 8, 2024
48c86a8
pkgbuild: dont run check
gnattu Jul 8, 2024
b338572
pkgbuild: add libtheora patch
gnattu Jul 8, 2024
dfcf8b5
msys2: don't enable shared dll for clang
gnattu Jul 8, 2024
e6a0643
ci: install zip for clang builder
gnattu Jul 8, 2024
ba428b6
ci: fix artifact path
gnattu Jul 8, 2024
dc5ce19
ci: re-enable other ci
gnattu Jul 8, 2024
cf76ead
pkgbuild: use mirrors.kernel.org instead of sourceware.org
gnattu Jul 8, 2024
0b41bc9
ci: enable directwrite for libass
gnattu Jul 15, 2024
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
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
* text eol=lf
*.pnm -diff -text
tests/ref/fate/sub-scc eol=crlf
126 changes: 126 additions & 0 deletions .github/workflows/_meta_win_clang_portable.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
on:
workflow_call:
inputs:
release:
required: false
default: false
type: boolean
secrets:
deploy-host:
required: false
deploy-user:
required: false
deploy-key:
required: false

jobs:
build:
name: 'Build Portable FFmpeg'
runs-on: windows-latest
strategy:
fail-fast: true
matrix:
os:
- name: CLANG64
arch: win64
defaults:
run:
shell: msys2 {0}
steps:
- uses: msys2/setup-msys2@v2
with:
update: true
msystem: CLANG64
install: >-
git
curl
wget
zip
mingw-w64-clang-x86_64-toolchain
quilt
diffstat
mingw-w64-clang-x86_64-nasm

- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Prepare prefix dir
run: |
mkdir /clang64/ffbuild

- name: Build Portable
run: ./msys2/build.sh

- name: Upload Artifacts
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: win-clang-${{ matrix.os.arch }}-portable
path: ./msys2/artifacts

publish:
name: Publish Portable Release
if: ${{ inputs.release }}
runs-on: ubuntu-latest
needs:
- build
strategy:
fail-fast: true
matrix:
arch: [win64]

steps:
- name: Set Versions
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
id: set_version
with:
script: |
const tag = context.ref.substring(10)
const no_v = tag.replace('v', '')
const dash_index = no_v.lastIndexOf('-')
const major_index = no_v.indexOf('.')
const no_dash = (dash_index > -1) ? no_v.substring(0, dash_index) : no_v
const major = (major_index > -1) ? no_v.substring(0, major_index) : no_v
core.setOutput('tag', tag)
core.setOutput('no-v', no_v)
core.setOutput('no-dash', no_dash)
core.setOutput('major', major)

- name: Download Artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: win-clang-${{ matrix.arch }}-portable
path: artifact

- name: Upload GH Release Assets
uses: shogo82148/actions-upload-release-asset@8f032eff0255912cc9c8455797fd6d72f25c7ab7 # v1.7.5
with:
upload_url: ${{ github.event.release.upload_url }}
overwrite: true
asset_path: |
./artifact/**/*.zip

- name: Upload release archive to repo.jellyfin.org
uses: appleboy/scp-action@917f8b81dfc1ccd331fef9e2d61bdc6c8be94634 # v0.1.7
with:
host: ${{ secrets.deploy-host }}
username: ${{ secrets.deploy-user }}
key: ${{ secrets.deploy-key }}
source: artifact/*
strip_components: 1
target: /srv/incoming/ffmpeg/${{ steps.set_version.outputs.no-v }}/windows/${{ matrix.arch }}

- name: Move incoming release into repository
uses: appleboy/ssh-action@029f5b4aeeeb58fdfe1410a5d17f967dacf36262 # v1.0.3
with:
host: ${{ secrets.deploy-host }}
username: ${{ secrets.deploy-user }}
key: ${{ secrets.deploy-key }}
envs: JELLYFIN_VERSION
script_stop: true
script: |
# Create the target folder and move arch directory into it
sudo mkdir -p /srv/repository/main/ffmpeg/windows/${{ steps.set_version.outputs.major }}.x/${{ steps.set_version.outputs.no-v }}/${{ matrix.arch }}
sudo mv -t /srv/repository/main/ffmpeg/windows/${{ steps.set_version.outputs.major }}.x/${{ steps.set_version.outputs.no-v }}/${{ matrix.arch }}/ /srv/incoming/ffmpeg/${{ steps.set_version.outputs.no-v }}/windows/${{ matrix.arch }}/*
sudo chown -R root:root /srv/repository/main/ffmpeg/windows/${{ steps.set_version.outputs.major }}.x/${{ steps.set_version.outputs.no-v }}
# Update symlink for latest-X.x
sudo rm -f /srv/repository/main/ffmpeg/windows/latest-${{ steps.set_version.outputs.major }}.x || true
sudo ln -s /srv/repository/main/ffmpeg/windows/${{ steps.set_version.outputs.major }}.x/${{ steps.set_version.outputs.no-v }} /srv/repository/main/ffmpeg/windows/latest-${{ steps.set_version.outputs.major }}.x || true
5 changes: 5 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ jobs:
architectures: '["win64"]'
release: false

build_portable_windows_clang:
uses: ./.github/workflows/_meta_win_clang_portable.yaml
with:
release: false

build_portable_linux:
uses: ./.github/workflows/_meta_portable.yaml
with:
Expand Down
41 changes: 29 additions & 12 deletions debian/patches/0035-enable-gcc-vectorization-and-lto-auto.patch
Original file line number Diff line number Diff line change
@@ -1,17 +1,34 @@
Index: jellyfin-ffmpeg/configure
Index: FFmpeg/configure
===================================================================
--- jellyfin-ffmpeg.orig/configure
+++ jellyfin-ffmpeg/configure
@@ -7196,6 +7196,8 @@ if enabled lto; then
--- FFmpeg.orig/configure
+++ FFmpeg/configure
@@ -7195,8 +7195,23 @@ check_optflags -fno-signed-zeros

if enabled lto; then
test "$cc_type" != "$ld_type" && die "LTO requires same compiler and linker"
check_cflags -flto
check_ldflags -flto $cpuflags
+ check_cflags -flto=auto
+ check_ldflags -flto=auto $cpuflags
- check_cflags -flto
- check_ldflags -flto $cpuflags
+ if test "$cc_type" = "clang"; then
+ check_cflags -flto=thin
+ check_ldflags -flto=thin $cpuflags
+ # Clang's LTO fails on Windows, when there are references outside
+ # of inline assembly to nonlocal labels defined within inline assembly,
+ # see https://github.com/llvm/llvm-project/issues/76046.
+ case $target_os in
+ mingw*|win*)
+ disable inline_asm_nonlocal_labels
+ ;;
+ esac
+ else
+ check_cflags -flto
+ check_ldflags -flto $cpuflags
+ check_cflags -flto=auto
+ check_ldflags -flto=auto $cpuflags
+ fi
disable inline_asm_direct_symbol_refs
fi

@@ -7234,7 +7236,9 @@ if enabled icc; then
@@ -7235,7 +7250,9 @@ if enabled icc; then
disable aligned_stack
fi
elif enabled gcc; then
Expand All @@ -22,10 +39,10 @@ Index: jellyfin-ffmpeg/configure
check_cflags -Werror=format-security
check_cflags -Werror=implicit-function-declaration
check_cflags -Werror=missing-prototypes
Index: jellyfin-ffmpeg/libavcodec/x86/cabac.h
Index: FFmpeg/libavcodec/x86/cabac.h
===================================================================
--- jellyfin-ffmpeg.orig/libavcodec/x86/cabac.h
+++ jellyfin-ffmpeg/libavcodec/x86/cabac.h
--- FFmpeg.orig/libavcodec/x86/cabac.h
+++ FFmpeg/libavcodec/x86/cabac.h
@@ -183,6 +183,9 @@ av_noinline
#else
av_always_inline
Expand Down
83 changes: 83 additions & 0 deletions msys2/PKGBUILD/10-mingw-w64-brotli/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Maintainer: J. Peter Mugaas <[email protected]>

_realname=brotli
pkgbase=mingw-w64-jellyfin-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-jellyfin-${_realname}")
pkgver=1.1.0
pkgrel=1
pkgdesc="Brotli compression library (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
url='https://github.com/google/brotli'
msys2_references=(
"pypi: brotli"
"cpe: cpe:/a:google:brotli"
)
makedepends=("${MINGW_PACKAGE_PREFIX}-cmake"
"${MINGW_PACKAGE_PREFIX}-ninja"
"${MINGW_PACKAGE_PREFIX}-cc"
"${MINGW_PACKAGE_PREFIX}-python-setuptools"
"${MINGW_PACKAGE_PREFIX}-python-build"
"${MINGW_PACKAGE_PREFIX}-python-installer"
"${MINGW_PACKAGE_PREFIX}-python-wheel"
)
license=('spdx:MIT')
source=("${_realname}-${pkgver}.tar.gz"::"https://github.com/google/brotli/archive/v${pkgver}.tar.gz")
sha256sums=('e720a6ca29428b803f4ad165371771f5398faba397edf6778837a18599ea13ff')

prepare() {
cd "${srcdir}/${_realname}-${pkgver}"
}

build() {
cd "${srcdir}/${_realname}-${pkgver}"

${MINGW_PREFIX}/bin/python -m build --wheel --skip-dependency-check --no-isolation

declare -a extra_config
if check_option "debug" "n"; then
extra_config+=("-DCMAKE_BUILD_TYPE=Release")
else
extra_config+=("-DCMAKE_BUILD_TYPE=Debug")
fi

mkdir -p "${srcdir}/build-${MSYSTEM}-static" && cd "${srcdir}/build-${MSYSTEM}-static"

MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
${MINGW_PREFIX}/bin/cmake \
-GNinja \
-DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX}/ffbuild/ \
"${extra_config[@]}" \
-DBUILD_SHARED_LIBS=OFF \
-DENABLE_STATIC=ON \
-DBUILD_STATIC_LIBS=ON \
../${_realname}-${pkgver}

${MINGW_PREFIX}/bin/cmake --build .
}

check() {
:
}

package_brotli() {
cd "${srcdir}"/build-${MSYSTEM}-static
DESTDIR="${pkgdir}" ${MINGW_PREFIX}/bin/cmake --install .

install -D -m644 "${srcdir}"/brotli-${pkgver}/LICENSE "${pkgdir}${MINGW_PREFIX}/ffbuild/share/licenses/${_realname}/LICENSE"

# Let ffmpeg also statically link to brotlicommon
sed -s "s|-lbrotlidec|-lbrotlidec\ -lbrotlicommon|g" -i "${pkgdir}"${MINGW_PREFIX}/ffbuild/lib/pkgconfig/libbrotlidec.pc
sed -s "s|-lbrotlidec|-lbrotlidec\ -lbrotlicommon|g" -i "${pkgdir}"${MINGW_PREFIX}/ffbuild/lib/pkgconfig/libbrotlienc.pc
}

# template start; name=mingw-w64-splitpkg-wrappers; version=1.0;
# vim: set ft=bash :

# generate wrappers
for _name in "${pkgname[@]}"; do
_short="package_${_name#${MINGW_PACKAGE_PREFIX}-jellyfin-}"
_func="$(declare -f "${_short}")"
eval "${_func/#${_short}/package_${_name}}"
done
# template end;
70 changes: 70 additions & 0 deletions msys2/PKGBUILD/10-mingw-w64-bzip2/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Maintainer: Alexey Pavlov <[email protected]>
# Contributor: Renato Silva <[email protected]>

_realname=bzip2
pkgbase=mingw-w64-jellyfin-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-jellyfin-${_realname}"
pkgver=1.0.8
pkgrel=3
pkgdesc="A high-quality data compression program (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
url="https://sourceware.org/bzip2/"
msys2_references=(
"cpe: cpe:/a:bzip:bzip2"
)
license=("custom")
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs")
makedepends=("${MINGW_PACKAGE_PREFIX}-cc" "${MINGW_PACKAGE_PREFIX}-autotools")
options=('strip' 'staticlibs')
source=("https://mirrors.kernel.org/sourceware/bzip2/bzip2-${pkgver}.tar.gz"
"bzip2-cygming-1.0.6.src.all.patch"
"bzip2-buildsystem.all.patch"
"bzip2-1.0.6-progress.all.patch")
sha256sums=('ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269'
'7e67f77172b19f3e6c1f0875b1d3e9cb79211f8e1c752794ef9afd3704f928cf'
'e519a50a4adaf05b18650d3e9d644badc66e80ca86063681ffe9a2c2226319d0'
'f93e6b50082a8e880ee8436c7ec6a65a8f01e9282436af77f95bb259b1c7f7f7')

export FF_MINGW_PREFIX="${MINGW_PREFIX}/ffbuild"

prepare() {
cd "${srcdir}/${_realname}-${pkgver}"
# remove files that are created by patches.
rm -rf README.CYGMING | true
rm -rf aclocal.m4 | true
rm -rf configure.ac | true
rm -rf libbz2.def.in | true
rm -rf bzip2.pc.in | true
rm -rf Makefile.in | true

patch -p1 -i "$srcdir/"bzip2-cygming-1.0.6.src.all.patch
patch -p1 -i "$srcdir/"bzip2-buildsystem.all.patch
patch -p1 -i "$srcdir/"bzip2-1.0.6-progress.all.patch

autoreconf -fi
}

build() {
mkdir -p "${srcdir}/build-${CARCH}"
cd "${srcdir}/build-${CARCH}"
../${_realname}-${pkgver}/configure \
--prefix=${FF_MINGW_PREFIX} \
--build=${MINGW_CHOST} \
--host=${MINGW_CHOST} \
--target=${MINGW_CHOST} \
--disable-shared

make all-libs
}

check() {
:
}

package() {
cd "${srcdir}/build-${CARCH}"
make DESTDIR="${pkgdir}" install
# rm "${pkgdir}${MINGW_PREFIX}/bin/bz"{diff,grep,more}
install -Dm644 "${srcdir}/${_realname}-${pkgver}/LICENSE" "${pkgdir}${FF_MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
}
Loading
Loading