mirror of https://github.com/pyodide/pyodide.git
82 lines
3.2 KiB
Diff
82 lines
3.2 KiB
Diff
From c5b15988defebfd88bb3812a81179a92219047ad Mon Sep 17 00:00:00 2001
|
|
From: ryanking13 <def6488@gmail.com>
|
|
Date: Tue, 19 Apr 2022 07:18:31 +0000
|
|
Subject: [PATCH] Enable image formats
|
|
|
|
---
|
|
setup.py | 23 +++++++++++++++++------
|
|
1 file changed, 17 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/setup.py b/setup.py
|
|
index 3468b260d..ba7cc64e0 100755
|
|
--- a/setup.py
|
|
+++ b/setup.py
|
|
@@ -630,7 +630,9 @@ class pil_build_ext(build_ext):
|
|
|
|
if feature.want("zlib"):
|
|
_dbg("Looking for zlib")
|
|
- if _find_include_file(self, "zlib.h"):
|
|
+ if "PYODIDE" in os.environ:
|
|
+ feature.zlib = "z"
|
|
+ elif _find_include_file(self, "zlib.h"):
|
|
if _find_library_file(self, "z"):
|
|
feature.zlib = "z"
|
|
elif sys.platform == "win32" and _find_library_file(self, "zlib"):
|
|
@@ -638,7 +640,9 @@ class pil_build_ext(build_ext):
|
|
|
|
if feature.want("jpeg"):
|
|
_dbg("Looking for jpeg")
|
|
- if _find_include_file(self, "jpeglib.h"):
|
|
+ if "PYODIDE" in os.environ:
|
|
+ feature.jpeg = "jpeg"
|
|
+ elif _find_include_file(self, "jpeglib.h"):
|
|
if _find_library_file(self, "jpeg"):
|
|
feature.jpeg = "jpeg"
|
|
elif sys.platform == "win32" and _find_library_file(self, "libjpeg"):
|
|
@@ -694,7 +698,9 @@ class pil_build_ext(build_ext):
|
|
|
|
if feature.want("tiff"):
|
|
_dbg("Looking for tiff")
|
|
- if _find_include_file(self, "tiff.h"):
|
|
+ if "PYODIDE" in os.environ:
|
|
+ feature.tiff = "tiff"
|
|
+ elif _find_include_file(self, "tiff.h"):
|
|
if _find_library_file(self, "tiff"):
|
|
feature.tiff = "tiff"
|
|
if sys.platform in ["win32", "darwin"] and _find_library_file(
|
|
@@ -704,7 +710,9 @@ class pil_build_ext(build_ext):
|
|
|
|
if feature.want("freetype"):
|
|
_dbg("Looking for freetype")
|
|
- if _find_library_file(self, "freetype"):
|
|
+ if "PYODIDE" in os.environ:
|
|
+ feature.freetype = "freetype"
|
|
+ elif _find_library_file(self, "freetype"):
|
|
# look for freetype2 include files
|
|
freetype_version = 0
|
|
for subdir in self.compiler.include_dirs:
|
|
@@ -769,7 +777,9 @@ class pil_build_ext(build_ext):
|
|
|
|
if feature.want("webp"):
|
|
_dbg("Looking for webp")
|
|
- if _find_include_file(self, "webp/encode.h") and _find_include_file(
|
|
+ if "PYODIDE" in os.environ:
|
|
+ feature.webp = "webp"
|
|
+ elif _find_include_file(self, "webp/encode.h") and _find_include_file(
|
|
self, "webp/decode.h"
|
|
):
|
|
# In Google's precompiled zip it is call "libwebp":
|
|
@@ -810,7 +820,8 @@ class pil_build_ext(build_ext):
|
|
libs = self.add_imaging_libs.split()
|
|
defs = []
|
|
if feature.jpeg:
|
|
- libs.append(feature.jpeg)
|
|
+ if "PYODIDE" not in os.environ:
|
|
+ libs.append(feature.jpeg)
|
|
defs.append(("HAVE_LIBJPEG", None))
|
|
if feature.jpeg2000:
|
|
libs.append(feature.jpeg2000)
|
|
--
|
|
2.36.1
|
|
|