Skip to content

Commit

Permalink
Add gcompat
Browse files Browse the repository at this point in the history
 - Update ffmpeg, libheif, libpdfium, protoc and some dependencies
  • Loading branch information
HeavenVolkoff committed Jan 4, 2024
1 parent df2bca9 commit 2662564
Show file tree
Hide file tree
Showing 19 changed files with 94 additions and 105 deletions.
18 changes: 15 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ARG ZIG_VERSION="0.11.0"
ARG MESON_VERSION="1.3.0"
ARG CMAKE_VERSION="3.27.0"
ARG PATCHELF_VERSION="0.18.0"
ARG MACOS_SDK_VERSION="14.0"
ARG MACOS_SDK_VERSION="14.2"

#--

Expand Down Expand Up @@ -330,7 +330,6 @@ FROM layer-45 AS layer-50-onevpl

RUN --mount=type=cache,target=/root/.cache `
--mount=type=bind,source=stages/50-onevpl.sh,target=/srv/stage.sh `
--mount=type=bind,source=patches/50-onevpl,target="${PREFIX}/patches" `
/srv/build.sh

FROM layer-45 AS layer-50-opus
Expand Down Expand Up @@ -415,6 +414,16 @@ COPY --from=layer-50-zimg "${PREFIX}/." "$PREFIX"

#--

FROM layer-00 AS layer-99-gcompat

ADD https://git.adelielinux.org/adelie/gcompat/-/raw/1.1.0/LICENSE '/srv/gcompat/LICENSE.gcompat'
ADD https://github.com/void-linux/musl-obstack/raw/v1.2.3/COPYING '/srv/gcompat/COPYING.obstack'
ADD https://github.com/kaniini/libucontext/raw/v1.2/LICENSE '/srv/gcompat/LICENSE.ucontext'

RUN --mount=type=cache,target=/root/.cache `
--mount=type=bind,source=stages/99-gcompat.sh,target=/srv/stage.sh `
/srv/build.sh

FROM layer-00 AS layer-99-protoc

ADD https://raw.githubusercontent.com/protocolbuffers/protobuf/v25.0/LICENSE '/srv/protoc/LICENSE'
Expand Down Expand Up @@ -457,6 +466,9 @@ RUN --mount=type=cache,target=/root/.cache `

FROM layer-00 AS layer-99

COPY --from=layer-99-gcompat "${OUT}/." "$OUT"
COPY --from=layer-99-gcompat "${PREFIX}/licenses/." "${OUT}/licenses"

