diff options
author | wsnipex <wsnipex@a1.net> | 2015-10-25 10:49:47 +0100 |
---|---|---|
committer | wsnipex <wsnipex@a1.net> | 2015-11-19 19:50:18 +0100 |
commit | 1ce9a4a667e253ee6fc08604fa3a306eef62433b (patch) | |
tree | 54e4eef2f2370d9d92be6c19deed87e4863df5f5 /tools | |
parent | 3fdce5fa48c478bee13a87f68e3c59317383d24c (diff) |
[depends] switch from PIL to pillow
thanks to @Memphiz for the OSX build fix
Diffstat (limited to 'tools')
7 files changed, 222 insertions, 142 deletions
diff --git a/tools/depends/target/pythonmodule-pil/Imaging-1.1.7-access.patch b/tools/depends/target/pythonmodule-pil/Imaging-1.1.7-access.patch deleted file mode 100644 index dd51f4ac8e..0000000000 --- a/tools/depends/target/pythonmodule-pil/Imaging-1.1.7-access.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff -rupN Imaging-1.1.7/libImaging/Access.c Imaging-1.1.7-mod/libImaging/Access.c ---- Imaging-1.1.7/libImaging/Access.c 2009-10-31 20:44:12.000000000 -0400 -+++ Imaging-1.1.7-mod/libImaging/Access.c 2011-10-10 19:40:22.000000000 -0400 -@@ -32,7 +32,7 @@ add_item(const char* mode) - { - UINT32 i = hash(mode); - /* printf("hash %s => %d\n", mode, i); */ -- if (access_table[i].mode) { -+ if (access_table[i].mode && (strcmp(mode, access_table[i].mode) != 0)) { - fprintf(stderr, "AccessInit: hash collision: %d for both %s and %s\n", - i, mode, access_table[i].mode); - exit(1); - diff --git a/tools/depends/target/pythonmodule-pil/Imaging-1.1.7-bz2-link.patch b/tools/depends/target/pythonmodule-pil/Imaging-1.1.7-bz2-link.patch deleted file mode 100644 index de284045a5..0000000000 --- a/tools/depends/target/pythonmodule-pil/Imaging-1.1.7-bz2-link.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/setup.py b/setup.py -index 5872f72..372eeaa 100644 ---- a/setup.py -+++ b/setup.py -@@ -293,7 +293,7 @@ class pil_build_ext(build_ext): - if feature.freetype_version == 20: - defs.append(("USE_FREETYPE_2_0", None)) - exts.append(Extension( -- "_imagingft", ["_imagingft.c"], libraries=["freetype"], -+ "_imagingft", ["_imagingft.c"], libraries=["freetype", "bz2", "z"], - define_macros=defs - )) - diff --git a/tools/depends/target/pythonmodule-pil/Imaging-1.1.7-crosscompiling-0.1.patch b/tools/depends/target/pythonmodule-pil/Imaging-1.1.7-crosscompiling-0.1.patch deleted file mode 100644 index 48fad83ea0..0000000000 --- a/tools/depends/target/pythonmodule-pil/Imaging-1.1.7-crosscompiling-0.1.patch +++ /dev/null @@ -1,64 +0,0 @@ ---- Imaging-1.1.7/setup.py 2011-04-17 09:31:07.000000000 +0200 -+++ Imaging-1.1.7.patch/setup.py 2011-04-17 09:54:20.880047886 +0200 -@@ -147,7 +147,6 @@ - add_directory(library_dirs, "/opt/local/lib") - add_directory(include_dirs, "/opt/local/include") - -- add_directory(library_dirs, "/usr/local/lib") - # FIXME: check /opt/stuff directories here? - - prefix = sysconfig.get_config_var("prefix") -@@ -199,22 +198,6 @@ - add_directory(include_dirs, include_root) - - # -- # add standard directories -- -- # look for tcl specific subdirectory (e.g debian) -- if _tkinter: -- tcl_dir = "/usr/include/tcl" + TCL_VERSION -- if os.path.isfile(os.path.join(tcl_dir, "tk.h")): -- add_directory(include_dirs, tcl_dir) -- -- # standard locations -- add_directory(library_dirs, "/usr/local/lib") -- add_directory(include_dirs, "/usr/local/include") -- -- add_directory(library_dirs, "/usr/lib") -- add_directory(include_dirs, "/usr/include") -- -- # - # insert new dirs *before* default libs, to avoid conflicts - # between Python PYD stub libs and real libraries - - ---- a/setup.py.orig 2015-10-10 09:52:19.488633670 +0200 -+++ b/setup.py 2015-10-10 09:55:31.183384584 +0200 -@@ -127,6 +127,15 @@ - - add_directory(include_dirs, "libImaging") - -+ compiler = os.environ.get('CC') -+ args = {} -+ # unfortunately, distutils doesn't let us provide separate C and C++ -+ # compilers -+ if compiler is not None: -+ (ccshared,cflags) = sysconfig.get_config_vars('CCSHARED','CFLAGS') -+ args['compiler_so'] = compiler + ' ' + ccshared + ' ' + cflags -+ self.compiler.set_executables(**args) -+ - # - # add platform directories - -@@ -149,9 +158,10 @@ - - # FIXME: check /opt/stuff directories here? - -- prefix = sysconfig.get_config_var("prefix") -+ prefix = os.environ.get('PYTHONXCPREFIX') - if prefix: - add_directory(library_dirs, os.path.join(prefix, "lib")) -+ add_directory(include_dirs, os.path.join(prefix, "include/python2.7")) - add_directory(include_dirs, os.path.join(prefix, "include")) - - # diff --git a/tools/depends/target/pythonmodule-pil/Imaging-1.1.7-remove-zlib-check.patch b/tools/depends/target/pythonmodule-pil/Imaging-1.1.7-remove-zlib-check.patch deleted file mode 100644 index 3f97fa820e..0000000000 --- a/tools/depends/target/pythonmodule-pil/Imaging-1.1.7-remove-zlib-check.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- setup.py 2013-03-19 18:26:03.725978243 -0400 -+++ setup.py 2013-03-19 18:24:50.435978289 -0400 -@@ -211,11 +211,7 @@ - zlib = jpeg = tiff = freetype = tcl = tk = lcms = None - feature = feature() - -- if 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"): -- feature.zlib = "zlib" # alternative name -+ feature.zlib = "z" - - if find_include_file(self, "jpeglib.h"): - if find_library_file(self, "jpeg"): diff --git a/tools/depends/target/pythonmodule-pil/Imaging-1.1.7-zip-include.patch b/tools/depends/target/pythonmodule-pil/Imaging-1.1.7-zip-include.patch deleted file mode 100644 index fbd54e2802..0000000000 --- a/tools/depends/target/pythonmodule-pil/Imaging-1.1.7-zip-include.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- encode.c 2009-11-02 06:46:30.000000000 -0500 -+++ encode.c 2013-03-13 19:47:36.156302056 -0400 -@@ -426,7 +426,7 @@ - - #ifdef HAVE_LIBZ - --#include "Zip.h" -+#include "libImaging/Zip.h" - - PyObject* - PyImaging_ZipEncoderNew(PyObject* self, PyObject* args) ---- decode.c 2009-11-02 06:46:46.000000000 -0500 -+++ decode.c 2013-03-13 19:47:53.326302045 -0400 -@@ -602,7 +602,7 @@ - - #ifdef HAVE_LIBZ - --#include "Zip.h" -+#include "libImaging/Zip.h" - - PyObject* - PyImaging_ZipDecoderNew(PyObject* self, PyObject* args) diff --git a/tools/depends/target/pythonmodule-pil/Makefile b/tools/depends/target/pythonmodule-pil/Makefile index c608730474..da73934811 100644 --- a/tools/depends/target/pythonmodule-pil/Makefile +++ b/tools/depends/target/pythonmodule-pil/Makefile @@ -1,29 +1,32 @@ include ../../Makefile.include -DEPS= ../../Makefile.include Makefile Imaging-1.1.7-access.patch \ - Imaging-1.1.7-crosscompiling-0.1.patch +DEPS= ../../Makefile.include Makefile pillow-crosscompile.patch VERSION.TXT := $(XBMCROOT)/version.txt APP_NAME=$(shell awk '/APP_NAME/ {print tolower($$2)}' $(VERSION.TXT)) # lib name, version -LIBNAME=Imaging -VERSION=1.1.7 +LIBNAME=pillow +VERSION=3.0.0 SOURCE=$(LIBNAME)-$(VERSION) ARCHIVE=$(SOURCE).tar.gz -CROSSFLAGS=PYTHONXCPREFIX="$(PREFIX)" CC="$(CC)" LDSHARED="$(CC) -shared" LDFLAGS="$(LDFLAGS)" +CROSSFLAGS=PYTHONXCPREFIX="$(PREFIX)" CC="$(CC) $(CFLAGS)" LDSHARED="$(CC) -shared" LDFLAGS="$(LDFLAGS)" PYTHONPATH="$(PREFIX)/lib/python2.7/site-packages/" ifeq ($(OS),android) -CROSSFLAGS=PYTHONXCPREFIX="$(PREFIX)" CC="$(CC)" LDSHARED="$(CC) -shared" LDFLAGS="$(LDFLAGS) -L$(PREFIX)/lib/dummy-lib$(APP_NAME)/ -l$(APP_NAME) -lm" +PILPATH=$(PREFIX)/share/$(APP_NAME)/addons/script.module.pil +CROSSFLAGS=PYTHONXCPREFIX="$(PREFIX)" CC="$(CC) $(CFLAGS)" LDSHARED="$(CC) -shared" LDFLAGS="$(LDFLAGS) -L$(PREFIX)/lib/dummy-lib$(APP_NAME)/ -l$(APP_NAME) -lm" PYTHONPATH="$(PILPATH):$(PREFIX)/lib/python2.7/site-packages/" endif ifeq ($(OS),osx) -CROSSFLAGS=PYTHONXCPREFIX="$(PREFIX)" CC="$(CC)" LDSHARED="$(CC) -shared" LDFLAGS="$(LDFLAGS) -lpython" +CROSSFLAGS=PYTHONXCPREFIX="$(PREFIX)" CC="$(CC) $(CFLAGS)" CCSHARED="$(CC) $(CFLAGS) $(PYTHON_O)" LDFLAGS="$(LDFLAGS)" PYTHONPATH="$(PREFIX)/lib/python2.7/site-packages/" endif ifeq ($(OS),ios) PYTHON_O=$(abs_top_srcdir)/target/python27/$(PLATFORM)/Modules/python.o -CROSSFLAGS=PYTHONXCPREFIX="$(PREFIX)" CC="$(CC) $(CFLAGS)" CCSHARED="$(CC) $(CFLAGS) $(PYTHON_O)" LDFLAGS="$(LDFLAGS)" +CROSSFLAGS=PYTHONXCPREFIX="$(PREFIX)" CC="$(CC) $(CFLAGS)" CCSHARED="$(CC) $(CFLAGS) $(PYTHON_O)" LDFLAGS="$(LDFLAGS)" PYTHONPATH="$(PREFIX)/lib/python2.7/site-packages/" endif LIBDYLIB=$(PLATFORM)/dist/PIL-$(VERSION)-py2.7-$(OS)-$(CPU).egg +ifeq ($(OS),android) +LIBDYLIB=$(PREFIX)/share/$(APP_NAME)/addons/script.module.pil/lib/PIL/_imaging.so +endif all: .installed-$(PLATFORM) @@ -33,12 +36,7 @@ $(TARBALLS_LOCATION)/$(ARCHIVE): $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM) cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE) - cd $(PLATFORM); patch -p1 < ../Imaging-1.1.7-crosscompiling-0.1.patch - cd $(PLATFORM); patch -p1 < ../Imaging-1.1.7-access.patch - cd $(PLATFORM); patch -p0 < ../Imaging-1.1.7-zip-include.patch - cd $(PLATFORM); patch -p0 < ../Imaging-1.1.7-remove-zlib-check.patch - cd $(PLATFORM); patch -p1 < ../Imaging-1.1.7-bz2-link.patch - cd $(PLATFORM); sed -ie "s|"darwin"|"darwinNot"|g" "setup.py" + cd $(PLATFORM); patch -p0 < ../pillow-crosscompile.patch $(LIBDYLIB): $(PLATFORM) mkdir -p $(PLATFORM)/output @@ -47,7 +45,9 @@ $(LIBDYLIB): $(PLATFORM) .installed-$(PLATFORM): $(LIBDYLIB) ifeq ($(OS),android) mkdir -p $(PREFIX)/share/$(APP_NAME)/addons/script.module.pil/lib - cd $(PLATFORM); $(CROSSFLAGS) $(NATIVEPREFIX)/bin/python setup.py install --install-lib $(PREFIX)/share/$(APP_NAME)/addons/script.module.pil/lib + cd $(PLATFORM); $(CROSSFLAGS) $(NATIVEPREFIX)/bin/python setup.py install --install-lib $(PREFIX)/share/$(APP_NAME)/addons/script.module.pil + cd $(PREFIX)/share/$(APP_NAME)/addons/script.module.pil/lib && unzip ../Pillow-*.egg + cd $(PREFIX)/share/$(APP_NAME)/addons/script.module.pil && rm -rf Pillow-*.egg else cd $(PLATFORM); $(CROSSFLAGS) $(NATIVEPREFIX)/bin/python setup.py install --prefix=$(PREFIX) endif diff --git a/tools/depends/target/pythonmodule-pil/pillow-crosscompile.patch b/tools/depends/target/pythonmodule-pil/pillow-crosscompile.patch new file mode 100644 index 0000000000..a1b3e17d60 --- /dev/null +++ b/tools/depends/target/pythonmodule-pil/pillow-crosscompile.patch @@ -0,0 +1,207 @@ +--- setup.py.orig 2015-10-01 22:39:00.000000000 +0200 ++++ setup.py 2015-10-25 12:28:22.023743244 +0100 +@@ -156,6 +156,15 @@ + + _add_directory(include_dirs, "libImaging") + ++ compiler = os.environ.get('CC') ++ args = {} ++ # unfortunately, distutils doesn't let us provide separate C and C++ ++ # compilers ++ if compiler is not None: ++ (ccshared,cflags) = sysconfig.get_config_vars('CCSHARED','CFLAGS') ++ args['compiler_so'] = compiler + ' ' + ccshared + ' ' + cflags ++ self.compiler.set_executables(**args) ++ + # + # add configured kits + +@@ -187,10 +196,11 @@ + for d in os.environ[k].split(os.path.pathsep): + _add_directory(library_dirs, d) + +- prefix = sysconfig.get_config_var("prefix") ++ prefix = os.environ.get('PYTHONXCPREFIX') + if prefix: + _add_directory(library_dirs, os.path.join(prefix, "lib")) + _add_directory(include_dirs, os.path.join(prefix, "include")) ++ _add_directory(include_dirs, os.path.join(prefix, "include/python2.7")) + + # + # add platform directories +@@ -202,14 +212,14 @@ + + elif sys.platform == "darwin": + # attempt to make sure we pick freetype2 over other versions +- _add_directory(include_dirs, "/sw/include/freetype2") +- _add_directory(include_dirs, "/sw/lib/freetype2/include") ++ #_add_directory(include_dirs, "/sw/include/freetype2") ++ #_add_directory(include_dirs, "/sw/lib/freetype2/include") + # fink installation directories +- _add_directory(library_dirs, "/sw/lib") +- _add_directory(include_dirs, "/sw/include") ++ #_add_directory(library_dirs, "/sw/lib") ++ #_add_directory(include_dirs, "/sw/include") + # darwin ports installation directories +- _add_directory(library_dirs, "/opt/local/lib") +- _add_directory(include_dirs, "/opt/local/include") ++ #_add_directory(library_dirs, "/opt/local/lib") ++ #_add_directory(include_dirs, "/opt/local/include") + + # if Homebrew is installed, use its lib and include directories + import subprocess +@@ -234,15 +244,15 @@ + _add_directory(library_dirs, os.path.join(ft_prefix, 'lib')) + _add_directory( + include_dirs, os.path.join(ft_prefix, 'include')) +- else: ++ #else: + # fall back to freetype from XQuartz if + # Homebrew's freetype is missing +- _add_directory(library_dirs, "/usr/X11/lib") +- _add_directory(include_dirs, "/usr/X11/include") ++ #_add_directory(library_dirs, "/usr/X11/lib") ++ #_add_directory(include_dirs, "/usr/X11/include") + + elif sys.platform.startswith("linux"): + arch_tp = (plat.processor(), plat.architecture()[0]) +- if arch_tp == ("x86_64", "32bit"): ++ if arch_tp == ("x86_64xxx", "32bit"): + # 32 bit build on 64 bit machine. + _add_directory(library_dirs, "/usr/lib/i386-linux-gnu") + else: +@@ -252,43 +262,43 @@ + continue + + if platform_ in ["x86_64", "64bit"]: +- _add_directory(library_dirs, "/lib64") +- _add_directory(library_dirs, "/usr/lib64") +- _add_directory( +- library_dirs, "/usr/lib/x86_64-linux-gnu") ++ #_add_directory(library_dirs, "/lib64") ++ #_add_directory(library_dirs, "/usr/lib64") ++ #_add_directory( ++ # library_dirs, "/usr/lib/x86_64-linux-gnu") + break + elif platform_ in ["i386", "i686", "32bit"]: +- _add_directory( +- library_dirs, "/usr/lib/i386-linux-gnu") ++ #_add_directory( ++ # library_dirs, "/usr/lib/i386-linux-gnu") + break + elif platform_ in ["aarch64"]: +- _add_directory(library_dirs, "/usr/lib64") +- _add_directory( +- library_dirs, "/usr/lib/aarch64-linux-gnu") ++ #_add_directory(library_dirs, "/usr/lib64") ++ #_add_directory( ++ # library_dirs, "/usr/lib/aarch64-linux-gnu") + break + elif platform_ in ["arm", "armv7l"]: +- _add_directory( +- library_dirs, "/usr/lib/arm-linux-gnueabi") ++ #_add_directory( ++ # library_dirs, "/usr/lib/arm-linux-gnueabi") + break + elif platform_ in ["ppc64"]: +- _add_directory(library_dirs, "/usr/lib64") +- _add_directory( +- library_dirs, "/usr/lib/ppc64-linux-gnu") +- _add_directory( +- library_dirs, "/usr/lib/powerpc64-linux-gnu") ++ #_add_directory(library_dirs, "/usr/lib64") ++ #_add_directory( ++ # library_dirs, "/usr/lib/ppc64-linux-gnu") ++ #_add_directory( ++ # library_dirs, "/usr/lib/powerpc64-linux-gnu") + break + elif platform_ in ["ppc"]: +- _add_directory(library_dirs, "/usr/lib/ppc-linux-gnu") +- _add_directory( +- library_dirs, "/usr/lib/powerpc-linux-gnu") ++ #_add_directory(library_dirs, "/usr/lib/ppc-linux-gnu") ++ #_add_directory( ++ # library_dirs, "/usr/lib/powerpc-linux-gnu") + break + elif platform_ in ["s390x"]: +- _add_directory(library_dirs, "/usr/lib64") +- _add_directory( +- library_dirs, "/usr/lib/s390x-linux-gnu") ++ #_add_directory(library_dirs, "/usr/lib64") ++ #_add_directory( ++ # library_dirs, "/usr/lib/s390x-linux-gnu") + break + elif platform_ in ["s390"]: +- _add_directory(library_dirs, "/usr/lib/s390-linux-gnu") ++ #_add_directory(library_dirs, "/usr/lib/s390-linux-gnu") + break + else: + raise ValueError( +@@ -297,18 +307,18 @@ + # XXX Kludge. Above /\ we brute force support multiarch. Here we + # try Barry's more general approach. Afterward, something should + # work ;-) +- self.add_multiarch_paths() ++ #self.add_multiarch_paths() + +- elif sys.platform.startswith("gnu"): +- self.add_multiarch_paths() ++ #elif sys.platform.startswith("gnu"): ++ # self.add_multiarch_paths() + +- elif sys.platform.startswith("netbsd"): +- _add_directory(library_dirs, "/usr/pkg/lib") +- _add_directory(include_dirs, "/usr/pkg/include") +- +- elif sys.platform.startswith("sunos5"): +- _add_directory(library_dirs, "/opt/local/lib") +- _add_directory(include_dirs, "/opt/local/include") ++ #elif sys.platform.startswith("netbsd"): ++ #_add_directory(library_dirs, "/usr/pkg/lib") ++ #_add_directory(include_dirs, "/usr/pkg/include") ++ ++ #elif sys.platform.startswith("sunos5"): ++ #_add_directory(library_dirs, "/opt/local/lib") ++ #_add_directory(include_dirs, "/opt/local/include") + + # FIXME: check /opt/stuff directories here? + +@@ -350,11 +360,11 @@ + _add_directory(include_dirs, tcl_dir) + + # standard locations +- _add_directory(library_dirs, "/usr/local/lib") +- _add_directory(include_dirs, "/usr/local/include") ++ #_add_directory(library_dirs, "/usr/local/lib") ++ #_add_directory(include_dirs, "/usr/local/include") + +- _add_directory(library_dirs, "/usr/lib") +- _add_directory(include_dirs, "/usr/include") ++ #_add_directory(library_dirs, "/usr/lib") ++ #_add_directory(include_dirs, "/usr/include") + + # on Windows, look for the OpenJPEG libraries in the location that + # the official installer puts them +@@ -389,12 +399,7 @@ + feature = self.feature + + if feature.want('zlib'): +- if _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")): +- feature.zlib = "zlib" # alternative name ++ feature.zlib = "z" + + if feature.want('jpeg'): + if _find_include_file(self, "jpeglib.h"): +@@ -552,7 +557,7 @@ + + if feature.freetype: + exts.append(Extension( +- "PIL._imagingft", ["_imagingft.c"], libraries=["freetype"])) ++ "PIL._imagingft", ["_imagingft.c"], libraries=["freetype", "bz2", "z"])) + + if os.path.isfile("_imagingtiff.c") and feature.tiff: + exts.append(Extension( |