[oe-commits] Martin Jansa : python-imaging: add PACKAGECONFIG for lcms

git at git.openembedded.org git at git.openembedded.org
Fri Aug 16 10:12:03 UTC 2013


Module: openembedded-core.git
Branch: dylan
Commit: e535f7c7cb98b96635d1cdb3883c6a5a2785594d
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=e535f7c7cb98b96635d1cdb3883c6a5a2785594d

Author: Martin Jansa <Martin.Jansa at gmail.com>
Date:   Sun Jul 21 15:45:41 2013 +0200

python-imaging: add PACKAGECONFIG for lcms

* it's autodetected from sysroot
* add PACKAGECONFIG to make it deterministic

(From OE-Core master rev: c11aaac4952320f565bd65ec5f601c50763408a7)

Signed-off-by: Martin Jansa <Martin.Jansa at gmail.com>
Signed-off-by: Saul Wold <sgw at linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 .../allow.to.disable.some.features.patch           |   65 ++++++++++++++++++++
 .../python/python-imaging_1.1.7.bb                 |   10 +++-
 2 files changed, 74 insertions(+), 1 deletions(-)

diff --git a/meta/recipes-devtools/python/python-imaging/allow.to.disable.some.features.patch b/meta/recipes-devtools/python/python-imaging/allow.to.disable.some.features.patch
new file mode 100644
index 0000000..4960ed4
--- /dev/null
+++ b/meta/recipes-devtools/python/python-imaging/allow.to.disable.some.features.patch
@@ -0,0 +1,65 @@
+At least lcms wasn't deterministicly detected from sysroot.
+
+This will allow to export LCMS_ENABLED=False when lcms isn't in PACKAGECONFIG.
+
+Upstream-Status: Inappropriate [configuration]
+
+Signed-off-by: Martin Jansa <Martin.Jansa at gmail.com>
+
+diff -uNr Imaging-1.1.7.orig/setup.py Imaging-1.1.7/setup.py
+--- Imaging-1.1.7.orig/setup.py	2013-07-22 10:17:02.081457075 +0200
++++ Imaging-1.1.7/setup.py	2013-07-22 13:10:09.029707492 +0200
+@@ -39,6 +39,12 @@
+ TIFF_ROOT = None
+ FREETYPE_ROOT =  os.environ['STAGING_LIBDIR'], os.environ['STAGING_INCDIR']
+ LCMS_ROOT = None
++TCL_ENABLED = os.getenv('TCL_ENABLED', "True")
++JPEG_ENABLED = os.getenv('JPEG_ENABLED', "True")
++ZLIB_ENABLED = os.getenv('ZLIB_ENABLED', "True")
++TIFF_ENABLED = os.getenv('TIFF_ENABLED', "True")
++FREETYPE_ENABLED = os.getenv('FREETYPE_ENABLED', "True")
++LCMS_ENABLED = os.getenv('LCMS_ENABLED', "True")
+ 
+ # FIXME: add mechanism to explicitly *disable* the use of a library
+ 
+@@ -220,22 +226,22 @@
+             zlib = jpeg = tiff = freetype = tcl = tk = lcms = None
+         feature = feature()
+ 
+-        if find_include_file(self, "zlib.h"):
++        if ZLIB_ENABLED == 'True' and 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
+ 
+-        if find_include_file(self, "jpeglib.h"):
++        if JPEG_ENABLED == 'True' and 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"):
+                 feature.jpeg = "libjpeg" # alternative name
+ 
+-        if find_library_file(self, "tiff"):
++        if TIFF_ENABLED == 'True' and find_library_file(self, "tiff"):
+             feature.tiff = "tiff"
+ 
+-        if find_library_file(self, "freetype"):
++        if FREETYPE_ENABLED == 'True' and find_library_file(self, "freetype"):
+             # look for freetype2 include files
+             freetype_version = 0
+             for dir in self.compiler.include_dirs:
+@@ -256,11 +262,11 @@
+                 if dir:
+                     add_directory(self.compiler.include_dirs, dir, 0)
+ 
+-        if find_include_file(self, "lcms.h"):
++        if LCMS_ENABLED == 'True' and find_include_file(self, "lcms.h"):
+             if find_library_file(self, "lcms"):
+                 feature.lcms = "lcms"
+ 
+-        if _tkinter and find_include_file(self, "tk.h"):
++        if TCL_ENABLED == 'True' and _tkinter and find_include_file(self, "tk.h"):
+             # the library names may vary somewhat (e.g. tcl84 or tcl8.4)
+             version = TCL_VERSION[0] + TCL_VERSION[2]
+             if find_library_file(self, "tcl" + version):
diff --git a/meta/recipes-devtools/python/python-imaging_1.1.7.bb b/meta/recipes-devtools/python/python-imaging_1.1.7.bb
index de0e975..e100358 100644
--- a/meta/recipes-devtools/python/python-imaging_1.1.7.bb
+++ b/meta/recipes-devtools/python/python-imaging_1.1.7.bb
@@ -7,23 +7,31 @@ SRCNAME = "Imaging"
 PR = "r5"
 
 SRC_URI = "http://effbot.org/downloads/Imaging-${PV}.tar.gz \
-           file://0001-python-imaging-setup.py-force-paths-for-zlib-freetyp.patch"
+           file://0001-python-imaging-setup.py-force-paths-for-zlib-freetyp.patch \
+           file://allow.to.disable.some.features.patch"
 
 SRC_URI[md5sum] = "fc14a54e1ce02a0225be8854bfba478e"
 SRC_URI[sha256sum] = "895bc7c2498c8e1f9b99938f1a40dc86b3f149741f105cf7c7bd2e0725405211"
 S = "${WORKDIR}/${SRCNAME}-${PV}"
 
+# There isn't enable/disable option, and lcms is in meta-oe, at least make it explicit when enabled
+# setup.py already has FIXME: add mechanism to explicitly *disable* the use of a library
+PACKAGECONFIG ??= ""
+PACKAGECONFIG[lcms] = ",,lcms"
+
 inherit distutils
 
 do_compile() {
     export STAGING_LIBDIR=${STAGING_LIBDIR}
     export STAGING_INCDIR=${STAGING_INCDIR}
+    export LCMS_ENABLED=${@base_contains('PACKAGECONFIG', 'lcms', 'True', 'False', d)}
     distutils_do_compile
 }
 
 do_install() {
     export STAGING_LIBDIR=${STAGING_LIBDIR}
     export STAGING_INCDIR=${STAGING_INCDIR}
+    export LCMS_ENABLED=${@base_contains('PACKAGECONFIG', 'lcms', 'True', 'False', d)}
     distutils_do_install
     install -d ${D}${datadir}/doc/${BPN}/html/
     install -m 0644 ${S}/README ${D}${datadir}/doc/${BPN}/



More information about the Openembedded-commits mailing list