COPY --from=layer-99-heif "${OUT}/." "$OUT"
COPY --from=layer-99-heif "${PREFIX}/srv/." "${OUT}/srv"
COPY --from=layer-99-heif "${PREFIX}/licenses/." "${OUT}/licenses"
Expand Down Expand Up @@ -493,7 +505,7 @@ RUN find "$OUT/lib" -name '*.lib' -exec `
# https://github.com/NixOS/patchelf/issues/507
RUN --mount=type=cache,target=/root/.cache `
echo 'strip -S "$@" && chmod +x "$@"' >/srv/stage.sh `
&& find "$OUT" -type f \( -name '*.so' -o -name '*.so.*' -o -name '*.dll' -o -name '*.dylib' \) -exec /srv/build.sh {} +
&& find "$OUT" -type f \( -name '*.so' -o -name '*.so.*' -o -name '*.dll' -o -name '*.dylib' \) -not -wholename "${OUT}/gcompat/*" -exec /srv/build.sh {} +

# Ensure all .so files have the correct rpaths (Linux target only)
RUN find "$OUT" -type f \( -name '*.so' -o -name '*.so.*' \) -exec patchelf --set-rpath '$ORIGIN' {} \;
Expand Down
46 changes: 0 additions & 46 deletions patches/50-onevpl/fix-pkgconfig.patch

This file was deleted.

2 changes: 1 addition & 1 deletion stages/00-apple/01-xar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ echo "Download xar ..."

mkdir -p "xar/build"

curl_tar 'https://github.com/tpoechtrager/xar/archive/7eeb4be.tar.gz' 'xar' 1
curl_tar 'https://github.com/tpoechtrager/xar/archive/5fa4675.tar.gz' 'xar' 1

cd xar/xar

Expand Down
2 changes: 1 addition & 1 deletion stages/00-apple/04-cctools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ echo "Download cctools ..."

mkdir -p "cctools"

curl_tar 'https://github.com/tpoechtrager/cctools-port/archive/59f5fb8.tar.gz' 'cctools' 1
curl_tar 'https://github.com/tpoechtrager/cctools-port/archive/a98286d.tar.gz' 'cctools' 1

cd cctools/cctools

Expand Down
5 changes: 1 addition & 4 deletions stages/10-sse2neon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ echo "Download sse2neon..."

mkdir -p sse2neon

curl_tar 'https://github.com/DLTcollab/sse2neon/archive/refs/tags/v1.6.0.tar.gz' 'sse2neon' 1

curl 'https://raw.githubusercontent.com/HandBrake/HandBrake/172cd5d/contrib/sse2neon/A01-types-fix.patch' \
| patch -F5 -lp1 -d "sse2neon" -t
curl_tar 'https://github.com/DLTcollab/sse2neon/archive/refs/tags/v1.7.0.tar.gz' 'sse2neon' 1

# Remove unused components
rm -r sse2neon/{.ci,.github,tests}
Expand Down
13 changes: 1 addition & 12 deletions stages/25-lcms.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
echo "Download lcms..."
mkdir -p lcms

curl_tar 'https://github.com/mm2/Little-CMS/releases/download/lcms2.15/lcms2-2.15.tar.gz' lcms 1
curl_tar 'https://github.com/mm2/Little-CMS/releases/download/lcms2.16/lcms2-2.16.tar.gz' lcms 1

case "$TARGET" in
aarch64*)
Expand All @@ -12,17 +12,6 @@ case "$TARGET" in
;;
esac

# Some required patches for fixing meson and windows cross-compile issues
for patch in \
'https://github.com/mm2/Little-CMS/commit/4e55c55.patch' \
'https://github.com/mm2/Little-CMS/commit/8ddc268.patch' \
'https://github.com/mm2/Little-CMS/commit/8769c0e.patch' \
'https://github.com/mm2/Little-CMS/commit/7984408.patch' \
'https://github.com/mm2/Little-CMS/commit/b35e271.patch'; do
curl "$patch" | patch -F5 -lp1 -d lcms -t
done

sed -i "/subdir('utils')/d" lcms/meson.build
sed -i "/subdir('testbed')/d" lcms/meson.build
sed -i "/subdir('testbed')/d" lcms/plugins/threaded/meson.build
sed -i "/subdir('testbed')/d" lcms/plugins/fast_float/meson.build
Expand Down
2 changes: 1 addition & 1 deletion stages/45-de265.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
echo "Download de265..."
mkdir -p de265

curl_tar 'https://github.com/strukturag/libde265/archive/refs/tags/v1.0.14.tar.gz' de265 1
curl_tar 'https://github.com/strukturag/libde265/archive/refs/tags/v1.0.15.tar.gz' de265 1

case "$TARGET" in
aarch64*)
Expand Down
2 changes: 1 addition & 1 deletion stages/45-opencl/25-opencl-headers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ echo "Download opencl headers..."

mkdir -p opencl-headers

curl_tar 'https://github.com/KhronosGroup/OpenCL-Headers/archive/refs/tags/v2023.04.17.tar.gz' opencl-headers 1
curl_tar 'https://github.com/KhronosGroup/OpenCL-Headers/archive/refs/tags/v2023.12.14.tar.gz' opencl-headers 1

# Remove some superfluous files
rm -rf opencl-headers/{.github,tests}
Expand Down
2 changes: 1 addition & 1 deletion stages/45-opencl/45-opencl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ echo "Download opencl..."

mkdir -p opencl

curl_tar 'https://github.com/KhronosGroup/OpenCL-ICD-Loader/archive/refs/tags/v2023.04.17.tar.gz' opencl 1
curl_tar 'https://github.com/KhronosGroup/OpenCL-ICD-Loader/archive/refs/tags/v2023.12.14.tar.gz' opencl 1

# Remove some superfluous files
rm -rf opencl/{.github,test}
Expand Down
6 changes: 1 addition & 5 deletions stages/50-onevpl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@ esac
echo "Download oneVPL..."
mkdir -p oneVPL

curl_tar 'https://github.com/oneapi-src/oneVPL/archive/refs/tags/v2023.3.1.tar.gz' oneVPL 1

for patch in "$PREFIX"/patches/*; do
patch -F5 -lp1 -d oneVPL -t < "$patch"
done
curl_tar 'https://github.com/intel/libvpl/archive/refs/tags/v2.10.1.tar.gz' oneVPL 1

sed -i '/add_subdirectory(examples)/d' oneVPL/CMakeLists.txt

Expand Down
2 changes: 1 addition & 1 deletion stages/50-svt-av1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
echo "Download svt-av1..."
mkdir -p svt-av1

curl_tar 'https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v1.7.0/SVT-AV1-v1.7.0.tar.gz' svt-av1 1
curl_tar 'https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v1.8.0/SVT-AV1-v1.8.0.tar.gz' svt-av1 1

case "$TARGET" in
x86_64*)
Expand Down
2 changes: 1 addition & 1 deletion stages/50-vulkan/45-vulkan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ esac
echo "Download vulkan..."
mkdir -p vulkan-headers

curl_tar 'https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/v1.3.268.tar.gz' vulkan-headers 1
curl_tar 'https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/v1.3.274.tar.gz' vulkan-headers 1

VERSION="$(
sed -nr \
Expand Down
10 changes: 6 additions & 4 deletions stages/50-vulkan/50-shaderc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@ mkdir -p shaderc/third_party/{glslang,spirv-headers,spirv-tools}

# All the version for the main package and third-party deps must match what is here:
# https://github.com/google/shaderc/blob/known-good/known_good.json
curl_tar 'https://github.com/google/shaderc/archive/refs/tags/v2023.7.tar.gz' shaderc 1
curl_tar 'https://github.com/google/shaderc/archive/refs/tags/v2023.8.tar.gz' shaderc 1

sed -ie 's|#!/usr/bin/env python|#!/usr/bin/env python3|' shaderc/utils/update_build_version.py

# Thrid party deps
curl_tar 'https://github.com/KhronosGroup/glslang/archive/48f9ed8.tar.gz' shaderc/third_party/glslang 1
curl_tar 'https://github.com/KhronosGroup/glslang/archive/a91631b.tar.gz' shaderc/third_party/glslang 1
cp -a shaderc/third_party/glslang/LICENSE.txt shaderc/LICENSE.glslang

curl_tar 'https://github.com/KhronosGroup/SPIRV-Headers/archive/4183b26.tar.gz' shaderc/third_party/spirv-headers 1
curl_tar 'https://github.com/KhronosGroup/SPIRV-Headers/archive/1c6bb27.tar.gz' shaderc/third_party/spirv-headers 1
cp -a shaderc/third_party/spirv-headers/LICENSE shaderc/LICENSE.spirv-headers

curl_tar 'https://github.com/KhronosGroup/SPIRV-Tools/archive/360d469.tar.gz' shaderc/third_party/spirv-tools 1
curl_tar 'https://github.com/KhronosGroup/SPIRV-Tools/archive/f0cc85e.tar.gz' shaderc/third_party/spirv-tools 1
cp -a shaderc/third_party/spirv-tools/LICENSE shaderc/LICENSE.spirv-tools

sed -i '/add_subdirectory(test)/d' shaderc/third_party/spirv-tools/CMakeLists.txt
Expand Down
2 changes: 1 addition & 1 deletion stages/50-x265.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ echo "Download x265..."
mkdir -p x265

# Need to use master, because the latest release doesn't support optmized aarch64 and it is from 2021
curl_tar 'https://bitbucket.org/multicoreware/x265_git/get/8ee01d4.tar.bz2' x265 1
curl_tar 'https://bitbucket.org/multicoreware/x265_git/get/ce8642f.tar.bz2' x265 1

# Remove some superfluous files
rm -rf x265/{doc,build}
Expand Down
40 changes: 20 additions & 20 deletions stages/99-ffmpeg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,29 @@
echo "Download ffmpeg..."
mkdir -p ffmpeg

curl_tar 'https://github.com/FFmpeg/FFmpeg/archive/refs/tags/n6.1.tar.gz' ffmpeg 1
curl_tar 'https://github.com/FFmpeg/FFmpeg/archive/refs/tags/n6.1.1.tar.gz' ffmpeg 1

# Handbreak patches
for patch in \
'https://github.com/HandBrake/HandBrake/raw/9c9cf41/contrib/ffmpeg/A01-mov-read-name-track-tag-written-by-movenc.patch' \
'https://github.com/HandBrake/HandBrake/raw/9c9cf41/contrib/ffmpeg/A02-movenc-write-3gpp-track-titl-tag.patch' \
'https://github.com/HandBrake/HandBrake/raw/9c9cf41/contrib/ffmpeg/A03-mov-read-3gpp-udta-tags.patch' \
'https://github.com/HandBrake/HandBrake/raw/9c9cf41/contrib/ffmpeg/A04-movenc-write-3gpp-track-names-tags-for-all-available.patch' \
'https://github.com/HandBrake/HandBrake/raw/9c9cf41/contrib/ffmpeg/A05-dvdsubdec-fix-processing-of-partial-packets.patch' \
'https://github.com/HandBrake/HandBrake/raw/9c9cf41/contrib/ffmpeg/A06-dvdsubdec-return-number-of-bytes-used.patch' \
'https://github.com/HandBrake/HandBrake/raw/9c9cf41/contrib/ffmpeg/A07-dvdsubdec-use-pts-of-initial-packet.patch' \
'https://github.com/HandBrake/HandBrake/raw/9c9cf41/contrib/ffmpeg/A08-ccaption_dec-fix-pts-in-real_time-mode.patch' \
'https://github.com/HandBrake/HandBrake/raw/9c9cf41/contrib/ffmpeg/A09-matroskaenc-aac-extradata-updated.patch' \
'https://github.com/HandBrake/HandBrake/raw/9c9cf41/contrib/ffmpeg/A10-amfenc-Add-support-for-pict_type-field.patch' \
'https://github.com/HandBrake/HandBrake/raw/9c9cf41/contrib/ffmpeg/A11-amfenc-Fixes-the-color-information-in-the-ou.patch' \
'https://github.com/HandBrake/HandBrake/raw/9c9cf41/contrib/ffmpeg/A12-amfenc-HDR-metadata.patch' \
'https://github.com/HandBrake/HandBrake/raw/9c9cf41/contrib/ffmpeg/A13-libavcodec-amfenc-Fix-issue-with-missing-headers-in-.patch' \
'https://github.com/HandBrake/HandBrake/raw/9c9cf41/contrib/ffmpeg/A14-avcodec-add-ambient-viewing-environment-packet-side-.patch' \
'https://github.com/HandBrake/HandBrake/raw/9c9cf41/contrib/ffmpeg/A15-avformat-mov-add-support-for-amve-ambient-viewing-en.patch' \
'https://github.com/HandBrake/HandBrake/raw/9c9cf41/contrib/ffmpeg/A16-videotoolbox-dec-h264-10bit.patch' \
'https://github.com/HandBrake/HandBrake/raw/9c9cf41/contrib/ffmpeg/A17-libswscale-fix-yuv420p-to-p01xle-color-conversion-bu.patch' \
'https://github.com/HandBrake/HandBrake/raw/9c9cf41/contrib/ffmpeg/A18-qsv-fix-decode-10bit-hdr.patch' \
'https://github.com/HandBrake/HandBrake/raw/9c9cf41/contrib/ffmpeg/A19-ffbuild-common-use-gzip-n-flag-for-cuda.patch'; do
'https://github.com/HandBrake/HandBrake/raw/ce96bc5/contrib/ffmpeg/A01-mov-read-name-track-tag-written-by-movenc.patch' \
'https://github.com/HandBrake/HandBrake/raw/ce96bc5/contrib/ffmpeg/A02-movenc-write-3gpp-track-titl-tag.patch' \
'https://github.com/HandBrake/HandBrake/raw/ce96bc5/contrib/ffmpeg/A03-mov-read-3gpp-udta-tags.patch' \
'https://github.com/HandBrake/HandBrake/raw/ce96bc5/contrib/ffmpeg/A04-movenc-write-3gpp-track-names-tags-for-all-available.patch' \
'https://github.com/HandBrake/HandBrake/raw/ce96bc5/contrib/ffmpeg/A05-dvdsubdec-fix-processing-of-partial-packets.patch' \
'https://github.com/HandBrake/HandBrake/raw/ce96bc5/contrib/ffmpeg/A06-dvdsubdec-return-number-of-bytes-used.patch' \
'https://github.com/HandBrake/HandBrake/raw/ce96bc5/contrib/ffmpeg/A07-dvdsubdec-use-pts-of-initial-packet.patch' \
'https://github.com/HandBrake/HandBrake/raw/ce96bc5/contrib/ffmpeg/A08-ccaption_dec-fix-pts-in-real_time-mode.patch' \
'https://github.com/HandBrake/HandBrake/raw/ce96bc5/contrib/ffmpeg/A09-matroskaenc-aac-extradata-updated.patch' \
'https://github.com/HandBrake/HandBrake/raw/ce96bc5/contrib/ffmpeg/A10-amfenc-Add-support-for-pict_type-field.patch' \
'https://github.com/HandBrake/HandBrake/raw/ce96bc5/contrib/ffmpeg/A11-amfenc-Fixes-the-color-information-in-the-ou.patch' \
'https://github.com/HandBrake/HandBrake/raw/ce96bc5/contrib/ffmpeg/A12-amfenc-HDR-metadata.patch' \
'https://github.com/HandBrake/HandBrake/raw/ce96bc5/contrib/ffmpeg/A13-libavcodec-amfenc-Fix-issue-with-missing-headers-in-.patch' \
'https://github.com/HandBrake/HandBrake/raw/ce96bc5/contrib/ffmpeg/A14-avcodec-add-ambient-viewing-environment-packet-side-.patch' \
'https://github.com/HandBrake/HandBrake/raw/ce96bc5/contrib/ffmpeg/A15-avformat-mov-add-support-for-amve-ambient-viewing-en.patch' \
'https://github.com/HandBrake/HandBrake/raw/ce96bc5/contrib/ffmpeg/A16-videotoolbox-dec-h264.patch' \
'https://github.com/HandBrake/HandBrake/raw/ce96bc5/contrib/ffmpeg/A17-libswscale-fix-yuv420p-to-p01xle-color-conversion-bu.patch' \
'https://github.com/HandBrake/HandBrake/raw/ce96bc5/contrib/ffmpeg/A18-qsv-fix-decode-10bit-hdr.patch' \
'https://github.com/HandBrake/HandBrake/raw/ce96bc5/contrib/ffmpeg/A19-ffbuild-common-use-gzip-n-flag-for-cuda.patch'; do
curl "$patch" | patch -F5 -lp1 -d ffmpeg -t
done

Expand Down
39 changes: 39 additions & 0 deletions stages/99-gcompat.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env -S bash -euo pipefail

case "$TARGET" in
*linux-gnu)
;;
*)
export UNSUPPORTED=1
exit 1
;;
esac

echo "Download gcompat..."
mkdir -p gcompat

cd gcompat
curl -JO 'https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.14.0/x86_64/apk.static'

chmod +x apk.static

./apk.static \
--arch "${TARGET%%-*}" \
-X 'http://dl-cdn.alpinelinux.org/alpine/edge/main/' \
-U --allow-untrusted --root "$(pwd)" --initdb \
add gcompat

# Remove unused components
find . -type d -name 'apk' -exec rm -r {} +
find . -name '*.so*' -not -wholename './lib/*' -exec mv -n -t lib {} + || true
rm -r lib64 usr/lib apk.static
find . -empty -type d -delete

# Adjust rpath to use $ORIGIN
find lib -type f -name '*.so*' -exec patchelf --set-rpath "\$ORIGIN" {} \;

# Copy gcompat and it's dependencies to the output directory, resolving symlinks
mkdir -p "${OUT}/gcompat"
for lib in libgcompat.so.0 libobstack.so.1 libucontext.so.1 libucontext_posix.so.1; do
cp -L "lib/${lib}" "${OUT}/gcompat/"
done
2 changes: 1 addition & 1 deletion stages/99-heif.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
echo "Download heif..."
mkdir -p heif

curl_tar 'https://github.com/strukturag/libheif/releases/download/v1.17.5/libheif-1.17.5.tar.gz' heif 1
curl_tar 'https://github.com/strukturag/libheif/releases/download/v1.17.6/libheif-1.17.6.tar.gz' heif 1

case "$TARGET" in
*windows*)
Expand Down
2 changes: 1 addition & 1 deletion stages/99-pdfium.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
echo "Download pdfium..."
mkdir -p pdfium

_tag='chromium/6150'
_tag='chromium/6219'
case "$TARGET" in
x86_64-windows*)
_name='win-x64'
Expand Down
2 changes: 1 addition & 1 deletion stages/99-protoc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
echo "Download pdfium..."
mkdir -p pdfium

_tag='25.0'
_tag='25.1'
case "$TARGET" in
x86_64-windows*)
_suffix='win64'
Expand Down

0 comments on commit 2662564

Please sign in to comment.