commit
381fb1f2c1
12 changed files with 214 additions and 134 deletions
Binary file not shown.
21
recipes/host_setuptools/__init__.py
Normal file
21
recipes/host_setuptools/__init__.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
from toolchain import Recipe, shprint
|
||||
from os.path import join, exists
|
||||
import sh
|
||||
import os
|
||||
import fnmatch
|
||||
import shutil
|
||||
|
||||
|
||||
class HostSetuptools(Recipe):
|
||||
depends = ["hostpython"]
|
||||
archs = 'i386'
|
||||
url = ""
|
||||
|
||||
def prebuild_arch(self, arch):
|
||||
hostpython = sh.Command(self.ctx.hostpython)
|
||||
sh.curl("-O", "https://bootstrap.pypa.io/ez_setup.py")
|
||||
shprint(hostpython, "./ez_setup.py")
|
||||
|
||||
recipe = HostSetuptools()
|
||||
|
||||
|
|
@ -53,3 +53,4 @@ future_builtins future_builtins.c
|
|||
|
||||
# ctypes
|
||||
_ctypes _ctypes/_ctypes.c _ctypes/callbacks.c _ctypes/callproc.c _ctypes/stgdict.c _ctypes/cfield.c
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@ class HostpythonRecipe(Recipe):
|
|||
def prebuild_arch(self, arch):
|
||||
if self.has_marker("patched"):
|
||||
return
|
||||
self.copy_file("_scproxy.py", "Lib/_scproxy.py")
|
||||
self.apply_patch("ssize-t-max.patch")
|
||||
self.apply_patch("dynload.patch")
|
||||
self.apply_patch("static-_sqlite3.patch")
|
||||
|
|
10
recipes/hostpython/_scproxy.py
Normal file
10
recipes/hostpython/_scproxy.py
Normal file
|
@ -0,0 +1,10 @@
|
|||
'''
|
||||
Stub functions for _scproxy on OsX
|
||||
No proxy is supported yet.
|
||||
'''
|
||||
|
||||
def _get_proxy_settings():
|
||||
return {'exclude_simple': 1}
|
||||
|
||||
def _get_proxies():
|
||||
return {}
|
36
recipes/libjpeg/__init__.py
Normal file
36
recipes/libjpeg/__init__.py
Normal file
|
@ -0,0 +1,36 @@
|
|||
from toolchain import Recipe, shprint
|
||||
from os.path import join, exists
|
||||
import sh
|
||||
import os
|
||||
|
||||
|
||||
class JpegRecipe(Recipe):
|
||||
version = "v9a"
|
||||
url = "http://www.ijg.org/files/jpegsrc.{version}.tar.gz"
|
||||
library = ".libs/libjpeg.a"
|
||||
include_dir = [
|
||||
("jpeglib.h", ""),
|
||||
("jconfig.h", ""),
|
||||
("jerror.h", ""),
|
||||
("jmorecfg.h", ""),
|
||||
]
|
||||
include_per_arch = True
|
||||
|
||||
|
||||
def build_arch(self, arch):
|
||||
build_env = arch.get_env()
|
||||
configure = sh.Command(join(self.build_dir, "configure"))
|
||||
shprint(configure,
|
||||
"CC={}".format(build_env["CC"]),
|
||||
"LD={}".format(build_env["LD"]),
|
||||
"CFLAGS={}".format(build_env["CFLAGS"]),
|
||||
"LDFLAGS={}".format(build_env["LDFLAGS"]),
|
||||
"--prefix=/",
|
||||
"--host={}".format(arch.triple),
|
||||
"--disable-shared")
|
||||
shprint(sh.make, "clean")
|
||||
shprint(sh.make)
|
||||
|
||||
recipe = JpegRecipe()
|
||||
|
||||
|
64
recipes/pil/__init__.py
Normal file
64
recipes/pil/__init__.py
Normal file
|
@ -0,0 +1,64 @@
|
|||
from toolchain import Recipe, shprint
|
||||
from os.path import join
|
||||
import sh
|
||||
import os
|
||||
import fnmatch
|
||||
|
||||
|
||||
class PillowRecipe(Recipe):
|
||||
version = "2.7.0"
|
||||
url = "https://github.com/python-pillow/Pillow/archive/{version}.zip"
|
||||
library = "libpil.a"
|
||||
depends = ["hostpython", "host_setuptools", "pkgresources", "freetype", "libjpeg", "python", "ios"]
|
||||
pbx_libraries = ["libz", "libbz2"]
|
||||
include_per_arch = True
|
||||
|
||||
def get_pil_env(self, arch):
|
||||
build_env = arch.get_env()
|
||||
build_env["IOSROOT"] = self.ctx.root_dir
|
||||
build_env["IOSSDKROOT"] = arch.sysroot
|
||||
build_env["LDSHARED"] = join(self.ctx.root_dir, "tools", "liblink")
|
||||
build_env["ARM_LD"] = build_env["LD"]
|
||||
build_env["ARCH"] = arch.arch
|
||||
build_env["C_INCLUDE_PATH"] = join(arch.sysroot, "usr", "include")
|
||||
build_env["LIBRARY_PATH"] = join(arch.sysroot, "usr", "lib")
|
||||
build_env["CFLAGS"] = " ".join([
|
||||
"-I{}".format(join(self.ctx.dist_dir, "include", arch.arch, "freetype")) +
|
||||
" -I{}".format(join(self.ctx.dist_dir, "include", arch.arch, "libjpeg")) +
|
||||
" -arch {}".format(arch.arch)
|
||||
])
|
||||
return build_env
|
||||
|
||||
def build_arch(self, arch):
|
||||
self.apply_patch('pil_setup.patch')
|
||||
build_env = self.get_pil_env(arch)
|
||||
#build_dir = self.get_build_dir(arch.arch)
|
||||
hostpython = sh.Command(self.ctx.hostpython)
|
||||
#build_env["PYTHONHOME"] = hostpython
|
||||
# first try to generate .h
|
||||
shprint(hostpython, "setup.py", "build_ext", "-g",
|
||||
_env=build_env)
|
||||
self.biglink()
|
||||
|
||||
def install(self):
|
||||
arch = list(self.filtered_archs)[0]
|
||||
build_dir = self.get_build_dir(arch.arch)
|
||||
os.chdir(build_dir)
|
||||
hostpython = sh.Command(self.ctx.hostpython)
|
||||
build_env = self.get_pil_env(arch)
|
||||
dest_dir = join(self.ctx.dist_dir, "root", "python")
|
||||
build_env['PYTHONPATH'] = join(dest_dir, 'lib', 'python2.7', 'site-packages')
|
||||
shprint(hostpython, "setup.py", "install", "-O2",
|
||||
"--prefix", dest_dir,
|
||||
_env=build_env)
|
||||
|
||||
def biglink(self):
|
||||
dirs = []
|
||||
for root, dirnames, filenames in os.walk(self.build_dir):
|
||||
if fnmatch.filter(filenames, "*.so.libs"):
|
||||
dirs.append(root)
|
||||
cmd = sh.Command(join(self.ctx.root_dir, "tools", "biglink"))
|
||||
shprint(cmd, join(self.build_dir, "libpil.a"), *dirs)
|
||||
|
||||
recipe = PillowRecipe()
|
||||
|
60
recipes/pil/pil_setup.patch
Normal file
60
recipes/pil/pil_setup.patch
Normal file
|
@ -0,0 +1,60 @@
|
|||
--- Pillow-2.7.0/setup.py 2014-12-31 20:42:56.000000000 +0530
|
||||
+++ Pillow-2.7.0/setup.py 2015-02-26 19:38:59.000000000 +0530
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
# monkey patch import hook. Even though flake8 says it's not used, it is.
|
||||
# comment this out to disable multi threaded builds.
|
||||
-import mp_compile
|
||||
|
||||
_IMAGING = (
|
||||
"decode", "encode", "map", "display", "outline", "path")
|
||||
@@ -83,7 +82,7 @@
|
||||
return open(file, 'rb').read()
|
||||
|
||||
try:
|
||||
- import _tkinter
|
||||
+ _tkinter = None
|
||||
except (ImportError, OSError):
|
||||
# pypy emits an oserror
|
||||
_tkinter = None
|
||||
@@ -186,7 +185,7 @@
|
||||
for d in os.environ[k].split(os.path.pathsep):
|
||||
_add_directory(library_dirs, d)
|
||||
|
||||
- prefix = sysconfig.get_config_var("prefix")
|
||||
+ prefix = False
|
||||
if prefix:
|
||||
_add_directory(library_dirs, os.path.join(prefix, "lib"))
|
||||
_add_directory(include_dirs, os.path.join(prefix, "include"))
|
||||
@@ -199,7 +198,9 @@
|
||||
_add_directory(library_dirs, os.path.join(
|
||||
"/usr/lib", "python%s" % sys.version[:3], "config"))
|
||||
|
||||
- elif sys.platform == "darwin":
|
||||
+ elif True:
|
||||
+ pass
|
||||
+ if False:
|
||||
# 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")
|
||||
@@ -346,11 +347,7 @@
|
||||
_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")
|
||||
|
||||
# on Windows, look for the OpenJPEG libraries in the location that
|
||||
# the official installer puts them
|
||||
@@ -575,7 +572,7 @@
|
||||
exts.append(Extension(
|
||||
"PIL._webp", ["_webp.c"], libraries=libs, define_macros=defs))
|
||||
|
||||
- if sys.platform == "darwin":
|
||||
+ if False:
|
||||
# locate Tcl/Tk frameworks
|
||||
frameworks = []
|
||||
framework_roots = [
|
17
recipes/pkgresources/__init__.py
Normal file
17
recipes/pkgresources/__init__.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
from toolchain import Recipe, shprint
|
||||
from os.path import join
|
||||
import sh
|
||||
import os
|
||||
|
||||
|
||||
class pkg_resources(Recipe):
|
||||
depends = ["hostpython", "python"]
|
||||
archs = ['i386']
|
||||
url = ""
|
||||
|
||||
def prebuild_arch(self, arch):
|
||||
sh.cp("/Library/Python/2.7/site-packages/pkg_resources.py", join(self.ctx.dist_dir, "root", "python", "lib", "python2.7", "site-packages", "pkg_resources.py"))
|
||||
|
||||
recipe = pkg_resources()
|
||||
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
--- Makefile_old 2013-07-12 14:23:38.000000000 +0200
|
||||
+++ Makefile 2013-07-12 14:26:34.000000000 +0200
|
||||
@@ -36,7 +36,7 @@
|
||||
LDLIBS=
|
||||
|
||||
# If using GNU libtool, LIBTOOL references it; if not, LIBTOOL is empty.
|
||||
-LIBTOOL = ./libtool
|
||||
+LIBTOOL =
|
||||
# $(O) expands to "lo" if using libtool, plain "o" if not.
|
||||
# Similarly, $(A) expands to "la" or "a".
|
||||
O = lo
|
|
@ -1,123 +0,0 @@
|
|||
diff -rupN Imaging-1.1.7/_imaging.c Imaging-1.1.7_patched/_imaging.c
|
||||
--- Imaging-1.1.7/_imaging.c 2009-11-02 05:18:48.000000000 -0600
|
||||
+++ Imaging-1.1.7_patched/_imaging.c 2013-10-25 15:07:23.000000000 -0500
|
||||
@@ -71,12 +71,28 @@
|
||||
* See the README file for information on usage and redistribution.
|
||||
*/
|
||||
|
||||
-
|
||||
#include "Python.h"
|
||||
|
||||
#include "Imaging.h"
|
||||
|
||||
|
||||
+#include <stdio.h>
|
||||
+
|
||||
+FILE *fopen$UNIX2003( const char *filename, const char *mode )
|
||||
+{
|
||||
+ return fopen(filename, mode);
|
||||
+}
|
||||
+
|
||||
+size_t fwrite$UNIX2003( const void *a, size_t b, size_t c, FILE *d )
|
||||
+{
|
||||
+ return fwrite(a, b, c, d);
|
||||
+}
|
||||
+
|
||||
+ssize_t write$UNIX2003(int a, const void *b, size_t c)
|
||||
+{
|
||||
+ return write(a,b,c);
|
||||
+}
|
||||
+
|
||||
/* Configuration stuff. Feel free to undef things you don't need. */
|
||||
#define WITH_IMAGECHOPS /* ImageChops support */
|
||||
#define WITH_IMAGEDRAW /* ImageDraw support */
|
||||
diff -rupN Imaging-1.1.7/libImaging/Quant.c Imaging-1.1.7_patched/libImaging/Quant.c
|
||||
--- Imaging-1.1.7/libImaging/Quant.c 2009-10-31 20:29:14.000000000 -0500
|
||||
+++ Imaging-1.1.7_patched/libImaging/Quant.c 2013-10-25 15:07:23.000000000 -0500
|
||||
@@ -20,10 +20,15 @@
|
||||
|
||||
#include "Imaging.h"
|
||||
|
||||
+#include <time.h>
|
||||
+clock_t clock$UNIX2003(void)
|
||||
+{
|
||||
+ return clock();
|
||||
+}
|
||||
+
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
-#include <time.h>
|
||||
|
||||
#include "Quant.h"
|
||||
|
||||
@@ -33,6 +38,7 @@
|
||||
|
||||
#define NO_OUTPUT
|
||||
|
||||
+
|
||||
typedef struct {
|
||||
unsigned long scale;
|
||||
} PixelHashData;
|
||||
diff -rupN Imaging-1.1.7/setup.py Imaging-1.1.7_patched/setup.py
|
||||
--- Imaging-1.1.7/setup.py 2009-11-15 10:06:10.000000000 -0600
|
||||
+++ Imaging-1.1.7_patched/setup.py 2013-10-25 15:08:08.000000000 -0500
|
||||
@@ -88,6 +88,7 @@ from distutils.command.build_ext import
|
||||
|
||||
try:
|
||||
import _tkinter
|
||||
+ _tkinter = None
|
||||
except ImportError:
|
||||
_tkinter = None
|
||||
|
||||
@@ -208,11 +209,11 @@ class pil_build_ext(build_ext):
|
||||
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")
|
||||
|
||||
#
|
||||
# insert new dirs *before* default libs, to avoid conflicts
|
||||
@@ -283,6 +284,14 @@ class pil_build_ext(build_ext):
|
||||
#
|
||||
# core library
|
||||
|
||||
+
|
||||
+ class feature:
|
||||
+ tiff = tcl = tk = lcms = None
|
||||
+ jpeg="jpeg"
|
||||
+ zlib="zlib"
|
||||
+ freetype="freetype";freetype_version=21
|
||||
+ feature = feature()
|
||||
+
|
||||
files = ["_imaging.c"]
|
||||
for file in IMAGING:
|
||||
files.append(file + ".c")
|
||||
@@ -348,7 +357,7 @@ class pil_build_ext(build_ext):
|
||||
dir = os.path.join(root, "Tk.framework", "Headers")
|
||||
add_directory(self.compiler.include_dirs, dir, 1)
|
||||
break
|
||||
- if frameworks:
|
||||
+ if False and frameworks:
|
||||
exts.append(Extension(
|
||||
"_imagingtk", ["_imagingtk.c", "Tk/tkImaging.c"],
|
||||
extra_compile_args=frameworks, extra_link_args=frameworks
|
||||
@@ -364,7 +373,9 @@ class pil_build_ext(build_ext):
|
||||
exts.append(Extension("_imagingmath", ["_imagingmath.c"]))
|
||||
|
||||
self.extensions[:] = exts
|
||||
-
|
||||
+ print "Extensions:"
|
||||
+ for e in exts:
|
||||
+ print e.name,str(e.sources)
|
||||
build_ext.build_extensions(self)
|
||||
|
||||
#
|
|
@ -365,6 +365,8 @@ class Recipe(object):
|
|||
"""
|
||||
Download an `url` to `outfn`
|
||||
"""
|
||||
if not url:
|
||||
return
|
||||
def report_hook(index, blksize, size):
|
||||
if size <= 0:
|
||||
progression = '{0} bytes'.format(index * blksize)
|
||||
|
@ -387,6 +389,8 @@ class Recipe(object):
|
|||
"""
|
||||
Extract the `filename` into the directory `cwd`.
|
||||
"""
|
||||
if not filename:
|
||||
return
|
||||
print("Extract {} into {}".format(filename, cwd))
|
||||
if filename.endswith(".tgz") or filename.endswith(".tar.gz"):
|
||||
shprint(sh.tar, "-C", cwd, "-xvzf", filename)
|
||||
|
|
Loading…
Reference in a new issue