Yocto 2.3

Move OpenBMC to Yocto 2.3(pyro).

Tested: Built and verified Witherspoon and Palmetto images
Change-Id: I50744030e771f4850afc2a93a10d3507e76d36bc
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Resolves: openbmc/openbmc#2461
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/assimp/assimp_3.1.1.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/assimp/assimp_3.1.1.bb
index 5ffa5c2..4da3dc2 100644
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/assimp/assimp_3.1.1.bb
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/assimp/assimp_3.1.1.bb
@@ -5,7 +5,7 @@
 LICENSE = "BSD"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=bc4231a2268da8fc55525ad119638a87"
 
-DEPENDS = "boost"
+DEPENDS = "boost virtual/libgl"
 
 SRC_URI = "http://sourceforge.net/projects/${BPN}/files/${BPN}-3.1/${BPN}-${PV}_no_test_models.zip"
 SRC_URI[md5sum] = "ccd4788204509da58a3a53c7aeda7a8b"
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/cairo/cairomm_1.11.2.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/cairo/cairomm_1.11.2.bb
deleted file mode 100644
index a330458..0000000
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/cairo/cairomm_1.11.2.bb
+++ /dev/null
@@ -1,16 +0,0 @@
-SUMMARY = "C++ bindings for Cairo graphics library"
-
-LICENSE = "LGPLv2"
-LIC_FILES_CHKSUM = "file://COPYING;md5=c46bda00ffbb0ba1dac22f8d087f54d9"
-
-inherit autotools pkgconfig
-
-DEPENDS = "cairo libsigc++-2.0"
-
-SRC_URI = "http://cairographics.org/releases/cairomm-${PV}.tar.gz;name=archive"
-SRC_URI[archive.md5sum] = "732a3ff5b57401eb5dfeef795a2a0c52"
-SRC_URI[archive.sha256sum] = "ccf677098c1e08e189add0bd146f78498109f202575491a82f1815b6bc28008d"
-
-FILES_${PN}-doc += "${datadir}/devhelp"
-FILES_${PN}-dev += "${libdir}/cairomm-*/"
-
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/cairo/cairomm_1.12.0.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/cairo/cairomm_1.12.0.bb
new file mode 100644
index 0000000..d49a509
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/cairo/cairomm_1.12.0.bb
@@ -0,0 +1,15 @@
+SUMMARY = "C++ bindings for Cairo graphics library"
+
+LICENSE = "LGPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=c46bda00ffbb0ba1dac22f8d087f54d9"
+
+inherit gnomebase
+
+DEPENDS = "cairo libsigc++-2.0"
+
+SRC_URI[archive.md5sum] = "c62b476b61bd0abf7e9851f417d73291"
+SRC_URI[archive.sha256sum] = "a54ada8394a86182525c0762e6f50db6b9212a2109280d13ec6a0b29bfd1afe6"
+
+FILES_${PN}-doc += "${datadir}/devhelp"
+FILES_${PN}-dev += "${libdir}/cairomm-*/"
+
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/clutter/clutter-box2d_git.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/clutter/clutter-box2d_git.bb
index 194d104..d73e2f1 100644
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/clutter/clutter-box2d_git.bb
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/clutter/clutter-box2d_git.bb
@@ -5,7 +5,7 @@
 # 0.12.1+gitAUTOINC+de5452e56b-r1/git/clutter-box2d/clutter-box2d.h:226:47:
 #  fatal error: clutter-box2d/clutter-box2d-child.h: No such file or directory
 # |  #include <clutter-box2d/clutter-box2d-child.h>
-PNBLACKLIST[clutter-box2d] ?= "BROKEN: doesn't build with B!=S"
+PNBLACKLIST[clutter-box2d] ?= "BROKEN: doesn't build with B!=S - the recipe will be removed on 2017-09-01 unless the issue is fixed"
 
 SRCREV = "de5452e56b537a11fd7f9453d048ff4b4793b5a2"
 PV = "0.12.1+git${SRCPV}"
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/directfb/directfb.inc b/import-layers/meta-openembedded/meta-oe/recipes-graphics/directfb/directfb.inc
index fc272bd..bfbd9c2 100644
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/directfb/directfb.inc
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/directfb/directfb.inc
@@ -51,6 +51,8 @@
   --disable-sdl \
   --disable-vnc \
   --disable-x11 \
+  --disable-x11vdpau \
+  --disable-xine-vdpau \
 "
 
 #Once -fno-omit-frame-pointer option of gcc is added into TARGET_CLFAGS as default
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/fbgrab/fbgrab_1.2.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/fbgrab/fbgrab_1.3.bb
similarity index 71%
rename from import-layers/meta-openembedded/meta-oe/recipes-graphics/fbgrab/fbgrab_1.2.bb
rename to import-layers/meta-openembedded/meta-oe/recipes-graphics/fbgrab/fbgrab_1.3.bb
index 1d87b86..e12bc09 100644
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/fbgrab/fbgrab_1.2.bb
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/fbgrab/fbgrab_1.3.bb
@@ -8,10 +8,8 @@
 
 inherit autotools-brokensep
 
