50-libjxl.sh 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/bin/bash
  2. SCRIPT_REPO="https://github.com/libjxl/libjxl.git"
  3. SCRIPT_COMMIT="adeeccc415f7c18e6a1732d4c9d6d905ed8e2f9b"
  4. ffbuild_enabled() {
  5. [[ $ADDINS_STR == *4.4* ]] && return -1
  6. [[ $ADDINS_STR == *5.0* ]] && return -1
  7. [[ $ADDINS_STR == *5.1* ]] && return -1
  8. [[ $ADDINS_STR == *6.0* ]] && return -1
  9. return 0
  10. }
  11. ffbuild_dockerdl() {
  12. default_dl .
  13. echo "git submodule update --init --recursive --depth 1 --recommend-shallow third_party/highway"
  14. }
  15. ffbuild_dockerbuild() {
  16. mkdir build && cd build
  17. if [[ $TARGET == linux* ]]; then
  18. # our glibc is too old(<2.25), and their detection fails for some reason
  19. export CXXFLAGS="$CXXFLAGS -DVQSORT_GETRANDOM=0 -DVQSORT_SECURE_SEED=0"
  20. elif [[ $TARGET == win32 || $TARGET == win64 ]]; then
  21. # Fix AVX2 related crash due to unaligned stack memory
  22. export CXXFLAGS="$CXXFLAGS -Wa,-muse-unaligned-vector-move"
  23. export CFLAGS="$CFLAGS -Wa,-muse-unaligned-vector-move"
  24. fi
  25. cmake -G Ninja -DCMAKE_TOOLCHAIN_FILE="$FFBUILD_CMAKE_TOOLCHAIN" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$FFBUILD_PREFIX" -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
  26. -DJPEGXL_ENABLE_SKCMS=OFF -DJPEGXL_FORCE_SYSTEM_LCMS2=ON \
  27. -DBUILD_SHARED_LIBS=OFF -DJPEGXL_STATIC=OFF -DBUILD_SHARED_LIBS=OFF -DJPEGXL_ENABLE_TOOLS=OFF -DJPEGXL_ENABLE_VIEWERS=OFF -DJPEGXL_EMSCRIPTEN=OFF -DJPEGXL_ENABLE_DOXYGEN=OFF \
  28. -DJPEGXL_ENABLE_JPEGLI=OFF -DBUILD_TESTING=OFF -DJPEGXL_ENABLE_EXAMPLES=OFF -DJPEGXL_ENABLE_MANPAGES=OFF -DJPEGXL_ENABLE_JNI=OFF -DJPEGXL_ENABLE_PLUGINS=OFF \
  29. -DJPEGXL_ENABLE_DEVTOOLS=OFF -DJPEGXL_ENABLE_BENCHMARK=OFF -DJPEGXL_BUNDLE_LIBPNG=OFF -DJPEGXL_ENABLE_SJPEG=OFF -DJPEGXL_FORCE_SYSTEM_BROTLI=ON ..
  30. ninja -j$(nproc)
  31. ninja install
  32. if [[ $TARGET == win* ]]; then
  33. echo "Libs.private: -lstdc++ -ladvapi32" >> "${FFBUILD_PREFIX}"/lib/pkgconfig/libjxl.pc
  34. echo "Libs.private: -lstdc++ -ladvapi32" >> "${FFBUILD_PREFIX}"/lib/pkgconfig/libjxl_threads.pc
  35. else
  36. echo "Libs.private: -lstdc++" >> "${FFBUILD_PREFIX}"/lib/pkgconfig/libjxl.pc
  37. echo "Libs.private: -lstdc++" >> "${FFBUILD_PREFIX}"/lib/pkgconfig/libjxl_threads.pc
  38. fi
  39. echo "Requires.private: lcms2" >> "${FFBUILD_PREFIX}"/lib/pkgconfig/libjxl_cms.pc
  40. }
  41. ffbuild_configure() {
  42. echo --enable-libjxl
  43. }
  44. ffbuild_unconfigure() {
  45. [[ $ADDINS_STR == *4.4* ]] && return 0
  46. [[ $ADDINS_STR == *5.0* ]] && return 0
  47. echo --disable-libjxl
  48. }