mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-06 14:40:51 +03:00
Allow libavif to install rav1e, except on manylinux2014 and aarch64 (#7)
* Allow libavif to install rav1e, except on manylinux2014 and aarch64 * Allow libavif to install rav1e on Windows --------- Co-authored-by: Andrew Murray <radarhere@users.noreply.github.com>
This commit is contained in:
parent
d76ae2f10c
commit
9ad83119cf
4
.github/workflows/test-windows.yml
vendored
4
.github/workflows/test-windows.yml
vendored
|
@ -139,10 +139,6 @@ jobs:
|
|||
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||
run: "& winbuild\\build\\build_dep_libpng.cmd"
|
||||
|
||||
- name: Build dependencies / rav1e
|
||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||
run: "& winbuild\\build\\build_dep_rav1e.cmd"
|
||||
|
||||
- name: Build dependencies / meson
|
||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||
run: "& winbuild\\build\\install_meson.cmd"
|
||||
|
|
47
.github/workflows/wheels-dependencies.sh
vendored
47
.github/workflows/wheels-dependencies.sh
vendored
|
@ -97,28 +97,21 @@ function build_harfbuzz {
|
|||
touch harfbuzz-stamp
|
||||
}
|
||||
|
||||
function install_rav1e {
|
||||
if [ -n "$IS_MACOS" ]; then
|
||||
suffix="macos"
|
||||
if [[ "$PLAT" == "arm64" ]]; then
|
||||
suffix+="-aarch64"
|
||||
fi
|
||||
else
|
||||
suffix="linux"
|
||||
function build_libavif {
|
||||
if [ -e libavif-stamp ]; then return; fi
|
||||
|
||||
if [[ -z "$IS_MACOS" ]] && ([[ "$MB_ML_VER" == 2014 ]] || [[ "$PLAT" == "aarch64" ]]); then
|
||||
# Once Amazon 2 is EOL on 30 June 2025, manylinux2014 will no longer be needed
|
||||
# Once GitHub Actions supports aarch64 without emulation, this will no longer needed as building will be faster
|
||||
if [[ "$PLAT" == "aarch64" ]]; then
|
||||
suffix+="-aarch64"
|
||||
suffix="aarch64"
|
||||
else
|
||||
suffix+="-generic"
|
||||
fi
|
||||
suffix="generic"
|
||||
fi
|
||||
|
||||
curl -sLo - \
|
||||
https://github.com/xiph/rav1e/releases/download/v$RAV1E_VERSION/librav1e-$RAV1E_VERSION-$suffix.tar.gz \
|
||||
| tar -C $BUILD_PREFIX --exclude LICENSE --exclude '*.so' --exclude '*.dylib' -zxf -
|
||||
|
||||
if [ -z "$IS_MACOS" ]; then
|
||||
sed -i 's/-lgcc_s/-lgcc_eh/g' "${BUILD_PREFIX}/lib/pkgconfig/rav1e.pc"
|
||||
fi
|
||||
https://github.com/xiph/rav1e/releases/download/v$RAV1E_VERSION/librav1e-$RAV1E_VERSION-linux-$suffix.tar.gz \
|
||||
| tar -C $BUILD_PREFIX -zxf -
|
||||
|
||||
# Force libavif to treat system rav1e as if it were local
|
||||
mkdir -p /tmp/cmake/Modules
|
||||
|
@ -130,15 +123,23 @@ function install_rav1e {
|
|||
INTERFACE_INCLUDE_DIRECTORIES "$BUILD_PREFIX/include/rav1e"
|
||||
)
|
||||
EOF
|
||||
}
|
||||
|
||||
function build_libavif {
|
||||
if [ -e libavif-stamp ]; then return; fi
|
||||
install_rav1e
|
||||
rav1e=SYSTEM
|
||||
else
|
||||
curl https://sh.rustup.rs -sSf | sh -s -- -y
|
||||
. "$HOME/.cargo/env"
|
||||
|
||||
if [ -z "$IS_ALPINE" ] && [ -z "$IS_MACOS" ]; then
|
||||
yum install -y perl
|
||||
fi
|
||||
|
||||
rav1e=LOCAL
|
||||
fi
|
||||
|
||||
python3 -m pip install meson ninja
|
||||
|
||||
if [[ "$PLAT" == "x86_64" ]]; then
|
||||
build_simple nasm 2.16.03 https://www.nasm.us/pub/nasm/releasebuilds/2.16.03/
|
||||
build_simple nasm 2.16.03 https://www.nasm.us/pub/nasm/releasebuilds/2.16.03
|
||||
fi
|
||||
|
||||
local out_dir=$(fetch_unpack https://github.com/AOMediaCodec/libavif/archive/refs/tags/v$LIBAVIF_VERSION.tar.gz libavif-$LIBAVIF_VERSION.tar.gz)
|
||||
|
@ -150,7 +151,7 @@ function build_libavif {
|
|||
-DBUILD_SHARED_LIBS=OFF \
|
||||
-DAVIF_LIBSHARPYUV=LOCAL \
|
||||
-DAVIF_LIBYUV=LOCAL \
|
||||
-DAVIF_CODEC_RAV1E=SYSTEM \
|
||||
-DAVIF_CODEC_RAV1E=$rav1e \
|
||||
-DAVIF_CODEC_AOM=LOCAL \
|
||||
-DAVIF_CODEC_DAV1D=LOCAL \
|
||||
-DAVIF_CODEC_SVT=LOCAL \
|
||||
|
|
|
@ -226,7 +226,7 @@ Many of Pillow's features require external libraries:
|
|||
|
||||
sudo pkg install jpeg-turbo tiff webp lcms2 freetype2 openjpeg harfbuzz fribidi libxcb libavif
|
||||
|
||||
See ``depends/install_raqm_cmake.sh`` to install libraqm.
|
||||
Then see ``depends/install_raqm_cmake.sh`` to install libraqm.
|
||||
|
||||
.. tab:: Android
|
||||
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
file(TO_CMAKE_PATH "${AVIF_RAV1E_ROOT}" RAV1E_ROOT_PATH)
|
||||
add_library(rav1e::rav1e STATIC IMPORTED GLOBAL)
|
||||
set_target_properties(
|
||||
rav1e::rav1e
|
||||
PROPERTIES IMPORTED_LOCATION "${RAV1E_ROOT_PATH}/lib/rav1e.lib"
|
||||
AVIF_LOCAL ON
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${RAV1E_ROOT_PATH}/inc/rav1e"
|
||||
IMPORTED_SONAME rav1e)
|
||||
target_link_libraries(rav1e::rav1e INTERFACE ntdll.lib userenv.lib ws2_32.lib
|
||||
bcrypt.lib)
|
|
@ -124,7 +124,6 @@ V = {
|
|||
"ZLIB": "1.3.1",
|
||||
"MESON": "1.6.0",
|
||||
"LIBAVIF": "1.1.1",
|
||||
"RAV1E": "0.7.1",
|
||||
}
|
||||
V["LIBPNG_DOTLESS"] = V["LIBPNG"].replace(".", "")
|
||||
V["LIBPNG_XY"] = "".join(V["LIBPNG"].split(".")[:2])
|
||||
|
@ -400,19 +399,6 @@ DEPS: dict[str, dict[str, Any]] = {
|
|||
],
|
||||
"bins": [r"*.dll"],
|
||||
},
|
||||
"rav1e": {
|
||||
"url": (
|
||||
f"https://github.com/xiph/rav1e/releases/download/v{V['RAV1E']}/FILENAME"
|
||||
),
|
||||
"filename": f"rav1e-{V['RAV1E']}-windows-msvc-generic.zip",
|
||||
"dir": "rav1e-windows-msvc-sdk",
|
||||
"license": "LICENSE",
|
||||
"build": [
|
||||
cmd_xcopy("include", "{inc_dir}"),
|
||||
],
|
||||
"bins": [r"bin\*.dll"],
|
||||
"libs": [r"lib\*.*"],
|
||||
},
|
||||
"libavif": {
|
||||
"url": f"https://github.com/AOMediaCodec/libavif/archive/v{V['LIBAVIF']}.zip",
|
||||
"filename": f"libavif-{V['LIBAVIF']}.zip",
|
||||
|
@ -435,8 +421,7 @@ DEPS: dict[str, dict[str, Any]] = {
|
|||
"-DAVIF_CODEC_AOM=LOCAL",
|
||||
"-DAVIF_LIBYUV=LOCAL",
|
||||
"-DAVIF_LIBSHARPYUV=LOCAL",
|
||||
"-DAVIF_CODEC_RAV1E=SYSTEM",
|
||||
"-DAVIF_RAV1E_ROOT={build_dir}",
|
||||
"-DAVIF_CODEC_RAV1E=LOCAL",
|
||||
"-DCMAKE_MODULE_PATH={winbuild_dir_cmake}",
|
||||
"-DAVIF_CODEC_DAV1D=LOCAL",
|
||||
"-DAVIF_CODEC_SVT=LOCAL",
|
||||
|
@ -804,7 +789,7 @@ def main() -> None:
|
|||
if args.no_fribidi:
|
||||
disabled += ["fribidi"]
|
||||
if args.no_avif or args.architecture != "AMD64":
|
||||
disabled += ["rav1e", "libavif"]
|
||||
disabled += ["libavif"]
|
||||
|
||||
prefs = {
|
||||
"architecture": args.architecture,
|
||||
|
|
Loading…
Reference in New Issue
Block a user