-S = "${WORKDIR}/${BPN}"
-
-SRC_URI[md5sum] = "15b432735d6efd0373722bb96577b945"
-SRC_URI[sha256sum] = "61e0772ad6ea744ee597ae478398ddd0ba6fceee2cf343859bebde2c15bafb91"
+SRC_URI[md5sum] = "7d8c24081c681dfbba21f2934c1ac656"
+SRC_URI[sha256sum] = "5fab478cbf8731fbacefaa76236a8f8b38ccff920c53b3a8253bc35509fba8ed"
 
 do_configure_prepend() {
     sed -i 's|$(DESTDIR)/usr/man/|$(DESTDIR)${mandir}/|g' ${S}/Makefile
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/fbida/fbida_2.10.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/fbida/fbida_2.10.bb
index c14fc9b..0bf48ac 100644
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/fbida/fbida_2.10.bb
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/fbida/fbida_2.10.bb
@@ -10,12 +10,19 @@
 
 DEPENDS = "virtual/libiconv jpeg fontconfig freetype libexif"
 
-SRC_URI = "https://www.kraxel.org/releases/fbida/fbida-${PV}.tar.gz"
+SRC_URI = "https://www.kraxel.org/releases/fbida/fbida-${PV}.tar.gz \
+	   file://0001-Avoid-using-host-path.patch \
+	   file://fix-preprocessor.patch \
+           file://support-jpeg-turbo.patch \
+           file://use-jpeg-turbo.patch \
+	   "
 SRC_URI[md5sum] = "09460b964b58c2e39b665498eca29018"
 SRC_URI[sha256sum] = "7a5a3aac61b40a6a2bbf716d270a46e2f8e8d5c97e314e927d41398a4d0b6cb6"
 
 B = "${WORKDIR}/build"
 
+inherit pkgconfig
+
 EXTRA_OEMAKE = "STRIP= 'srcdir=${S}' -f ${S}/GNUmakefile"
 
 PACKAGECONFIG ??= "gif png curl"
@@ -30,29 +37,29 @@
 do_compile() {
     sed -i -e 's# fbgs# \$(srcdir)/fbgs#; s#-Ijpeg#-I\$(srcdir)/jpeg#; s# jpeg/# \$(srcdir)/jpeg/#' ${S}/GNUmakefile
     sed -i -e 's:/sbin/ldconfig:echo x:' ${S}/mk/Autoconf.mk
-    sed -i -e 's: cpp: ${TARGET_PREFIX}cpp -I${STAGING_INCDIR}:' ${S}/GNUmakefile
+    sed -i -e 's: cpp: ${CPP}:' ${S}/GNUmakefile
 
     # Be sure to respect preferences (force to "no")
     # Also avoid issues when ${BUILD_ARCH} == ${HOST_ARCH}
-    if [ -z "${@bb.utils.contains('PACKAGECONFIG', 'curl', 'curl', '', d)}" ]; then
+    if [ -z "${@bb.utils.filter('PACKAGECONFIG', 'curl', d)}" ]; then
         sed -i -e '/^HAVE_LIBCURL/s/:=.*$/:= no/' ${S}/GNUmakefile
     fi
-    if [ -z "${@bb.utils.contains('PACKAGECONFIG', 'gif', 'gif', '', d)}" ]; then
+    if [ -z "${@bb.utils.filter('PACKAGECONFIG', 'gif', d)}" ]; then
         sed -i -e '/^HAVE_LIBGIF/s/:=.*$/:= no/' ${S}/GNUmakefile
     fi
-    if [ -z "${@bb.utils.contains('PACKAGECONFIG', 'png', 'png', '', d)}" ]; then
+    if [ -z "${@bb.utils.filter('PACKAGECONFIG', 'png', d)}" ]; then
         sed -i -e '/^HAVE_LIBPNG/s/:=.*$/:= no/' ${S}/GNUmakefile
     fi
-    if [ -z "${@bb.utils.contains('PACKAGECONFIG', 'tiff', 'tiff', '', d)}" ]; then
+    if [ -z "${@bb.utils.filter('PACKAGECONFIG', 'tiff', d)}" ]; then
         sed -i -e '/^HAVE_LIBTIFF/s/:=.*$/:= no/' ${S}/GNUmakefile
     fi
-    if [ -z "${@bb.utils.contains('PACKAGECONFIG', 'motif', 'motif', '', d)}" ]; then
+    if [ -z "${@bb.utils.filter('PACKAGECONFIG', 'motif', d)}" ]; then
         sed -i -e '/^HAVE_MOTIF/s/:=.*$/:= no/' ${S}/GNUmakefile
     fi
-    if [ -z "${@bb.utils.contains('PACKAGECONFIG', 'webp', 'webp', '', d)}" ]; then
+    if [ -z "${@bb.utils.filter('PACKAGECONFIG', 'webp', d)}" ]; then
         sed -i -e '/^HAVE_LIBWEBP/s/:=.*$/:= no/' ${S}/GNUmakefile
     fi
-    if [ -z "${@bb.utils.contains('PACKAGECONFIG', 'lirc', 'lirc', '', d)}" ]; then
+    if [ -z "${@bb.utils.filter('PACKAGECONFIG', 'lirc', d)}" ]; then
         sed -i -e '/^HAVE_LIBLIRC/s/:=.*$/:= no/' ${S}/GNUmakefile
     fi
 
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/fbida/files/0001-Avoid-using-host-path.patch b/import-layers/meta-openembedded/meta-oe/recipes-graphics/fbida/files/0001-Avoid-using-host-path.patch
new file mode 100644
index 0000000..cdf2c25
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/fbida/files/0001-Avoid-using-host-path.patch
@@ -0,0 +1,34 @@
+From 8d8fa9f22d9f6a95523bac63ac3af724faf5ff92 Mon Sep 17 00:00:00 2001
+From: Marek Vasut <marex@denx.de>
+Date: Fri, 7 Apr 2017 23:26:09 +0200
+Subject: [PATCH] Avoid using host-path
+
+Remove the explicit reference to /usr/local/* , this is completely
+bogus and causes trouble during cross-compilation.
+
+Signed-off-by: Marek Vasut <marex@denx.de>
+Upstream-Status: Inappropriate [upstream requires this]
+---
+ mk/Variables.mk | 6 ------
+ 1 file changed, 6 deletions(-)
+
+diff --git a/mk/Variables.mk b/mk/Variables.mk
+index 99f787c..3ffd87a 100644
+--- a/mk/Variables.mk
++++ b/mk/Variables.mk
+@@ -42,12 +42,6 @@ CFLAGS		+= -Wall -Wmissing-prototypes -Wstrict-prototypes \
+ 		   -Wpointer-arith -Wunused
+ CXXFLAGS	+= -Wall -Wpointer-arith -Wunused
+ 
+-# add /usr/local to the search path if something is in there ...
+-ifneq ($(wildcard /usr/local/include/*.h),)
+-  CFLAGS  += -I/usr/local/include
+-  LDFLAGS += -L/usr/local/$(LIB)
+-endif
+-
+ # fixup include path for $(srcdir) != "."
+ ifneq ($(srcdir),.)
+   CFLAGS  += -I. -I$(srcdir)
+-- 
+2.11.0
+
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/fbida/files/fix-preprocessor.patch b/import-layers/meta-openembedded/meta-oe/recipes-graphics/fbida/files/fix-preprocessor.patch
new file mode 100644
index 0000000..909a0a6
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/fbida/files/fix-preprocessor.patch
@@ -0,0 +1,14 @@
+Index: fbida-2.13/GNUmakefile
+===================================================================
+--- fbida-2.13.orig/GNUmakefile
++++ fbida-2.13/GNUmakefile
+@@ -53,8 +53,7 @@ include $(srcdir)/mk/Autoconf.mk
+ 
+ ac_jpeg_ver = $(shell \
+ 	$(call ac_init,for libjpeg version);\
+-	$(call ac_s_cmd,echo JPEG_LIB_VERSION \
+-		| cpp -include jpeglib.h | tail -n 1);\
++	$(call ac_s_cmd,cpp -include jpeglib.h -dM -E -x c /dev/null  | grep 'define JPEG_LIB_VERSION' | cut -f 3 -d' ');\
+ 	$(call ac_fini))
+ 
+ define make-config
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/fbida/files/support-jpeg-turbo.patch b/import-layers/meta-openembedded/meta-oe/recipes-graphics/fbida/files/support-jpeg-turbo.patch
new file mode 100644
index 0000000..05cd74d
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/fbida/files/support-jpeg-turbo.patch
@@ -0,0 +1,1854 @@
+Add patch by Ondrej Sury to migrate to libjpeg-turbo (Closes: #763263)
+
+Index: fbida-2.10/jpeg/62/jpegcomp.h
+===================================================================
+--- /dev/null
++++ fbida-2.10/jpeg/62/jpegcomp.h
+@@ -0,0 +1,30 @@
++/*
++ * jpegcomp.h
++ *
++ * Copyright (C) 2010, D. R. Commander
++ * For conditions of distribution and use, see the accompanying README file.
++ *
++ * JPEG compatibility macros
++ * These declarations are considered internal to the JPEG library; most
++ * applications using the library shouldn't need to include this file.
++ */
++
++#if JPEG_LIB_VERSION >= 70
++#define _DCT_scaled_size DCT_h_scaled_size
++#define _DCT_h_scaled_size DCT_h_scaled_size
++#define _DCT_v_scaled_size DCT_v_scaled_size
++#define _min_DCT_scaled_size min_DCT_h_scaled_size
++#define _min_DCT_h_scaled_size min_DCT_h_scaled_size
++#define _min_DCT_v_scaled_size min_DCT_v_scaled_size
++#define _jpeg_width jpeg_width
++#define _jpeg_height jpeg_height
++#else
++#define _DCT_scaled_size DCT_scaled_size
++#define _DCT_h_scaled_size DCT_scaled_size
++#define _DCT_v_scaled_size DCT_scaled_size
++#define _min_DCT_scaled_size min_DCT_scaled_size
++#define _min_DCT_h_scaled_size min_DCT_scaled_size
++#define _min_DCT_v_scaled_size min_DCT_scaled_size
++#define _jpeg_width image_width
++#define _jpeg_height image_height
++#endif
+Index: fbida-2.10/jpeg/62/transupp.c
+===================================================================
+--- fbida-2.10.orig/jpeg/62/transupp.c
++++ fbida-2.10/jpeg/62/transupp.c
+@@ -1,8 +1,10 @@
+ /*
+  * transupp.c
+  *
+- * Copyright (C) 1997, Thomas G. Lane.
+- * This file is part of the Independent JPEG Group's software.
++ * This file was part of the Independent JPEG Group's software:
++ * Copyright (C) 1997-2011, Thomas G. Lane, Guido Vollbeding.
++ * libjpeg-turbo Modifications:
++ * Copyright (C) 2010, D. R. Commander.
+  * For conditions of distribution and use, see the accompanying README file.
+  *
+  * This file contains image transformation routines and other utility code
+@@ -20,6 +22,17 @@
+ #include "jinclude.h"
+ #include "jpeglib.h"
+ #include "transupp.h"		/* My own external interface */
++#include "jpegcomp.h"
++#include <ctype.h>		/* to declare isdigit() */
++
++
++#if JPEG_LIB_VERSION >= 70
++#define dstinfo_min_DCT_h_scaled_size dstinfo->min_DCT_h_scaled_size
++#define dstinfo_min_DCT_v_scaled_size dstinfo->min_DCT_v_scaled_size
++#else
++#define dstinfo_min_DCT_h_scaled_size DCTSIZE
++#define dstinfo_min_DCT_v_scaled_size DCTSIZE
++#endif
+ 
+ 
+ #if TRANSFORMS_SUPPORTED
+@@ -28,7 +41,8 @@
+  * Lossless image transformation routines.  These routines work on DCT
+  * coefficient arrays and thus do not require any lossy decompression
+  * or recompression of the image.
+- * Thanks to Guido Vollbeding for the initial design and code of this feature.
++ * Thanks to Guido Vollbeding for the initial design and code of this feature,
++ * and to Ben Jackson for introducing the cropping feature.
+  *
+  * Horizontal flipping is done in-place, using a single top-to-bottom
+  * pass through the virtual source array.  It will thus be much the
+@@ -42,6 +56,13 @@
+  * arrays for most of the transforms.  That could result in much thrashing
+  * if the image is larger than main memory.
+  *
++ * If cropping or trimming is involved, the destination arrays may be smaller
++ * than the source arrays.  Note it is not possible to do horizontal flip
++ * in-place when a nonzero Y crop offset is specified, since we'd have to move
++ * data from one block row to another but the virtual array manager doesn't
++ * guarantee we can touch more than one row at a time.  So in that case,
++ * we have to use a separate destination array.
++ *
+  * Some notes about the operating environment of the individual transform
+  * routines:
+  * 1. Both the source and destination virtual arrays are allocated from the
+@@ -54,20 +75,65 @@
+  *    and we may as well take that as the effective iMCU size.
+  * 4. When "trim" is in effect, the destination's dimensions will be the
+  *    trimmed values but the source's will be untrimmed.
+- * 5. All the routines assume that the source and destination buffers are
++ * 5. When "crop" is in effect, the destination's dimensions will be the
++ *    cropped values but the source's will be uncropped.  Each transform
++ *    routine is responsible for picking up source data starting at the
++ *    correct X and Y offset for the crop region.  (The X and Y offsets
++ *    passed to the transform routines are measured in iMCU blocks of the
++ *    destination.)
++ * 6. All the routines assume that the source and destination buffers are
+  *    padded out to a full iMCU boundary.  This is true, although for the
+  *    source buffer it is an undocumented property of jdcoefct.c.
+- * Notes 2,3,4 boil down to this: generally we should use the destination's
+- * dimensions and ignore the source's.
+  */
+ 
+ 
+ LOCAL(void)
+-do_flip_h (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
+-	   jvirt_barray_ptr *src_coef_arrays)
+-/* Horizontal flip; done in-place, so no separate dest array is required */
++do_crop (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
++	 JDIMENSION x_crop_offset, JDIMENSION y_crop_offset,
++	 jvirt_barray_ptr *src_coef_arrays,
++	 jvirt_barray_ptr *dst_coef_arrays)
++/* Crop.  This is only used when no rotate/flip is requested with the crop. */
++{
++  JDIMENSION dst_blk_y, x_crop_blocks, y_crop_blocks;
++  int ci, offset_y;
++  JBLOCKARRAY src_buffer, dst_buffer;
++  jpeg_component_info *compptr;
++
++  /* We simply have to copy the right amount of data (the destination's
++   * image size) starting at the given X and Y offsets in the source.
++   */
++  for (ci = 0; ci < dstinfo->num_components; ci++) {
++    compptr = dstinfo->comp_info + ci;
++    x_crop_blocks = x_crop_offset * compptr->h_samp_factor;
++    y_crop_blocks = y_crop_offset * compptr->v_samp_factor;
++    for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks;
++	 dst_blk_y += compptr->v_samp_factor) {
++      dst_buffer = (*srcinfo->mem->access_virt_barray)
++	((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y,
++	 (JDIMENSION) compptr->v_samp_factor, TRUE);
++      src_buffer = (*srcinfo->mem->access_virt_barray)
++	((j_common_ptr) srcinfo, src_coef_arrays[ci],
++	 dst_blk_y + y_crop_blocks,
++	 (JDIMENSION) compptr->v_samp_factor, FALSE);
++      for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) {
++	jcopy_block_row(src_buffer[offset_y] + x_crop_blocks,
++			dst_buffer[offset_y],
++			compptr->width_in_blocks);
++      }
++    }
++  }
++}
++
++
++LOCAL(void)
++do_flip_h_no_crop (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
++		   JDIMENSION x_crop_offset,
++		   jvirt_barray_ptr *src_coef_arrays)
++/* Horizontal flip; done in-place, so no separate dest array is required.
++ * NB: this only works when y_crop_offset is zero.
++ */
+ {
+-  JDIMENSION MCU_cols, comp_width, blk_x, blk_y;
++  JDIMENSION MCU_cols, comp_width, blk_x, blk_y, x_crop_blocks;
+   int ci, k, offset_y;
+   JBLOCKARRAY buffer;
+   JCOEFPTR ptr1, ptr2;
+@@ -79,17 +145,20 @@ do_flip_h (j_decompress_ptr srcinfo, j_c
+    * mirroring by changing the signs of odd-numbered columns.
+    * Partial iMCUs at the right edge are left untouched.
+    */
+-  MCU_cols = dstinfo->image_width / (dstinfo->max_h_samp_factor * DCTSIZE);
++  MCU_cols = srcinfo->output_width /
++    (dstinfo->max_h_samp_factor * dstinfo_min_DCT_h_scaled_size);
+ 
+   for (ci = 0; ci < dstinfo->num_components; ci++) {
+     compptr = dstinfo->comp_info + ci;
+     comp_width = MCU_cols * compptr->h_samp_factor;
++    x_crop_blocks = x_crop_offset * compptr->h_samp_factor;
+     for (blk_y = 0; blk_y < compptr->height_in_blocks;
+ 	 blk_y += compptr->v_samp_factor) {
+       buffer = (*srcinfo->mem->access_virt_barray)
+ 	((j_common_ptr) srcinfo, src_coef_arrays[ci], blk_y,
+ 	 (JDIMENSION) compptr->v_samp_factor, TRUE);
+       for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) {
++	/* Do the mirroring */
+ 	for (blk_x = 0; blk_x * 2 < comp_width; blk_x++) {
+ 	  ptr1 = buffer[offset_y][blk_x];
+ 	  ptr2 = buffer[offset_y][comp_width - blk_x - 1];
+@@ -105,6 +174,80 @@ do_flip_h (j_decompress_ptr srcinfo, j_c
+ 	    *ptr2++ = -temp1;
+ 	  }
+ 	}
++	if (x_crop_blocks > 0) {
++	  /* Now left-justify the portion of the data to be kept.
++	   * We can't use a single jcopy_block_row() call because that routine
++	   * depends on memcpy(), whose behavior is unspecified for overlapping
++	   * source and destination areas.  Sigh.
++	   */
++	  for (blk_x = 0; blk_x < compptr->width_in_blocks; blk_x++) {
++	    jcopy_block_row(buffer[offset_y] + blk_x + x_crop_blocks,
++			    buffer[offset_y] + blk_x,
++			    (JDIMENSION) 1);
++	  }
++	}
++      }
++    }
++  }
++}
++
++
++LOCAL(void)
++do_flip_h (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
++	   JDIMENSION x_crop_offset, JDIMENSION y_crop_offset,
++	   jvirt_barray_ptr *src_coef_arrays,
++	   jvirt_barray_ptr *dst_coef_arrays)
++/* Horizontal flip in general cropping case */
++{
++  JDIMENSION MCU_cols, comp_width, dst_blk_x, dst_blk_y;
++  JDIMENSION x_crop_blocks, y_crop_blocks;
++  int ci, k, offset_y;
++  JBLOCKARRAY src_buffer, dst_buffer;
++  JBLOCKROW src_row_ptr, dst_row_ptr;
++  JCOEFPTR src_ptr, dst_ptr;
++  jpeg_component_info *compptr;
++
++  /* Here we must output into a separate array because we can't touch
++   * different rows of a single virtual array simultaneously.  Otherwise,
++   * this is essentially the same as the routine above.
++   */
++  MCU_cols = srcinfo->output_width /
++    (dstinfo->max_h_samp_factor * dstinfo_min_DCT_h_scaled_size);
++
++  for (ci = 0; ci < dstinfo->num_components; ci++) {
++    compptr = dstinfo->comp_info + ci;
++    comp_width = MCU_cols * compptr->h_samp_factor;
++    x_crop_blocks = x_crop_offset * compptr->h_samp_factor;
++    y_crop_blocks = y_crop_offset * compptr->v_samp_factor;
++    for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks;
++	 dst_blk_y += compptr->v_samp_factor) {
++      dst_buffer = (*srcinfo->mem->access_virt_barray)
++	((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y,
++	 (JDIMENSION) compptr->v_samp_factor, TRUE);
++      src_buffer = (*srcinfo->mem->access_virt_barray)
++	((j_common_ptr) srcinfo, src_coef_arrays[ci],
++	 dst_blk_y + y_crop_blocks,
++	 (JDIMENSION) compptr->v_samp_factor, FALSE);
++      for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) {
++	dst_row_ptr = dst_buffer[offset_y];
++	src_row_ptr = src_buffer[offset_y];
++	for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks; dst_blk_x++) {
++	  if (x_crop_blocks + dst_blk_x < comp_width) {
++	    /* Do the mirrorable blocks */
++	    dst_ptr = dst_row_ptr[dst_blk_x];
++	    src_ptr = src_row_ptr[comp_width - x_crop_blocks - dst_blk_x - 1];
++	    /* this unrolled loop doesn't need to know which row it's on... */
++	    for (k = 0; k < DCTSIZE2; k += 2) {
++	      *dst_ptr++ = *src_ptr++;	 /* copy even column */
++	      *dst_ptr++ = - *src_ptr++; /* copy odd column with sign change */
++	    }
++	  } else {
++	    /* Copy last partial block(s) verbatim */
++	    jcopy_block_row(src_row_ptr + dst_blk_x + x_crop_blocks,
++			    dst_row_ptr + dst_blk_x,
++			    (JDIMENSION) 1);
++	  }
++	}
+       }
+     }
+   }
+@@ -113,11 +256,13 @@ do_flip_h (j_decompress_ptr srcinfo, j_c
+ 
+ LOCAL(void)
+ do_flip_v (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
++	   JDIMENSION x_crop_offset, JDIMENSION y_crop_offset,
+ 	   jvirt_barray_ptr *src_coef_arrays,
+ 	   jvirt_barray_ptr *dst_coef_arrays)
+ /* Vertical flip */
+ {
+   JDIMENSION MCU_rows, comp_height, dst_blk_x, dst_blk_y;
++  JDIMENSION x_crop_blocks, y_crop_blocks;
+   int ci, i, j, offset_y;
+   JBLOCKARRAY src_buffer, dst_buffer;
+   JBLOCKROW src_row_ptr, dst_row_ptr;
+@@ -131,33 +276,39 @@ do_flip_v (j_decompress_ptr srcinfo, j_c
+    * of odd-numbered rows.
+    * Partial iMCUs at the bottom edge are copied verbatim.
+    */
+-  MCU_rows = dstinfo->image_height / (dstinfo->max_v_samp_factor * DCTSIZE);
++  MCU_rows = srcinfo->output_height /
++    (dstinfo->max_v_samp_factor * dstinfo_min_DCT_v_scaled_size);
+ 
+   for (ci = 0; ci < dstinfo->num_components; ci++) {
+     compptr = dstinfo->comp_info + ci;
+     comp_height = MCU_rows * compptr->v_samp_factor;
++    x_crop_blocks = x_crop_offset * compptr->h_samp_factor;
++    y_crop_blocks = y_crop_offset * compptr->v_samp_factor;
+     for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks;
+ 	 dst_blk_y += compptr->v_samp_factor) {
+       dst_buffer = (*srcinfo->mem->access_virt_barray)
+ 	((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y,
+ 	 (JDIMENSION) compptr->v_samp_factor, TRUE);
+-      if (dst_blk_y < comp_height) {
++      if (y_crop_blocks + dst_blk_y < comp_height) {
+ 	/* Row is within the mirrorable area. */
+ 	src_buffer = (*srcinfo->mem->access_virt_barray)
+ 	  ((j_common_ptr) srcinfo, src_coef_arrays[ci],
+-	   comp_height - dst_blk_y - (JDIMENSION) compptr->v_samp_factor,
++	   comp_height - y_crop_blocks - dst_blk_y -
++	   (JDIMENSION) compptr->v_samp_factor,
+ 	   (JDIMENSION) compptr->v_samp_factor, FALSE);
+       } else {
+ 	/* Bottom-edge blocks will be copied verbatim. */
+ 	src_buffer = (*srcinfo->mem->access_virt_barray)
+-	  ((j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_y,
++	  ((j_common_ptr) srcinfo, src_coef_arrays[ci],
++	   dst_blk_y + y_crop_blocks,
+ 	   (JDIMENSION) compptr->v_samp_factor, FALSE);
+       }
+       for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) {
+-	if (dst_blk_y < comp_height) {
++	if (y_crop_blocks + dst_blk_y < comp_height) {
+ 	  /* Row is within the mirrorable area. */
+ 	  dst_row_ptr = dst_buffer[offset_y];
+ 	  src_row_ptr = src_buffer[compptr->v_samp_factor - offset_y - 1];
++	  src_row_ptr += x_crop_blocks;
+ 	  for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks;
+ 	       dst_blk_x++) {
+ 	    dst_ptr = dst_row_ptr[dst_blk_x];
+@@ -173,7 +324,8 @@ do_flip_v (j_decompress_ptr srcinfo, j_c
+ 	  }
+ 	} else {
+ 	  /* Just copy row verbatim. */
+-	  jcopy_block_row(src_buffer[offset_y], dst_buffer[offset_y],
++	  jcopy_block_row(src_buffer[offset_y] + x_crop_blocks,
++			  dst_buffer[offset_y],
+ 			  compptr->width_in_blocks);
+ 	}
+       }
+@@ -184,11 +336,12 @@ do_flip_v (j_decompress_ptr srcinfo, j_c
+ 
+ LOCAL(void)
+ do_transpose (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
++	      JDIMENSION x_crop_offset, JDIMENSION y_crop_offset,
+ 	      jvirt_barray_ptr *src_coef_arrays,
+ 	      jvirt_barray_ptr *dst_coef_arrays)
+ /* Transpose source into destination */
+ {
+-  JDIMENSION dst_blk_x, dst_blk_y;
++  JDIMENSION dst_blk_x, dst_blk_y, x_crop_blocks, y_crop_blocks;
+   int ci, i, j, offset_x, offset_y;
+   JBLOCKARRAY src_buffer, dst_buffer;
+   JCOEFPTR src_ptr, dst_ptr;
+@@ -201,6 +354,8 @@ do_transpose (j_decompress_ptr srcinfo,
+    */
+   for (ci = 0; ci < dstinfo->num_components; ci++) {
+     compptr = dstinfo->comp_info + ci;
++    x_crop_blocks = x_crop_offset * compptr->h_samp_factor;
++    y_crop_blocks = y_crop_offset * compptr->v_samp_factor;
+     for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks;
+ 	 dst_blk_y += compptr->v_samp_factor) {
+       dst_buffer = (*srcinfo->mem->access_virt_barray)
+@@ -210,11 +365,12 @@ do_transpose (j_decompress_ptr srcinfo,
+ 	for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks;
+ 	     dst_blk_x += compptr->h_samp_factor) {
+ 	  src_buffer = (*srcinfo->mem->access_virt_barray)
+-	    ((j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_x,
++	    ((j_common_ptr) srcinfo, src_coef_arrays[ci],
++	     dst_blk_x + x_crop_blocks,
+ 	     (JDIMENSION) compptr->h_samp_factor, FALSE);
+ 	  for (offset_x = 0; offset_x < compptr->h_samp_factor; offset_x++) {
+-	    src_ptr = src_buffer[offset_x][dst_blk_y + offset_y];
+ 	    dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x];
++	    src_ptr = src_buffer[offset_x][dst_blk_y + offset_y + y_crop_blocks];
+ 	    for (i = 0; i < DCTSIZE; i++)
+ 	      for (j = 0; j < DCTSIZE; j++)
+ 		dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];
+@@ -228,6 +384,7 @@ do_transpose (j_decompress_ptr srcinfo,
+ 
+ LOCAL(void)
+ do_rot_90 (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
++	   JDIMENSION x_crop_offset, JDIMENSION y_crop_offset,
+ 	   jvirt_barray_ptr *src_coef_arrays,
+ 	   jvirt_barray_ptr *dst_coef_arrays)
+ /* 90 degree rotation is equivalent to
+@@ -237,6 +394,7 @@ do_rot_90 (j_decompress_ptr srcinfo, j_c
+  */
+ {
+   JDIMENSION MCU_cols, comp_width, dst_blk_x, dst_blk_y;
++  JDIMENSION x_crop_blocks, y_crop_blocks;
+   int ci, i, j, offset_x, offset_y;
+   JBLOCKARRAY src_buffer, dst_buffer;
+   JCOEFPTR src_ptr, dst_ptr;
+@@ -246,11 +404,14 @@ do_rot_90 (j_decompress_ptr srcinfo, j_c
+    * at the (output) right edge properly.  They just get transposed and
+    * not mirrored.
+    */
+-  MCU_cols = dstinfo->image_width / (dstinfo->max_h_samp_factor * DCTSIZE);
++  MCU_cols = srcinfo->output_height /
++    (dstinfo->max_h_samp_factor * dstinfo_min_DCT_h_scaled_size);
+ 
+   for (ci = 0; ci < dstinfo->num_components; ci++) {
+     compptr = dstinfo->comp_info + ci;
+     comp_width = MCU_cols * compptr->h_samp_factor;
++    x_crop_blocks = x_crop_offset * compptr->h_samp_factor;
++    y_crop_blocks = y_crop_offset * compptr->v_samp_factor;
+     for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks;
+ 	 dst_blk_y += compptr->v_samp_factor) {
+       dst_buffer = (*srcinfo->mem->access_virt_barray)
+@@ -259,15 +420,26 @@ do_rot_90 (j_decompress_ptr srcinfo, j_c
+       for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) {
+ 	for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks;
+ 	     dst_blk_x += compptr->h_samp_factor) {
+-	  src_buffer = (*srcinfo->mem->access_virt_barray)
+-	    ((j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_x,
+-	     (JDIMENSION) compptr->h_samp_factor, FALSE);
++	  if (x_crop_blocks + dst_blk_x < comp_width) {
++	    /* Block is within the mirrorable area. */
++	    src_buffer = (*srcinfo->mem->access_virt_barray)
++	      ((j_common_ptr) srcinfo, src_coef_arrays[ci],
++	       comp_width - x_crop_blocks - dst_blk_x -
++	       (JDIMENSION) compptr->h_samp_factor,
++	       (JDIMENSION) compptr->h_samp_factor, FALSE);
++	  } else {
++	    /* Edge blocks are transposed but not mirrored. */
++	    src_buffer = (*srcinfo->mem->access_virt_barray)
++	      ((j_common_ptr) srcinfo, src_coef_arrays[ci],
++	       dst_blk_x + x_crop_blocks,
++	       (JDIMENSION) compptr->h_samp_factor, FALSE);
++	  }
+ 	  for (offset_x = 0; offset_x < compptr->h_samp_factor; offset_x++) {
+-	    src_ptr = src_buffer[offset_x][dst_blk_y + offset_y];
+-	    if (dst_blk_x < comp_width) {
++	    dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x];
++	    if (x_crop_blocks + dst_blk_x < comp_width) {
+ 	      /* Block is within the mirrorable area. */
+-	      dst_ptr = dst_buffer[offset_y]
+-		[comp_width - dst_blk_x - offset_x - 1];
++	      src_ptr = src_buffer[compptr->h_samp_factor - offset_x - 1]
++		[dst_blk_y + offset_y + y_crop_blocks];
+ 	      for (i = 0; i < DCTSIZE; i++) {
+ 		for (j = 0; j < DCTSIZE; j++)
+ 		  dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];
+@@ -277,7 +449,8 @@ do_rot_90 (j_decompress_ptr srcinfo, j_c
+ 	      }
+ 	    } else {
+ 	      /* Edge blocks are transposed but not mirrored. */
+-	      dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x];
++	      src_ptr = src_buffer[offset_x]
++		[dst_blk_y + offset_y + y_crop_blocks];
+ 	      for (i = 0; i < DCTSIZE; i++)
+ 		for (j = 0; j < DCTSIZE; j++)
+ 		  dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];
+@@ -292,6 +465,7 @@ do_rot_90 (j_decompress_ptr srcinfo, j_c
+ 
+ LOCAL(void)
+ do_rot_270 (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
++	    JDIMENSION x_crop_offset, JDIMENSION y_crop_offset,
+ 	    jvirt_barray_ptr *src_coef_arrays,
+ 	    jvirt_barray_ptr *dst_coef_arrays)
+ /* 270 degree rotation is equivalent to
+@@ -301,6 +475,7 @@ do_rot_270 (j_decompress_ptr srcinfo, j_
+  */
+ {
+   JDIMENSION MCU_rows, comp_height, dst_blk_x, dst_blk_y;
++  JDIMENSION x_crop_blocks, y_crop_blocks;
+   int ci, i, j, offset_x, offset_y;
+   JBLOCKARRAY src_buffer, dst_buffer;
+   JCOEFPTR src_ptr, dst_ptr;
+@@ -310,11 +485,14 @@ do_rot_270 (j_decompress_ptr srcinfo, j_
+    * at the (output) bottom edge properly.  They just get transposed and
+    * not mirrored.
+    */
+-  MCU_rows = dstinfo->image_height / (dstinfo->max_v_samp_factor * DCTSIZE);
++  MCU_rows = srcinfo->output_width /
++    (dstinfo->max_v_samp_factor * dstinfo_min_DCT_v_scaled_size);
+ 
+   for (ci = 0; ci < dstinfo->num_components; ci++) {
+     compptr = dstinfo->comp_info + ci;
+     comp_height = MCU_rows * compptr->v_samp_factor;
++    x_crop_blocks = x_crop_offset * compptr->h_samp_factor;
++    y_crop_blocks = y_crop_offset * compptr->v_samp_factor;
+     for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks;
+ 	 dst_blk_y += compptr->v_samp_factor) {
+       dst_buffer = (*srcinfo->mem->access_virt_barray)
+@@ -324,14 +502,15 @@ do_rot_270 (j_decompress_ptr srcinfo, j_
+ 	for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks;
+ 	     dst_blk_x += compptr->h_samp_factor) {
+ 	  src_buffer = (*srcinfo->mem->access_virt_barray)
+-	    ((j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_x,
++	    ((j_common_ptr) srcinfo, src_coef_arrays[ci],
++	     dst_blk_x + x_crop_blocks,
+ 	     (JDIMENSION) compptr->h_samp_factor, FALSE);
+ 	  for (offset_x = 0; offset_x < compptr->h_samp_factor; offset_x++) {
+ 	    dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x];
+-	    if (dst_blk_y < comp_height) {
++	    if (y_crop_blocks + dst_blk_y < comp_height) {
+ 	      /* Block is within the mirrorable area. */
+ 	      src_ptr = src_buffer[offset_x]
+-		[comp_height - dst_blk_y - offset_y - 1];
++		[comp_height - y_crop_blocks - dst_blk_y - offset_y - 1];
+ 	      for (i = 0; i < DCTSIZE; i++) {
+ 		for (j = 0; j < DCTSIZE; j++) {
+ 		  dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];
+@@ -341,7 +520,8 @@ do_rot_270 (j_decompress_ptr srcinfo, j_
+ 	      }
+ 	    } else {
+ 	      /* Edge blocks are transposed but not mirrored. */
+-	      src_ptr = src_buffer[offset_x][dst_blk_y + offset_y];
++	      src_ptr = src_buffer[offset_x]
++		[dst_blk_y + offset_y + y_crop_blocks];
+ 	      for (i = 0; i < DCTSIZE; i++)
+ 		for (j = 0; j < DCTSIZE; j++)
+ 		  dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];
+@@ -356,6 +536,7 @@ do_rot_270 (j_decompress_ptr srcinfo, j_
+ 
+ LOCAL(void)
+ do_rot_180 (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
++	    JDIMENSION x_crop_offset, JDIMENSION y_crop_offset,
+ 	    jvirt_barray_ptr *src_coef_arrays,
+ 	    jvirt_barray_ptr *dst_coef_arrays)
+ /* 180 degree rotation is equivalent to
+@@ -365,89 +546,95 @@ do_rot_180 (j_decompress_ptr srcinfo, j_
+  */
+ {
+   JDIMENSION MCU_cols, MCU_rows, comp_width, comp_height, dst_blk_x, dst_blk_y;
++  JDIMENSION x_crop_blocks, y_crop_blocks;
+   int ci, i, j, offset_y;
+   JBLOCKARRAY src_buffer, dst_buffer;
+   JBLOCKROW src_row_ptr, dst_row_ptr;
+   JCOEFPTR src_ptr, dst_ptr;
+   jpeg_component_info *compptr;
+ 
+-  MCU_cols = dstinfo->image_width / (dstinfo->max_h_samp_factor * DCTSIZE);
+-  MCU_rows = dstinfo->image_height / (dstinfo->max_v_samp_factor * DCTSIZE);
++  MCU_cols = srcinfo->output_width /
++    (dstinfo->max_h_samp_factor * dstinfo_min_DCT_h_scaled_size);
++  MCU_rows = srcinfo->output_height /
++    (dstinfo->max_v_samp_factor * dstinfo_min_DCT_v_scaled_size);
+ 
+   for (ci = 0; ci < dstinfo->num_components; ci++) {
+     compptr = dstinfo->comp_info + ci;
+     comp_width = MCU_cols * compptr->h_samp_factor;
+     comp_height = MCU_rows * compptr->v_samp_factor;
++    x_crop_blocks = x_crop_offset * compptr->h_samp_factor;
++    y_crop_blocks = y_crop_offset * compptr->v_samp_factor;
+     for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks;
+ 	 dst_blk_y += compptr->v_samp_factor) {
+       dst_buffer = (*srcinfo->mem->access_virt_barray)
+ 	((j_common_ptr) srcinfo, dst_coef_arrays[ci], dst_blk_y,
+ 	 (JDIMENSION) compptr->v_samp_factor, TRUE);
+-      if (dst_blk_y < comp_height) {
++      if (y_crop_blocks + dst_blk_y < comp_height) {
+ 	/* Row is within the vertically mirrorable area. */
+ 	src_buffer = (*srcinfo->mem->access_virt_barray)
+ 	  ((j_common_ptr) srcinfo, src_coef_arrays[ci],
+-	   comp_height - dst_blk_y - (JDIMENSION) compptr->v_samp_factor,
++	   comp_height - y_crop_blocks - dst_blk_y -
++	   (JDIMENSION) compptr->v_samp_factor,
+ 	   (JDIMENSION) compptr->v_samp_factor, FALSE);
+       } else {
+ 	/* Bottom-edge rows are only mirrored horizontally. */
+ 	src_buffer = (*srcinfo->mem->access_virt_barray)
+-	  ((j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_y,
++	  ((j_common_ptr) srcinfo, src_coef_arrays[ci],
++	   dst_blk_y + y_crop_blocks,
+ 	   (JDIMENSION) compptr->v_samp_factor, FALSE);
+       }
+       for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) {
+-	if (dst_blk_y < comp_height) {
++	dst_row_ptr = dst_buffer[offset_y];
++	if (y_crop_blocks + dst_blk_y < comp_height) {
+ 	  /* Row is within the mirrorable area. */
+-	  dst_row_ptr = dst_buffer[offset_y];
+ 	  src_row_ptr = src_buffer[compptr->v_samp_factor - offset_y - 1];
+-	  /* Process the blocks that can be mirrored both ways. */
+-	  for (dst_blk_x = 0; dst_blk_x < comp_width; dst_blk_x++) {
++	  for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks; dst_blk_x++) {
+ 	    dst_ptr = dst_row_ptr[dst_blk_x];
+-	    src_ptr = src_row_ptr[comp_width - dst_blk_x - 1];
+-	    for (i = 0; i < DCTSIZE; i += 2) {
+-	      /* For even row, negate every odd column. */
+-	      for (j = 0; j < DCTSIZE; j += 2) {
+-		*dst_ptr++ = *src_ptr++;
+-		*dst_ptr++ = - *src_ptr++;
++	    if (x_crop_blocks + dst_blk_x < comp_width) {
++	      /* Process the blocks that can be mirrored both ways. */
++	      src_ptr = src_row_ptr[comp_width - x_crop_blocks - dst_blk_x - 1];
++	      for (i = 0; i < DCTSIZE; i += 2) {
++		/* For even row, negate every odd column. */
++		for (j = 0; j < DCTSIZE; j += 2) {
++		  *dst_ptr++ = *src_ptr++;
++		  *dst_ptr++ = - *src_ptr++;
++		}
++		/* For odd row, negate every even column. */
++		for (j = 0; j < DCTSIZE; j += 2) {
++		  *dst_ptr++ = - *src_ptr++;
++		  *dst_ptr++ = *src_ptr++;
++		}
+ 	      }
+-	      /* For odd row, negate every even column. */
+-	      for (j = 0; j < DCTSIZE; j += 2) {
+-		*dst_ptr++ = - *src_ptr++;
+-		*dst_ptr++ = *src_ptr++;
++	    } else {
++	      /* Any remaining right-edge blocks are only mirrored vertically. */
++	      src_ptr = src_row_ptr[x_crop_blocks + dst_blk_x];
++	      for (i = 0; i < DCTSIZE; i += 2) {
++		for (j = 0; j < DCTSIZE; j++)
++		  *dst_ptr++ = *src_ptr++;
++		for (j = 0; j < DCTSIZE; j++)
++		  *dst_ptr++ = - *src_ptr++;
+ 	      }
+ 	    }
+ 	  }
+-	  /* Any remaining right-edge blocks are only mirrored vertically. */
+-	  for (; dst_blk_x < compptr->width_in_blocks; dst_blk_x++) {
+-	    dst_ptr = dst_row_ptr[dst_blk_x];
+-	    src_ptr = src_row_ptr[dst_blk_x];
+-	    for (i = 0; i < DCTSIZE; i += 2) {
+-	      for (j = 0; j < DCTSIZE; j++)
+-		*dst_ptr++ = *src_ptr++;
+-	      for (j = 0; j < DCTSIZE; j++)
+-		*dst_ptr++ = - *src_ptr++;
+-	    }
+-	  }
+ 	} else {
+ 	  /* Remaining rows are just mirrored horizontally. */
+-	  dst_row_ptr = dst_buffer[offset_y];
+ 	  src_row_ptr = src_buffer[offset_y];
+-	  /* Process the blocks that can be mirrored. */
+-	  for (dst_blk_x = 0; dst_blk_x < comp_width; dst_blk_x++) {
+-	    dst_ptr = dst_row_ptr[dst_blk_x];
+-	    src_ptr = src_row_ptr[comp_width - dst_blk_x - 1];
+-	    for (i = 0; i < DCTSIZE2; i += 2) {
+-	      *dst_ptr++ = *src_ptr++;
+-	      *dst_ptr++ = - *src_ptr++;
++	  for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks; dst_blk_x++) {
++	    if (x_crop_blocks + dst_blk_x < comp_width) {
++	      /* Process the blocks that can be mirrored. */
++	      dst_ptr = dst_row_ptr[dst_blk_x];
++	      src_ptr = src_row_ptr[comp_width - x_crop_blocks - dst_blk_x - 1];
++	      for (i = 0; i < DCTSIZE2; i += 2) {
++		*dst_ptr++ = *src_ptr++;
++		*dst_ptr++ = - *src_ptr++;
++	      }
++	    } else {
++	      /* Any remaining right-edge blocks are only copied. */
++	      jcopy_block_row(src_row_ptr + dst_blk_x + x_crop_blocks,
++			      dst_row_ptr + dst_blk_x,
++			      (JDIMENSION) 1);
+ 	    }
+ 	  }
+-	  /* Any remaining right-edge blocks are only copied. */
+-	  for (; dst_blk_x < compptr->width_in_blocks; dst_blk_x++) {
+-	    dst_ptr = dst_row_ptr[dst_blk_x];
+-	    src_ptr = src_row_ptr[dst_blk_x];
+-	    for (i = 0; i < DCTSIZE2; i++)
+-	      *dst_ptr++ = *src_ptr++;
+-	  }
+ 	}
+       }
+     }
+@@ -457,6 +644,7 @@ do_rot_180 (j_decompress_ptr srcinfo, j_
+ 
+ LOCAL(void)
+ do_transverse (j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
++	       JDIMENSION x_crop_offset, JDIMENSION y_crop_offset,
+ 	       jvirt_barray_ptr *src_coef_arrays,
+ 	       jvirt_barray_ptr *dst_coef_arrays)
+ /* Transverse transpose is equivalent to
+@@ -470,18 +658,23 @@ do_transverse (j_decompress_ptr srcinfo,
+  */
+ {
+   JDIMENSION MCU_cols, MCU_rows, comp_width, comp_height, dst_blk_x, dst_blk_y;
++  JDIMENSION x_crop_blocks, y_crop_blocks;
+   int ci, i, j, offset_x, offset_y;
+   JBLOCKARRAY src_buffer, dst_buffer;
+   JCOEFPTR src_ptr, dst_ptr;
+   jpeg_component_info *compptr;
+ 
+-  MCU_cols = dstinfo->image_width / (dstinfo->max_h_samp_factor * DCTSIZE);
+-  MCU_rows = dstinfo->image_height / (dstinfo->max_v_samp_factor * DCTSIZE);
++  MCU_cols = srcinfo->output_height /
++    (dstinfo->max_h_samp_factor * dstinfo_min_DCT_h_scaled_size);
++  MCU_rows = srcinfo->output_width /
++    (dstinfo->max_v_samp_factor * dstinfo_min_DCT_v_scaled_size);
+ 
+   for (ci = 0; ci < dstinfo->num_components; ci++) {
+     compptr = dstinfo->comp_info + ci;
+     comp_width = MCU_cols * compptr->h_samp_factor;
+     comp_height = MCU_rows * compptr->v_samp_factor;
++    x_crop_blocks = x_crop_offset * compptr->h_samp_factor;
++    y_crop_blocks = y_crop_offset * compptr->v_samp_factor;
+     for (dst_blk_y = 0; dst_blk_y < compptr->height_in_blocks;
+ 	 dst_blk_y += compptr->v_samp_factor) {
+       dst_buffer = (*srcinfo->mem->access_virt_barray)
+@@ -490,17 +683,26 @@ do_transverse (j_decompress_ptr srcinfo,
+       for (offset_y = 0; offset_y < compptr->v_samp_factor; offset_y++) {
+ 	for (dst_blk_x = 0; dst_blk_x < compptr->width_in_blocks;
+ 	     dst_blk_x += compptr->h_samp_factor) {
+-	  src_buffer = (*srcinfo->mem->access_virt_barray)
+-	    ((j_common_ptr) srcinfo, src_coef_arrays[ci], dst_blk_x,
+-	     (JDIMENSION) compptr->h_samp_factor, FALSE);
++	  if (x_crop_blocks + dst_blk_x < comp_width) {
++	    /* Block is within the mirrorable area. */
++	    src_buffer = (*srcinfo->mem->access_virt_barray)
++	      ((j_common_ptr) srcinfo, src_coef_arrays[ci],
++	       comp_width - x_crop_blocks - dst_blk_x -
++	       (JDIMENSION) compptr->h_samp_factor,
++	       (JDIMENSION) compptr->h_samp_factor, FALSE);
++	  } else {
++	    src_buffer = (*srcinfo->mem->access_virt_barray)
++	      ((j_common_ptr) srcinfo, src_coef_arrays[ci],
++	       dst_blk_x + x_crop_blocks,
++	       (JDIMENSION) compptr->h_samp_factor, FALSE);
++	  }
+ 	  for (offset_x = 0; offset_x < compptr->h_samp_factor; offset_x++) {
+-	    if (dst_blk_y < comp_height) {
+-	      src_ptr = src_buffer[offset_x]
+-		[comp_height - dst_blk_y - offset_y - 1];
+-	      if (dst_blk_x < comp_width) {
++	    dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x];
++	    if (y_crop_blocks + dst_blk_y < comp_height) {
++	      if (x_crop_blocks + dst_blk_x < comp_width) {
+ 		/* Block is within the mirrorable area. */
+-		dst_ptr = dst_buffer[offset_y]
+-		  [comp_width - dst_blk_x - offset_x - 1];
++		src_ptr = src_buffer[compptr->h_samp_factor - offset_x - 1]
++		  [comp_height - y_crop_blocks - dst_blk_y - offset_y - 1];
+ 		for (i = 0; i < DCTSIZE; i++) {
+ 		  for (j = 0; j < DCTSIZE; j++) {
+ 		    dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];
+@@ -516,7 +718,8 @@ do_transverse (j_decompress_ptr srcinfo,
+ 		}
+ 	      } else {
+ 		/* Right-edge blocks are mirrored in y only */
+-		dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x];
++		src_ptr = src_buffer[offset_x]
++		  [comp_height - y_crop_blocks - dst_blk_y - offset_y - 1];
+ 		for (i = 0; i < DCTSIZE; i++) {
+ 		  for (j = 0; j < DCTSIZE; j++) {
+ 		    dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];
+@@ -526,11 +729,10 @@ do_transverse (j_decompress_ptr srcinfo,
+ 		}
+ 	      }
+ 	    } else {
+-	      src_ptr = src_buffer[offset_x][dst_blk_y + offset_y];
+-	      if (dst_blk_x < comp_width) {
++	      if (x_crop_blocks + dst_blk_x < comp_width) {
+ 		/* Bottom-edge blocks are mirrored in x only */
+-		dst_ptr = dst_buffer[offset_y]
+-		  [comp_width - dst_blk_x - offset_x - 1];
++		src_ptr = src_buffer[compptr->h_samp_factor - offset_x - 1]
++		  [dst_blk_y + offset_y + y_crop_blocks];
+ 		for (i = 0; i < DCTSIZE; i++) {
+ 		  for (j = 0; j < DCTSIZE; j++)
+ 		    dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];
+@@ -540,7 +742,8 @@ do_transverse (j_decompress_ptr srcinfo,
+ 		}
+ 	      } else {
+ 		/* At lower right corner, just transpose, no mirroring */
+-		dst_ptr = dst_buffer[offset_y][dst_blk_x + offset_x];
++		src_ptr = src_buffer[offset_x]
++		  [dst_blk_y + offset_y + y_crop_blocks];
+ 		for (i = 0; i < DCTSIZE; i++)
+ 		  for (j = 0; j < DCTSIZE; j++)
+ 		    dst_ptr[j*DCTSIZE+i] = src_ptr[i*DCTSIZE+j];
+@@ -554,83 +757,372 @@ do_transverse (j_decompress_ptr srcinfo,
+ }
+ 
+ 
++/* Parse an unsigned integer: subroutine for jtransform_parse_crop_spec.
++ * Returns TRUE if valid integer found, FALSE if not.
++ * *strptr is advanced over the digit string, and *result is set to its value.
++ */
++
++LOCAL(boolean)
++jt_read_integer (const char ** strptr, JDIMENSION * result)
++{
++  const char * ptr = *strptr;
++  JDIMENSION val = 0;
++
++  for (; isdigit(*ptr); ptr++) {
++    val = val * 10 + (JDIMENSION) (*ptr - '0');
++  }
++  *result = val;
++  if (ptr == *strptr)
++    return FALSE;		/* oops, no digits */
++  *strptr = ptr;
++  return TRUE;
++}
++
++
++/* Parse a crop specification (written in X11 geometry style).
++ * The routine returns TRUE if the spec string is valid, FALSE if not.
++ *
++ * The crop spec string should have the format
++ *	<width>[f]x<height>[f]{+-}<xoffset>{+-}<yoffset>
++ * where width, height, xoffset, and yoffset are unsigned integers.
++ * Each of the elements can be omitted to indicate a default value.
++ * (A weakness of this style is that it is not possible to omit xoffset
++ * while specifying yoffset, since they look alike.)
++ *
++ * This code is loosely based on XParseGeometry from the X11 distribution.
++ */
++
++GLOBAL(boolean)
++jtransform_parse_crop_spec (jpeg_transform_info *info, const char *spec)
++{
++  info->crop = FALSE;
++  info->crop_width_set = JCROP_UNSET;
++  info->crop_height_set = JCROP_UNSET;
++  info->crop_xoffset_set = JCROP_UNSET;
++  info->crop_yoffset_set = JCROP_UNSET;
++
++  if (isdigit(*spec)) {
++    /* fetch width */
++    if (! jt_read_integer(&spec, &info->crop_width))
++      return FALSE;
++    if (*spec == 'f' || *spec == 'F') {
++      spec++;
++      info->crop_width_set = JCROP_FORCE;
++    } else
++      info->crop_width_set = JCROP_POS;
++  }
++  if (*spec == 'x' || *spec == 'X') {
++    /* fetch height */
++    spec++;
++    if (! jt_read_integer(&spec, &info->crop_height))
++      return FALSE;
++    if (*spec == 'f' || *spec == 'F') {
++      spec++;
++      info->crop_height_set = JCROP_FORCE;
++    } else
++      info->crop_height_set = JCROP_POS;
++  }
++  if (*spec == '+' || *spec == '-') {
++    /* fetch xoffset */
++    info->crop_xoffset_set = (*spec == '-') ? JCROP_NEG : JCROP_POS;
++    spec++;
++    if (! jt_read_integer(&spec, &info->crop_xoffset))
++      return FALSE;
++  }
++  if (*spec == '+' || *spec == '-') {
++    /* fetch yoffset */
++    info->crop_yoffset_set = (*spec == '-') ? JCROP_NEG : JCROP_POS;
++    spec++;
++    if (! jt_read_integer(&spec, &info->crop_yoffset))
++      return FALSE;
++  }
++  /* We had better have gotten to the end of the string. */
++  if (*spec != '\0')
++    return FALSE;
++  info->crop = TRUE;
++  return TRUE;
++}
++
++
++/* Trim off any partial iMCUs on the indicated destination edge */
++
++LOCAL(void)
++trim_right_edge (jpeg_transform_info *info, JDIMENSION full_width)
++{
++  JDIMENSION MCU_cols;
++
++  MCU_cols = info->output_width / info->iMCU_sample_width;
++  if (MCU_cols > 0 && info->x_crop_offset + MCU_cols ==
++      full_width / info->iMCU_sample_width)
++    info->output_width = MCU_cols * info->iMCU_sample_width;
++}
++
++LOCAL(void)
++trim_bottom_edge (jpeg_transform_info *info, JDIMENSION full_height)
++{
++  JDIMENSION MCU_rows;
++
++  MCU_rows = info->output_height / info->iMCU_sample_height;
++  if (MCU_rows > 0 && info->y_crop_offset + MCU_rows ==
++      full_height / info->iMCU_sample_height)
++    info->output_height = MCU_rows * info->iMCU_sample_height;
++}
++
++
+ /* Request any required workspace.
+  *
++ * This routine figures out the size that the output image will be
++ * (which implies that all the transform parameters must be set before
++ * it is called).
++ *
+  * We allocate the workspace virtual arrays from the source decompression
+  * object, so that all the arrays (both the original data and the workspace)
+  * will be taken into account while making memory management decisions.
+  * Hence, this routine must be called after jpeg_read_header (which reads
+  * the image dimensions) and before jpeg_read_coefficients (which realizes
+  * the source's virtual arrays).
++ *
++ * This function returns FALSE right away if -perfect is given
++ * and transformation is not perfect.  Otherwise returns TRUE.
+  */
+ 
+-GLOBAL(void)
++GLOBAL(boolean)
+ jtransform_request_workspace (j_decompress_ptr srcinfo,
+ 			      jpeg_transform_info *info)
+ {
+-  jvirt_barray_ptr *coef_arrays = NULL;
++  jvirt_barray_ptr *coef_arrays;
++  boolean need_workspace, transpose_it;
+   jpeg_component_info *compptr;
+-  int ci;
++  JDIMENSION xoffset, yoffset;
++  JDIMENSION width_in_iMCUs, height_in_iMCUs;
++  JDIMENSION width_in_blocks, height_in_blocks;
++  int ci, h_samp_factor, v_samp_factor;
+ 
++  /* Determine number of components in output image */
+   if (info->force_grayscale &&
+       srcinfo->jpeg_color_space == JCS_YCbCr &&
+-      srcinfo->num_components == 3) {
++      srcinfo->num_components == 3)
+     /* We'll only process the first component */
+     info->num_components = 1;
+-  } else {
++  else
+     /* Process all the components */
+     info->num_components = srcinfo->num_components;
++
++  /* Compute output image dimensions and related values. */
++#if JPEG_LIB_VERSION >= 80
++  jpeg_core_output_dimensions(srcinfo);
++#else
++  srcinfo->output_width = srcinfo->image_width;
++  srcinfo->output_height = srcinfo->image_height;
++#endif
++
++  /* Return right away if -perfect is given and transformation is not perfect.
++   */
++  if (info->perfect) {
++    if (info->num_components == 1) {
++      if (!jtransform_perfect_transform(srcinfo->output_width,
++	  srcinfo->output_height,
++	  srcinfo->_min_DCT_h_scaled_size,
++	  srcinfo->_min_DCT_v_scaled_size,
++	  info->transform))
++	return FALSE;
++    } else {
++      if (!jtransform_perfect_transform(srcinfo->output_width,
++	  srcinfo->output_height,
++	  srcinfo->max_h_samp_factor * srcinfo->_min_DCT_h_scaled_size,
++	  srcinfo->max_v_samp_factor * srcinfo->_min_DCT_v_scaled_size,
++	  info->transform))
++	return FALSE;
++    }
++  }
++
++  /* If there is only one output component, force the iMCU size to be 1;
++   * else use the source iMCU size.  (This allows us to do the right thing
++   * when reducing color to grayscale, and also provides a handy way of
++   * cleaning up "funny" grayscale images whose sampling factors are not 1x1.)
++   */
++  switch (info->transform) {
++  case JXFORM_TRANSPOSE:
++  case JXFORM_TRANSVERSE:
++  case JXFORM_ROT_90:
++  case JXFORM_ROT_270:
++    info->output_width = srcinfo->output_height;
++    info->output_height = srcinfo->output_width;
++    if (info->num_components == 1) {
++      info->iMCU_sample_width = srcinfo->_min_DCT_v_scaled_size;
++      info->iMCU_sample_height = srcinfo->_min_DCT_h_scaled_size;
++    } else {
++      info->iMCU_sample_width =
++	srcinfo->max_v_samp_factor * srcinfo->_min_DCT_v_scaled_size;
++      info->iMCU_sample_height =
++	srcinfo->max_h_samp_factor * srcinfo->_min_DCT_h_scaled_size;
++    }
++    break;
++  default:
++    info->output_width = srcinfo->output_width;
++    info->output_height = srcinfo->output_height;
++    if (info->num_components == 1) {
++      info->iMCU_sample_width = srcinfo->_min_DCT_h_scaled_size;
++      info->iMCU_sample_height = srcinfo->_min_DCT_v_scaled_size;
++    } else {
++      info->iMCU_sample_width =
++	srcinfo->max_h_samp_factor * srcinfo->_min_DCT_h_scaled_size;
++      info->iMCU_sample_height =
++	srcinfo->max_v_samp_factor * srcinfo->_min_DCT_v_scaled_size;
++    }
++    break;
+   }
+ 
++  /* If cropping has been requested, compute the crop area's position and
++   * dimensions, ensuring that its upper left corner falls at an iMCU boundary.
++   */
++  if (info->crop) {
++    /* Insert default values for unset crop parameters */
++    if (info->crop_xoffset_set == JCROP_UNSET)
++      info->crop_xoffset = 0;	/* default to +0 */
++    if (info->crop_yoffset_set == JCROP_UNSET)
++      info->crop_yoffset = 0;	/* default to +0 */
++    if (info->crop_xoffset >= info->output_width ||
++	info->crop_yoffset >= info->output_height)
++      ERREXIT(srcinfo, JERR_BAD_CROP_SPEC);
++    if (info->crop_width_set == JCROP_UNSET)
++      info->crop_width = info->output_width - info->crop_xoffset;
++    if (info->crop_height_set == JCROP_UNSET)
++      info->crop_height = info->output_height - info->crop_yoffset;
++    /* Ensure parameters are valid */
++    if (info->crop_width <= 0 || info->crop_width > info->output_width ||
++	info->crop_height <= 0 || info->crop_height > info->output_height ||
++	info->crop_xoffset > info->output_width - info->crop_width ||
++	info->crop_yoffset > info->output_height - info->crop_height)
++      ERREXIT(srcinfo, JERR_BAD_CROP_SPEC);
++    /* Convert negative crop offsets into regular offsets */
++    if (info->crop_xoffset_set == JCROP_NEG)
++      xoffset = info->output_width - info->crop_width - info->crop_xoffset;
++    else
++      xoffset = info->crop_xoffset;
++    if (info->crop_yoffset_set == JCROP_NEG)
++      yoffset = info->output_height - info->crop_height - info->crop_yoffset;
++    else
++      yoffset = info->crop_yoffset;
++    /* Now adjust so that upper left corner falls at an iMCU boundary */
++    if (info->crop_width_set == JCROP_FORCE)
++      info->output_width = info->crop_width;
++    else
++      info->output_width =
++        info->crop_width + (xoffset % info->iMCU_sample_width);
++    if (info->crop_height_set == JCROP_FORCE)
++      info->output_height = info->crop_height;
++    else
++      info->output_height =
++        info->crop_height + (yoffset % info->iMCU_sample_height);
++    /* Save x/y offsets measured in iMCUs */
++    info->x_crop_offset = xoffset / info->iMCU_sample_width;
++    info->y_crop_offset = yoffset / info->iMCU_sample_height;
++  } else {
++    info->x_crop_offset = 0;
++    info->y_crop_offset = 0;
++  }
++
++  /* Figure out whether we need workspace arrays,
++   * and if so whether they are transposed relative to the source.
++   */
++  need_workspace = FALSE;
++  transpose_it = FALSE;
+   switch (info->transform) {
+   case JXFORM_NONE:
++    if (info->x_crop_offset != 0 || info->y_crop_offset != 0)
++      need_workspace = TRUE;
++    /* No workspace needed if neither cropping nor transforming */
++    break;
+   case JXFORM_FLIP_H:
+-    /* Don't need a workspace array */
++    if (info->trim)
++      trim_right_edge(info, srcinfo->output_width);
++    if (info->y_crop_offset != 0 || info->slow_hflip)
++      need_workspace = TRUE;
++    /* do_flip_h_no_crop doesn't need a workspace array */
+     break;
+   case JXFORM_FLIP_V:
+-  case JXFORM_ROT_180:
+-    /* Need workspace arrays having same dimensions as source image.
+-     * Note that we allocate arrays padded out to the next iMCU boundary,
+-     * so that transform routines need not worry about missing edge blocks.
+-     */
+-    coef_arrays = (jvirt_barray_ptr *)
+-      (*srcinfo->mem->alloc_small) ((j_common_ptr) srcinfo, JPOOL_IMAGE,
+-	SIZEOF(jvirt_barray_ptr) * info->num_components);
+-    for (ci = 0; ci < info->num_components; ci++) {
+-      compptr = srcinfo->comp_info + ci;
+-      coef_arrays[ci] = (*srcinfo->mem->request_virt_barray)
+-	((j_common_ptr) srcinfo, JPOOL_IMAGE, FALSE,
+-	 (JDIMENSION) jround_up((long) compptr->width_in_blocks,
+-				(long) compptr->h_samp_factor),
+-	 (JDIMENSION) jround_up((long) compptr->height_in_blocks,
+-				(long) compptr->v_samp_factor),
+-	 (JDIMENSION) compptr->v_samp_factor);
+-    }
++    if (info->trim)
++      trim_bottom_edge(info, srcinfo->output_height);
++    /* Need workspace arrays having same dimensions as source image. */
++    need_workspace = TRUE;
+     break;
+   case JXFORM_TRANSPOSE:
++    /* transpose does NOT have to trim anything */
++    /* Need workspace arrays having transposed dimensions. */
++    need_workspace = TRUE;
++    transpose_it = TRUE;
++    break;
+   case JXFORM_TRANSVERSE:
++    if (info->trim) {
++      trim_right_edge(info, srcinfo->output_height);
++      trim_bottom_edge(info, srcinfo->output_width);
++    }
++    /* Need workspace arrays having transposed dimensions. */
++    need_workspace = TRUE;
++    transpose_it = TRUE;
++    break;
+   case JXFORM_ROT_90:
++    if (info->trim)
++      trim_right_edge(info, srcinfo->output_height);
++    /* Need workspace arrays having transposed dimensions. */
++    need_workspace = TRUE;
++    transpose_it = TRUE;
++    break;
++  case JXFORM_ROT_180:
++    if (info->trim) {
++      trim_right_edge(info, srcinfo->output_width);
++      trim_bottom_edge(info, srcinfo->output_height);
++    }
++    /* Need workspace arrays having same dimensions as source image. */
++    need_workspace = TRUE;
++    break;
+   case JXFORM_ROT_270:
+-    /* Need workspace arrays having transposed dimensions.
+-     * Note that we allocate arrays padded out to the next iMCU boundary,
+-     * so that transform routines need not worry about missing edge blocks.
+-     */
++    if (info->trim)
++      trim_bottom_edge(info, srcinfo->output_width);
++    /* Need workspace arrays having transposed dimensions. */
++    need_workspace = TRUE;
++    transpose_it = TRUE;
++    break;
++  }
++
++  /* Allocate workspace if needed.
++   * Note that we allocate arrays padded out to the next iMCU boundary,
++   * so that transform routines need not worry about missing edge blocks.
++   */
++  if (need_workspace) {
+     coef_arrays = (jvirt_barray_ptr *)
+       (*srcinfo->mem->alloc_small) ((j_common_ptr) srcinfo, JPOOL_IMAGE,
+-	SIZEOF(jvirt_barray_ptr) * info->num_components);
++		SIZEOF(jvirt_barray_ptr) * info->num_components);
++    width_in_iMCUs = (JDIMENSION)
++      jdiv_round_up((long) info->output_width,
++		    (long) info->iMCU_sample_width);
++    height_in_iMCUs = (JDIMENSION)
++      jdiv_round_up((long) info->output_height,
++		    (long) info->iMCU_sample_height);
+     for (ci = 0; ci < info->num_components; ci++) {
+       compptr = srcinfo->comp_info + ci;
++      if (info->num_components == 1) {
++	/* we're going to force samp factors to 1x1 in this case */
++	h_samp_factor = v_samp_factor = 1;
++      } else if (transpose_it) {
++	h_samp_factor = compptr->v_samp_factor;
++	v_samp_factor = compptr->h_samp_factor;
++      } else {
++	h_samp_factor = compptr->h_samp_factor;
++	v_samp_factor = compptr->v_samp_factor;
++      }
++      width_in_blocks = width_in_iMCUs * h_samp_factor;
++      height_in_blocks = height_in_iMCUs * v_samp_factor;
+       coef_arrays[ci] = (*srcinfo->mem->request_virt_barray)
+ 	((j_common_ptr) srcinfo, JPOOL_IMAGE, FALSE,
+-	 (JDIMENSION) jround_up((long) compptr->height_in_blocks,
+-				(long) compptr->v_samp_factor),
+-	 (JDIMENSION) jround_up((long) compptr->width_in_blocks,
+-				(long) compptr->h_samp_factor),
+-	 (JDIMENSION) compptr->h_samp_factor);
++	 width_in_blocks, height_in_blocks, (JDIMENSION) v_samp_factor);
+     }
+-    break;
+-  }
+-  info->workspace_coef_arrays = coef_arrays;
++    info->workspace_coef_arrays = coef_arrays;
++  } else
++    info->workspace_coef_arrays = NULL;
++
++  return TRUE;
+ }
+ 
+ 
+@@ -642,13 +1134,18 @@ transpose_critical_parameters (j_compres
+   int tblno, i, j, ci, itemp;
+   jpeg_component_info *compptr;
+   JQUANT_TBL *qtblptr;
+-  JDIMENSION dtemp;
++  JDIMENSION jtemp;
+   UINT16 qtemp;
+ 
+-  /* Transpose basic image dimensions */
+-  dtemp = dstinfo->image_width;
++  /* Transpose image dimensions */
++  jtemp = dstinfo->image_width;
+   dstinfo->image_width = dstinfo->image_height;
+-  dstinfo->image_height = dtemp;
++  dstinfo->image_height = jtemp;
++#if JPEG_LIB_VERSION >= 70
++  itemp = dstinfo->min_DCT_h_scaled_size;
++  dstinfo->min_DCT_h_scaled_size = dstinfo->min_DCT_v_scaled_size;
++  dstinfo->min_DCT_v_scaled_size = itemp;
++#endif
+ 
+   /* Transpose sampling factors */
+   for (ci = 0; ci < dstinfo->num_components; ci++) {
+@@ -674,47 +1171,162 @@ transpose_critical_parameters (j_compres
+ }
+ 
+ 
+-/* Trim off any partial iMCUs on the indicated destination edge */
++/* Adjust Exif image parameters.
++ *
++ * We try to adjust the Tags ExifImageWidth and ExifImageHeight if possible.
++ */
+ 
++#if JPEG_LIB_VERSION >= 70
+ LOCAL(void)
+-trim_right_edge (j_compress_ptr dstinfo)
++adjust_exif_parameters (JOCTET FAR * data, unsigned int length,
++			JDIMENSION new_width, JDIMENSION new_height)
+ {
+-  int ci, max_h_samp_factor;
+-  JDIMENSION MCU_cols;
++  boolean is_motorola; /* Flag for byte order */
++  unsigned int number_of_tags, tagnum;
++  unsigned int firstoffset, offset;
++  JDIMENSION new_value;
++
++  if (length < 12) return; /* Length of an IFD entry */
++
++  /* Discover byte order */
++  if (GETJOCTET(data[0]) == 0x49 && GETJOCTET(data[1]) == 0x49)
++    is_motorola = FALSE;
++  else if (GETJOCTET(data[0]) == 0x4D && GETJOCTET(data[1]) == 0x4D)
++    is_motorola = TRUE;
++  else
++    return;
++
++  /* Check Tag Mark */
++  if (is_motorola) {
++    if (GETJOCTET(data[2]) != 0) return;
++    if (GETJOCTET(data[3]) != 0x2A) return;
++  } else {
++    if (GETJOCTET(data[3]) != 0) return;
++    if (GETJOCTET(data[2]) != 0x2A) return;
++  }
+ 
+-  /* We have to compute max_h_samp_factor ourselves,
+-   * because it hasn't been set yet in the destination
+-   * (and we don't want to use the source's value).
+-   */
+-  max_h_samp_factor = 1;
+-  for (ci = 0; ci < dstinfo->num_components; ci++) {
+-    int h_samp_factor = dstinfo->comp_info[ci].h_samp_factor;
+-    max_h_samp_factor = MAX(max_h_samp_factor, h_samp_factor);
++  /* Get first IFD offset (offset to IFD0) */
++  if (is_motorola) {
++    if (GETJOCTET(data[4]) != 0) return;
++    if (GETJOCTET(data[5]) != 0) return;
++    firstoffset = GETJOCTET(data[6]);
++    firstoffset <<= 8;
++    firstoffset += GETJOCTET(data[7]);
++  } else {
++    if (GETJOCTET(data[7]) != 0) return;
++    if (GETJOCTET(data[6]) != 0) return;
++    firstoffset = GETJOCTET(data[5]);
++    firstoffset <<= 8;
++    firstoffset += GETJOCTET(data[4]);
+   }
+-  MCU_cols = dstinfo->image_width / (max_h_samp_factor * DCTSIZE);
+-  if (MCU_cols > 0)		/* can't trim to 0 pixels */
+-    dstinfo->image_width = MCU_cols * (max_h_samp_factor * DCTSIZE);
+-}
++  if (firstoffset > length - 2) return; /* check end of data segment */
+ 
+-LOCAL(void)
+-trim_bottom_edge (j_compress_ptr dstinfo)
+-{
+-  int ci, max_v_samp_factor;
+-  JDIMENSION MCU_rows;
++  /* Get the number of directory entries contained in this IFD */
++  if (is_motorola) {
++    number_of_tags = GETJOCTET(data[firstoffset]);
++    number_of_tags <<= 8;
++    number_of_tags += GETJOCTET(data[firstoffset+1]);
++  } else {
++    number_of_tags = GETJOCTET(data[firstoffset+1]);
++    number_of_tags <<= 8;
++    number_of_tags += GETJOCTET(data[firstoffset]);
++  }
++  if (number_of_tags == 0) return;
++  firstoffset += 2;
+ 
+-  /* We have to compute max_v_samp_factor ourselves,
+-   * because it hasn't been set yet in the destination
+-   * (and we don't want to use the source's value).
+-   */
+-  max_v_samp_factor = 1;
+-  for (ci = 0; ci < dstinfo->num_components; ci++) {
+-    int v_samp_factor = dstinfo->comp_info[ci].v_samp_factor;
+-    max_v_samp_factor = MAX(max_v_samp_factor, v_samp_factor);
++  /* Search for ExifSubIFD offset Tag in IFD0 */
++  for (;;) {
++    if (firstoffset > length - 12) return; /* check end of data segment */
++    /* Get Tag number */
++    if (is_motorola) {
++      tagnum = GETJOCTET(data[firstoffset]);
++      tagnum <<= 8;
++      tagnum += GETJOCTET(data[firstoffset+1]);
++    } else {
++      tagnum = GETJOCTET(data[firstoffset+1]);
++      tagnum <<= 8;
++      tagnum += GETJOCTET(data[firstoffset]);
++    }
++    if (tagnum == 0x8769) break; /* found ExifSubIFD offset Tag */
++    if (--number_of_tags == 0) return;
++    firstoffset += 12;
++  }
++
++  /* Get the ExifSubIFD offset */
++  if (is_motorola) {
++    if (GETJOCTET(data[firstoffset+8]) != 0) return;
++    if (GETJOCTET(data[firstoffset+9]) != 0) return;
++    offset = GETJOCTET(data[firstoffset+10]);
++    offset <<= 8;
++    offset += GETJOCTET(data[firstoffset+11]);
++  } else {
++    if (GETJOCTET(data[firstoffset+11]) != 0) return;
++    if (GETJOCTET(data[firstoffset+10]) != 0) return;
++    offset = GETJOCTET(data[firstoffset+9]);
++    offset <<= 8;
++    offset += GETJOCTET(data[firstoffset+8]);
++  }
++  if (offset > length - 2) return; /* check end of data segment */
++
++  /* Get the number of directory entries contained in this SubIFD */
++  if (is_motorola) {
++    number_of_tags = GETJOCTET(data[offset]);
++    number_of_tags <<= 8;
++    number_of_tags += GETJOCTET(data[offset+1]);
++  } else {
++    number_of_tags = GETJOCTET(data[offset+1]);
++    number_of_tags <<= 8;
++    number_of_tags += GETJOCTET(data[offset]);
+   }
+-  MCU_rows = dstinfo->image_height / (max_v_samp_factor * DCTSIZE);
+-  if (MCU_rows > 0)		/* can't trim to 0 pixels */
+-    dstinfo->image_height = MCU_rows * (max_v_samp_factor * DCTSIZE);
++  if (number_of_tags < 2) return;
++  offset += 2;
++
++  /* Search for ExifImageWidth and ExifImageHeight Tags in this SubIFD */
++  do {
++    if (offset > length - 12) return; /* check end of data segment */
++    /* Get Tag number */
++    if (is_motorola) {
++      tagnum = GETJOCTET(data[offset]);
++      tagnum <<= 8;
++      tagnum += GETJOCTET(data[offset+1]);
++    } else {
++      tagnum = GETJOCTET(data[offset+1]);
++      tagnum <<= 8;
++      tagnum += GETJOCTET(data[offset]);
++    }
++    if (tagnum == 0xA002 || tagnum == 0xA003) {
++      if (tagnum == 0xA002)
++	new_value = new_width; /* ExifImageWidth Tag */
++      else
++	new_value = new_height; /* ExifImageHeight Tag */
++      if (is_motorola) {
++	data[offset+2] = 0; /* Format = unsigned long (4 octets) */
++	data[offset+3] = 4;
++	data[offset+4] = 0; /* Number Of Components = 1 */
++	data[offset+5] = 0;
++	data[offset+6] = 0;
++	data[offset+7] = 1;
++	data[offset+8] = 0;
++	data[offset+9] = 0;
++	data[offset+10] = (JOCTET)((new_value >> 8) & 0xFF);
++	data[offset+11] = (JOCTET)(new_value & 0xFF);
++      } else {
++	data[offset+2] = 4; /* Format = unsigned long (4 octets) */
++	data[offset+3] = 0;
++	data[offset+4] = 1; /* Number Of Components = 1 */
++	data[offset+5] = 0;
++	data[offset+6] = 0;
++	data[offset+7] = 0;
++	data[offset+8] = (JOCTET)(new_value & 0xFF);
++	data[offset+9] = (JOCTET)((new_value >> 8) & 0xFF);
++	data[offset+10] = 0;
++	data[offset+11] = 0;
++      }
++    }
++    offset += 12;
++  } while (--number_of_tags);
+ }
++#endif
+ 
+ 
+ /* Adjust output image parameters as needed.
+@@ -736,18 +1348,22 @@ jtransform_adjust_parameters (j_decompre
+ {
+   /* If force-to-grayscale is requested, adjust destination parameters */
+   if (info->force_grayscale) {
+-    /* We use jpeg_set_colorspace to make sure subsidiary settings get fixed
+-     * properly.  Among other things, the target h_samp_factor & v_samp_factor
+-     * will get set to 1, which typically won't match the source.
+-     * In fact we do this even if the source is already grayscale; that
+-     * provides an easy way of coercing a grayscale JPEG with funny sampling
+-     * factors to the customary 1,1.  (Some decoders fail on other factors.)
++    /* First, ensure we have YCbCr or grayscale data, and that the source's
++     * Y channel is full resolution.  (No reasonable person would make Y
++     * be less than full resolution, so actually coping with that case
++     * isn't worth extra code space.  But we check it to avoid crashing.)
+      */
+-    if ((dstinfo->jpeg_color_space == JCS_YCbCr &&
+-	 dstinfo->num_components == 3) ||
+-	(dstinfo->jpeg_color_space == JCS_GRAYSCALE &&
+-	 dstinfo->num_components == 1)) {
+-      /* We have to preserve the source's quantization table number. */
++    if (((dstinfo->jpeg_color_space == JCS_YCbCr &&
++	  dstinfo->num_components == 3) ||
++	 (dstinfo->jpeg_color_space == JCS_GRAYSCALE &&
++	  dstinfo->num_components == 1)) &&
++	srcinfo->comp_info[0].h_samp_factor == srcinfo->max_h_samp_factor &&
++	srcinfo->comp_info[0].v_samp_factor == srcinfo->max_v_samp_factor) {
++      /* We use jpeg_set_colorspace to make sure subsidiary settings get fixed
++       * properly.  Among other things, it sets the target h_samp_factor &
++       * v_samp_factor to 1, which typically won't match the source.
++       * We have to preserve the source's quantization table number, however.
++       */
+       int sv_quant_tbl_no = dstinfo->comp_info[0].quant_tbl_no;
+       jpeg_set_colorspace(dstinfo, JCS_GRAYSCALE);
+       dstinfo->comp_info[0].quant_tbl_no = sv_quant_tbl_no;
+@@ -755,50 +1371,66 @@ jtransform_adjust_parameters (j_decompre
+       /* Sorry, can't do it */
+       ERREXIT(dstinfo, JERR_CONVERSION_NOTIMPL);
+     }
++  } else if (info->num_components == 1) {
++    /* For a single-component source, we force the destination sampling factors
++     * to 1x1, with or without force_grayscale.  This is useful because some
++     * decoders choke on grayscale images with other sampling factors.
++     */
++    dstinfo->comp_info[0].h_samp_factor = 1;
++    dstinfo->comp_info[0].v_samp_factor = 1;
+   }
+ 
+-  /* Correct the destination's image dimensions etc if necessary */
++  /* Correct the destination's image dimensions as necessary
++   * for rotate/flip, resize, and crop operations.
++   */
++#if JPEG_LIB_VERSION >= 70
++  dstinfo->jpeg_width = info->output_width;
++  dstinfo->jpeg_height = info->output_height;
++#endif
++
++  /* Transpose destination image parameters */
+   switch (info->transform) {
+-  case JXFORM_NONE:
+-    /* Nothing to do */
+-    break;
+-  case JXFORM_FLIP_H:
+-    if (info->trim)
+-      trim_right_edge(dstinfo);
+-    break;
+-  case JXFORM_FLIP_V:
+-    if (info->trim)
+-      trim_bottom_edge(dstinfo);
+-    break;
+   case JXFORM_TRANSPOSE:
+-    transpose_critical_parameters(dstinfo);
+-    /* transpose does NOT have to trim anything */
+-    break;
+   case JXFORM_TRANSVERSE:
+-    transpose_critical_parameters(dstinfo);
+-    if (info->trim) {
+-      trim_right_edge(dstinfo);
+-      trim_bottom_edge(dstinfo);
+-    }
+-    break;
+   case JXFORM_ROT_90:
+-    transpose_critical_parameters(dstinfo);
+-    if (info->trim)
+-      trim_right_edge(dstinfo);
+-    break;
+-  case JXFORM_ROT_180:
+-    if (info->trim) {
+-      trim_right_edge(dstinfo);
+-      trim_bottom_edge(dstinfo);
+-    }
+-    break;
+   case JXFORM_ROT_270:
++#if JPEG_LIB_VERSION < 70
++    dstinfo->image_width = info->output_height;
++    dstinfo->image_height = info->output_width;
++#endif
+     transpose_critical_parameters(dstinfo);
+-    if (info->trim)
+-      trim_bottom_edge(dstinfo);
++    break;
++  default:
++#if JPEG_LIB_VERSION < 70
++    dstinfo->image_width = info->output_width;
++    dstinfo->image_height = info->output_height;
++#endif
+     break;
+   }
+ 
++  /* Adjust Exif properties */
++  if (srcinfo->marker_list != NULL &&
++      srcinfo->marker_list->marker == JPEG_APP0+1 &&
++      srcinfo->marker_list->data_length >= 6 &&
++      GETJOCTET(srcinfo->marker_list->data[0]) == 0x45 &&
++      GETJOCTET(srcinfo->marker_list->data[1]) == 0x78 &&
++      GETJOCTET(srcinfo->marker_list->data[2]) == 0x69 &&
++      GETJOCTET(srcinfo->marker_list->data[3]) == 0x66 &&
++      GETJOCTET(srcinfo->marker_list->data[4]) == 0 &&
++      GETJOCTET(srcinfo->marker_list->data[5]) == 0) {
++    /* Suppress output of JFIF marker */
++    dstinfo->write_JFIF_header = FALSE;
++#if JPEG_LIB_VERSION >= 70
++    /* Adjust Exif image parameters */
++    if (dstinfo->jpeg_width != srcinfo->image_width ||
++	dstinfo->jpeg_height != srcinfo->image_height)
++      /* Align data segment to start of TIFF structure for parsing */
++      adjust_exif_parameters(srcinfo->marker_list->data + 6,
++	srcinfo->marker_list->data_length - 6,
++	dstinfo->jpeg_width, dstinfo->jpeg_height);
++#endif
++  }
++
+   /* Return the appropriate output data set */
+   if (info->workspace_coef_arrays != NULL)
+     return info->workspace_coef_arrays;
+@@ -816,40 +1448,110 @@ jtransform_adjust_parameters (j_decompre
+  */
+ 
+ GLOBAL(void)
+-jtransform_execute_transformation (j_decompress_ptr srcinfo,
+-				   j_compress_ptr dstinfo,
+-				   jvirt_barray_ptr *src_coef_arrays,
+-				   jpeg_transform_info *info)
++jtransform_execute_transform (j_decompress_ptr srcinfo,
++			      j_compress_ptr dstinfo,
++			      jvirt_barray_ptr *src_coef_arrays,
++			      jpeg_transform_info *info)
+ {
+   jvirt_barray_ptr *dst_coef_arrays = info->workspace_coef_arrays;
+ 
++  /* Note: conditions tested here should match those in switch statement
++   * in jtransform_request_workspace()
++   */
+   switch (info->transform) {
+   case JXFORM_NONE:
++    if (info->x_crop_offset != 0 || info->y_crop_offset != 0)
++      do_crop(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset,
++	      src_coef_arrays, dst_coef_arrays);
+     break;
+   case JXFORM_FLIP_H:
+-    do_flip_h(srcinfo, dstinfo, src_coef_arrays);
++    if (info->y_crop_offset != 0 || info->slow_hflip)
++      do_flip_h(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset,
++		src_coef_arrays, dst_coef_arrays);
++    else
++      do_flip_h_no_crop(srcinfo, dstinfo, info->x_crop_offset,
++			src_coef_arrays);
+     break;
+   case JXFORM_FLIP_V:
+-    do_flip_v(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays);
++    do_flip_v(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset,
++	      src_coef_arrays, dst_coef_arrays);
+     break;
+   case JXFORM_TRANSPOSE:
+-    do_transpose(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays);
++    do_transpose(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset,
++		 src_coef_arrays, dst_coef_arrays);
+     break;
+   case JXFORM_TRANSVERSE:
+-    do_transverse(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays);
++    do_transverse(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset,
++		  src_coef_arrays, dst_coef_arrays);
+     break;
+   case JXFORM_ROT_90:
+-    do_rot_90(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays);
++    do_rot_90(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset,
++	      src_coef_arrays, dst_coef_arrays);
+     break;
+   case JXFORM_ROT_180:
+-    do_rot_180(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays);
++    do_rot_180(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset,
++	       src_coef_arrays, dst_coef_arrays);
+     break;
+   case JXFORM_ROT_270:
+-    do_rot_270(srcinfo, dstinfo, src_coef_arrays, dst_coef_arrays);
++    do_rot_270(srcinfo, dstinfo, info->x_crop_offset, info->y_crop_offset,
++	       src_coef_arrays, dst_coef_arrays);
+     break;
+   }
+ }
+ 
++/* jtransform_perfect_transform
++ *
++ * Determine whether lossless transformation is perfectly
++ * possible for a specified image and transformation.
++ *
++ * Inputs:
++ *   image_width, image_height: source image dimensions.
++ *   MCU_width, MCU_height: pixel dimensions of MCU.
++ *   transform: transformation identifier.
++ * Parameter sources from initialized jpeg_struct
++ * (after reading source header):
++ *   image_width = cinfo.image_width
++ *   image_height = cinfo.image_height
++ *   MCU_width = cinfo.max_h_samp_factor * cinfo.block_size
++ *   MCU_height = cinfo.max_v_samp_factor * cinfo.block_size
++ * Result:
++ *   TRUE = perfect transformation possible
++ *   FALSE = perfect transformation not possible
++ *           (may use custom action then)
++ */
++
++GLOBAL(boolean)
++jtransform_perfect_transform(JDIMENSION image_width, JDIMENSION image_height,
++			     int MCU_width, int MCU_height,
++			     JXFORM_CODE transform)
++{
++  boolean result = TRUE; /* initialize TRUE */
++
++  switch (transform) {
++  case JXFORM_FLIP_H:
++  case JXFORM_ROT_270:
++    if (image_width % (JDIMENSION) MCU_width)
++      result = FALSE;
++    break;
++  case JXFORM_FLIP_V:
++  case JXFORM_ROT_90:
++    if (image_height % (JDIMENSION) MCU_height)
++      result = FALSE;
++    break;
++  case JXFORM_TRANSVERSE:
++  case JXFORM_ROT_180:
++    if (image_width % (JDIMENSION) MCU_width)
++      result = FALSE;
++    if (image_height % (JDIMENSION) MCU_height)
++      result = FALSE;
++    break;
++  default:
++    break;
++  }
++
++  return result;
++}
++
+ #endif /* TRANSFORMS_SUPPORTED */
+ 
+ 
+Index: fbida-2.10/jpeg/62/transupp.h
+===================================================================
+--- fbida-2.10.orig/jpeg/62/transupp.h
++++ fbida-2.10/jpeg/62/transupp.h
+@@ -1,7 +1,7 @@
+ /*
+  * transupp.h
+  *
+- * Copyright (C) 1997, Thomas G. Lane.
++ * Copyright (C) 1997-2011, Thomas G. Lane, Guido Vollbeding.
+  * This file is part of the Independent JPEG Group's software.
+  * For conditions of distribution and use, see the accompanying README file.
+  *
+@@ -22,32 +22,6 @@
+ #define TRANSFORMS_SUPPORTED 1		/* 0 disables transform code */
+ #endif
+ 
+-/* Short forms of external names for systems with brain-damaged linkers. */
+-
+-#ifdef NEED_SHORT_EXTERNAL_NAMES
+-#define jtransform_request_workspace		jTrRequest
+-#define jtransform_adjust_parameters		jTrAdjust
+-#define jtransform_execute_transformation	jTrExec
+-#define jcopy_markers_setup			jCMrkSetup
+-#define jcopy_markers_execute			jCMrkExec
+-#endif /* NEED_SHORT_EXTERNAL_NAMES */
+-
+-
+-/*
+- * Codes for supported types of image transformations.
+- */
+-
+-typedef enum {
+-	JXFORM_NONE,		/* no transformation */
+-	JXFORM_FLIP_H,		/* horizontal flip */
+-	JXFORM_FLIP_V,		/* vertical flip */
+-	JXFORM_TRANSPOSE,	/* transpose across UL-to-LR axis */
+-	JXFORM_TRANSVERSE,	/* transpose across UR-to-LL axis */
+-	JXFORM_ROT_90,		/* 90-degree clockwise rotation */
+-	JXFORM_ROT_180,		/* 180-degree rotation */
+-	JXFORM_ROT_270		/* 270-degree clockwise (or 90 ccw) */
+-} JXFORM_CODE;
+-
+ /*
+  * Although rotating and flipping data expressed as DCT coefficients is not
+  * hard, there is an asymmetry in the JPEG format specification for images
+@@ -75,6 +49,25 @@ typedef enum {
+  * (For example, -rot 270 -trim trims only the bottom edge, but -rot 90 -trim
+  * followed by -rot 180 -trim trims both edges.)
+  *
++ * We also offer a lossless-crop option, which discards data outside a given
++ * image region but losslessly preserves what is inside.  Like the rotate and
++ * flip transforms, lossless crop is restricted by the JPEG format: the upper
++ * left corner of the selected region must fall on an iMCU boundary.  If this
++ * does not hold for the given crop parameters, we silently move the upper left
++ * corner up and/or left to make it so, simultaneously increasing the region
++ * dimensions to keep the lower right crop corner unchanged.  (Thus, the
++ * output image covers at least the requested region, but may cover more.)
++ * The adjustment of the region dimensions may be optionally disabled.
++ *
++ * We also provide a lossless-resize option, which is kind of a lossless-crop
++ * operation in the DCT coefficient block domain - it discards higher-order
++ * coefficients and losslessly preserves lower-order coefficients of a
++ * sub-block.
++ *
++ * Rotate/flip transform, resize, and crop can be requested together in a
++ * single invocation.  The crop is applied last --- that is, the crop region
++ * is specified in terms of the destination image after transform/resize.
++ *
+  * We also offer a "force to grayscale" option, which simply discards the
+  * chrominance channels of a YCbCr image.  This is lossless in the sense that
+  * the luminance channel is preserved exactly.  It's not the same kind of
+@@ -83,22 +76,100 @@ typedef enum {
+  * be aware of the option to know how many components to work on.
+  */
+ 
++
++/* Short forms of external names for systems with brain-damaged linkers. */
++
++#ifdef NEED_SHORT_EXTERNAL_NAMES
++#define jtransform_parse_crop_spec	jTrParCrop
++#define jtransform_request_workspace	jTrRequest
++#define jtransform_adjust_parameters	jTrAdjust
++#define jtransform_execute_transform	jTrExec
++#define jtransform_perfect_transform	jTrPerfect
++#define jcopy_markers_setup		jCMrkSetup
++#define jcopy_markers_execute		jCMrkExec
++#endif /* NEED_SHORT_EXTERNAL_NAMES */
++
++
++/*
++ * Codes for supported types of image transformations.
++ */
++
++typedef enum {
++	JXFORM_NONE,		/* no transformation */
++	JXFORM_FLIP_H,		/* horizontal flip */
++	JXFORM_FLIP_V,		/* vertical flip */
++	JXFORM_TRANSPOSE,	/* transpose across UL-to-LR axis */
++	JXFORM_TRANSVERSE,	/* transpose across UR-to-LL axis */
++	JXFORM_ROT_90,		/* 90-degree clockwise rotation */
++	JXFORM_ROT_180,		/* 180-degree rotation */
++	JXFORM_ROT_270		/* 270-degree clockwise (or 90 ccw) */
++} JXFORM_CODE;
++
++/*
++ * Codes for crop parameters, which can individually be unspecified,
++ * positive or negative for xoffset or yoffset,
++ * positive or forced for width or height.
++ */
++
++typedef enum {
++        JCROP_UNSET,
++        JCROP_POS,
++        JCROP_NEG,
++        JCROP_FORCE
++} JCROP_CODE;
++
++/*
++ * Transform parameters struct.
++ * NB: application must not change any elements of this struct after
++ * calling jtransform_request_workspace.
++ */
++
+ typedef struct {
+   /* Options: set by caller */
+   JXFORM_CODE transform;	/* image transform operator */
++  boolean perfect;		/* if TRUE, fail if partial MCUs are requested */
+   boolean trim;			/* if TRUE, trim partial MCUs as needed */
+   boolean force_grayscale;	/* if TRUE, convert color image to grayscale */
++  boolean crop;			/* if TRUE, crop source image */
++  boolean slow_hflip;  /* For best performance, the JXFORM_FLIP_H transform
++                          normally modifies the source coefficients in place.
++                          Setting this to TRUE will instead use a slower,
++                          double-buffered algorithm, which leaves the source
++                          coefficients in tact (necessary if other transformed
++                          images must be generated from the same set of
++                          coefficients. */
++
++  /* Crop parameters: application need not set these unless crop is TRUE.
++   * These can be filled in by jtransform_parse_crop_spec().
++   */
++  JDIMENSION crop_width;	/* Width of selected region */
++  JCROP_CODE crop_width_set;	/* (forced disables adjustment) */
++  JDIMENSION crop_height;	/* Height of selected region */
++  JCROP_CODE crop_height_set;	/* (forced disables adjustment) */
++  JDIMENSION crop_xoffset;	/* X offset of selected region */
++  JCROP_CODE crop_xoffset_set;	/* (negative measures from right edge) */
++  JDIMENSION crop_yoffset;	/* Y offset of selected region */
++  JCROP_CODE crop_yoffset_set;	/* (negative measures from bottom edge) */
+ 
+   /* Internal workspace: caller should not touch these */
+   int num_components;		/* # of components in workspace */
+   jvirt_barray_ptr * workspace_coef_arrays; /* workspace for transformations */
++  JDIMENSION output_width;	/* cropped destination dimensions */
++  JDIMENSION output_height;
++  JDIMENSION x_crop_offset;	/* destination crop offsets measured in iMCUs */
++  JDIMENSION y_crop_offset;
++  int iMCU_sample_width;	/* destination iMCU size */
++  int iMCU_sample_height;
+ } jpeg_transform_info;
+ 
+ 
+ #if TRANSFORMS_SUPPORTED
+ 
++/* Parse a crop specification (written in X11 geometry style) */
++EXTERN(boolean) jtransform_parse_crop_spec
++	JPP((jpeg_transform_info *info, const char *spec));
+ /* Request any required workspace */
+-EXTERN(void) jtransform_request_workspace
++EXTERN(boolean) jtransform_request_workspace
+ 	JPP((j_decompress_ptr srcinfo, jpeg_transform_info *info));
+ /* Adjust output image parameters */
+ EXTERN(jvirt_barray_ptr *) jtransform_adjust_parameters
+@@ -106,10 +177,24 @@ EXTERN(jvirt_barray_ptr *) jtransform_ad
+ 	     jvirt_barray_ptr *src_coef_arrays,
+ 	     jpeg_transform_info *info));
+ /* Execute the actual transformation, if any */
+-EXTERN(void) jtransform_execute_transformation
++EXTERN(void) jtransform_execute_transform
+ 	JPP((j_decompress_ptr srcinfo, j_compress_ptr dstinfo,
+ 	     jvirt_barray_ptr *src_coef_arrays,
+ 	     jpeg_transform_info *info));
++/* Determine whether lossless transformation is perfectly
++ * possible for a specified image and transformation.
++ */
++EXTERN(boolean) jtransform_perfect_transform
++	JPP((JDIMENSION image_width, JDIMENSION image_height,
++	     int MCU_width, int MCU_height,
++	     JXFORM_CODE transform));
++
++/* jtransform_execute_transform used to be called
++ * jtransform_execute_transformation, but some compilers complain about
++ * routine names that long.  This macro is here to avoid breaking any
++ * old source code that uses the original name...
++ */
++#define jtransform_execute_transformation	jtransform_execute_transform
+ 
+ #endif /* TRANSFORMS_SUPPORTED */
+ 
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/fbida/files/use-jpeg-turbo.patch b/import-layers/meta-openembedded/meta-oe/recipes-graphics/fbida/files/use-jpeg-turbo.patch
new file mode 100644
index 0000000..9963955
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/fbida/files/use-jpeg-turbo.patch
@@ -0,0 +1,13 @@
+Index: fbida-2.10/GNUmakefile
+===================================================================
+--- fbida-2.10.orig/GNUmakefile
++++ fbida-2.10/GNUmakefile
+@@ -51,7 +51,7 @@ HAVE_LIBSANE	:= $(call ac_lib,sane_init,
+ HAVE_LIBCURL	:= $(call ac_lib,curl_easy_init,curl)
+ HAVE_LIBLIRC	:= $(call ac_lib,lirc_init,lirc_client)
+ HAVE_MOTIF	:= $(call ac_lib,XmStringGenerate,Xm,-L/usr/X11R6/$(LIB) -lXpm -lXt -lXext -lX11)
+-JPEG_VER        := $(call ac_jpeg_ver)
++JPEG_VER        := 62
+ endef
+ 
+ # transposing
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/fim/fim_0.4-rc1.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/fim/fim_0.4-rc1.bb
index 90ac702..7d1a3aa 100644
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/fim/fim_0.4-rc1.bb
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/fim/fim_0.4-rc1.bb
@@ -8,7 +8,7 @@
 LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://COPYING;md5=fa01bff138cc98a62b8840a157951c88"
 
-PNBLACKLIST[fim] ?= "BROKEN: doesn't build with B!=S (flex: can't open lex.lex)"
+PNBLACKLIST[fim] ?= "BROKEN: doesn't build with B!=S (flex: can't open lex.lex) - the recipe will be removed on 2017-09-01 unless the issue is fixed"
 
 # flex with provide /usr/include/FlexLexer.h
 DEPENDS = "flex-native bison-native flex"
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/fontforge/fontforge_20150824.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/fontforge/fontforge_20161012.bb
similarity index 91%
rename from import-layers/meta-openembedded/meta-oe/recipes-graphics/fontforge/fontforge_20150824.bb
rename to import-layers/meta-openembedded/meta-oe/recipes-graphics/fontforge/fontforge_20161012.bb
index 544149d..1c3376d 100644
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/fontforge/fontforge_20150824.bb
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/fontforge/fontforge_20161012.bb
@@ -9,13 +9,13 @@
 DEPENDS = "glib-2.0 pango giflib tiff libxml2 jpeg python libtool uthash gnulib"
 DEPENDS_append_class-target = " libxi"
 
-inherit autotools pkgconfig pythonnative distro_features_check
+inherit autotools pkgconfig pythonnative distro_features_check gettext
 
 REQUIRED_DISTRO_FEATURES_append_class-target = " x11"
 
 SRC_URI = "git://github.com/${BPN}/${BPN}.git"
-# tag 20150824
-SRCREV = "07d5ccff2704f8a56f1b3cc6695a4e31f85f88e6"
+# tag 20161012
+SRCREV = "072edb0235cd163d6c3391da9cc3754c3c66f47a"
 S = "${WORKDIR}/git"
 
 EXTRA_OECONF_append_class-native = " with_x=no"
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/gegl/gegl_0.3.4.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/gegl/gegl_0.3.4.bb
index 9de8489..90f0216 100644
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/gegl/gegl_0.3.4.bb
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/gegl/gegl_0.3.4.bb
@@ -19,6 +19,8 @@
 SRC_URI[md5sum] = "c19478321594d715a4cb324a0decda6f"
 SRC_URI[sha256sum] = "846290a790854d1e6b7c17a2d6f82ad7cb14c72e240bd3b81b98cc0ceddbc3ec"
 
+LDFLAGS += "-lm"
+
 # There are a couple of non-symlink .so files installed into libdir, which need to go into main package
 FILES_${PN}_append = " ${libdir}/gegl-0.3/*.so ${libdir}/gegl-0.3/*.json ${libdir}/libgegl-npd-0.3.so ${libdir}/libgegl-sc-0.3.so"
 FILES_${PN}-dev_append = " ${libdir}/gegl-0.3/*.la ${libdir}/libgegl-0.3.so"
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/gimp/gimp_2.8.18.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/gimp/gimp_2.8.20.bb
similarity index 86%
rename from import-layers/meta-openembedded/meta-oe/recipes-graphics/gimp/gimp_2.8.18.bb
rename to import-layers/meta-openembedded/meta-oe/recipes-graphics/gimp/gimp_2.8.20.bb
index 1f83523..9588ab0 100644
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/gimp/gimp_2.8.18.bb
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/gimp/gimp_2.8.20.bb
@@ -7,6 +7,7 @@
 DEPENDS = " \
     gdk-pixbuf-native \
     intltool-native \
+    libxslt-native \
     gtk+ \
     babl \
     gegl \
@@ -20,6 +21,7 @@
     jasper \
     bzip2 \
     libgudev \
+    libmng \
 "
 DEPENDS += "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'libxmu libxpm', '', d)}"
 
@@ -30,8 +32,8 @@
     file://0001-configure-ac-do-not-check-for-freetype-config.patch \
     file://bump_Babl-GEGL_versions.patch \
 "
-SRC_URI[md5sum] = "5adaa11a68bc8a42bb2c778fee4d389c"
-SRC_URI[sha256sum] = "39dd2247c678deaf5cc664397d3c6bd4fb910d3472290fd54b52b441b5815441"
+SRC_URI[md5sum] = "d405640c426b234d6efc36fb4f5bae57"
+SRC_URI[sha256sum] = "939ca1df70be865c672ffd654f4e20f188121d01601c5c90237214101533c805"
 
 EXTRA_OECONF = "--disable-python \
                 --without-webkit \
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/glcompbench/glcompbench/0001-waf-Disable-errors-due-to-Wdeprecated.patch b/import-layers/meta-openembedded/meta-oe/recipes-graphics/glcompbench/glcompbench/0001-waf-Disable-errors-due-to-Wdeprecated.patch
new file mode 100644
index 0000000..deb6016
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/glcompbench/glcompbench/0001-waf-Disable-errors-due-to-Wdeprecated.patch
@@ -0,0 +1,31 @@
+From 49297e2fbe0420a255cbe67989d0ec539125412c Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sun, 23 Apr 2017 10:38:24 -0700
+Subject: [PATCH] waf: Disable errors due to -Wdeprecated
+
+throw() has been deprecated in c++11 and removed
+from c++17, gcc7 is more pedandic about this warning
+we therefore add a workaround to ignore this warning
+for now.
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ wscript | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/wscript b/wscript
+index 485a9fb..7f59761 100644
+--- a/wscript
++++ b/wscript
+@@ -79,7 +79,7 @@ def configure(ctx):
+             ctx.check_cfg(package = pkg, uselib_store = uselib, args = '--cflags --libs',
+                           mandatory = True)
+ 
+-    ctx.env.append_unique('CXXFLAGS', '-Wall -Werror -std=c++11 -Wextra'.split(' '))
++    ctx.env.append_unique('CXXFLAGS', '-Wall -Werror -std=c++11 -Wextra -Wno-error=deprecated'.split(' '))
+ 
+     # Prepend -O# and -g flags so that they can be overriden by the CFLAGS environment variable
+     if Options.options.opt:
+-- 
+2.12.2
+
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/glcompbench/glcompbench_2012.08.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/glcompbench/glcompbench_2012.08.bb
index 7cf9692..e846585 100755
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/glcompbench/glcompbench_2012.08.bb
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/glcompbench/glcompbench_2012.08.bb
@@ -11,7 +11,8 @@
            file://Fix_space_issues.patch \
            file://Fix_auto_ptr_deprecated.patch \
            file://0001-build-Specify-std-c-11-on-cmdline.patch \
-"
+           file://0001-waf-Disable-errors-due-to-Wdeprecated.patch \
+           "
 
 SRC_URI[md5sum] = "c939d9156fe940960098f38707fea827"
 SRC_URI[sha256sum] = "b04b738cec06c6786ceafa86e4735fd8b971c078265754854ef356b0379542ee"
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/glm/glm_0.9.8.4.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/glm/glm_0.9.8.4.bb
new file mode 100644
index 0000000..2d2e9ad
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/glm/glm_0.9.8.4.bb
@@ -0,0 +1,22 @@
+SUMMARY = "OpenGL Mathematics Library"
+DESCRIPTION = "OpenGL Mathematics (GLM) is a header only C++ \
+mathematics library for graphics software based on the OpenGL \
+Shading Language (GLSL) specifications."
+HOMEPAGE = "https://glm.g-truc.net"
+BUGTRACKER = "https://github.com/g-truc/glm/issues"
+
+SECTION = "libs"
+
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://copying.txt;md5=4431606d144252143c9c3df384a74cad"
+
+SRC_URI = "git://github.com/g-truc/glm;protocol=https"
+
+SRCREV = "5dcc56489e1b66dfd5bca751fa9b8dc68059e008"
+
+S = "${WORKDIR}/git"
+
+inherit cmake
+
+FILES_${PN}-dev += "${libdir}/cmake"
+RDEPENDS_${PN}-dev = ""
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/gphoto2/libgphoto2-2.5.8/0001-scripts-remove-bashisms.patch b/import-layers/meta-openembedded/meta-oe/recipes-graphics/gphoto2/libgphoto2-2.5.8/0001-scripts-remove-bashisms.patch
new file mode 100644
index 0000000..0e0dc87
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/gphoto2/libgphoto2-2.5.8/0001-scripts-remove-bashisms.patch
@@ -0,0 +1,149 @@
+From c00e63e97d8718836ba011d9172128732eecf001 Mon Sep 17 00:00:00 2001
+From: Ismo Puustinen <ismo.puustinen@intel.com>
+Date: Tue, 24 Jan 2017 22:24:05 +0200
+Subject: [PATCH] scripts: remove bashisms.
+
+Convert bash scripts to more generic shell scripts. This removes the
+strict bash dependency and the scripts should now run with any posix
+shell. Also fix the issues reported by shellcheck while at it.
+
+Upstream-status: Accepted [https://github.com/gphoto/libgphoto2/commit/39b4395532058c0edb9a56d0ff04e48a472e4743]
+
+---
+ packaging/generic/check-ptp-camera          | 12 ++++++------
+ packaging/linux-hotplug/gphoto-set-procperm | 14 +++++++-------
+ packaging/linux-hotplug/usbcam.console      |  4 ++--
+ packaging/linux-hotplug/usbcam.group        |  2 +-
+ packaging/linux-hotplug/usbcam.user         |  2 +-
+ packaging/linux-hotplug/usbcam.x11-app      |  4 ++--
+ 6 files changed, 19 insertions(+), 19 deletions(-)
+
+diff --git a/packaging/generic/check-ptp-camera b/packaging/generic/check-ptp-camera
+index 1793fc8..bc3c6ac 100644
+--- a/packaging/generic/check-ptp-camera
++++ b/packaging/generic/check-ptp-camera
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/bin/sh
+ # This program is free software; you can redistribute it and/or
+ # modify it under the terms of the GNU Lesser General Public
+ # License as published by the Free Software Foundation; either
+@@ -20,13 +20,13 @@ INTERFACE="${1:-06/01/01}"
+ 
+ BASENAME=${DEVPATH##*/}
+ for d in /sys/${DEVPATH}/${BASENAME}:*; do
+-	[[ -d ${d} ]] || continue
+-	INTERFACEID="$(< ${d}/bInterfaceClass)"
+-	INTERFACEID="${INTERFACEID}/$(< ${d}/bInterfaceSubClass)"
+-	INTERFACEID="${INTERFACEID}/$(< ${d}/bInterfaceProtocol)"
++	[ -d "${d}" ] || continue
++	INTERFACEID="$(cat "${d}"/bInterfaceClass)"
++	INTERFACEID="${INTERFACEID}/$(cat "${d}"/bInterfaceSubClass)"
++	INTERFACEID="${INTERFACEID}/$(cat "${d}"/bInterfaceProtocol)"
+ 
+ 	#echo ${d}: ${INTERFACEID}
+-	if [[ ${INTERFACE} == ${INTERFACEID} ]]; then
++	if [ "${INTERFACE}" = "${INTERFACEID}" ]; then
+ 		# Found interface
+ 		exit 0
+ 	fi
+diff --git a/packaging/linux-hotplug/gphoto-set-procperm b/packaging/linux-hotplug/gphoto-set-procperm
+index d72ee68..977cbf5 100644
+--- a/packaging/linux-hotplug/gphoto-set-procperm
++++ b/packaging/linux-hotplug/gphoto-set-procperm
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/bin/sh
+ # This program is free software; you can redistribute it and/or
+ # modify it under the terms of the GNU Lesser General Public
+ # License as published by the Free Software Foundation; either
+@@ -18,22 +18,22 @@
+ # This is taken from Fedora Core gphoto2 package.
+ # http://cvs.fedora.redhat.com/viewcvs/*checkout*/devel/gphoto2/gphoto-set-procperm
+ 
+-console_user=`cat /var/run/console/console.lock` 
++console_user=$(cat /var/run/console/console.lock)
+ 
+ if [ -z "$console_user" ] ; then
+   exit 1 
+ fi
+ 
+-if [ -z "$HAL_PROP_USB_BUS_NUMBER" -o -z "$HAL_PROP_USB_LINUX_DEVICE_NUMBER" ] ; then
++if [ -z "$HAL_PROP_USB_BUS_NUMBER" ] || [ -z "$HAL_PROP_USB_LINUX_DEVICE_NUMBER" ] ; then
+   exit 1 
+ fi
+ 
+-if [ $HAL_PROP_USB_BUS_NUMBER -lt 0 -o  $HAL_PROP_USB_LINUX_DEVICE_NUMBER -lt 0 ] ; then
++if [ "$HAL_PROP_USB_BUS_NUMBER" -lt 0 ] || [ "$HAL_PROP_USB_LINUX_DEVICE_NUMBER" -lt 0 ] ; then
+   exit 1 
+ fi
+ 
+ 
+-bus_num=`printf %.3u $HAL_PROP_USB_BUS_NUMBER`
+-dev_num=`printf %.3u $HAL_PROP_USB_LINUX_DEVICE_NUMBER`
++bus_num=$(printf %.3u "$HAL_PROP_USB_BUS_NUMBER")
++dev_num=$(printf %.3u "$HAL_PROP_USB_LINUX_DEVICE_NUMBER")
+ 
+-chown $console_user /proc/bus/usb/$bus_num/$dev_num 
++chown "$console_user" /proc/bus/usb/"$bus_num"/"$dev_num"
+diff --git a/packaging/linux-hotplug/usbcam.console b/packaging/linux-hotplug/usbcam.console
+index d72128f..7ac6dc5 100755
+--- a/packaging/linux-hotplug/usbcam.console
++++ b/packaging/linux-hotplug/usbcam.console
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/bin/sh
+ # This program is free software; you can redistribute it and/or
+ # modify it under the terms of the GNU Lesser General Public
+ # License as published by the Free Software Foundation; either
+@@ -50,7 +50,7 @@ then
+         /var/lock/console.lock
+     do
+         if [ -f "$conlock" ]; then
+-	    CONSOLEOWNER=`cat $conlock`
++            CONSOLEOWNER=$(cat $conlock)
+         fi
+     done
+     if [ -n "$CONSOLEOWNER" ]
+diff --git a/packaging/linux-hotplug/usbcam.group b/packaging/linux-hotplug/usbcam.group
+index f96c33d..8761fac 100755
+--- a/packaging/linux-hotplug/usbcam.group
++++ b/packaging/linux-hotplug/usbcam.group
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/bin/sh
+ # This program is free software; you can redistribute it and/or
+ # modify it under the terms of the GNU Lesser General Public
+ # License as published by the Free Software Foundation; either
+diff --git a/packaging/linux-hotplug/usbcam.user b/packaging/linux-hotplug/usbcam.user
+index c46f155..a3ba71a 100644
+--- a/packaging/linux-hotplug/usbcam.user
++++ b/packaging/linux-hotplug/usbcam.user
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/bin/sh
+ # This program is free software; you can redistribute it and/or
+ # modify it under the terms of the GNU Lesser General Public
+ # License as published by the Free Software Foundation; either
+diff --git a/packaging/linux-hotplug/usbcam.x11-app b/packaging/linux-hotplug/usbcam.x11-app
+index 023ae9b..618e7db 100644
+--- a/packaging/linux-hotplug/usbcam.x11-app
++++ b/packaging/linux-hotplug/usbcam.x11-app
+@@ -1,4 +1,4 @@
+-#!/bin/bash
++#!/bin/sh
+ # This program is free software; you can redistribute it and/or
+ # modify it under the terms of the GNU Lesser General Public
+ # License as published by the Free Software Foundation; either
+@@ -69,7 +69,7 @@ then
+     if [ "${USER}" != "root" ]
+     then
+ 	# we don't want to run this as root. definitely not.
+-	cd "${DIRECTORY}"
++	cd "${DIRECTORY}" || exit 1
+ 	usrhome=~${USER}
+ 	"${SU}" "${USER}" -c "${ENV} DISPLAY=${DISPLAY} HOME=${usrhome} ${X11_APP}"
+     fi
+-- 
+2.9.3
+
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/gphoto2/libgphoto2_2.5.8.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/gphoto2/libgphoto2_2.5.8.bb
index 098da79..5e798ef 100644
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/gphoto2/libgphoto2_2.5.8.bb
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/gphoto2/libgphoto2_2.5.8.bb
@@ -16,6 +16,7 @@
            file://0001-configure.ac-remove-AM_PO_SUBDIRS.patch \
            file://0002-correct-jpeg-memsrcdest-support.patch \
            file://avoid_using_sprintf.patch \
+           file://0001-scripts-remove-bashisms.patch \
 "
 
 SRC_URI[libgphoto2.md5sum] = "873ab01aced49c6b92a98e515db5dcef"
@@ -23,7 +24,7 @@
 
 inherit autotools pkgconfig gettext lib_package
 
-EXTRA_OECONF = " --with-drivers=all udevscriptdir=/lib/udev ac_cv_lib_ltdl_lt_dlcaller_register=yes"
+EXTRA_OECONF = " --with-drivers=all udevscriptdir=${nonarch_base_libdir}/udev ac_cv_lib_ltdl_lt_dlcaller_register=yes"
 
 PACKAGECONFIG ??= ""
 PACKAGECONFIG[gd] = ",--without-gdlib,gd"
@@ -47,7 +48,6 @@
 PACKAGES =+ "libgphotoport libgphoto2-camlibs"
 FILES_libgphoto2-camlibs = "${libdir}/libgphoto2*/*/*.so*"
 RRECOMMENDS_${PN} = "libgphoto2-camlibs"
-RDEPENDS_${PN} = "bash"
 
 FILES_libgphotoport = "${libdir}/libgphoto2_port.so.*"
 
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/gtkperf/gtkperf/0001-Include-stdlib.h-for-exit-API.patch b/import-layers/meta-openembedded/meta-oe/recipes-graphics/gtkperf/gtkperf/0001-Include-stdlib.h-for-exit-API.patch
new file mode 100644
index 0000000..d529ddd
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/gtkperf/gtkperf/0001-Include-stdlib.h-for-exit-API.patch
@@ -0,0 +1,34 @@
+From f8ac48abded02353918b02db38629988bd111c46 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 27 Jun 2017 08:19:44 -0700
+Subject: [PATCH 1/2] Include stdlib.h for exit() API
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Fixes
+main.c:81: warning: incompatible implicit declaration of built-in function ‘exit’
+
+Patch from Debian
+http://sources.debian.net/src/gtkperf/0.40%2Bds-2/debian/patches/01-include_stdlib.patch/
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/main.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/main.c b/src/main.c
+index 888eb36..c226799 100644
+--- a/src/main.c
++++ b/src/main.c
+@@ -11,6 +11,7 @@
+ #endif
+ 
+ #include <getopt.h>
++#include <stdlib.h>
+ 
+ #include "interface.h"
+ #include "support.h"
+-- 
+2.13.2
+
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/gtkperf/gtkperf/0002-timing.c-Fix-format-security-errors.patch b/import-layers/meta-openembedded/meta-oe/recipes-graphics/gtkperf/gtkperf/0002-timing.c-Fix-format-security-errors.patch
new file mode 100644
index 0000000..0548040
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/gtkperf/gtkperf/0002-timing.c-Fix-format-security-errors.patch
@@ -0,0 +1,42 @@
+From 47974b8473c5b928f6742caee466f5c2d4d2e9eb Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 27 Jun 2017 08:22:26 -0700
+Subject: [PATCH 2/2] timing.c: Fix format-security errors
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/timing.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/timing.c b/src/timing.c
+index 0b8f0eb..c0668c9 100644
+--- a/src/timing.c
++++ b/src/timing.c
+@@ -97,7 +97,7 @@ add_test_info_time (AppData * appdata)
+ 	gtk_text_buffer_insert (appdata->textview_info_buffer, &iter,
+ 				timestring, -1);
+ 
+-	g_printf (timestring);
++	g_printf ("%s", timestring);
+ 
+ }
+ 
+@@ -129,7 +129,7 @@ add_test_info_end (AppData * appdata)
+ 	gtk_statusbar_push (GTK_STATUSBAR (appdata->statusbar_main), 0,
+ 			    " Test Finished");
+ 
+-	g_printf (timestring);
++	g_printf ("%s", timestring);
+ 
+ }
+ 
+@@ -154,5 +154,5 @@ add_test_info_start (AppData * appdata)
+ 	gtk_statusbar_push (GTK_STATUSBAR (appdata->statusbar_main), 0,
+ 			    " Running tests...");
+ 
+-	g_printf (timestring);
++	g_printf ("%s", timestring);
+ }
+-- 
+2.13.2
+
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/gtkperf/gtkperf_0.40.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/gtkperf/gtkperf_0.40.bb
index e404a7a..2db91904 100644
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/gtkperf/gtkperf_0.40.bb
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/gtkperf/gtkperf_0.40.bb
@@ -4,7 +4,10 @@
 LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
 
 SRC_URI = "http://prdownloads.sourceforge.net/${BPN}/${BPN}_${PV}.tar.gz \
-           file://Makevars"
+           file://Makevars \
+           file://0001-Include-stdlib.h-for-exit-API.patch \
+           file://0002-timing.c-Fix-format-security-errors.patch \
+           "
 
 SRC_URI[md5sum] = "4331dde4bb83865e15482885fcb0cc53"
 SRC_URI[sha256sum] = "9704344e732038eecbd007dd996a56293a6b027b5b76f3f036273a3fae1ab27b"
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/libmng/libmng_2.0.3.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/libmng/libmng_2.0.3.bb
new file mode 100644
index 0000000..ba928d2
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/libmng/libmng_2.0.3.bb
@@ -0,0 +1,23 @@
+# Copyright (C) 2016 Khem Raj <raj.khem@gmail.com>
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+DESCRIPTION = "Development files for the Multiple-image Network Graphics library"
+HOMEPAGE = "http://www.libpng.org/pub/mng/"
+LICENSE = "Zlib"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=32becdb8930f90eab219a8021130ec09"
+SECTION = "devel"
+DEPENDS = "zlib"
+
+SRC_URI = "${SOURCEFORGE_MIRROR}/${BPN}/${BP}.tar.gz"
+
+SRC_URI[md5sum] = "7e9a12ba2a99dff7e736902ea07383d4"
+SRC_URI[sha256sum] = "cf112a1fb02f5b1c0fce5cab11ea8243852c139e669c44014125874b14b7dfaa"
+
+inherit autotools-brokensep pkgconfig
+
+PACKAGECONFIG ??= "jpeg"
+
+PACKAGECONFIG[jpeg] = "--with-jpeg,--without-jpeg,jpeg"
+PACKAGECONFIG[lcms] = "--with-lcms2,--without-lcms2,lcms"
+
+BBCLASSEXTEND = "native"
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/libsexy/libsexy_0.1.11.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/libsexy/libsexy_0.1.11.bb
index 86b4958..2ba1ebb 100644
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/libsexy/libsexy_0.1.11.bb
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/libsexy/libsexy_0.1.11.bb
@@ -4,3 +4,5 @@
 
 SRC_URI[md5sum] = "33c079a253270ec8bfb9508e4bb30754"
 SRC_URI[sha256sum] = "8c4101a8cda5fccbba85ba1a15f46f2cf75deaa8b3c525ce5b135b9e1a8fe49e"
+
+PNBLACKLIST[libsexy] ?= "Fails to build with RSS http://errors.yoctoproject.org/Errors/Details/130607/ - the recipe will be removed on 2017-09-01 unless the issue is fixed"
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/libvncserver/libvncserver/0002-format_string.patch b/import-layers/meta-openembedded/meta-oe/recipes-graphics/libvncserver/libvncserver/0002-format_string.patch
new file mode 100644
index 0000000..566a208
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/libvncserver/libvncserver/0002-format_string.patch
@@ -0,0 +1,21 @@
+From: Luca Falavigna <dktrkranz@debian.org>
+Date: Tue, 27 Jan 2015 01:26:04 +0000
+Subject: format_string
+
+---
+ client_examples/gtkvncviewer.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/client_examples/gtkvncviewer.c b/client_examples/gtkvncviewer.c
+index 261b2da..861e4e3 100644
+--- a/client_examples/gtkvncviewer.c
++++ b/client_examples/gtkvncviewer.c
+@@ -588,7 +588,7 @@ static void GtkDefaultLog (const char *format, ...)
+ 
+ 	time (&log_clock);
+ 	strftime (buf, 255, "%d/%m/%Y %X ", localtime (&log_clock));
+-	fprintf (stdout, buf);
++	fprintf (stdout, "%s", buf);
+ 
+ 	vfprintf (stdout, format, args);
+ 	fflush (stdout);
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/libvncserver/libvncserver_0.9.10.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/libvncserver/libvncserver_0.9.10.bb
index 387202b..0eba87c 100644
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/libvncserver/libvncserver_0.9.10.bb
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/libvncserver/libvncserver_0.9.10.bb
@@ -14,6 +14,7 @@
     ${DEBIAN_MIRROR}/main/libv/libvncserver/libvncserver_0.9.10+dfsg.orig.tar.xz \
     file://0001-remove-webclients-build.patch \
     file://0002-common-add-sha1.patch \
+    file://0002-format_string.patch \
 "
 
 SRC_URI[md5sum] = "e883b6c7bd339a5e1c48645051abe5c4"
@@ -21,4 +22,6 @@
 
 S = "${WORKDIR}/${BPN}-LibVNCServer-${PV}"
 
+EXTRA_OECONF += "--without-libva"
+
 TARGET_LDFLAGS += "-lgcrypt"
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/lxdm/lxdm/0001-check-for-libexecinfo-providing-backtrace-APIs.patch b/import-layers/meta-openembedded/meta-oe/recipes-graphics/lxdm/lxdm/0001-check-for-libexecinfo-providing-backtrace-APIs.patch
new file mode 100644
index 0000000..f9fd497
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/lxdm/lxdm/0001-check-for-libexecinfo-providing-backtrace-APIs.patch
@@ -0,0 +1,36 @@
+From 1d2425febf2020e38db70188df582acc9f37b136 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 30 Mar 2017 13:01:33 -0700
+Subject: [PATCH] check for libexecinfo providing backtrace() APIs
+
+on musl it depends on external library to provide backtrace APIs
+unlike glibc where it is bundled in
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ configure.ac | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/configure.ac b/configure.ac
+index aa3291c..b15f65d 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -15,6 +15,7 @@ AM_PROG_CC_C_O
+ 
+ # Checks for libraries.
+ AC_CHECK_LIB([crypt], [crypt])
++AC_CHECK_LIB([execinfo], [backtrace])
+ 
+ # Check for PAM support
+ AC_ARG_WITH(pam, AC_HELP_STRING([--with-pam],[Use PAM for authentication]),
+@@ -33,6 +34,7 @@ AM_CONDITIONAL(HAVE_PAM, [test -n "$USE_PAM" -a "x$USE_PAM" != xno ])
+ # Checks for header files.
+ AC_PATH_X
+ AC_CHECK_HEADERS([shadow.h stdlib.h string.h unistd.h utmpx.h])
++AC_CHECK_HEADERS([execinfo.h])
+ 
+ # Checks for typedefs, structures, and compiler characteristics.
+ AC_TYPE_PID_T
+-- 
+2.12.1
+
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/lxdm/lxdm_0.5.3.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/lxdm/lxdm_0.5.3.bb
index 407129d..c98c3a1 100644
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/lxdm/lxdm_0.5.3.bb
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/lxdm/lxdm_0.5.3.bb
@@ -2,13 +2,13 @@
 HOMEPAGE = "http://blog.lxde.org/?p=531"
 LICENSE = "GPLv3"
 LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
-SRC_URI = " \
-    ${SOURCEFORGE_MIRROR}/project/${BPN}/${BPN}%20${PV}/${BPN}-${PV}.tar.xz \
-    file://lxdm.conf \
-    ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'file://lxdm-pam file://lxdm-pam-debug', '', d)} \
-    ${@bb.utils.contains("DISTRO_TYPE", "debug", "", "file://0001-lxdm.conf.in-blacklist-root-for-release-images.patch",d)} \
-    file://0002-let-autotools-create-lxdm.conf.patch \
-"
+SRC_URI = "${SOURCEFORGE_MIRROR}/project/${BPN}/${BPN}%20${PV}/${BPN}-${PV}.tar.xz \
+           file://lxdm.conf \
+           ${@bb.utils.contains('DISTRO_FEATURES', 'pam', 'file://lxdm-pam file://lxdm-pam-debug', '', d)} \
+           ${@bb.utils.contains("DISTRO_TYPE", "debug", "", "file://0001-lxdm.conf.in-blacklist-root-for-release-images.patch",d)} \
+           file://0002-let-autotools-create-lxdm.conf.patch \
+           file://0001-check-for-libexecinfo-providing-backtrace-APIs.patch \
+           "
 SRC_URI[md5sum] = "061caae432634e6db38bbdc84bc6ffa0"
 SRC_URI[sha256sum] = "4891efee81c72a400cc6703e40aa76f3f3853833d048b72ec805da0f93567f2f"
 
@@ -16,6 +16,7 @@
 
 DEPENDS = "virtual/libintl intltool-native cairo dbus gdk-pixbuf glib-2.0 gtk+ virtual/libx11 libxcb pango iso-codes"
 DEPENDS += "${@bb.utils.contains("DISTRO_FEATURES", "systemd", "", "consolekit", d)}"
+DEPENDS_append_libc-musl = " libexecinfo"
 
 # combine oe-core way with angstrom DISTRO_TYPE
 DISTRO_TYPE ?= "${@bb.utils.contains("IMAGE_FEATURES", "debug-tweaks", "debug", "",d)}"
@@ -25,6 +26,7 @@
 REQUIRED_DISTRO_FEATURES = "x11"
 
 CFLAGS_append = " -fno-builtin-fork -fno-builtin-memset -fno-builtin-strstr "
+LDFLAGS_append_libc-musl = " -lexecinfo"
 
 EXTRA_OECONF += "--enable-gtk3=no --enable-password=yes --with-x -with-xconn=xcb \
     ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '--with-systemdsystemunitdir=${systemd_unitdir}/system/ --disable-consolekit', '--without-systemdsystemunitdir', d)} \
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/pango/pangomm_2.36.0.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/pango/pangomm_2.40.1.bb
similarity index 71%
rename from import-layers/meta-openembedded/meta-oe/recipes-graphics/pango/pangomm_2.36.0.bb
rename to import-layers/meta-openembedded/meta-oe/recipes-graphics/pango/pangomm_2.40.1.bb
index f738153..02bb1cc 100644
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/pango/pangomm_2.36.0.bb
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/pango/pangomm_2.40.1.bb
@@ -6,11 +6,11 @@
 
 DEPENDS = "mm-common cairomm glibmm pango"
 
-SHRT_VER = "${@d.getVar('PV',1).split('.')[0]}.${@d.getVar('PV',1).split('.')[1]}"
+SHRT_VER = "${@d.getVar('PV').split('.')[0]}.${@d.getVar('PV').split('.')[1]}"
 
 SRC_URI = "http://ftp.gnome.org/pub/GNOME/sources/pangomm/${SHRT_VER}/pangomm-${PV}.tar.xz"
-SRC_URI[md5sum] = "62910723211d86ab825b666b479871c9"
-SRC_URI[sha256sum] = "a8d96952c708d7726bed260d693cece554f8f00e48b97cccfbf4f5690b6821f0"
+SRC_URI[md5sum] = "874eadd9434613dbacf0272c82c3ac23"
+SRC_URI[sha256sum] = "9762ee2a2d5781be6797448d4dd2383ce14907159b30bc12bf6b08e7227be3af"
 
 inherit autotools pkgconfig
 
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/slim/slim_1.3.2.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/slim/slim_1.3.2.bb
index 71359e0..2fbdcab 100644
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/slim/slim_1.3.2.bb
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/slim/slim_1.3.2.bb
@@ -79,4 +79,4 @@
 sed -i /slim/d $D${sysconfdir}/X11/default-display-manager || true
 }
 
-PNBLACKLIST[slim] ?= "does not build with distroless qemuarm as reported in 'State of bitbake world' thread, nobody volunteered to fix them"
+PNBLACKLIST[slim] ?= "does not build with distroless qemuarm as reported in 'State of bitbake world' thread, nobody volunteered to fix them - the recipe will be removed on 2017-09-01 unless the issue is fixed"
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/terminus-font/terminus-font_4.38.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/terminus-font/terminus-font_4.38.bb
index e5bea97..4c8399d 100644
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/terminus-font/terminus-font_4.38.bb
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/terminus-font/terminus-font_4.38.bb
@@ -16,7 +16,7 @@
 
 inherit allarch fontcache
 
-PACKAGECONFIG ?= "${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'x11', '', d)}"
+PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'x11', d)}"
 PACKAGECONFIG[x11] = ""
 
 # Don't use font cache mecanism for console packages
@@ -43,3 +43,5 @@
 FILES_${PN}-consolefonts = "${datadir}/consolefonts"
 FILES_${PN}-consoletrans = "${datadir}/consoletrans"
 FILES_${PN}-pcf = "${datadir}/fonts/terminus"
+
+PNBLACKLIST[terminus-font] ?= "Fails to build with RSS http://errors.yoctoproject.org/Errors/Details/130638/ - the recipe will be removed on 2017-09-01 unless the issue is fixed"
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/tesseract/tesseract-lang_git.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/tesseract/tesseract-lang_git.bb
index 28ea33e..ac36a91 100644
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/tesseract/tesseract-lang_git.bb
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/tesseract/tesseract-lang_git.bb
@@ -18,7 +18,7 @@
 python populate_packages_prepend () {
     tessdata_dir= d.expand('${datadir}/tessdata')
     pkgs = do_split_packages(d, tessdata_dir, '^([a-z_]*)\.*', '${BPN}-%s', 'tesseract-ocr language files for %s', extra_depends='')
-    pn = d.getVar('PN', True)
+    pn = d.getVar('PN')
     d.appendVar('RDEPENDS_' + pn, ' '+' '.join(pkgs))
 }
 
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/ttf-fonts/ttf-abyssinica_1.500.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/ttf-fonts/ttf-abyssinica_1.500.bb
index cd96fbb..ce003e9 100644
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/ttf-fonts/ttf-abyssinica_1.500.bb
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/ttf-fonts/ttf-abyssinica_1.500.bb
@@ -6,7 +6,7 @@
 LIC_FILES_CHKSUM = "file://OFL.txt;md5=1694c7fc245cdc85c9971db707928159"
 
 SRCNAME = "AbyssinicaSIL"
-SRC_URI = "http://software.sil.org/downloads/d/abyssinica/${SRCNAME}-${PV}.zip"
+SRC_URI = "http://software.sil.org/downloads/r/abyssinica/${SRCNAME}-${PV}.zip"
 S = "${WORKDIR}/${SRCNAME}-${PV}"
 
 SRC_URI[md5sum] = "a3d943d18e303197c8d3d92d2de54d1e"
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/vdpau/libvdpau_git.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/vdpau/libvdpau_git.bb
new file mode 100644
index 0000000..31f4df4
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/vdpau/libvdpau_git.bb
@@ -0,0 +1,23 @@
+SUMMARY = "Video Decode and Presentation API for UNIX"
+
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://COPYING;md5=83af8811a28727a13f04132cc33b7f58"
+
+DEPENDS = "virtual/libx11 libxext dri2proto"
+
+PV = "1.1.1+git${SRCPV}"
+
+SRCREV = "a21bf7aa438f5dd40d0a300a3167aa3d6f26dccc"
+SRC_URI = "git://anongit.freedesktop.org/vdpau/libvdpau"
+
+S = "${WORKDIR}/git"
+
+inherit autotools pkgconfig
+
+do_install_append() {
+    rm -f ${D}${libdir}/*/*.la
+}
+
+FILES_${PN}-dbg += "${libdir}/vdpau/.debug"
+FILES_${PN}-dev += "${libdir}/vdpau/lib*${SOLIBSDEV}"
+FILES_${PN} += "${libdir}/vdpau/lib*${SOLIBS}"
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/wayland/wayland-fits_git.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/wayland/wayland-fits_git.bb
index d060c47..2af6697 100755
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/wayland/wayland-fits_git.bb
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/wayland/wayland-fits_git.bb
@@ -31,3 +31,5 @@
 
 FILES_${PN} += "${bindir}/wfits ${libdir}/weston/*.so"
 FILES_${PN}-dbg += "${bindir}/.debug ${libdir}/weston/.debug ${prefix}/src"
+
+PNBLACKLIST[wayland-fits] ?= "Fails to build with RSS http://errors.yoctoproject.org/Errors/Details/130632/ - the recipe will be removed on 2017-09-01 unless the issue is fixed"
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xdotool/xdotool_1.20100416.2809.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xdotool/xdotool_1.20100416.2809.bb
index 474d298..b68e994 100644
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xdotool/xdotool_1.20100416.2809.bb
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xdotool/xdotool_1.20100416.2809.bb
@@ -7,7 +7,7 @@
 
 PR = "r1"
 
-inherit distro_features_check
+inherit distro_features_check pkgconfig
 # depends on virtual/libx11
 REQUIRED_DISTRO_FEATURES = "x11"
 
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-app/xstdcmap_1.0.3.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-app/xstdcmap_1.0.3.bb
index 3f5511e..99f7036 100644
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-app/xstdcmap_1.0.3.bb
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-app/xstdcmap_1.0.3.bb
@@ -8,8 +8,9 @@
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://COPYING;md5=2b08d9e2e718ac83e6fe2b974d4b5fd8"
 
-RDEPENDS_${PN} = "libxmu"
+DEPENDS += "libxmu"
 BBCLASSEXTEND = "native"
 
 SRC_URI[md5sum] = "eb5473acaef15a5db9b50df29c6a7f90"
 SRC_URI[sha256sum] = "f648e2b0cf16aa29856de998e2c7204be39dc1f8daeda9464d32288e0b580fc1"
+
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-driver/xf86-input-mtev_git.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-driver/xf86-input-mtev_git.bb
index 547ec86..5f2adec 100644
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-driver/xf86-input-mtev_git.bb
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-driver/xf86-input-mtev_git.bb
@@ -5,7 +5,7 @@
 
 DEPENDS += "pixman"
 
-PNBLACKLIST[xf86-input-mtev] ?= "BROKEN: doesn't build with B!=S (Makefile without ${S} in sed call)"
+PNBLACKLIST[xf86-input-mtev] ?= "BROKEN: doesn't build with B!=S (Makefile without ${S} in sed call) - the recipe will be removed on 2017-09-01 unless the issue is fixed"
 
 SRC_URI = "git://gitorious.org/xorg/xf86-input-mtev.git file://fix-it.patch"
 SRCREV = "1eb469166ffc095c5801475f057f911f97a6e641"
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-driver/xf86-input-tslib_0.0.6.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-driver/xf86-input-tslib_0.0.6.bb
index 082c771..6a3689a 100644
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-driver/xf86-input-tslib_0.0.6.bb
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-driver/xf86-input-tslib_0.0.6.bb
@@ -28,8 +28,8 @@
 do_install_append() {
     install -d ${D}/${datadir}/hal/fdi/policy/20thirdparty
     install -m 0644 ${WORKDIR}/10-x11-input-tslib.fdi ${D}/${datadir}/hal/fdi/policy/20thirdparty
-    install -d ${D}/lib/udev/rules.d
-    install -m 0644 ${WORKDIR}/99-xf86-input-tslib.rules ${D}/lib/udev/rules.d/
+    install -d ${D}${nonarch_base_libdir}/udev/rules.d
+    install -m 0644 ${WORKDIR}/99-xf86-input-tslib.rules ${D}${nonarch_base_libdir}/udev/rules.d/
 }
 
-FILES_${PN} += "${datadir}/hal /lib/udev"
+FILES_${PN} += "${datadir}/hal ${nonarch_base_libdir}/udev"
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-driver/xf86-video-ati_7.6.1.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-driver/xf86-video-ati_7.8.0.bb
similarity index 79%
rename from import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-driver/xf86-video-ati_7.6.1.bb
rename to import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-driver/xf86-video-ati_7.8.0.bb
index bffa7b0..a101008 100644
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-driver/xf86-video-ati_7.6.1.bb
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-driver/xf86-video-ati_7.8.0.bb
@@ -11,8 +11,8 @@
 
 COMPATIBLE_HOST = '(i.86|x86_64).*-linux'
 
-SRC_URI[md5sum] = "ede86cd3d1b1d8882f0aea61d9e924ed"
-SRC_URI[sha256sum] = "2516d9eeb8da8bcd3a01365ed1314919777910fa904ab268af342b5693e1d34c"
+SRC_URI[md5sum] = "f34d04a755e761e03b459155fa3ddcbb"
+SRC_URI[sha256sum] = "401f5de772928f3dc4ce43a885adb0a47a2f61aa4a9e45d2ab3d184136a9d6fa"
 
 EXTRA_OECONF += "--disable-glamor"
 
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-driver/xf86-video-geode_2.11.16.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-driver/xf86-video-geode_2.11.16.bb
index d267598..e543413 100644
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-driver/xf86-video-geode_2.11.16.bb
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-driver/xf86-video-geode_2.11.16.bb
@@ -13,4 +13,4 @@
 RDEPENDS_${PN} += "xserver-xorg-module-exa"
 
 # 2_2.11.16-r21.0/xf86-video-geode-2.11.16/src/gx_driver.c:376:20: error: implicit declaration of function 'xf86MapVidMem' [-Werror=implicit-function-declaration]
-PNBLACKLIST[xf86-video-geode] ?= "BROKEN, fails to build"
+PNBLACKLIST[xf86-video-geode] ?= "BROKEN, fails to build - the recipe will be removed on 2017-09-01 unless the issue is fixed"
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-driver/xf86-video-glamo_git.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-driver/xf86-video-glamo_git.bb
index 74c066f..5818d0c 100644
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-driver/xf86-video-glamo_git.bb
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-driver/xf86-video-glamo_git.bb
@@ -21,3 +21,5 @@
 SRCREV = "cb9ed17035a79e49dde26a1e7e2bc5f10fd8144b"
 
 EXTRA_OECONF = " --disable-kms "
+
+PNBLACKLIST[xf86-video-glamo] ?= "Fails to build with RSS http://errors.yoctoproject.org/Errors/Details/130629/ - the recipe will be removed on 2017-09-01 unless the issue is fixed"
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-driver/xf86-video-nouveau_1.0.12.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-driver/xf86-video-nouveau_1.0.12.bb
index 3a7507c..444189a 100644
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-driver/xf86-video-nouveau_1.0.12.bb
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-driver/xf86-video-nouveau_1.0.12.bb
@@ -15,3 +15,5 @@
 SRC_URI[md5sum] = "dc79910c7b9e32321cefc7af250c7765"
 SRC_URI[sha256sum] = "0ea057ad7fc31caba2d4e46c7e418fe2b3c762b04fb8d382f53383397fd8391e"
 
+
+PNBLACKLIST[xf86-video-nouveau] ?= "Fails to build with RSS http://errors.yoctoproject.org/Errors/Details/130657/ - the recipe will be removed on 2017-09-01 unless the issue is fixed"
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-font/font-adobe-100dpi_1.0.3.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-font/font-adobe-100dpi_1.0.3.bb
index 85a4466..29229bb 100644
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-font/font-adobe-100dpi_1.0.3.bb
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-font/font-adobe-100dpi_1.0.3.bb
@@ -6,7 +6,7 @@
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://COPYING;md5=5dfa0fdf45473b4ca0acf37d854df10e"
 
-DEPENDS = "util-macros-native font-util-native bdftopcf-native"
+DEPENDS = "util-macros-native font-util-native bdftopcf-native font-util"
 RDEPENDS_${PN} = "encodings font-util"
 RDEPENDS_${PN}_class-native = "font-util-native"
 
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-font/font-adobe-utopia-100dpi_1.0.4.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-font/font-adobe-utopia-100dpi_1.0.4.bb
index 16e3d2c..898850b 100644
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-font/font-adobe-utopia-100dpi_1.0.4.bb
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-font/font-adobe-utopia-100dpi_1.0.4.bb
@@ -6,7 +6,7 @@
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://COPYING;md5=fa13e704b7241f60ef9105cc041b9732"
 
-DEPENDS = "util-macros-native font-util-native bdftopcf-native"
+DEPENDS = "util-macros-native font-util-native bdftopcf-native font-util"
 RDEPENDS_${PN} = "encodings font-util"
 RDEPENDS_${PN}_class-native = "font-util-native"
 
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-font/font-bh-100dpi_1.0.3.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-font/font-bh-100dpi_1.0.3.bb
index 08ed6b6..4976e52 100644
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-font/font-bh-100dpi_1.0.3.bb
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-font/font-bh-100dpi_1.0.3.bb
@@ -6,7 +6,7 @@
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://COPYING;md5=cffd5e9c4b61b3d74166ca74b99e460e"
 
-DEPENDS = "util-macros-native font-util-native bdftopcf-native"
+DEPENDS += "util-macros-native font-util-native bdftopcf-native font-util"
 RDEPENDS_${PN} = "encodings font-util"
 RDEPENDS_${PN}_class-native = "font-util-native"
 
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-font/font-bh-lucidatypewriter-100dpi_1.0.3.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-font/font-bh-lucidatypewriter-100dpi_1.0.3.bb
index 5ded41a..6e0b33c 100644
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-font/font-bh-lucidatypewriter-100dpi_1.0.3.bb
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-font/font-bh-lucidatypewriter-100dpi_1.0.3.bb
@@ -6,7 +6,7 @@
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://COPYING;md5=0d221a9cd144806cb469735cc4775939"
 
-DEPENDS = "util-macros-native font-util-native bdftopcf-native"
+DEPENDS = "util-macros-native font-util-native bdftopcf-native font-util"
 RDEPENDS_${PN} = "encodings font-util"
 RDEPENDS_${PN}_class-native = "font-util-native"
 
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-font/font-misc-misc_1.1.2.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-font/font-misc-misc_1.1.2.bb
index a7c284a..e4cd90a 100644
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-font/font-misc-misc_1.1.2.bb
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-font/font-misc-misc_1.1.2.bb
@@ -6,7 +6,7 @@
 LICENSE = "PD"
 LIC_FILES_CHKSUM = "file://COPYING;md5=200c507f595ee97008c7c5c3e94ab9a8"
 
-DEPENDS = "util-macros-native font-util-native bdftopcf-native"
+DEPENDS = "util-macros-native font-util-native bdftopcf-native font-util"
 RDEPENDS_${PN} = "encodings font-util"
 
 inherit distro_features_check
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-font/xorg-fonts-100dpi.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-font/xorg-fonts-100dpi.bb
index 45e3f7b..fcf6826 100644
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-font/xorg-fonts-100dpi.bb
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xorg-font/xorg-fonts-100dpi.bb
@@ -12,3 +12,13 @@
     font-bh-lucidatypewriter-100dpi \
     font-bitstream-100dpi \
 "
+
+PNBLACKLIST[xorg-fonts-100dpi] ?= "Runtime depends on blacklisted font-adobe-100dpi - the recipe will be removed on 2017-09-01 unless the issue is fixed"
+
+PNBLACKLIST[xorg-fonts-100dpi] ?= "Runtime depends on blacklisted xorg-fonts-100dpi - the recipe will be removed on 2017-09-01 unless the issue is fixed"
+
+PNBLACKLIST[xorg-fonts-100dpi] ?= "Runtime depends on blacklisted font-bh-100dpi - the recipe will be removed on 2017-09-01 unless the issue is fixed"
+
+PNBLACKLIST[xorg-fonts-100dpi] ?= "Runtime depends on blacklisted font-adobe-utopia-100dpi - the recipe will be removed on 2017-09-01 unless the issue is fixed"
+
+PNBLACKLIST[xorg-fonts-100dpi] ?= "Runtime depends on blacklisted font-bh-lucidatypewriter-100dpi - the recipe will be removed on 2017-09-01 unless the issue is fixed"
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xserver-common/xserver-common-1.34/0001-Don-t-install-Xsession-or-Xserver.patch b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xserver-common/xserver-common-1.34/0001-Don-t-install-Xsession-or-Xserver.patch
new file mode 100644
index 0000000..26288d6
--- /dev/null
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xserver-common/xserver-common-1.34/0001-Don-t-install-Xsession-or-Xserver.patch
@@ -0,0 +1,30 @@
+From c92ce6a4b3622874f820b5ec487a2b63f519826c Mon Sep 17 00:00:00 2001
+From: Jussi Kukkonen <jussi.kukkonen@intel.com>
+Date: Thu, 10 Nov 2016 14:33:05 +0200
+Subject: [PATCH] Don't install Xsession or Xserver
+
+The goal is to use Xsession and Xserver from xserver-nodm-init.
+Xsession scripts and xserver-common from this recipe will still
+be used as before.
+
+Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
+---
+ Makefile | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index caa5de1..7e36bbc 100644
+--- a/Makefile
++++ b/Makefile
+@@ -20,7 +20,5 @@ install-program:
+ 	install -m 755 run-calibrate.sh $(DESTDIR)$(PREFIX)/bin/run-calibrate.sh
+ 	install -m 644 X11/Xdefaults $(DESTDIR)/etc/X11/Xdefaults
+ 	install -m 755 X11/Xinit $(DESTDIR)/etc/X11/Xinit
+-	install -m 755 X11/Xserver $(DESTDIR)/etc/X11/Xserver
+-	install -m 755 X11/Xsession $(DESTDIR)/etc/X11/Xsession
+ 	install -m 755 X11/xserver-common $(DESTDIR)/etc/X11/xserver-common
+ 	install -m 755 X11/functions $(DESTDIR)/etc/X11/functions
+ 	install -d $(DESTDIR)/etc/X11/xmodmap
+-- 
+2.1.4
+
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xserver-common/xserver-common-1.34/0003-add-89xdgautostart-Xsession.d-script.patch b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xserver-common/xserver-common-1.34/0003-add-89xdgautostart-Xsession.d-script.patch
deleted file mode 100644
index bf806a9..0000000
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xserver-common/xserver-common-1.34/0003-add-89xdgautostart-Xsession.d-script.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From a93a86c2ff1ca5eb35615f4e1568409ff342aa7f Mon Sep 17 00:00:00 2001
-From: Martin Jansa <Martin.Jansa@gmail.com>
-Date: Wed, 11 Apr 2012 14:29:41 +0200
-Subject: [PATCH 03/12] add 89xdgautostart Xsession.d script
-
-Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
----
- X11/Xsession.d/89xdgautostart |    9 +++++++++
- 1 files changed, 9 insertions(+), 0 deletions(-)
- create mode 100644 X11/Xsession.d/89xdgautostart
-
-diff --git a/X11/Xsession.d/89xdgautostart b/X11/Xsession.d/89xdgautostart
-new file mode 100644
-index 0000000..9886f9f
---- /dev/null
-+++ b/X11/Xsession.d/89xdgautostart
-@@ -0,0 +1,9 @@
-+#!/bin/sh
-+
-+XDGAUTOSTART=/etc/xdg/autostart
-+if [ -d $XDGAUTOSTART ] ; then
-+    for SCRIPT in $XDGAUTOSTART/*; do
-+        CMD=`grep ^Exec= $SCRIPT | cut -d '=' -f 2`
-+        $CMD &
-+    done
-+fi
--- 
-1.7.8.5
-
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xserver-common/xserver-common-1.34/0005-add-XWindowManager-Xsession.d-script.patch b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xserver-common/xserver-common-1.34/0005-add-XWindowManager-Xsession.d-script.patch
deleted file mode 100644
index 1782665..0000000
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xserver-common/xserver-common-1.34/0005-add-XWindowManager-Xsession.d-script.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-From b01a532ebb525552e23d7169a2aeb55c42b3ec99 Mon Sep 17 00:00:00 2001
-From: Martin Jansa <Martin.Jansa@gmail.com>
-Date: Wed, 11 Apr 2012 14:32:13 +0200
-Subject: [PATCH 05/12] add XWindowManager Xsession.d script
-
-Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
----
- X11/Xsession.d/90xXWindowManager |    6 ++++++
- 1 files changed, 6 insertions(+), 0 deletions(-)
- create mode 100644 X11/Xsession.d/90xXWindowManager
-
-Index: xserver-common-1.34/X11/Xsession.d/90xXWindowManager
-===================================================================
---- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ xserver-common-1.34/X11/Xsession.d/90xXWindowManager	2012-06-28 15:02:22.010521773 +0200
-@@ -0,0 +1,7 @@
-+if [ -x $HOME/.Xsession ]; then
-+    exec $HOME/.Xsession
-+elif [ -x /usr/bin/x-session-manager ]; then
-+    exec /usr/bin/x-session-manager
-+else
-+    exec /usr/bin/x-window-manager
-+fi
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xserver-common/xserver-common-1.34/0014-Xserver-Start-Xsession-like-x11-common-does.patch b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xserver-common/xserver-common-1.34/0014-Xserver-Start-Xsession-like-x11-common-does.patch
deleted file mode 100644
index 5a75964..0000000
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xserver-common/xserver-common-1.34/0014-Xserver-Start-Xsession-like-x11-common-does.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-From 8171f89944969a081be1ac193b2a59016e39a345 Mon Sep 17 00:00:00 2001
-From: Martin Jansa <Martin.Jansa@gmail.com>
-Date: Tue, 29 Oct 2013 17:07:21 +0100
-Subject: [PATCH 14/14] Xserver: Start Xsession like x11-common does
-
-Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
----
- X11/Xserver | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/X11/Xserver b/X11/Xserver
-index 559f059..4b88637 100755
---- a/X11/Xserver
-+++ b/X11/Xserver
-@@ -4,6 +4,6 @@
- . /etc/X11/xserver-common
- 
- echo "tslib: $TSLIB_TSDEVICE"
--echo "exec $XSERVER $ARGS -dpi $DPI $*"
--exec $XSERVER $ARGS -dpi $DPI $*
-+echo "exec xinit /etc/X11/Xsession -- $BINDIR/$XSERVER $ARGS -dpi $DPI $*"
- 
-+exec xinit /etc/X11/Xsession -- $BINDIR/$XSERVER $ARGS -dpi $DPI $*
--- 
-1.8.4.2
-
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xserver-common/xserver-common_1.34.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xserver-common/xserver-common_1.34.bb
index 0315ed7..cc30541 100644
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xserver-common/xserver-common_1.34.bb
+++ b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xserver-common/xserver-common_1.34.bb
@@ -2,7 +2,7 @@
 LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
 
-PR = "r8"
+PR = "r9"
 
 # we are using a gpe-style Makefile
 inherit gpe
@@ -13,8 +13,6 @@
 SRC_URI_append = " \
     file://0001-COPYING-add-GPLv2-license-file.patch \
     file://0002-add-setdpi-Xinit.d-script.patch \
-    file://0003-add-89xdgautostart-Xsession.d-script.patch \
-    file://0005-add-XWindowManager-Xsession.d-script.patch \
     file://0006-add-support-for-etc-X11-xserver-system.patch \
     file://0007-use-own-functions-file-instead-etc-init.d-functions.patch \
     file://0008-xserver-common-add-dpi-and-nocursor-params-for-gta01.patch \
@@ -23,8 +21,8 @@
     file://0011-xserver-common-add-support-for-nexus-one-alias-mahim.patch \
     file://0012-xserver-common-add-support-for-gta04-alias-OpenPhoen.patch \
     file://0013-xserver-common-add-support-for-tuna-alias-Galaxy-Nex.patch \
-    file://0014-Xserver-Start-Xsession-like-x11-common-does.patch \
     file://0015-xserver-common-disable-TCP-connections.patch \
+    file://0001-Don-t-install-Xsession-or-Xserver.patch \
 "
 
 do_install_append() {
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xserver-nodm-init/xserver-nodm-init-2.0/gplv2-license.patch b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xserver-nodm-init/xserver-nodm-init-2.0/gplv2-license.patch
deleted file mode 100644
index ec93253..0000000
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xserver-nodm-init/xserver-nodm-init-2.0/gplv2-license.patch
+++ /dev/null
@@ -1,353 +0,0 @@
-COPYING: add GPLv2 license file
-
-this is a local file recipe and the license file is missing.In order
-to pass the license checksum checking, the license file is needed. So
-this patch add the GPLv2 license file.
-
-Signed-off-by: Yu Ke <ke.yu@intel.com>
-
-diff --git a/COPYING b/COPYING
-new file mode 100644
-index 0000000..d511905
---- /dev/null
-+++ b/COPYING
-@@ -0,0 +1,339 @@
-+		    GNU GENERAL PUBLIC LICENSE
-+		       Version 2, June 1991
-+
-+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
-+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-+ Everyone is permitted to copy and distribute verbatim copies
-+ of this license document, but changing it is not allowed.
-+
-+			    Preamble
-+
-+  The licenses for most software are designed to take away your
-+freedom to share and change it.  By contrast, the GNU General Public
-+License is intended to guarantee your freedom to share and change free
-+software--to make sure the software is free for all its users.  This
-+General Public License applies to most of the Free Software
-+Foundation's software and to any other program whose authors commit to
-+using it.  (Some other Free Software Foundation software is covered by
-+the GNU Lesser General Public License instead.)  You can apply it to
-+your programs, too.
-+
-+  When we speak of free software, we are referring to freedom, not
-+price.  Our General Public Licenses are designed to make sure that you
-+have the freedom to distribute copies of free software (and charge for
-+this service if you wish), that you receive source code or can get it
-+if you want it, that you can change the software or use pieces of it
-+in new free programs; and that you know you can do these things.
-+
-+  To protect your rights, we need to make restrictions that forbid
-+anyone to deny you these rights or to ask you to surrender the rights.
-+These restrictions translate to certain responsibilities for you if you
-+distribute copies of the software, or if you modify it.
-+
-+  For example, if you distribute copies of such a program, whether
-+gratis or for a fee, you must give the recipients all the rights that
-+you have.  You must make sure that they, too, receive or can get the
-+source code.  And you must show them these terms so they know their
-+rights.
-+
-+  We protect your rights with two steps: (1) copyright the software, and
-+(2) offer you this license which gives you legal permission to copy,
-+distribute and/or modify the software.
-+
-+  Also, for each author's protection and ours, we want to make certain
-+that everyone understands that there is no warranty for this free
-+software.  If the software is modified by someone else and passed on, we
-+want its recipients to know that what they have is not the original, so
-+that any problems introduced by others will not reflect on the original
-+authors' reputations.
-+
-+  Finally, any free program is threatened constantly by software
-+patents.  We wish to avoid the danger that redistributors of a free
-+program will individually obtain patent licenses, in effect making the
-+program proprietary.  To prevent this, we have made it clear that any
-+patent must be licensed for everyone's free use or not licensed at all.
-+
-+  The precise terms and conditions for copying, distribution and
-+modification follow.
-+
-+		    GNU GENERAL PUBLIC LICENSE
-+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-+
-+  0. This License applies to any program or other work which contains
-+a notice placed by the copyright holder saying it may be distributed
-+under the terms of this General Public License.  The "Program", below,
-+refers to any such program or work, and a "work based on the Program"
-+means either the Program or any derivative work under copyright law:
-+that is to say, a work containing the Program or a portion of it,
-+either verbatim or with modifications and/or translated into another
-+language.  (Hereinafter, translation is included without limitation in
-+the term "modification".)  Each licensee is addressed as "you".
-+
-+Activities other than copying, distribution and modification are not
-+covered by this License; they are outside its scope.  The act of
-+running the Program is not restricted, and the output from the Program
-+is covered only if its contents constitute a work based on the
-+Program (independent of having been made by running the Program).
-+Whether that is true depends on what the Program does.
-+
-+  1. You may copy and distribute verbatim copies of the Program's
-+source code as you receive it, in any medium, provided that you
-+conspicuously and appropriately publish on each copy an appropriate
-+copyright notice and disclaimer of warranty; keep intact all the
-+notices that refer to this License and to the absence of any warranty;
-+and give any other recipients of the Program a copy of this License
-+along with the Program.
-+
-+You may charge a fee for the physical act of transferring a copy, and
-+you may at your option offer warranty protection in exchange for a fee.
-+
-+  2. You may modify your copy or copies of the Program or any portion
-+of it, thus forming a work based on the Program, and copy and
-+distribute such modifications or work under the terms of Section 1
-+above, provided that you also meet all of these conditions:
-+
-+    a) You must cause the modified files to carry prominent notices
-+    stating that you changed the files and the date of any change.
-+
-+    b) You must cause any work that you distribute or publish, that in
-+    whole or in part contains or is derived from the Program or any
-+    part thereof, to be licensed as a whole at no charge to all third
-+    parties under the terms of this License.
-+
-+    c) If the modified program normally reads commands interactively
-+    when run, you must cause it, when started running for such
-+    interactive use in the most ordinary way, to print or display an
-+    announcement including an appropriate copyright notice and a
-+    notice that there is no warranty (or else, saying that you provide
-+    a warranty) and that users may redistribute the program under
-+    these conditions, and telling the user how to view a copy of this
-+    License.  (Exception: if the Program itself is interactive but
-+    does not normally print such an announcement, your work based on
-+    the Program is not required to print an announcement.)
-+
-+These requirements apply to the modified work as a whole.  If
-+identifiable sections of that work are not derived from the Program,
-+and can be reasonably considered independent and separate works in
-+themselves, then this License, and its terms, do not apply to those
-+sections when you distribute them as separate works.  But when you
-+distribute the same sections as part of a whole which is a work based
-+on the Program, the distribution of the whole must be on the terms of
-+this License, whose permissions for other licensees extend to the
-+entire whole, and thus to each and every part regardless of who wrote it.
-+
-+Thus, it is not the intent of this section to claim rights or contest
-+your rights to work written entirely by you; rather, the intent is to
-+exercise the right to control the distribution of derivative or
-+collective works based on the Program.
-+
-+In addition, mere aggregation of another work not based on the Program
-+with the Program (or with a work based on the Program) on a volume of
-+a storage or distribution medium does not bring the other work under
-+the scope of this License.
-+
-+  3. You may copy and distribute the Program (or a work based on it,
-+under Section 2) in object code or executable form under the terms of
-+Sections 1 and 2 above provided that you also do one of the following:
-+
-+    a) Accompany it with the complete corresponding machine-readable
-+    source code, which must be distributed under the terms of Sections
-+    1 and 2 above on a medium customarily used for software interchange; or,
-+
-+    b) Accompany it with a written offer, valid for at least three
-+    years, to give any third party, for a charge no more than your
-+    cost of physically performing source distribution, a complete
-+    machine-readable copy of the corresponding source code, to be
-+    distributed under the terms of Sections 1 and 2 above on a medium
-+    customarily used for software interchange; or,
-+
-+    c) Accompany it with the information you received as to the offer
-+    to distribute corresponding source code.  (This alternative is
-+    allowed only for noncommercial distribution and only if you
-+    received the program in object code or executable form with such
-+    an offer, in accord with Subsection b above.)
-+
-+The source code for a work means the preferred form of the work for
-+making modifications to it.  For an executable work, complete source
-+code means all the source code for all modules it contains, plus any
-+associated interface definition files, plus the scripts used to
-+control compilation and installation of the executable.  However, as a
-+special exception, the source code distributed need not include
-+anything that is normally distributed (in either source or binary
-+form) with the major components (compiler, kernel, and so on) of the
-+operating system on which the executable runs, unless that component
-+itself accompanies the executable.
-+
-+If distribution of executable or object code is made by offering
-+access to copy from a designated place, then offering equivalent
-+access to copy the source code from the same place counts as
-+distribution of the source code, even though third parties are not
-+compelled to copy the source along with the object code.
-+
-+  4. You may not copy, modify, sublicense, or distribute the Program
-+except as expressly provided under this License.  Any attempt
-+otherwise to copy, modify, sublicense or distribute the Program is
-+void, and will automatically terminate your rights under this License.
-+However, parties who have received copies, or rights, from you under
-+this License will not have their licenses terminated so long as such
-+parties remain in full compliance.
-+
-+  5. You are not required to accept this License, since you have not
-+signed it.  However, nothing else grants you permission to modify or
-+distribute the Program or its derivative works.  These actions are
-+prohibited by law if you do not accept this License.  Therefore, by
-+modifying or distributing the Program (or any work based on the
-+Program), you indicate your acceptance of this License to do so, and
-+all its terms and conditions for copying, distributing or modifying
-+the Program or works based on it.
-+
-+  6. Each time you redistribute the Program (or any work based on the
-+Program), the recipient automatically receives a license from the
-+original licensor to copy, distribute or modify the Program subject to
-+these terms and conditions.  You may not impose any further
-+restrictions on the recipients' exercise of the rights granted herein.
-+You are not responsible for enforcing compliance by third parties to
-+this License.
-+
-+  7. If, as a consequence of a court judgment or allegation of patent
-+infringement or for any other reason (not limited to patent issues),
-+conditions are imposed on you (whether by court order, agreement or
-+otherwise) that contradict the conditions of this License, they do not
-+excuse you from the conditions of this License.  If you cannot
-+distribute so as to satisfy simultaneously your obligations under this
-+License and any other pertinent obligations, then as a consequence you
-+may not distribute the Program at all.  For example, if a patent
-+license would not permit royalty-free redistribution of the Program by
-+all those who receive copies directly or indirectly through you, then
-+the only way you could satisfy both it and this License would be to
-+refrain entirely from distribution of the Program.
-+
-+If any portion of this section is held invalid or unenforceable under
-+any particular circumstance, the balance of the section is intended to
-+apply and the section as a whole is intended to apply in other
-+circumstances.
-+
-+It is not the purpose of this section to induce you to infringe any
-+patents or other property right claims or to contest validity of any
-+such claims; this section has the sole purpose of protecting the
-+integrity of the free software distribution system, which is
-+implemented by public license practices.  Many people have made
-+generous contributions to the wide range of software distributed
-+through that system in reliance on consistent application of that
-+system; it is up to the author/donor to decide if he or she is willing
-+to distribute software through any other system and a licensee cannot
-+impose that choice.
-+
-+This section is intended to make thoroughly clear what is believed to
-+be a consequence of the rest of this License.
-+
-+  8. If the distribution and/or use of the Program is restricted in
-+certain countries either by patents or by copyrighted interfaces, the
-+original copyright holder who places the Program under this License
-+may add an explicit geographical distribution limitation excluding
-+those countries, so that distribution is permitted only in or among
-+countries not thus excluded.  In such case, this License incorporates
-+the limitation as if written in the body of this License.
-+
-+  9. The Free Software Foundation may publish revised and/or new versions
-+of the General Public License from time to time.  Such new versions will
-+be similar in spirit to the present version, but may differ in detail to
-+address new problems or concerns.
-+
-+Each version is given a distinguishing version number.  If the Program
-+specifies a version number of this License which applies to it and "any
-+later version", you have the option of following the terms and conditions
-+either of that version or of any later version published by the Free
-+Software Foundation.  If the Program does not specify a version number of
-+this License, you may choose any version ever published by the Free Software
-+Foundation.
-+
-+  10. If you wish to incorporate parts of the Program into other free
-+programs whose distribution conditions are different, write to the author
-+to ask for permission.  For software which is copyrighted by the Free
-+Software Foundation, write to the Free Software Foundation; we sometimes
-+make exceptions for this.  Our decision will be guided by the two goals
-+of preserving the free status of all derivatives of our free software and
-+of promoting the sharing and reuse of software generally.
-+
-+			    NO WARRANTY
-+
-+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
-+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
-+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
-+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-+REPAIR OR CORRECTION.
-+
-+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-+POSSIBILITY OF SUCH DAMAGES.
-+
-+		     END OF TERMS AND CONDITIONS
-+
-+	    How to Apply These Terms to Your New Programs
-+
-+  If you develop a new program, and you want it to be of the greatest
-+possible use to the public, the best way to achieve this is to make it
-+free software which everyone can redistribute and change under these terms.
-+
-+  To do so, attach the following notices to the program.  It is safest
-+to attach them to the start of each source file to most effectively
-+convey the exclusion of warranty; and each file should have at least
-+the "copyright" line and a pointer to where the full notice is found.
-+
-+    <one line to give the program's name and a brief idea of what it does.>
-+    Copyright (C) <year>  <name of author>
-+
-+    This program is free software; you can redistribute it and/or modify
-+    it under the terms of the GNU General Public License as published by
-+    the Free Software Foundation; either version 2 of the License, or
-+    (at your option) any later version.
-+
-+    This program is distributed in the hope that it will be useful,
-+    but WITHOUT ANY WARRANTY; without even the implied warranty of
-+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+    GNU General Public License for more details.
-+
-+    You should have received a copy of the GNU General Public License along
-+    with this program; if not, write to the Free Software Foundation, Inc.,
-+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-+
-+Also add information on how to contact you by electronic and paper mail.
-+
-+If the program is interactive, make it output a short notice like this
-+when it starts in an interactive mode:
-+
-+    Gnomovision version 69, Copyright (C) year name of author
-+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-+    This is free software, and you are welcome to redistribute it
-+    under certain conditions; type `show c' for details.
-+
-+The hypothetical commands `show w' and `show c' should show the appropriate
-+parts of the General Public License.  Of course, the commands you use may
-+be called something other than `show w' and `show c'; they could even be
-+mouse-clicks or menu items--whatever suits your program.
-+
-+You should also get your employer (if you work as a programmer) or your
-+school, if any, to sign a "copyright disclaimer" for the program, if
-+necessary.  Here is a sample; alter the names:
-+
-+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
-+
-+  <signature of Ty Coon>, 1 April 1989
-+  Ty Coon, President of Vice
-+
-+This General Public License does not permit incorporating your program into
-+proprietary programs.  If your program is a subroutine library, you may
-+consider it more useful to permit linking proprietary applications with the
-+library.  If this is what you want to do, use the GNU Lesser General
-+Public License instead of this License.
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xserver-nodm-init/xserver-nodm-init-2.0/xserver-nodm b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xserver-nodm-init/xserver-nodm-init-2.0/xserver-nodm
deleted file mode 100755
index 5d7e8a2..0000000
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xserver-nodm-init/xserver-nodm-init-2.0/xserver-nodm
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/bin/sh
-#
-### BEGIN INIT INFO
-# Provides: xserver
-# Required-Start: $local_fs $remote_fs dbus
-# Required-Stop: $local_fs $remote_fs
-# Default-Start:     5
-# Default-Stop:      0 1 2 3 6
-### END INIT INFO
-
-
-. /etc/init.d/functions
-
-for x in $(cat /proc/cmdline); do
-        case $x in
-        x11=false)
-		echo "X Server disabled" 
-		exit 0;
-                ;;
-        esac
-done
-
-case "$1" in
-  start)
-    # We don't want this script to block the rest of the boot process
-    if [ "$2" != "background" ]; then
-      $0 $1 background &
-    else
-       # work around from /etc/X11/Xinit
-       export USER=root
-       export HOME=/home/root
-       if [ ! -d $HOME ] && [ -d /root ]; then
-         HOME=/root
-       fi
-
-       . /etc/profile
-
-       echo "Starting Xserver"
-       . /etc/X11/xserver-common
-       xinit /etc/X11/Xsession -- `which $XSERVER` $ARGS >/var/log/Xsession.log 2>&1
-    fi 
-  ;;
-
-  stop)
-        echo "Stopping XServer"
-        killproc xinit
-  ;;
-
-  restart)
-	$0 stop
-        sleep 1
-        $0 start
-  ;;
-
-  *)
-        echo "usage: $0 { start | stop | restart }"
-  ;;
-esac
-
-exit 0
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xserver-nodm-init/xserver-nodm-init-2.0/xserver-nodm.conf b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xserver-nodm-init/xserver-nodm-init-2.0/xserver-nodm.conf
deleted file mode 100644
index 3c0582a..0000000
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xserver-nodm-init/xserver-nodm-init-2.0/xserver-nodm.conf
+++ /dev/null
@@ -1 +0,0 @@
-HOME=/home/root
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xserver-nodm-init/xserver-nodm-init-2.0/xserver-nodm.service b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xserver-nodm-init/xserver-nodm-init-2.0/xserver-nodm.service
deleted file mode 100644
index 94d221e..0000000
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xserver-nodm-init/xserver-nodm-init-2.0/xserver-nodm.service
+++ /dev/null
@@ -1,9 +0,0 @@
-[Unit]
-Description=Xserver startup with a display manager
-
-[Service]
-EnvironmentFile=/etc/default/xserver-nodm
-ExecStart=/etc/X11/Xserver
-
-[Install]
-Alias=display-manager.service
diff --git a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xserver-nodm-init/xserver-nodm-init_2.0.bb b/import-layers/meta-openembedded/meta-oe/recipes-graphics/xserver-nodm-init/xserver-nodm-init_2.0.bb
deleted file mode 100644
index 95a07d1..0000000
--- a/import-layers/meta-openembedded/meta-oe/recipes-graphics/xserver-nodm-init/xserver-nodm-init_2.0.bb
+++ /dev/null
@@ -1,41 +0,0 @@
-SUMMARY = "Simple Xserver Init Script (no dm)"
-LICENSE = "GPLv2"
-LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
-SECTION = "x11"
-
-PR = "r22"
-
-SRC_URI = "file://xserver-nodm \
-           file://gplv2-license.patch \
-           file://xserver-nodm.service \
-           file://xserver-nodm.conf \
-"
-S = "${WORKDIR}"
-
-inherit update-rc.d systemd
-
-INITSCRIPT_NAME = "xserver-nodm"
-INITSCRIPT_PARAMS = "start 01 5 . stop 01 0 1 2 3 6 ."
-INITSCRIPT_PARAMS_shr = "start 90 5 . stop 90 0 1 2 3 6 ."
-
-do_install() {
-    install -d ${D}${sysconfdir}/init.d
-    install xserver-nodm ${D}${sysconfdir}/init.d
-
-    install -d ${D}${sysconfdir}/default
-
-    if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
-        install -d ${D}${systemd_unitdir}/system
-        install xserver-nodm.conf ${D}${sysconfdir}/default/xserver-nodm
-        install -m 0644 ${WORKDIR}/xserver-nodm.service ${D}${systemd_unitdir}/system
-    fi
-}
-
-RDEPENDS_${PN} = "xserver-common (>= 1.30) xinit"
-
-RPROVIDES_${PN} += "${PN}-systemd"
-RREPLACES_${PN} += "${PN}-systemd"
-RCONFLICTS_${PN} += "${PN}-systemd"
-SYSTEMD_SERVICE_${PN} = "xserver-nodm.service"
-
-FILES_${PN} += "${sysconfdir}/default/xserver-nodm"