mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-11 00:32:27 +03:00
Merge pull request #6562 from nulano/winbuild-update
This commit is contained in:
commit
d0ad0a0d3d
29
.github/workflows/test-windows.yml
vendored
29
.github/workflows/test-windows.yml
vendored
|
@ -90,19 +90,28 @@ jobs:
|
||||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||||
run: "& winbuild\\build\\build_dep_zlib.cmd"
|
run: "& winbuild\\build\\build_dep_zlib.cmd"
|
||||||
|
|
||||||
- name: Build dependencies / LibTiff
|
- name: Build dependencies / xz
|
||||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||||
run: "& winbuild\\build\\build_dep_libtiff.cmd"
|
run: "& winbuild\\build\\build_dep_xz.cmd"
|
||||||
|
|
||||||
- name: Build dependencies / WebP
|
- name: Build dependencies / WebP
|
||||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||||
run: "& winbuild\\build\\build_dep_libwebp.cmd"
|
run: "& winbuild\\build\\build_dep_libwebp.cmd"
|
||||||
|
|
||||||
|
- name: Build dependencies / LibTiff
|
||||||
|
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||||
|
run: "& winbuild\\build\\build_dep_libtiff.cmd"
|
||||||
|
|
||||||
# for FreeType CBDT/SBIX font support
|
# for FreeType CBDT/SBIX font support
|
||||||
- name: Build dependencies / libpng
|
- name: Build dependencies / libpng
|
||||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||||
run: "& winbuild\\build\\build_dep_libpng.cmd"
|
run: "& winbuild\\build\\build_dep_libpng.cmd"
|
||||||
|
|
||||||
|
# for FreeType WOFF2 font support
|
||||||
|
- name: Build dependencies / brotli
|
||||||
|
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||||
|
run: "& winbuild\\build\\build_dep_brotli.cmd"
|
||||||
|
|
||||||
- name: Build dependencies / FreeType
|
- name: Build dependencies / FreeType
|
||||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||||
run: "& winbuild\\build\\build_dep_freetype.cmd"
|
run: "& winbuild\\build\\build_dep_freetype.cmd"
|
||||||
|
@ -185,6 +194,22 @@ jobs:
|
||||||
id: wheel
|
id: wheel
|
||||||
if: "github.event_name != 'pull_request'"
|
if: "github.event_name != 'pull_request'"
|
||||||
run: |
|
run: |
|
||||||
|
setlocal EnableDelayedExpansion
|
||||||
|
for %%f in (winbuild\build\license\*) do (
|
||||||
|
set x=%%~nf
|
||||||
|
rem Skip FriBiDi license, it is not included in the wheel.
|
||||||
|
set fribidi=!x:~0,7!
|
||||||
|
if NOT !fribidi!==fribidi (
|
||||||
|
rem Skip imagequant license, it is not included in the wheel.
|
||||||
|
set libimagequant=!x:~0,13!
|
||||||
|
if NOT !libimagequant!==libimagequant (
|
||||||
|
echo. >> LICENSE
|
||||||
|
echo ===== %%~nf ===== >> LICENSE
|
||||||
|
echo. >> LICENSE
|
||||||
|
type %%f >> LICENSE
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
for /f "tokens=3 delims=/" %%a in ("${{ github.ref }}") do echo ::set-output name=dist::dist-%%a
|
for /f "tokens=3 delims=/" %%a in ("${{ github.ref }}") do echo ::set-output name=dist::dist-%%a
|
||||||
winbuild\\build\\build_pillow.cmd --disable-imagequant bdist_wheel
|
winbuild\\build\\build_pillow.cmd --disable-imagequant bdist_wheel
|
||||||
shell: cmd
|
shell: cmd
|
||||||
|
|
|
@ -8,6 +8,7 @@ TINY5x3GX.ttf, from http://velvetyne.fr/fonts/tiny
|
||||||
ArefRuqaa-Regular.ttf, from https://github.com/google/fonts/tree/master/ofl/arefruqaa
|
ArefRuqaa-Regular.ttf, from https://github.com/google/fonts/tree/master/ofl/arefruqaa
|
||||||
ter-x20b.pcf, from http://terminus-font.sourceforge.net/
|
ter-x20b.pcf, from http://terminus-font.sourceforge.net/
|
||||||
BungeeColor-Regular_colr_Windows.ttf, from https://github.com/djrrb/bungee
|
BungeeColor-Regular_colr_Windows.ttf, from https://github.com/djrrb/bungee
|
||||||
|
OpenSans.woff2, from https://fonts.googleapis.com/css?family=Open+Sans
|
||||||
|
|
||||||
All of the above fonts are published under the SIL Open Font License (OFL) v1.1 (http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL), which allows you to copy, modify, and redistribute them if you need to.
|
All of the above fonts are published under the SIL Open Font License (OFL) v1.1 (http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL), which allows you to copy, modify, and redistribute them if you need to.
|
||||||
|
|
||||||
|
|
BIN
Tests/fonts/OpenSans.woff2
Normal file
BIN
Tests/fonts/OpenSans.woff2
Normal file
Binary file not shown.
BIN
Tests/images/hopper_lzma.tif
Normal file
BIN
Tests/images/hopper_lzma.tif
Normal file
Binary file not shown.
BIN
Tests/images/hopper_webp.png
Normal file
BIN
Tests/images/hopper_webp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
BIN
Tests/images/hopper_webp.tif
Normal file
BIN
Tests/images/hopper_webp.tif
Normal file
Binary file not shown.
BIN
Tests/images/test_woff2.png
Normal file
BIN
Tests/images/test_woff2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.6 KiB |
|
@ -3,6 +3,7 @@ import io
|
||||||
import itertools
|
import itertools
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import sys
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
@ -825,6 +826,44 @@ class TestFileLibTiff(LibTiffTestCase):
|
||||||
assert reloaded.mode == "F"
|
assert reloaded.mode == "F"
|
||||||
assert reloaded.getexif()[SAMPLEFORMAT] == 3
|
assert reloaded.getexif()[SAMPLEFORMAT] == 3
|
||||||
|
|
||||||
|
def test_lzma(self, capfd):
|
||||||
|
try:
|
||||||
|
with Image.open("Tests/images/hopper_lzma.tif") as im:
|
||||||
|
assert im.mode == "RGB"
|
||||||
|
assert im.size == (128, 128)
|
||||||
|
assert im.format == "TIFF"
|
||||||
|
im2 = hopper()
|
||||||
|
assert_image_similar(im, im2, 5)
|
||||||
|
except OSError:
|
||||||
|
captured = capfd.readouterr()
|
||||||
|
if "LZMA compression support is not configured" in captured.err:
|
||||||
|
pytest.skip("LZMA compression support is not configured")
|
||||||
|
sys.stdout.write(captured.out)
|
||||||
|
sys.stderr.write(captured.err)
|
||||||
|
raise
|
||||||
|
|
||||||
|
def test_webp(self, capfd):
|
||||||
|
try:
|
||||||
|
with Image.open("Tests/images/hopper_webp.tif") as im:
|
||||||
|
assert im.mode == "RGB"
|
||||||
|
assert im.size == (128, 128)
|
||||||
|
assert im.format == "TIFF"
|
||||||
|
assert_image_similar_tofile(im, "Tests/images/hopper_webp.png", 1)
|
||||||
|
except OSError:
|
||||||
|
captured = capfd.readouterr()
|
||||||
|
if "WEBP compression support is not configured" in captured.err:
|
||||||
|
pytest.skip("WEBP compression support is not configured")
|
||||||
|
if (
|
||||||
|
"Compression scheme 50001 strip decoding is not implemented"
|
||||||
|
in captured.err
|
||||||
|
):
|
||||||
|
pytest.skip(
|
||||||
|
"Compression scheme 50001 strip decoding is not implemented"
|
||||||
|
)
|
||||||
|
sys.stdout.write(captured.out)
|
||||||
|
sys.stderr.write(captured.err)
|
||||||
|
raise
|
||||||
|
|
||||||
def test_lzw(self):
|
def test_lzw(self):
|
||||||
with Image.open("Tests/images/hopper_lzw.tif") as im:
|
with Image.open("Tests/images/hopper_lzw.tif") as im:
|
||||||
assert im.mode == "RGB"
|
assert im.mode == "RGB"
|
||||||
|
|
|
@ -1063,6 +1063,25 @@ def test_colr_mask(layout_engine):
|
||||||
assert_image_similar_tofile(im, "Tests/images/colr_bungee_mask.png", 22)
|
assert_image_similar_tofile(im, "Tests/images/colr_bungee_mask.png", 22)
|
||||||
|
|
||||||
|
|
||||||
|
def test_woff2(layout_engine):
|
||||||
|
try:
|
||||||
|
font = ImageFont.truetype(
|
||||||
|
"Tests/fonts/OpenSans.woff2",
|
||||||
|
size=64,
|
||||||
|
layout_engine=layout_engine,
|
||||||
|
)
|
||||||
|
except OSError as e:
|
||||||
|
assert str(e) in ("unimplemented feature", "unknown file format")
|
||||||
|
pytest.skip("FreeType compiled without brotli or WOFF2 support")
|
||||||
|
|
||||||
|
im = Image.new("RGB", (350, 100), "white")
|
||||||
|
d = ImageDraw.Draw(im)
|
||||||
|
|
||||||
|
d.text((15, 5), "OpenSans", "black", font=font)
|
||||||
|
|
||||||
|
assert_image_similar_tofile(im, "Tests/images/test_woff2.png", 5)
|
||||||
|
|
||||||
|
|
||||||
def test_fill_deprecation(font):
|
def test_fill_deprecation(font):
|
||||||
with pytest.warns(DeprecationWarning):
|
with pytest.warns(DeprecationWarning):
|
||||||
font.getmask2("Hello world", fill=Image.core.fill)
|
font.getmask2("Hello world", fill=Image.core.fill)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import struct
|
import struct
|
||||||
import subprocess
|
import subprocess
|
||||||
|
@ -111,6 +112,11 @@ deps = {
|
||||||
+ "/libjpeg-turbo/files/2.1.4/libjpeg-turbo-2.1.4.tar.gz/download",
|
+ "/libjpeg-turbo/files/2.1.4/libjpeg-turbo-2.1.4.tar.gz/download",
|
||||||
"filename": "libjpeg-turbo-2.1.4.tar.gz",
|
"filename": "libjpeg-turbo-2.1.4.tar.gz",
|
||||||
"dir": "libjpeg-turbo-2.1.4",
|
"dir": "libjpeg-turbo-2.1.4",
|
||||||
|
"license": ["README.ijg", "LICENSE.md"],
|
||||||
|
"license_pattern": (
|
||||||
|
"(LEGAL ISSUES\n============\n\n.+?)\n\nREFERENCES\n=========="
|
||||||
|
".+(libjpeg-turbo Licenses\n======================\n\n.+)$"
|
||||||
|
),
|
||||||
"build": [
|
"build": [
|
||||||
cmd_cmake(
|
cmd_cmake(
|
||||||
[
|
[
|
||||||
|
@ -135,6 +141,8 @@ deps = {
|
||||||
"url": "https://zlib.net/zlib1213.zip",
|
"url": "https://zlib.net/zlib1213.zip",
|
||||||
"filename": "zlib1213.zip",
|
"filename": "zlib1213.zip",
|
||||||
"dir": "zlib-1.2.13",
|
"dir": "zlib-1.2.13",
|
||||||
|
"license": "README",
|
||||||
|
"license_pattern": "Copyright notice:\n\n(.+)$",
|
||||||
"build": [
|
"build": [
|
||||||
cmd_nmake(r"win32\Makefile.msc", "clean"),
|
cmd_nmake(r"win32\Makefile.msc", "clean"),
|
||||||
cmd_nmake(r"win32\Makefile.msc", "zlib.lib"),
|
cmd_nmake(r"win32\Makefile.msc", "zlib.lib"),
|
||||||
|
@ -143,10 +151,73 @@ deps = {
|
||||||
"headers": [r"z*.h"],
|
"headers": [r"z*.h"],
|
||||||
"libs": [r"*.lib"],
|
"libs": [r"*.lib"],
|
||||||
},
|
},
|
||||||
|
"xz": {
|
||||||
|
"url": SF_PROJECTS + "/lzmautils/files/xz-5.2.7.tar.gz/download",
|
||||||
|
"filename": "xz-5.2.7.tar.gz",
|
||||||
|
"dir": "xz-5.2.7",
|
||||||
|
"license": "COPYING",
|
||||||
|
"patch": {
|
||||||
|
r"src\liblzma\api\lzma.h": {
|
||||||
|
"#ifndef LZMA_API_IMPORT": "#ifndef LZMA_API_IMPORT\n#define LZMA_API_STATIC", # noqa: E501
|
||||||
|
},
|
||||||
|
r"windows\vs2019\liblzma.vcxproj": {
|
||||||
|
# retarget to default toolset (selected by vcvarsall.bat)
|
||||||
|
"<PlatformToolset>v142</PlatformToolset>": "<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>", # noqa: E501
|
||||||
|
# retarget to latest (selected by vcvarsall.bat)
|
||||||
|
"<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>": "<WindowsTargetPlatformVersion>$(WindowsSDKVersion)</WindowsTargetPlatformVersion>", # noqa: E501
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"build": [
|
||||||
|
cmd_msbuild(r"windows\vs2019\liblzma.vcxproj", "Release", "Clean"),
|
||||||
|
cmd_msbuild(r"windows\vs2019\liblzma.vcxproj", "Release", "Build"),
|
||||||
|
cmd_mkdir(r"{inc_dir}\lzma"),
|
||||||
|
cmd_copy(r"src\liblzma\api\lzma\*.h", r"{inc_dir}\lzma"),
|
||||||
|
],
|
||||||
|
"headers": [r"src\liblzma\api\lzma.h"],
|
||||||
|
"libs": [r"windows\vs2019\Release\{msbuild_arch}\liblzma\liblzma.lib"],
|
||||||
|
},
|
||||||
|
"libwebp": {
|
||||||
|
"url": "http://downloads.webmproject.org/releases/webp/libwebp-1.2.4.tar.gz",
|
||||||
|
"filename": "libwebp-1.2.4.tar.gz",
|
||||||
|
"dir": "libwebp-1.2.4",
|
||||||
|
"license": "COPYING",
|
||||||
|
"build": [
|
||||||
|
cmd_rmdir(r"output\release-static"), # clean
|
||||||
|
cmd_nmake(
|
||||||
|
"Makefile.vc",
|
||||||
|
"all",
|
||||||
|
[
|
||||||
|
"CFG=release-static",
|
||||||
|
"RTLIBCFG=dynamic",
|
||||||
|
"OBJDIR=output",
|
||||||
|
"ARCH={architecture}",
|
||||||
|
"LIBWEBP_BASENAME=webp",
|
||||||
|
],
|
||||||
|
),
|
||||||
|
cmd_mkdir(r"{inc_dir}\webp"),
|
||||||
|
cmd_copy(r"src\webp\*.h", r"{inc_dir}\webp"),
|
||||||
|
],
|
||||||
|
"libs": [r"output\release-static\{architecture}\lib\*.lib"],
|
||||||
|
},
|
||||||
"libtiff": {
|
"libtiff": {
|
||||||
"url": "https://download.osgeo.org/libtiff/tiff-4.4.0.tar.gz",
|
"url": "https://download.osgeo.org/libtiff/tiff-4.4.0.tar.gz",
|
||||||
"filename": "tiff-4.4.0.tar.gz",
|
"filename": "tiff-4.4.0.tar.gz",
|
||||||
"dir": "tiff-4.4.0",
|
"dir": "tiff-4.4.0",
|
||||||
|
"license": "COPYRIGHT",
|
||||||
|
"patch": {
|
||||||
|
r"cmake\LZMACodec.cmake": {
|
||||||
|
# fix typo
|
||||||
|
"${{LZMA_FOUND}}": "${{LIBLZMA_FOUND}}",
|
||||||
|
},
|
||||||
|
r"libtiff\tif_lzma.c": {
|
||||||
|
# link against liblzma.lib
|
||||||
|
"#ifdef LZMA_SUPPORT": '#ifdef LZMA_SUPPORT\n#pragma comment(lib, "liblzma.lib")', # noqa: E501
|
||||||
|
},
|
||||||
|
r"libtiff\tif_webp.c": {
|
||||||
|
# link against webp.lib
|
||||||
|
"#ifdef WEBP_SUPPORT": '#ifdef WEBP_SUPPORT\n#pragma comment(lib, "webp.lib")', # noqa: E501
|
||||||
|
},
|
||||||
|
},
|
||||||
"build": [
|
"build": [
|
||||||
cmd_cmake("-DBUILD_SHARED_LIBS:BOOL=OFF"),
|
cmd_cmake("-DBUILD_SHARED_LIBS:BOOL=OFF"),
|
||||||
cmd_nmake(target="clean"),
|
cmd_nmake(target="clean"),
|
||||||
|
@ -156,26 +227,11 @@ deps = {
|
||||||
"libs": [r"libtiff\*.lib"],
|
"libs": [r"libtiff\*.lib"],
|
||||||
# "bins": [r"libtiff\*.dll"],
|
# "bins": [r"libtiff\*.dll"],
|
||||||
},
|
},
|
||||||
"libwebp": {
|
|
||||||
"url": "http://downloads.webmproject.org/releases/webp/libwebp-1.2.4.tar.gz",
|
|
||||||
"filename": "libwebp-1.2.4.tar.gz",
|
|
||||||
"dir": "libwebp-1.2.4",
|
|
||||||
"build": [
|
|
||||||
cmd_rmdir(r"output\release-static"), # clean
|
|
||||||
cmd_nmake(
|
|
||||||
"Makefile.vc",
|
|
||||||
"all",
|
|
||||||
["CFG=release-static", "OBJDIR=output", "ARCH={architecture}"],
|
|
||||||
),
|
|
||||||
cmd_mkdir(r"{inc_dir}\webp"),
|
|
||||||
cmd_copy(r"src\webp\*.h", r"{inc_dir}\webp"),
|
|
||||||
],
|
|
||||||
"libs": [r"output\release-static\{architecture}\lib\*.lib"],
|
|
||||||
},
|
|
||||||
"libpng": {
|
"libpng": {
|
||||||
"url": SF_PROJECTS + "/libpng/files/libpng16/1.6.37/lpng1637.zip/download",
|
"url": SF_PROJECTS + "/libpng/files/libpng16/1.6.38/lpng1638.zip/download",
|
||||||
"filename": "lpng1637.zip",
|
"filename": "lpng1638.zip",
|
||||||
"dir": "lpng1637",
|
"dir": "lpng1638",
|
||||||
|
"license": "LICENSE",
|
||||||
"build": [
|
"build": [
|
||||||
# lint: do not inline
|
# lint: do not inline
|
||||||
cmd_cmake(("-DPNG_SHARED:BOOL=OFF", "-DPNG_TESTS:BOOL=OFF")),
|
cmd_cmake(("-DPNG_SHARED:BOOL=OFF", "-DPNG_TESTS:BOOL=OFF")),
|
||||||
|
@ -186,10 +242,25 @@ deps = {
|
||||||
"headers": [r"png*.h"],
|
"headers": [r"png*.h"],
|
||||||
"libs": [r"libpng16.lib"],
|
"libs": [r"libpng16.lib"],
|
||||||
},
|
},
|
||||||
|
"brotli": {
|
||||||
|
"url": "https://github.com/google/brotli/archive/refs/tags/v1.0.9.tar.gz",
|
||||||
|
"filename": "brotli-1.0.9.tar.gz",
|
||||||
|
"dir": "brotli-1.0.9",
|
||||||
|
"license": "LICENSE",
|
||||||
|
"build": [
|
||||||
|
cmd_cmake(),
|
||||||
|
cmd_nmake(target="clean"),
|
||||||
|
cmd_nmake(target="brotlicommon-static"),
|
||||||
|
cmd_nmake(target="brotlidec-static"),
|
||||||
|
cmd_xcopy(r"c\include", "{inc_dir}"),
|
||||||
|
],
|
||||||
|
"libs": ["*.lib"],
|
||||||
|
},
|
||||||
"freetype": {
|
"freetype": {
|
||||||
"url": "https://download.savannah.gnu.org/releases/freetype/freetype-2.12.1.tar.gz", # noqa: E501
|
"url": "https://download.savannah.gnu.org/releases/freetype/freetype-2.12.1.tar.gz", # noqa: E501
|
||||||
"filename": "freetype-2.12.1.tar.gz",
|
"filename": "freetype-2.12.1.tar.gz",
|
||||||
"dir": "freetype-2.12.1",
|
"dir": "freetype-2.12.1",
|
||||||
|
"license": ["LICENSE.TXT", r"docs\FTL.TXT", r"docs\GPLv2.TXT"],
|
||||||
"patch": {
|
"patch": {
|
||||||
r"builds\windows\vc2010\freetype.vcxproj": {
|
r"builds\windows\vc2010\freetype.vcxproj": {
|
||||||
# freetype setting is /MD for .dll and /MT for .lib, we need /MD
|
# freetype setting is /MD for .dll and /MT for .lib, we need /MD
|
||||||
|
@ -198,13 +269,13 @@ deps = {
|
||||||
'<PropertyGroup Label="Globals">': '<PropertyGroup Label="Globals">\n <WindowsTargetPlatformVersion>$(WindowsSDKVersion)</WindowsTargetPlatformVersion>', # noqa: E501
|
'<PropertyGroup Label="Globals">': '<PropertyGroup Label="Globals">\n <WindowsTargetPlatformVersion>$(WindowsSDKVersion)</WindowsTargetPlatformVersion>', # noqa: E501
|
||||||
},
|
},
|
||||||
r"builds\windows\vc2010\freetype.user.props": {
|
r"builds\windows\vc2010\freetype.user.props": {
|
||||||
"<UserDefines></UserDefines>": "<UserDefines>FT_CONFIG_OPTION_SYSTEM_ZLIB;FT_CONFIG_OPTION_USE_PNG;FT_CONFIG_OPTION_USE_HARFBUZZ</UserDefines>", # noqa: E501
|
"<UserDefines></UserDefines>": "<UserDefines>FT_CONFIG_OPTION_SYSTEM_ZLIB;FT_CONFIG_OPTION_USE_PNG;FT_CONFIG_OPTION_USE_HARFBUZZ;FT_CONFIG_OPTION_USE_BROTLI</UserDefines>", # noqa: E501
|
||||||
"<UserIncludeDirectories></UserIncludeDirectories>": r"<UserIncludeDirectories>{dir_harfbuzz}\src;{inc_dir}</UserIncludeDirectories>", # noqa: E501
|
"<UserIncludeDirectories></UserIncludeDirectories>": r"<UserIncludeDirectories>{dir_harfbuzz}\src;{inc_dir}</UserIncludeDirectories>", # noqa: E501
|
||||||
"<UserLibraryDirectories></UserLibraryDirectories>": "<UserLibraryDirectories>{lib_dir}</UserLibraryDirectories>", # noqa: E501
|
"<UserLibraryDirectories></UserLibraryDirectories>": "<UserLibraryDirectories>{lib_dir}</UserLibraryDirectories>", # noqa: E501
|
||||||
"<UserDependencies></UserDependencies>": "<UserDependencies>zlib.lib;libpng16.lib</UserDependencies>", # noqa: E501
|
"<UserDependencies></UserDependencies>": "<UserDependencies>zlib.lib;libpng16.lib;brotlicommon-static.lib;brotlidec-static.lib</UserDependencies>", # noqa: E501
|
||||||
},
|
},
|
||||||
r"src/autofit/afshaper.c": {
|
r"src/autofit/afshaper.c": {
|
||||||
# link against harfbuzz.lib once it becomes available
|
# link against harfbuzz.lib
|
||||||
"#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ": '#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ\n#pragma comment(lib, "harfbuzz.lib")', # noqa: E501
|
"#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ": '#ifdef FT_CONFIG_OPTION_USE_HARFBUZZ\n#pragma comment(lib, "harfbuzz.lib")', # noqa: E501
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -225,6 +296,7 @@ deps = {
|
||||||
"url": SF_PROJECTS + "/lcms/files/lcms/2.13/lcms2-2.13.1.tar.gz/download",
|
"url": SF_PROJECTS + "/lcms/files/lcms/2.13/lcms2-2.13.1.tar.gz/download",
|
||||||
"filename": "lcms2-2.13.1.tar.gz",
|
"filename": "lcms2-2.13.1.tar.gz",
|
||||||
"dir": "lcms2-2.13.1",
|
"dir": "lcms2-2.13.1",
|
||||||
|
"license": "COPYING",
|
||||||
"patch": {
|
"patch": {
|
||||||
r"Projects\VC2022\lcms2_static\lcms2_static.vcxproj": {
|
r"Projects\VC2022\lcms2_static\lcms2_static.vcxproj": {
|
||||||
# default is /MD for x86 and /MT for x64, we need /MD always
|
# default is /MD for x86 and /MT for x64, we need /MD always
|
||||||
|
@ -250,8 +322,9 @@ deps = {
|
||||||
"url": "https://github.com/uclouvain/openjpeg/archive/v2.5.0.tar.gz",
|
"url": "https://github.com/uclouvain/openjpeg/archive/v2.5.0.tar.gz",
|
||||||
"filename": "openjpeg-2.5.0.tar.gz",
|
"filename": "openjpeg-2.5.0.tar.gz",
|
||||||
"dir": "openjpeg-2.5.0",
|
"dir": "openjpeg-2.5.0",
|
||||||
|
"license": "LICENSE",
|
||||||
"build": [
|
"build": [
|
||||||
cmd_cmake(("-DBUILD_THIRDPARTY:BOOL=OFF", "-DBUILD_SHARED_LIBS:BOOL=OFF")),
|
cmd_cmake(("-DBUILD_CODEC:BOOL=OFF", "-DBUILD_SHARED_LIBS:BOOL=OFF")),
|
||||||
cmd_nmake(target="clean"),
|
cmd_nmake(target="clean"),
|
||||||
cmd_nmake(target="openjp2"),
|
cmd_nmake(target="openjp2"),
|
||||||
cmd_mkdir(r"{inc_dir}\openjpeg-2.5.0"),
|
cmd_mkdir(r"{inc_dir}\openjpeg-2.5.0"),
|
||||||
|
@ -264,6 +337,7 @@ deps = {
|
||||||
"url": "https://github.com/ImageOptim/libimagequant/archive/e4c1334be0eff290af5e2b4155057c2953a313ab.zip", # noqa: E501
|
"url": "https://github.com/ImageOptim/libimagequant/archive/e4c1334be0eff290af5e2b4155057c2953a313ab.zip", # noqa: E501
|
||||||
"filename": "libimagequant-e4c1334be0eff290af5e2b4155057c2953a313ab.zip",
|
"filename": "libimagequant-e4c1334be0eff290af5e2b4155057c2953a313ab.zip",
|
||||||
"dir": "libimagequant-e4c1334be0eff290af5e2b4155057c2953a313ab",
|
"dir": "libimagequant-e4c1334be0eff290af5e2b4155057c2953a313ab",
|
||||||
|
"license": "COPYRIGHT",
|
||||||
"patch": {
|
"patch": {
|
||||||
"CMakeLists.txt": {
|
"CMakeLists.txt": {
|
||||||
"if(OPENMP_FOUND)": "if(false)",
|
"if(OPENMP_FOUND)": "if(false)",
|
||||||
|
@ -284,6 +358,7 @@ deps = {
|
||||||
"url": "https://github.com/harfbuzz/harfbuzz/archive/5.3.1.zip",
|
"url": "https://github.com/harfbuzz/harfbuzz/archive/5.3.1.zip",
|
||||||
"filename": "harfbuzz-5.3.1.zip",
|
"filename": "harfbuzz-5.3.1.zip",
|
||||||
"dir": "harfbuzz-5.3.1",
|
"dir": "harfbuzz-5.3.1",
|
||||||
|
"license": "COPYING",
|
||||||
"build": [
|
"build": [
|
||||||
cmd_cmake("-DHB_HAVE_FREETYPE:BOOL=TRUE"),
|
cmd_cmake("-DHB_HAVE_FREETYPE:BOOL=TRUE"),
|
||||||
cmd_nmake(target="clean"),
|
cmd_nmake(target="clean"),
|
||||||
|
@ -296,6 +371,7 @@ deps = {
|
||||||
"url": "https://github.com/fribidi/fribidi/archive/v1.0.12.zip",
|
"url": "https://github.com/fribidi/fribidi/archive/v1.0.12.zip",
|
||||||
"filename": "fribidi-1.0.12.zip",
|
"filename": "fribidi-1.0.12.zip",
|
||||||
"dir": "fribidi-1.0.12",
|
"dir": "fribidi-1.0.12",
|
||||||
|
"license": "COPYING",
|
||||||
"build": [
|
"build": [
|
||||||
cmd_copy(r"{winbuild_dir}\fribidi.cmake", r"CMakeLists.txt"),
|
cmd_copy(r"{winbuild_dir}\fribidi.cmake", r"CMakeLists.txt"),
|
||||||
cmd_cmake(),
|
cmd_cmake(),
|
||||||
|
@ -406,8 +482,8 @@ def write_script(name, lines):
|
||||||
name = os.path.join(build_dir, name)
|
name = os.path.join(build_dir, name)
|
||||||
lines = [line.format(**prefs) for line in lines]
|
lines = [line.format(**prefs) for line in lines]
|
||||||
print("Writing " + name)
|
print("Writing " + name)
|
||||||
with open(name, "w") as f:
|
with open(name, "w", newline="") as f:
|
||||||
f.write("\n\r".join(lines))
|
f.write(os.linesep.join(lines))
|
||||||
if verbose:
|
if verbose:
|
||||||
for line in lines:
|
for line in lines:
|
||||||
print(" " + line)
|
print(" " + line)
|
||||||
|
@ -431,6 +507,21 @@ def build_dep(name):
|
||||||
|
|
||||||
extract_dep(dep["url"], dep["filename"])
|
extract_dep(dep["url"], dep["filename"])
|
||||||
|
|
||||||
|
licenses = dep["license"]
|
||||||
|
if isinstance(licenses, str):
|
||||||
|
licenses = [licenses]
|
||||||
|
license_text = ""
|
||||||
|
for license_file in licenses:
|
||||||
|
with open(os.path.join(sources_dir, dir, license_file)) as f:
|
||||||
|
license_text += f.read()
|
||||||
|
if "license_pattern" in dep:
|
||||||
|
match = re.search(dep["license_pattern"], license_text, re.DOTALL)
|
||||||
|
license_text = "\n".join(match.groups())
|
||||||
|
assert len(license_text) > 50
|
||||||
|
with open(os.path.join(license_dir, f"{dir}.txt"), "w") as f:
|
||||||
|
print(f"Writing license {dir}.txt")
|
||||||
|
f.write(license_text)
|
||||||
|
|
||||||
for patch_file, patch_list in dep.get("patch", {}).items():
|
for patch_file, patch_list in dep.get("patch", {}).items():
|
||||||
patch_file = os.path.join(sources_dir, dir, patch_file.format(**prefs))
|
patch_file = os.path.join(sources_dir, dir, patch_file.format(**prefs))
|
||||||
with open(patch_file) as f:
|
with open(patch_file) as f:
|
||||||
|
@ -477,6 +568,7 @@ def build_pillow():
|
||||||
cmd_cd("{pillow_dir}"),
|
cmd_cd("{pillow_dir}"),
|
||||||
*prefs["header"],
|
*prefs["header"],
|
||||||
cmd_set("DISTUTILS_USE_SDK", "1"), # use same compiler to build Pillow
|
cmd_set("DISTUTILS_USE_SDK", "1"), # use same compiler to build Pillow
|
||||||
|
cmd_set("py_vcruntime_redist", "true"), # always use /MD, never /MT
|
||||||
r'"{python_dir}\{python_exe}" setup.py build_ext --vendor-raqm --vendor-fribidi %*', # noqa: E501
|
r'"{python_dir}\{python_exe}" setup.py build_ext --vendor-raqm --vendor-fribidi %*', # noqa: E501
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -551,10 +643,12 @@ if __name__ == "__main__":
|
||||||
bin_dir = os.path.join(build_dir, "bin")
|
bin_dir = os.path.join(build_dir, "bin")
|
||||||
# directory for storing project files
|
# directory for storing project files
|
||||||
sources_dir = build_dir + sources_dir
|
sources_dir = build_dir + sources_dir
|
||||||
|
# copy dependency licenses to this directory
|
||||||
|
license_dir = os.path.join(build_dir, "license")
|
||||||
|
|
||||||
shutil.rmtree(build_dir, ignore_errors=True)
|
shutil.rmtree(build_dir, ignore_errors=True)
|
||||||
os.makedirs(build_dir, exist_ok=False)
|
os.makedirs(build_dir, exist_ok=False)
|
||||||
for path in [inc_dir, lib_dir, bin_dir, sources_dir]:
|
for path in [inc_dir, lib_dir, bin_dir, sources_dir, license_dir]:
|
||||||
os.makedirs(path, exist_ok=True)
|
os.makedirs(path, exist_ok=True)
|
||||||
|
|
||||||
prefs = {
|
prefs = {
|
||||||
|
@ -572,6 +666,7 @@ if __name__ == "__main__":
|
||||||
"lib_dir": lib_dir,
|
"lib_dir": lib_dir,
|
||||||
"bin_dir": bin_dir,
|
"bin_dir": bin_dir,
|
||||||
"src_dir": sources_dir,
|
"src_dir": sources_dir,
|
||||||
|
"license_dir": license_dir,
|
||||||
# Compilers / Tools
|
# Compilers / Tools
|
||||||
**msvs,
|
**msvs,
|
||||||
"cmake": "cmake.exe", # TODO find CMAKE automatically
|
"cmake": "cmake.exe", # TODO find CMAKE automatically
|
||||||
|
|
Loading…
Reference in New Issue
Block a user