-
Notifications
You must be signed in to change notification settings - Fork 2k
add pil/png/jpeg recipes #586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| APP_OPTIM := release | ||
| APP_ABI := all # or armeabi | ||
| APP_MODULES := libjpeg |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| from pythonforandroid.recipe import NDKRecipe | ||
| from pythonforandroid.logger import shprint | ||
| from os.path import join, exists | ||
| import sh | ||
|
|
||
|
|
||
| class JpegRecipe(NDKRecipe): | ||
| name = 'jpeg' | ||
| version = 'linaro-android' | ||
| url = 'git://git.linaro.org/people/tomgall/libjpeg-turbo/libjpeg-turbo.git' | ||
|
|
||
| patches = ['build-static.patch'] | ||
|
|
||
| generated_libraries = ['libjpeg.a'] | ||
|
|
||
| def prebuild_arch(self, arch): | ||
| super(JpegRecipe, self).prebuild_arch(arch) | ||
|
|
||
| build_dir = self.get_build_dir(arch.arch) | ||
| app_mk = join(build_dir, 'Application.mk') | ||
| if not exists(app_mk): | ||
| shprint(sh.cp, join(self.get_recipe_dir(), 'Application.mk'), app_mk) | ||
| jni_ln = join(build_dir, 'jni') | ||
| if not exists(jni_ln): | ||
| shprint(sh.ln, '-s', build_dir, jni_ln) | ||
|
|
||
|
|
||
| recipe = JpegRecipe() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| diff -Naur jpeg/Android.mk b/Android.mk | ||
| --- jpeg/Android.mk 2015-12-14 11:37:25.900190235 -0600 | ||
| +++ b/Android.mk 2015-12-14 11:41:27.532182210 -0600 | ||
| @@ -54,8 +54,7 @@ | ||
|
|
||
| LOCAL_SRC_FILES:= $(libjpeg_SOURCES_DIST) | ||
|
|
||
| -LOCAL_SHARED_LIBRARIES := libcutils | ||
| -LOCAL_STATIC_LIBRARIES := libsimd | ||
| +LOCAL_STATIC_LIBRARIES := libsimd libcutils | ||
|
|
||
| LOCAL_C_INCLUDES := $(LOCAL_PATH) | ||
|
|
||
| @@ -68,7 +67,7 @@ | ||
|
|
||
| LOCAL_MODULE := libjpeg | ||
|
|
||
| -include $(BUILD_SHARED_LIBRARY) | ||
| +include $(BUILD_STATIC_LIBRARY) | ||
|
|
||
| ###################################################### | ||
| ### cjpeg ### | ||
| @@ -82,7 +81,7 @@ | ||
|
|
||
| LOCAL_SRC_FILES:= $(cjpeg_SOURCES) | ||
|
|
||
| -LOCAL_SHARED_LIBRARIES := libjpeg | ||
| +LOCAL_STATIC_LIBRARIES := libjpeg | ||
|
|
||
| LOCAL_C_INCLUDES := $(LOCAL_PATH) \ | ||
| $(LOCAL_PATH)/android | ||
| @@ -110,7 +109,7 @@ | ||
|
|
||
| LOCAL_SRC_FILES:= $(djpeg_SOURCES) | ||
|
|
||
| -LOCAL_SHARED_LIBRARIES := libjpeg | ||
| +LOCAL_STATIC_LIBRARIES := libjpeg | ||
|
|
||
| LOCAL_C_INCLUDES := $(LOCAL_PATH) \ | ||
| $(LOCAL_PATH)/android | ||
| @@ -137,7 +136,7 @@ | ||
|
|
||
| LOCAL_SRC_FILES:= $(jpegtran_SOURCES) | ||
|
|
||
| -LOCAL_SHARED_LIBRARIES := libjpeg | ||
| +LOCAL_STATIC_LIBRARIES := libjpeg | ||
|
|
||
| LOCAL_C_INCLUDES := $(LOCAL_PATH) \ | ||
| $(LOCAL_PATH)/android | ||
| @@ -163,7 +162,7 @@ | ||
|
|
||
| LOCAL_SRC_FILES:= $(tjunittest_SOURCES) | ||
|
|
||
| -LOCAL_SHARED_LIBRARIES := libjpeg | ||
| +LOCAL_STATIC_LIBRARIES := libjpeg | ||
|
|
||
| LOCAL_C_INCLUDES := $(LOCAL_PATH) | ||
|
|
||
| @@ -189,7 +188,7 @@ | ||
|
|
||
| LOCAL_SRC_FILES:= $(tjbench_SOURCES) | ||
|
|
||
| -LOCAL_SHARED_LIBRARIES := libjpeg | ||
| +LOCAL_STATIC_LIBRARIES := libjpeg | ||
|
|
||
| LOCAL_C_INCLUDES := $(LOCAL_PATH) | ||
|
|
||
| @@ -215,7 +214,7 @@ | ||
|
|
||
| LOCAL_SRC_FILES:= $(rdjpgcom_SOURCES) | ||
|
|
||
| -LOCAL_SHARED_LIBRARIES := libjpeg | ||
| +LOCAL_STATIC_LIBRARIES := libjpeg | ||
|
|
||
| LOCAL_C_INCLUDES := $(LOCAL_PATH) | ||
|
|
||
| @@ -240,7 +239,7 @@ | ||
|
|
||
| LOCAL_SRC_FILES:= $(wrjpgcom_SOURCES) | ||
|
|
||
| -LOCAL_SHARED_LIBRARIES := libjpeg | ||
| +LOCAL_STATIC_LIBRARIES := libjpeg | ||
|
|
||
| LOCAL_C_INCLUDES := $(LOCAL_PATH) | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| from os.path import join | ||
|
|
||
| from pythonforandroid.recipe import CompiledComponentsPythonRecipe | ||
|
|
||
|
|
||
| class PILRecipe(CompiledComponentsPythonRecipe): | ||
| name = 'pil' | ||
| version = '1.1.7' | ||
| url = 'http://effbot.org/downloads/Imaging-{version}.tar.gz' | ||
| depends = [('python2', 'python3'), 'png', 'jpeg'] | ||
| site_packages_name = 'PIL' | ||
|
|
||
| patches = ['disable-tk.patch', | ||
| 'fix-directories.patch'] | ||
|
|
||
| def get_recipe_env(self, arch=None): | ||
| env = super(PILRecipe, self).get_recipe_env(arch) | ||
|
|
||
| png = self.get_recipe('png', self.ctx) | ||
| png_lib_dir = png.get_lib_dir(arch) | ||
| png_jni_dir = png.get_jni_dir(arch) | ||
| jpeg = self.get_recipe('jpeg', self.ctx) | ||
| jpeg_lib_dir = jpeg.get_lib_dir(arch) | ||
| jpeg_jni_dir = jpeg.get_jni_dir(arch) | ||
| env['JPEG_ROOT'] = '{}|{}'.format(jpeg_lib_dir, jpeg_jni_dir) | ||
|
|
||
| cflags = ' -I{} -L{} -I{} -L{}'.format(png_jni_dir, png_lib_dir, jpeg_jni_dir, jpeg_lib_dir) | ||
| env['CFLAGS'] += cflags | ||
| env['CXXFLAGS'] += cflags | ||
| env['CC'] += cflags | ||
| env['CXX'] += cflags | ||
|
|
||
| ndk_dir = self.ctx.ndk_platform | ||
| ndk_lib_dir = join(ndk_dir, 'usr', 'lib') | ||
| ndk_include_dir = join(ndk_dir, 'usr', 'include') | ||
| env['ZLIB_ROOT'] = '{}|{}'.format(ndk_lib_dir, ndk_include_dir) | ||
|
|
||
| return env | ||
|
|
||
|
|
||
| recipe = PILRecipe() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| --- Imaging-1.1.7/setup.py.orig 2012-08-31 12:52:25.000000000 +0200 | ||
| +++ Imaging-1.1.7/setup.py 2012-08-31 12:53:04.000000000 +0200 | ||
| @@ -322,7 +322,7 @@ | ||
| "_imagingcms", ["_imagingcms.c"], libraries=["lcms"] + extra | ||
| )) | ||
|
|
||
| - if sys.platform == "darwin": | ||
| + if False: #sys.platform == "darwin": | ||
| # locate Tcl/Tk frameworks | ||
| frameworks = [] | ||
| framework_roots = [ | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| diff -Naur pil/setup.py b/setup.py | ||
| --- pil/setup.py 2015-12-11 16:42:40.817701332 -0600 | ||
| +++ b/setup.py 2015-12-11 17:07:34.778477132 -0600 | ||
| @@ -34,10 +34,10 @@ | ||
| # TIFF_ROOT = libinclude("/opt/tiff") | ||
|
|
||
| TCL_ROOT = None | ||
| -JPEG_ROOT = None | ||
| -ZLIB_ROOT = None | ||
| +JPEG_ROOT = tuple(os.environ['JPEG_ROOT'].split('|')) if 'JPEG_ROOT' in os.environ else None | ||
| +ZLIB_ROOT = tuple(os.environ['ZLIB_ROOT'].split('|')) if 'ZLIB_ROOT' in os.environ else None | ||
| TIFF_ROOT = None | ||
| -FREETYPE_ROOT = None | ||
| +FREETYPE_ROOT = tuple(os.environ['FREETYPE_ROOT'].split('|')) if 'FREETYPE_ROOT' in os.environ else None | ||
| LCMS_ROOT = None | ||
|
|
||
| # FIXME: add mechanism to explicitly *disable* the use of a library | ||
| @@ -127,29 +127,6 @@ | ||
|
|
||
| add_directory(include_dirs, "libImaging") | ||
|
|
||
| - # | ||
| - # add platform directories | ||
| - | ||
| - if 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") | ||
| - | ||
| - add_directory(library_dirs, "/usr/local/lib") | ||
| - # FIXME: check /opt/stuff directories here? | ||
| - | ||
| prefix = sysconfig.get_config_var("prefix") | ||
| if prefix: | ||
| add_directory(library_dirs, os.path.join(prefix, "lib")) | ||
| @@ -199,22 +176,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 | ||
|
|
||
| @@ -299,8 +260,6 @@ | ||
| defs.append(("HAVE_LIBZ", None)) | ||
| if sys.platform == "win32": | ||
| libs.extend(["kernel32", "user32", "gdi32"]) | ||
| - if struct.unpack("h", "\0\1")[0] == 1: | ||
| - defs.append(("WORDS_BIGENDIAN", None)) | ||
|
|
||
| exts = [(Extension( | ||
| "_imaging", files, libraries=libs, define_macros=defs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| from pythonforandroid.recipe import NDKRecipe | ||
|
|
||
|
|
||
| class PngRecipe(NDKRecipe): | ||
| name = 'png' | ||
| version = '1.6.15' | ||
| url = 'https://github.com/julienr/libpng-android/archive/{version}.zip' | ||
|
|
||
| generated_libraries = ['libpng.a'] | ||
|
|
||
|
|
||
| recipe = PngRecipe() | ||
|
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this is an old one, but I came across it.
Is this
versionever being picked up?Also I had some connection refused issues recently while cloning
git://git.linaro.org/people/tomgall/libjpeg-turbo/libjpeg-turbo.gitperhaps we should use a release tar.gz archive, what do you guys think?