Files
spacedrive/.github/scripts/ffmpeg-windows/scripts.d/50-libjxl.sh
Vítor Vasconcellos 1c7855ded6 [ENG-630] Windows ffmpeg + libheif custom build (#871)
* Initial Windows ffmpeg + libheif custom build

* Add build steps for most of ffmpeg deps

* FFmpeg deps and libheif

* Fix libheif build

* Fix libvpx and dlfcn + attempt to fix rav1e

* Rework the whole ffmpeg-windows build system
 - New system based on https://github.com/BtbN/FFmpeg-Builds
 - Add new ffmpeg-windows workflow
 - Rename macos ffmpeg workflow
 - Adapt macos setupt script due to above name change

* Forgot to update update the workflow name

* Strip all libs from debug symbols

* Add docs

* Add libde265 deps, required by libheif
 - Make x265, svtav1 and dav1d as shared deps (used by both ffmpeg and libheif)

* Add missing libheif to Linux setup script

* Fix libx265 build script

* Forgot to point x265 ninja install to the correct directory

* Remove libaom and libsvt-av1
 - dav1d and rav1d are our default AV1 decoders/encoders
 - Quote subshell executions
 - Make libweb shared

* Forgot to remove libaom and libsvt-av1 build steps

* Fix typo

* Try force webp to link against static libs

* Revert libwebp to a static build

* Dumb typo

* Modify windows script to download our ffmpeg build (WIP)

* Fix dlls output folder structure

* Fix dumb mistake

* Remove unused ffbuild_enabled

* Enable core's heif feature on Windows
 - Fix windows ffmpeg build not including the headers
 - Fix windows setupt script incorrect download loagic
 - Implement build_arg to pass which repo ref to use when cloning

* Fix windows setup script

* Fix workflow artifact path
 - Make ffmpeg-windows dockerfile respect the FFMPEG_VERSION env

* Fix Windows setup script incorrect logic for downloading ffmpeg builds

* Error out when workflow_runs is empty

* Fix dumb mistake

* Manually define ffmpeg version for windows script

* Fix ffmpeg windows build extract logic

* Fix prop access in windows setup script

* Revert back to a web request because nightly.link does a redirect before serving the artifact content

* Fix windows setup script

* Do not use nightly.link in Github CI

* Fix windows setup script

* Should finally fix window setup script
 - Update ffmpeg-windows deps
 - Should fix ffmpeg-windows failing to build due to mingw changes in new base image

* Fix libxz failing to build due to doxygen

* Fix windows setup-script not executing till the end

* Fix LASTEXITCODE not defined

* Remove libjxl, deps are not being compiled

* Fix dll and lib copy logic

* Move final copy dll logic to external script

* Use main for libjxl

* Change brotli from stable to main
 - Attempt to fix libjxl

* Attempt fix lib copy again

* Split copy_dll logic to avoid cache burst in docker

* Missing file

* Change how to export build files from shared deps

* Replace rsync with cp

* Fix copy

* Fix dir not existing

* Fix pkgconfig

* Remove superflous files from exported ffmpeg for windows
 - Adjust dav1d to not build tools and examples
 - Adjust windows setup-script to point linker to the libs directory

* Fix dav1d meson config args

* Fix dumb mistake

* WORK PLZ

* Fix .lib file location
 - Strip all dlls

* Formatter
2023-06-10 15:23:37 +00:00

58 lines
2.0 KiB
Bash
Executable File

#!/bin/bash
SCRIPT_REPO="https://github.com/libjxl/libjxl.git"
SCRIPT_COMMIT="7263ec97397a8113cfa4012bf84ca4618198df3b"
ffbuild_dockerbuild() {
git-mini-clone "$SCRIPT_REPO" "$SCRIPT_COMMIT" jxl
cd jxl
git submodule update --init --recursive --depth 1 --recommend-shallow third_party/{highway,skcms}
mkdir build && cd build
if [[ $TARGET == linux* ]]; then
# our glibc is too old(<2.25), and their detection fails for some reason
export CXXFLAGS="$CXXFLAGS -DVQSORT_GETRANDOM=0 -DVQSORT_SECURE_SEED=0"
elif [[ $TARGET == win* ]]; then
# Fix AVX2 related crash due to unaligned stack memory
export CXXFLAGS="$CXXFLAGS -Wa,-muse-unaligned-vector-move"
export CFLAGS="$CFLAGS -Wa,-muse-unaligned-vector-move"
fi
cmake -G Ninja \
-DCMAKE_INSTALL_PREFIX="$FFBUILD_PREFIX" \
-DCMAKE_TOOLCHAIN_FILE="$FFBUILD_CMAKE_TOOLCHAIN" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DBUILD_SHARED_LIBS=OFF \
-DJPEGXL_STATIC=OFF \
-DJPEGXL_ENABLE_TOOLS=OFF \
-DJPEGXL_ENABLE_VIEWERS=OFF \
-DJPEGXL_EMSCRIPTEN=OFF \
-DJPEGXL_ENABLE_DOXYGEN=OFF \
-DBUILD_TESTING=OFF \
-DJPEGXL_ENABLE_EXAMPLES=OFF \
-DJPEGXL_ENABLE_MANPAGES=OFF \
-DJPEGXL_ENABLE_JNI=OFF \
-DJPEGXL_ENABLE_PLUGINS=OFF \
-DJPEGXL_ENABLE_DEVTOOLS=OFF \
-DJPEGXL_ENABLE_BENCHMARK=OFF \
-DJPEGXL_BUNDLE_LIBPNG=OFF \
-DJPEGXL_ENABLE_SJPEG=OFF \
-DJPEGXL_FORCE_SYSTEM_BROTLI=ON \
..
ninja -j"$(nproc)"
ninja install
echo "Cflags.private: -DJXL_STATIC_DEFINE=1" >>"${FFBUILD_PREFIX}"/lib/pkgconfig/libjxl.pc
echo "Libs.private: -lstdc++" >>"${FFBUILD_PREFIX}"/lib/pkgconfig/libjxl.pc
echo "Cflags.private: -DJXL_STATIC_DEFINE=1" >>"${FFBUILD_PREFIX}"/lib/pkgconfig/libjxl_threads.pc
echo "Libs.private: -lstdc++" >>"${FFBUILD_PREFIX}"/lib/pkgconfig/libjxl_threads.pc
if [[ $TARGET == win* ]]; then
echo "Libs.private: -ladvapi32" >>"${FFBUILD_PREFIX}"/lib/pkgconfig/libjxl.pc
echo "Libs.private: -ladvapi32" >>"${FFBUILD_PREFIX}"/lib/pkgconfig/libjxl_threads.pc
fi
}