From 392242793e040d819dfa84ecfb9488de73d9b812 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Mon, 9 Dec 2024 20:58:38 +1100 Subject: [PATCH 1/4] Use cmds_cmake --- winbuild/build_prepare.py | 37 ++++++++++--------------------------- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/winbuild/build_prepare.py b/winbuild/build_prepare.py index 9758a804637..8bc0584f03d 100644 --- a/winbuild/build_prepare.py +++ b/winbuild/build_prepare.py @@ -405,35 +405,19 @@ def cmd_msbuild( "dir": f"libavif-{V['LIBAVIF']}", "license": "LICENSE", "build": [ - cmd_mkdir("build.pillow"), - cmd_cd("build.pillow"), - " ".join( - [ - "{cmake}", - "-DCMAKE_BUILD_TYPE=Release", - "-DCMAKE_VERBOSE_MAKEFILE=ON", - "-DCMAKE_RULE_MESSAGES:BOOL=OFF", - "-DCMAKE_C_COMPILER=cl.exe", - "-DCMAKE_CXX_COMPILER=cl.exe", - "-DCMAKE_C_FLAGS=-nologo", - "-DCMAKE_CXX_FLAGS=-nologo", - "-DBUILD_SHARED_LIBS=OFF", - "-DAVIF_CODEC_AOM=LOCAL", - "-DAVIF_LIBYUV=LOCAL", - "-DAVIF_LIBSHARPYUV=LOCAL", - "-DAVIF_CODEC_RAV1E=LOCAL", - "-DCMAKE_MODULE_PATH={winbuild_dir_cmake}", - "-DAVIF_CODEC_DAV1D=LOCAL", - "-DAVIF_CODEC_SVT=LOCAL", - '-G "Ninja"', - "..", - ] + *cmds_cmake( + "avif_static", + "-DBUILD_SHARED_LIBS=OFF", + "-DAVIF_CODEC_AOM=LOCAL", + "-DAVIF_LIBYUV=LOCAL", + "-DAVIF_LIBSHARPYUV=LOCAL", + "-DAVIF_CODEC_RAV1E=LOCAL", + "-DAVIF_CODEC_DAV1D=LOCAL", + "-DAVIF_CODEC_SVT=LOCAL", ), - "ninja -v", - cmd_cd(".."), cmd_xcopy("include", "{inc_dir}"), ], - "libs": [r"build.pillow\avif.lib"], + "libs": ["avif.lib"], }, } @@ -796,7 +780,6 @@ def main() -> None: **arch_prefs, # Pillow paths "winbuild_dir": winbuild_dir, - "winbuild_dir_cmake": winbuild_dir.replace("\\", "/"), # Build paths "bin_dir": bin_dir, "build_dir": args.build_dir, From 5c3e6c5d36952bf4d7d86c9702954b049379fabe Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Tue, 10 Dec 2024 06:45:35 +1100 Subject: [PATCH 2/4] Added libsharpyuv --- depends/install_libavif.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/depends/install_libavif.sh b/depends/install_libavif.sh index 09646c4ad78..29796a74dcc 100755 --- a/depends/install_libavif.sh +++ b/depends/install_libavif.sh @@ -51,6 +51,7 @@ fi cmake -G Ninja -S . -B build \ -DCMAKE_INSTALL_PREFIX=$PREFIX \ + -DAVIF_LIBSHARPYUV=LOCAL \ -DAVIF_LIBYUV=LOCAL \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_NAME_DIR=$PREFIX/lib \ From b0f197bde5b3e732b4cf2c38ba02e2f20227325e Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Fri, 13 Dec 2024 20:40:31 +1100 Subject: [PATCH 3/4] Combine meson into libavif install script --- .github/workflows/test-windows.yml | 4 ---- winbuild/build_prepare.py | 35 +++++++----------------------- 2 files changed, 8 insertions(+), 31 deletions(-) diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index fab90454a54..03fc7ebaa19 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -139,10 +139,6 @@ jobs: if: steps.build-cache.outputs.cache-hit != 'true' run: "& winbuild\\build\\build_dep_libpng.cmd" - - name: Build dependencies / meson - if: steps.build-cache.outputs.cache-hit != 'true' - run: "& winbuild\\build\\install_meson.cmd" - - name: Build dependencies / libavif if: steps.build-cache.outputs.cache-hit != 'true' run: "& winbuild\\build\\build_dep_libavif.cmd" diff --git a/winbuild/build_prepare.py b/winbuild/build_prepare.py index 8bc0584f03d..82488628c6f 100644 --- a/winbuild/build_prepare.py +++ b/winbuild/build_prepare.py @@ -122,7 +122,6 @@ def cmd_msbuild( "TIFF": "4.6.0", "XZ": "5.6.3", "ZLIB": "1.3.1", - "MESON": "1.6.0", "LIBAVIF": "1.1.1", } V["LIBPNG_DOTLESS"] = V["LIBPNG"].replace(".", "") @@ -405,6 +404,7 @@ def cmd_msbuild( "dir": f"libavif-{V['LIBAVIF']}", "license": "LICENSE", "build": [ + f"{sys.executable} -m pip install meson", *cmds_cmake( "avif_static", "-DBUILD_SHARED_LIBS=OFF", @@ -647,19 +647,13 @@ def build_dep_all(disabled: list[str], prefs: dict[str, str], verbose: bool) -> if dep_name in disabled: print(f"Skipping disabled dependency {dep_name}") continue - - scripts = [] - if dep_name == "libavif": - scripts.append("install_meson.cmd") - scripts.append(build_dep(dep_name, prefs, verbose)) - - for script in scripts: - if gha_groups: - lines.append(f"@echo ::group::Running {script}") - lines.append(rf'cmd.exe /c "{{build_dir}}\{script}"') - lines.append("if errorlevel 1 echo Build failed! && exit /B 1") - if gha_groups: - lines.append("@echo ::endgroup::") + script = build_dep(dep_name, prefs, verbose) + if gha_groups: + lines.append(f"@echo ::group::Running {script}") + lines.append(rf'cmd.exe /c "{{build_dir}}\{script}"') + lines.append("if errorlevel 1 echo Build failed! && exit /B 1") + if gha_groups: + lines.append("@echo ::endgroup::") print() lines.append("@echo All Pillow dependencies built successfully!") write_script("build_dep_all.cmd", lines, prefs, verbose) @@ -801,19 +795,6 @@ def main() -> None: print() write_script(".gitignore", ["*"], prefs, args.verbose) - if "libavif" not in disabled: - write_script( - "install_meson.cmd", - [ - r'call "{build_dir}\build_env.cmd"', - "@echo " + ("=" * 70), - f"@echo ==== {'Building meson':<60} ====", - "@echo " + ("=" * 70), - f"{sys.executable} -m pip install meson=={V['MESON']}", - ], - prefs, - args.verbose, - ) build_env(prefs, args.verbose) build_dep_all(disabled, prefs, args.verbose) From 80c5bb421dc3e940515413c4ccbe0c7946f9c8e8 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Fri, 13 Dec 2024 22:44:00 +1100 Subject: [PATCH 4/4] Simplified condition --- .github/workflows/wheels-dependencies.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wheels-dependencies.sh b/.github/workflows/wheels-dependencies.sh index f728d0e5520..0efda07eac6 100755 --- a/.github/workflows/wheels-dependencies.sh +++ b/.github/workflows/wheels-dependencies.sh @@ -100,7 +100,7 @@ function build_harfbuzz { function build_libavif { if [ -e libavif-stamp ]; then return; fi - if [[ -z "$IS_MACOS" ]] && ([[ "$MB_ML_VER" == 2014 ]] || [[ "$PLAT" == "aarch64" ]]); then + if [[ "$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