summaryrefslogtreecommitdiff
path: root/lang/python/pillow
diff options
context:
space:
mode:
authorAlexandru Ardelean <ardeleanalex@gmail.com>2017-05-17 16:45:48 +0300
committerAlexandru Ardelean <ardeleanalex@gmail.com>2017-05-17 16:51:14 +0300
commit68312f49c0b4456e665ed438a86a44738caa765a (patch)
tree6280a9fb0de5782ca8ca4ca39b014062e1b8d387 /lang/python/pillow
parent1bf7af4ca53db6f58655857f6eb49a9893c854d9 (diff)
python packages: move all things python under lang/python
I admit this may be be a bit aggressive, but the lang folder is getting cluttered/filled up with Python, PHP, Perl, Ruby, etc. packages. Makes sense to try to group them into per-lang folders. I took the Pythons. Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
Diffstat (limited to 'lang/python/pillow')
-rw-r--r--lang/python/pillow/Makefile53
-rw-r--r--lang/python/pillow/patches/010-fix-paths.patch182
2 files changed, 235 insertions, 0 deletions
diff --git a/lang/python/pillow/Makefile b/lang/python/pillow/Makefile
new file mode 100644
index 000000000..ee40d6c16
--- /dev/null
+++ b/lang/python/pillow/Makefile
@@ -0,0 +1,53 @@
+#
+# Copyright © 1997-2011 by Secret Labs AB
+# Copyright © 1995-2011 by Fredrik Lundh
+# Copyright © 2016 by Alex Clark and contributors
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=pillow
+PKG_VERSION:=3.3.1
+PKG_RELEASE=1
+PKG_LICENSE:=CUSTOM
+PKG_LICENSE_FILES:=LICENSE
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/python-pillow/Pillow.git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=aab33141f381d5577cdef9033b7fdff79122a10c
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+PKG_BUILD_DEPENDS:=python python-setuptools
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/pillow
+ SUBMENU:=Python
+ SECTION:=lang
+ CATEGORY:=Languages
+ TITLE:=The friendly PIL fork
+ MAINTAINER:=Gergely Kiss <mail.gery@gmail.com>
+ URL:=https://python-pillow.org/
+ DEPENDS:=+python +libfreetype +libjpeg +zlib +libtiff
+endef
+
+define Package/pillow/description
+ The friendly PIL fork
+endef
+
+define Build/Compile
+ $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR))
+endef
+
+define Package/pillow/install
+ $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR)
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(CP) \
+ $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \
+ $(1)$(PYTHON_PKG_DIR)/
+ $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin
+ $(CP) $(PKG_BUILD_DIR)/LICENSE $(1)$(PYTHON_PKG_DIR)/PIL/
+endef
+
+$(eval $(call BuildPackage,pillow))
diff --git a/lang/python/pillow/patches/010-fix-paths.patch b/lang/python/pillow/patches/010-fix-paths.patch
new file mode 100644
index 000000000..a6b86bfe6
--- /dev/null
+++ b/lang/python/pillow/patches/010-fix-paths.patch
@@ -0,0 +1,182 @@
+diff -rupN pillow-3.3.1.orig/setup.py pillow-3.3.1/setup.py
+--- pillow-3.3.1.orig/setup.py 2016-08-22 17:45:05.000000000 +0200
++++ pillow-3.3.1/setup.py 2016-08-22 18:09:51.947745155 +0200
+@@ -111,12 +111,12 @@ except (ImportError, OSError):
+
+ NAME = 'Pillow'
+ PILLOW_VERSION = '3.3.1'
+-JPEG_ROOT = None
++JPEG_ROOT = _lib_include(os.environ['STAGING_DIR'] + "/usr")
+ JPEG2K_ROOT = None
+-ZLIB_ROOT = None
++ZLIB_ROOT = _lib_include(os.environ['STAGING_DIR'] + "/usr")
+ IMAGEQUANT_ROOT = None
+-TIFF_ROOT = None
+-FREETYPE_ROOT = None
++TIFF_ROOT = _lib_include(os.environ['STAGING_DIR'] + "/usr")
++FREETYPE_ROOT = _lib_include(os.environ['STAGING_DIR'] + "/usr")
+ LCMS_ROOT = None
+
+
+@@ -221,161 +221,6 @@ class pil_build_ext(build_ext):
+ _add_directory(include_dirs, os.path.join(prefix, "include"))
+
+ #
+- # add platform directories
+-
+- if self.disable_platform_guessing:
+- pass
+-
+- elif sys.platform == "cygwin":
+- # pythonX.Y.dll.a is in the /usr/lib/pythonX.Y/config directory
+- _add_directory(library_dirs,
+- os.path.join("/usr/lib", "python%s" %
+- sys.version[:3], "config"))
+-
+- 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")
+- # fink installation directories
+- _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")
+-
+- # if Homebrew is installed, use its lib and include directories
+- try:
+- prefix = subprocess.check_output(['brew', '--prefix']).strip(
+- ).decode('latin1')
+- except:
+- # Homebrew not installed
+- prefix = None
+-
+- ft_prefix = None
+-
+- if prefix:
+- # add Homebrew's include and lib directories
+- _add_directory(library_dirs, os.path.join(prefix, 'lib'))
+- _add_directory(include_dirs, os.path.join(prefix, 'include'))
+- ft_prefix = os.path.join(prefix, 'opt', 'freetype')
+-
+- if ft_prefix and os.path.isdir(ft_prefix):
+- # freetype might not be linked into Homebrew's prefix
+- _add_directory(library_dirs, os.path.join(ft_prefix, 'lib'))
+- _add_directory(include_dirs,
+- os.path.join(ft_prefix, 'include'))
+- 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")
+-
+- elif sys.platform.startswith("linux"):
+- arch_tp = (plat.processor(), plat.architecture()[0])
+- if arch_tp == ("x86_64", "32bit"):
+- # 32-bit build on 64-bit machine.
+- _add_directory(library_dirs, "/usr/lib/i386-linux-gnu")
+- else:
+- for platform_ in arch_tp:
+-
+- if not platform_:
+- 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")
+- break
+- elif platform_ in ["i386", "i686", "32bit"]:
+- _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")
+- break
+- elif platform_ in ["arm", "armv7l"]:
+- _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")
+- break
+- elif platform_ in ["ppc"]:
+- _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")
+- break
+- elif platform_ in ["s390"]:
+- _add_directory(library_dirs, "/usr/lib/s390-linux-gnu")
+- break
+- else:
+- raise ValueError(
+- "Unable to identify Linux platform: `%s`" % platform_)
+-
+- # XXX Kludge. Above /\ we brute force support multiarch. Here we
+- # try Barry's more general approach. Afterward, something should
+- # work ;-)
+- self.add_multiarch_paths()
+-
+- elif sys.platform.startswith("gnu"):
+- self.add_multiarch_paths()
+-
+- elif sys.platform.startswith("freebsd"):
+- _add_directory(library_dirs, "/usr/local/lib")
+- _add_directory(include_dirs, "/usr/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?
+-
+- # standard locations
+- if not self.disable_platform_guessing:
+- _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")
+- # alpine, at least
+- _add_directory(library_dirs, "/lib")
+-
+- # on Windows, look for the OpenJPEG libraries in the location that
+- # the official installer puts them
+- if sys.platform == "win32":
+- program_files = os.environ.get('ProgramFiles', '')
+- best_version = (0, 0)
+- best_path = None
+- for name in os.listdir(program_files):
+- if name.startswith('OpenJPEG '):
+- version = tuple([int(x) for x in name[9:].strip().split(
+- '.')])
+- if version > best_version:
+- best_version = version
+- best_path = os.path.join(program_files, name)
+-
+- if best_path:
+- _dbg('Adding %s to search list', best_path)
+- _add_directory(library_dirs, os.path.join(best_path, 'lib'))
+- _add_directory(include_dirs,
+- os.path.join(best_path, 'include'))
+-
+- #
+ # insert new dirs *before* default libs, to avoid conflicts
+ # between Python PYD stub libs and real libraries
+