aboutsummaryrefslogtreecommitdiffstats
path: root/graphics/devil
diff options
context:
space:
mode:
authormi <mi@FreeBSD.org>2016-03-01 08:49:27 +0800
committermi <mi@FreeBSD.org>2016-03-01 08:49:27 +0800
commit910c03497485a1fdda898a59570c68599a33c1b9 (patch)
tree85ec5345c344a2f80c4fb562f6a191358b178877 /graphics/devil
parent33b81a9a3102ec7beee931113a89b9037c4af066 (diff)
downloadfreebsd-ports-gnome-910c03497485a1fdda898a59570c68599a33c1b9.tar.gz
freebsd-ports-gnome-910c03497485a1fdda898a59570c68599a33c1b9.tar.zst
freebsd-ports-gnome-910c03497485a1fdda898a59570c68599a33c1b9.zip
Make buildable with clang. While here, add patches submitted upstream
by others. Also make use of the author's own self-test suit. PR: 196161 Approved by: maintainer timeout
Diffstat (limited to 'graphics/devil')
-rw-r--r--graphics/devil/Makefile16
-rw-r--r--graphics/devil/files/patch-41103
-rw-r--r--graphics/devil/files/patch-4246
-rw-r--r--graphics/devil/files/patch-4326
-rw-r--r--graphics/devil/files/patch-4681
-rw-r--r--graphics/devil/files/patch-4744
-rw-r--r--graphics/devil/files/patch-4914
-rw-r--r--graphics/devil/files/patch-5014
-rw-r--r--graphics/devil/files/patch-5152
-rw-r--r--graphics/devil/files/patch-5247
-rw-r--r--graphics/devil/files/patch-clang367
-rw-r--r--graphics/devil/files/patch-testing28
-rw-r--r--graphics/devil/pkg-plist12
13 files changed, 838 insertions, 12 deletions
diff --git a/graphics/devil/Makefile b/graphics/devil/Makefile
index dff629a2e200..105a25c3a7c0 100644
--- a/graphics/devil/Makefile
+++ b/graphics/devil/Makefile
@@ -3,7 +3,7 @@
PORTNAME= devil
PORTVERSION= 1.7.8
-PORTREVISION= 20
+PORTREVISION= 21
PORTEPOCH= 1
CATEGORIES= graphics
MASTER_SITES= SF/openil/DevIL/${PORTVERSION}
@@ -14,12 +14,11 @@ COMMENT= Full featured cross-platform image library
USES= alias autoreconf libtool pkgconfig
GNU_CONFIGURE= yes
-CONFIGURE_ARGS= --enable-ILU \
+CONFIGURE_ARGS= --enable-ILU --enable-ILUT \
--disable-allegro --disable-directx8 --disable-directx9 \
--without-libsquish
INSTALL_TARGET= install-strip
USE_LDCONFIG= yes
-USE_GCC= any
WRKSRC= ${WRKDIR}/${DISTNAME:tl}
@@ -73,11 +72,8 @@ CONFIGURE_ENV+= libpng_app=no
.if ${PORT_OPTIONS:MX11}
USE_GL= glut
-CONFIGURE_ARGS+=--enable-ILUT
-PLIST_SUB+= X11=""
.else
CONFIGURE_ARGS+=--disable-opengl --disable-x11 --disable-xpm --disable-shm
-PLIST_SUB+= X11="@comment "
.endif
.if ${PORT_OPTIONS:MSDL}
@@ -97,6 +93,10 @@ post-patch:
@${REINPLACE_CMD} -e 's|<malloc\.h>|<stdlib.h>|g' \
${WRKSRC}/src-ILU/ilur/ilur.c
+post-configure:
+ ${REINPLACE_CMD} -e 's,-std=gnu99,,' \
+ ${WRKSRC}/Makefile ${WRKSRC}/*/Makefile
+
post-install:
@${RMDIR} ${STAGEDIR}${DATADIR}/examples
@${RMDIR} ${STAGEDIR}${DATADIR}
@@ -105,4 +105,8 @@ post-install:
${INSTALL_DATA} ${WRKSRC}/${file} ${STAGEDIR}${DOCSDIR}
.endfor
+do-test: build
+ ${MAKE} -C ${WRKSRC}/test testil
+ cd ${WRKSRC}/test && ${SH} format_test/format_checks.sh
+
.include <bsd.port.mk>
diff --git a/graphics/devil/files/patch-41 b/graphics/devil/files/patch-41
new file mode 100644
index 000000000000..e5d6b0d31437
--- /dev/null
+++ b/graphics/devil/files/patch-41
@@ -0,0 +1,103 @@
+See https://sourceforge.net/p/openil/patches/41/
+
+This patch improves alpha-compositing in DevIL.
+
+--- src-IL/src/il_devil.c (revision 1654)
++++ src-IL/src/il_devil.c (working copy)
+@@ -665,10 +665,10 @@
+ ILuint c;
+ ILuint StartX, StartY, StartZ;
+ ILboolean DestFlipped = IL_FALSE;
++ ILboolean DoAlphaBlend = IL_FALSE;
+ ILubyte *SrcTemp;
+- ILfloat Back;
+-
+- // Check if the desiination image really exists
++ ILfloat ResultAlpha;
++ // Check if the destination image really exists
+ if (DestName == 0 || iCurImage == NULL) {
+ ilSetError(IL_ILLEGAL_OPERATION);
+ return IL_FALSE;
+@@ -680,6 +680,9 @@
+ DestFlipped = IL_TRUE;
+ ilFlipImage();
+ }
++ //determining destination alpha support
++ DoAlphaBlend = ilIsEnabled(IL_BLIT_BLEND);
++
+ //DestOrigin = Dest->Origin;
+ ilBindImage(Source);
+
+@@ -688,7 +691,9 @@
+ ilSetError(IL_INVALID_PARAM);
+ return IL_FALSE;
+ }
+-
++ //determining source alpha support
++ DoAlphaBlend &= ilIsEnabled(IL_BLIT_BLEND);
++
+ Src = iCurImage;
+
+ //@TODO test if coordinates are inside the images (hard limit for source)
+@@ -737,38 +742,49 @@
+ const ILuint SrcIndex = (z+SrcZ)*ConvSizePlane + (y+SrcY)*ConvBps + (x+SrcX)*Dest->Bpp;
+ const ILuint DestIndex = (z+DestZ)*Dest->SizeOfPlane + (y+DestY)*Dest->Bps + (x+DestX)*Dest->Bpp;
+ const ILuint AlphaIdx = SrcIndex + bpp_without_alpha;
+- ILfloat Front = 0;
++ ILfloat FrontAlpha = 0; // foreground opacity
++ ILfloat BackAlpha = 0; // background opacity
+
+ switch (Dest->Type)
+ {
+ case IL_BYTE:
+ case IL_UNSIGNED_BYTE:
+- Front = Converted[AlphaIdx]/((float)IL_MAX_UNSIGNED_BYTE);
++ FrontAlpha = Converted[AlphaIdx]/((float)IL_MAX_UNSIGNED_BYTE);
++ BackAlpha = Dest->Data[AlphaIdx]/((float)IL_MAX_UNSIGNED_BYTE);
+ break;
+ case IL_SHORT:
+ case IL_UNSIGNED_SHORT:
+- Front = ((ILshort*)Converted)[AlphaIdx]/((float)IL_MAX_UNSIGNED_SHORT);
++ FrontAlpha = ((ILshort*)Converted)[AlphaIdx]/((float)IL_MAX_UNSIGNED_SHORT);
++ BackAlpha = ((ILshort*)Dest->Data)[AlphaIdx]/((float)IL_MAX_UNSIGNED_SHORT);
+ break;
+ case IL_INT:
+ case IL_UNSIGNED_INT:
+- Front = ((ILint*)Converted)[AlphaIdx]/((float)IL_MAX_UNSIGNED_INT);
++ FrontAlpha = ((ILint*)Converted)[AlphaIdx]/((float)IL_MAX_UNSIGNED_INT);
++ BackAlpha = ((ILint*)Dest->Data)[AlphaIdx]/((float)IL_MAX_UNSIGNED_INT);
+ break;
+ case IL_FLOAT:
+- Front = ((ILfloat*)Converted)[AlphaIdx];
++ FrontAlpha = ((ILfloat*)Converted)[AlphaIdx];
++ BackAlpha = ((ILfloat*)Dest->Data)[AlphaIdx];
+ break;
+ case IL_DOUBLE:
+- Front = (ILfloat)(((ILdouble*)Converted)[AlphaIdx]);
++ FrontAlpha = (ILfloat)(((ILdouble*)Converted)[AlphaIdx]);
++ BackAlpha = (ILfloat)(((ILdouble*)Dest->Data)[AlphaIdx]);
+ break;
+ }
+- Back = 1.0f - Front;
+- // In case of Alpha channel, the data is blended. Keeps the original alpha.
+- if (ilIsEnabled(IL_BLIT_BLEND)) {
++
++ // In case of Alpha channel, the data is blended.
++ // Computes composite Alpha
++ if (DoAlphaBlend)
++ {
++ ResultAlpha = FrontAlpha + (1.0f - FrontAlpha) * BackAlpha;
+ for (c = 0; c < bpp_without_alpha; c++)
+ {
+- Dest->Data[DestIndex + c] =
+- (ILubyte)(Converted[SrcIndex + c] * Front
+- + Dest->Data[DestIndex + c] * Back);
++ Dest->Data[DestIndex + c] = (ILubyte)( 0.5f +
++ (Converted[SrcIndex + c] * FrontAlpha +
++ (1.0f - FrontAlpha) * Dest->Data[DestIndex + c] * BackAlpha)
++ / ResultAlpha);
+ }
++ Dest->Data[AlphaIdx] = (ILubyte)(0.5f + ResultAlpha * (float)IL_MAX_UNSIGNED_BYTE);
+ }
+ else {
+ for (c = 0; c < Dest->Bpp; c++)
diff --git a/graphics/devil/files/patch-42 b/graphics/devil/files/patch-42
new file mode 100644
index 000000000000..d31bad6506ae
--- /dev/null
+++ b/graphics/devil/files/patch-42
@@ -0,0 +1,46 @@
+See https://sourceforge.net/p/openil/patches/42/
+
+This patch allows luminance BMPs to be saved as straight grayscale, saving
+lots of space for colorless images.
+--- src-IL/src/il_bmp.c (revision 1662)
++++ src-IL/src/il_bmp.c (working copy)
+@@ -928,6 +928,28 @@
+ }
+ }
+
++ if((iCurImage->Format == IL_LUMINANCE) && (iCurImage->Pal.Palette == NULL))
++ {
++ // For luminance images it is necessary to generate a grayscale BGR32
++ // color palette. Could call iConvertImage(..., IL_COLOR_INDEX, ...)
++ // to generate an RGB24 palette, followed by iConvertPal(..., IL_PAL_BGR32),
++ // to convert the palette to BGR32, but it seemed faster to just
++ // explicitely generate the correct palette.
++
++ iCurImage->Pal.PalSize = 256*4;
++ iCurImage->Pal.PalType = IL_PAL_BGR32;
++ iCurImage->Pal.Palette = (ILubyte*)ialloc(iCurImage->Pal.PalSize);
++
++ // Generate grayscale palette
++ for (i = 0; i < 256; i++)
++ {
++ iCurImage->Pal.Palette[i * 4] = i;
++ iCurImage->Pal.Palette[i * 4 + 1] = i;
++ iCurImage->Pal.Palette[i * 4 + 2] = i;
++ iCurImage->Pal.Palette[i * 4 + 3] = 0;
++ }
++ }
++
+ // If the current image has a palette, take care of it
+ TempPal = &iCurImage->Pal;
+ if( iCurImage->Pal.PalSize && iCurImage->Pal.Palette && iCurImage->Pal.PalType != IL_PAL_NONE ) {
+@@ -948,8 +970,8 @@
+ //BITMAPINFOHEADER, so that the written header refers to
+ //TempImage instead of the original image
+
+- // @TODO LUMINANCE converted to BGR insteaf of beign saved to luminance
+- if (iCurImage->Format != IL_BGR && iCurImage->Format != IL_BGRA && iCurImage->Format != IL_COLOUR_INDEX) {
++ if ((iCurImage->Format != IL_BGR) && (iCurImage->Format != IL_BGRA) &&
++ (iCurImage->Format != IL_COLOUR_INDEX) && (iCurImage->Format != IL_LUMINANCE)) {
+ if (iCurImage->Format == IL_RGBA) {
+ TempImage = iConvertImage(iCurImage, IL_BGRA, IL_UNSIGNED_BYTE);
+ } else {
diff --git a/graphics/devil/files/patch-43 b/graphics/devil/files/patch-43
new file mode 100644
index 000000000000..7a508447212e
--- /dev/null
+++ b/graphics/devil/files/patch-43
@@ -0,0 +1,26 @@
+See https://sourceforge.net/p/openil/patches/43/
+
+This patch will cause TIFFs with only a single color channel to be
+saved as such, rather than as RGB.
+
+--- src-IL/src/il_tiff.c (revision 1663)
++++ src-IL/src/il_tiff.c (working copy)
+@@ -987,11 +987,15 @@
+ TIFFSetField(File, TIFFTAG_IMAGEWIDTH, TempImage->Width);
+ TIFFSetField(File, TIFFTAG_IMAGELENGTH, TempImage->Height);
+ TIFFSetField(File, TIFFTAG_COMPRESSION, Compression);
+- TIFFSetField(File, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
++ if((TempImage->Format == IL_LUMINANCE) || (TempImage->Format == IL_LUMINANCE_ALPHA))
++ TIFFSetField(File, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);
++ else
++ TIFFSetField(File, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB);
+ TIFFSetField(File, TIFFTAG_BITSPERSAMPLE, TempImage->Bpc << 3);
+ TIFFSetField(File, TIFFTAG_SAMPLESPERPIXEL, TempImage->Bpp);
+- if (TempImage->Bpp == 4) //TODO: LUMINANCE, LUMINANCE_ALPHA
+- TIFFSetField(File, TIFFTAG_MATTEING, 1);
++ if ((TempImage->Bpp == ilGetBppFormat(IL_RGBA)) ||
++ (TempImage->Bpp == ilGetBppFormat(IL_LUMINANCE_ALPHA)))
++ TIFFSetField(File, TIFFTAG_EXTRASAMPLES, EXTRASAMPLE_ASSOCALPHA);
+ TIFFSetField(File, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
+ TIFFSetField(File, TIFFTAG_ROWSPERSTRIP, 1);
+ TIFFSetField(File, TIFFTAG_SOFTWARE, ilGetString(IL_VERSION_NUM));
diff --git a/graphics/devil/files/patch-46 b/graphics/devil/files/patch-46
new file mode 100644
index 000000000000..ab16eccd9aa4
--- /dev/null
+++ b/graphics/devil/files/patch-46
@@ -0,0 +1,81 @@
+See: https://sourceforge.net/p/openil/patches/46/
+
+Add the ability to alter the PNG-compression.
+
+--- include/IL/il.h (revision 1677)
++++ include/IL/il.h (working copy)
+@@ -377,6 +377,7 @@
+ #define IL_PNG_ALPHA_INDEX 0x0724 //XIX : ILint : the color in the palette at this index value (0-255) is considered transparent, -1 for no trasparent color
+ #define IL_JPG_PROGRESSIVE 0x0725
+ #define IL_VTF_COMP 0x0726
++#define IL_PNG_COMPRESSION 0x0727
+
+
+ // DXTC definitions
+--- src-IL/include/il_states.h (revision 1677)
++++ src-IL/include/il_states.h (working copy)
+@@ -76,6 +76,7 @@
+ ILboolean ilJpgProgressive;
+ ILenum ilDxtcFormat;
+ ILenum ilPcdPicNum;
++ ILuint ilPngCompression;
+
+ ILint ilPngAlphaIndex; // this index should be treated as an alpha key (most formats use this rather than having alpha in the palette), -1 for none
+ // currently only used when writing out .png files and should obviously be set to -1 most of the time
+--- src-IL/src/il_png.c (revision 1677)
++++ src-IL/src/il_png.c (working copy)
+@@ -538,6 +538,8 @@
+ // png_init_io(png_ptr, PngFile);
+ png_set_write_fn(png_ptr, NULL, png_write, flush_data);
+
++ png_set_compression_level(png_ptr, iGetInt(IL_PNG_COMPRESSION));
++
+ switch (iCurImage->Type)
+ {
+ case IL_BYTE:
+--- src-IL/src/il_states.c (revision 1677)
++++ src-IL/src/il_states.c (working copy)
+@@ -70,6 +70,10 @@
+ ilStates[ilCurrentPos].ilPngAlphaIndex = -1;
+ ilStates[ilCurrentPos].ilVtfCompression = IL_DXT_NO_COMP;
+
++ // Default PNG compression setting as defined in libpng manual:
++ // http://www.libpng.org/pub/png/libpng-1.2.5-manual.html#section-5.8
++ ilStates[ilCurrentPos].ilPngCompression = 6;
++
+ ilStates[ilCurrentPos].ilTgaId = NULL;
+ ilStates[ilCurrentPos].ilTgaAuthName = NULL;
+ ilStates[ilCurrentPos].ilTgaAuthComment = NULL;
+@@ -500,6 +504,9 @@
+ case IL_VTF_COMP:
+ *Param = ilStates[ilCurrentPos].ilVtfCompression;
+ break;
++ case IL_PNG_COMPRESSION:
++ *Param = ilStates[ilCurrentPos].ilPngCompression;
++ break;
+
+ // Boolean values
+ case IL_CONV_PAL:
+@@ -815,6 +822,7 @@
+ ilStates[ilCurrentPos].ilPcdPicNum = ilStates[ilCurrentPos-1].ilPcdPicNum;
+
+ ilStates[ilCurrentPos].ilPngAlphaIndex = ilStates[ilCurrentPos-1].ilPngAlphaIndex;
++ ilStates[ilCurrentPos].ilPngCompression = ilStates[ilCurrentPos-1].ilPngCompression;
+
+ // Strings
+ if (ilStates[ilCurrentPos].ilTgaId)
+@@ -1159,6 +1167,14 @@
+ return;
+ }
+ break;
++ case IL_PNG_COMPRESSION:
++ // Valid PNG compression settings as defined in libpng manual:
++ // http://www.libpng.org/pub/png/libpng-1.2.5-manual.html#section-5.8
++ if (Param >= 0 && Param <= 9) {
++ ilStates[ilCurrentPos].ilPngCompression = Param;
++ return;
++ }
++ break;
+
+ default:
+ ilSetError(IL_INVALID_ENUM);
diff --git a/graphics/devil/files/patch-47 b/graphics/devil/files/patch-47
new file mode 100644
index 000000000000..56744d6f98a8
--- /dev/null
+++ b/graphics/devil/files/patch-47
@@ -0,0 +1,44 @@
+See https://sourceforge.net/p/openil/patches/47/
+
+From 5ab2eae2939463aba7fd7bf9a37cc43b9d8cdc43 Mon Sep 17 00:00:00 2001
+From: Jeff Epler <jepler@unpythonic.net>
+Date: Thu, 3 Jun 2010 16:38:46 -0500
+Subject: [PATCH] PR20713: fix out of bounds access in iluGaussian
+
+the 'rightmost pixel' case in iluBlurGaussian was the same as the
+'leftmost pixel' case, which makes it refer to pixels that are off the
+right-hand side of the image by 1 or 2 pixels. In the final row they
+are beyond the end of the image, and if the bytes just beyond the end of
+the image are in an unmapped page, the program can segfault.
+
+change the 'rightmost' case to use the pixels to the left of the pixel
+being filtered instead.
+
+Signed-off-by: Jeff Epler <jepler@unpythonic.net>
+
+--- src-ILU/src/ilu_filter.c
++++ src-ILU/src/ilu_filter.c
+@@ -378,14 +378,14 @@ ILubyte *Filter(ILimage *Image, const ILint *matrix, ILint scale, ILint bias)
+ }
+ for (c = 0; c < Image->Bpp; c++) {
+ Num = Image->Data[y - Image->Bps + c] * matrix[0] +
+- Image->Data[y - Image->Bps + Image->Bpp + c] * matrix[1]+
+- Image->Data[y - Image->Bps + 2 * Image->Bpp + c] * matrix[2]+
++ Image->Data[y - Image->Bps - Image->Bpp + c] * matrix[1]+
++ Image->Data[y - Image->Bps - 2 * Image->Bpp + c] * matrix[2]+
+ Image->Data[y + c] * matrix[3]+
+- Image->Data[y + Image->Bpp + c] * matrix[4]+
+- Image->Data[y + 2 * Image->Bpp + c] * matrix[5]+
++ Image->Data[y - Image->Bpp + c] * matrix[4]+
++ Image->Data[y - 2 * Image->Bpp + c] * matrix[5]+
+ Image->Data[y + Image->Bps + c] * matrix[6]+
+- Image->Data[y + Image->Bps + Image->Bpp + c] * matrix[7]+
+- Image->Data[y + Image->Bps + 2 * Image->Bpp + c] * matrix[8];
++ Image->Data[y + Image->Bps - Image->Bpp + c] * matrix[7]+
++ Image->Data[y + Image->Bps - 2 * Image->Bpp + c] * matrix[8];
+
+ Temp = (ILuint)fabs((Num / (ILdouble)scale) + bias);
+ if (Temp > 255)
+--
+1.7.1
+
diff --git a/graphics/devil/files/patch-49 b/graphics/devil/files/patch-49
new file mode 100644
index 000000000000..384227561539
--- /dev/null
+++ b/graphics/devil/files/patch-49
@@ -0,0 +1,14 @@
+See https://sourceforge.net/p/openil/patches/49/ -- this patch allows
+DevIL to be configured with ILUT, but without X11:
+
+--- m4/devil-api_checks.m4 2009-03-08 10:10:05.000000000 +0300
++++ m4/devil-api_checks.m4 2012-01-31 17:05:07.163553444 +0400
+@@ -137,7 +137,7 @@
+ [main],
+ [dnl The use_x11 var is either "yes" already, or we don't want "no" to be overwritten
+ ILUT_LIBS="-lX11 $ILUT_LIBS"],
+- [use_x11="no"]) ])
++ [use_x11="no"]) ], [use_x11="no"])
+ TEST_API([shm])
+ AS_IF([test "x$enable_shm" = "xyes"],
+ [AC_CHECK_HEADER([X11/extensions/XShm.h],
diff --git a/graphics/devil/files/patch-50 b/graphics/devil/files/patch-50
new file mode 100644
index 000000000000..47a23359d544
--- /dev/null
+++ b/graphics/devil/files/patch-50
@@ -0,0 +1,14 @@
+See https://sourceforge.net/p/openil/patches/50/
+
+--- src-IL/src/il_targa.c (revision 1678)
++++ src-IL/src/il_targa.c (working copy)
+@@ -219,6 +219,9 @@
+ ilSetError(IL_ILLEGAL_FILE_VALUE);
+ return IL_FALSE;
+ }
++
++ if (bTarga==IL_FALSE)
++ return IL_FALSE;
+
+ // @JASON Extra Code to manipulate the image depending on
+ // the Image Descriptor's origin bits.
diff --git a/graphics/devil/files/patch-51 b/graphics/devil/files/patch-51
new file mode 100644
index 000000000000..d4ea5ca26323
--- /dev/null
+++ b/graphics/devil/files/patch-51
@@ -0,0 +1,52 @@
+See https://sourceforge.net/p/openil/patches/51/
+
+*** src-ILU/src/ilu_scale2d.c Wed Oct 28 16:51:50 2009
+--- src-ILU/src/ilu_scale2d.c Tue Dec 18 12:11:08 2012
+***************
+*** 204,209 ****
+--- 204,217 ----
+ ILfloat SrcX, SrcY;
+ ILuint iSrcX, iSrcY, iSrcXPlus1, iSrcYPlus1, ulOff, llOff, urOff, lrOff;
+
++ // only downscale is allowed
++ assert(ScaleX>0 && ScaleX<=1.0f);
++ assert(ScaleY>0 && ScaleY<=1.0f);
++
++ // scale factors should match images size
++ assert( ((ILfloat)Width -0.5f) / ScaleX < Image->Width );
++ assert( ((ILfloat)Height-0.5f) / ScaleY < Image->Height );
++
+ ImgBps = Image->Bps / Image->Bpc;
+ SclBps = Scaled->Bps / Scaled->Bpc;
+
+***************
+*** 213,226 ****
+ for (y = 0; y < Height; y++) {
+ for (x = 0; x < Width; x++) {
+ // Calculate where we want to choose pixels from in our source image.
+! SrcX = (ILfloat)x / (ILfloat)ScaleX;
+! SrcY = (ILfloat)y / (ILfloat)ScaleY;
+! // Integer part of SrcX and SrcY
+! iSrcX = (ILuint)floor(SrcX);
+! iSrcY = (ILuint)floor(SrcY);
+! // Fractional part of SrcX and SrcY
+! FracX = SrcX - (ILfloat)(iSrcX);
+! FracY = SrcY - (ILfloat)(iSrcY);
+
+ // We do not want to go past the right edge of the image or past the last line in the image,
+ // so this takes care of that. Normally, iSrcXPlus1 is iSrcX + 1, but if this is past the
+--- 221,234 ----
+ for (y = 0; y < Height; y++) {
+ for (x = 0; x < Width; x++) {
+ // Calculate where we want to choose pixels from in our source image.
+! SrcX = (ILfloat)(x+0.5f) / (ILfloat)ScaleX;
+! SrcY = (ILfloat)(y+0.5f) / (ILfloat)ScaleY;
+! // indices of upper-left pixel
+! iSrcX = (ILuint)(SrcX-0.5f);
+! iSrcY = (ILuint)(SrcY-0.5f);
+! // how far SrcX and SrcY are from upper-left pixel center
+! FracX = SrcX - (ILfloat)(iSrcX) - 0.5f;
+! FracY = SrcY - (ILfloat)(iSrcY) - 0.5f;
+
+ // We do not want to go past the right edge of the image or past the last line in the image,
+ // so this takes care of that. Normally, iSrcXPlus1 is iSrcX + 1, but if this is past the
diff --git a/graphics/devil/files/patch-52 b/graphics/devil/files/patch-52
new file mode 100644
index 000000000000..ff94644a86b1
--- /dev/null
+++ b/graphics/devil/files/patch-52
@@ -0,0 +1,47 @@
+See https://sourceforge.net/p/openil/patches/52/
+
+--- src-IL/src/il_pcx.c (revision 1678)
++++ src-IL/src/il_pcx.c (working copy)
+@@ -375,20 +375,26 @@
+ if (Header->NumPlanes == 1 && Header->Bpp == 1) {
+ for (j = 0; j < iCurImage->Height; j++) {
+ i = 0; //number of written pixels
+- while (i < iCurImage->Width) {
++ Bps = 0;
++ while (Bps<Header->Bps) {
+ if (iread(&HeadByte, 1, 1) != 1)
+ return IL_FALSE;
++ ++Bps;
++ // Check if we got duplicates with RLE compression
+ if (HeadByte >= 192) {
+ HeadByte -= 192;
+ if (iread(&Data, 1, 1) != 1)
+ return IL_FALSE;
+
++ --Bps;
++ // duplicate next byte
+ for (c = 0; c < HeadByte; c++) {
+ k = 128;
+ for (d = 0; d < 8 && i < iCurImage->Width; d++) {
+ iCurImage->Data[j * iCurImage->Width + i++] = ((Data & k) != 0 ? 255 : 0);
+ k >>= 1;
+ }
++ ++Bps;
+ }
+ }
+ else {
+@@ -408,8 +414,12 @@
+ //If Width/8 is even no padding is needed,
+ //one pad byte has to be read otherwise.
+ //(let's hope the above is true ;-))
+- if(!((iCurImage->Width >> 3) & 0x1))
+- igetc(); // Skip pad byte
++
++ // changed 2012-05-06
++ // Not the good size - don't need it, padding inside data already !
++
++ // if(!((iCurImage->Width >> 3) & 0x1))
++ // igetc(); // Skip pad byte
+ }
+ }
+ else if (Header->NumPlanes == 4 && Header->Bpp == 1){ // 4-bit images
diff --git a/graphics/devil/files/patch-clang b/graphics/devil/files/patch-clang
new file mode 100644
index 000000000000..ff388724006c
--- /dev/null
+++ b/graphics/devil/files/patch-clang
@@ -0,0 +1,367 @@
+Submitted upstream as:
+
+ https://sourceforge.net/p/openil/bugs/212/
+
+--- src-IL/include/il_internal.h 2009-03-08 03:10:08.000000000 -0400
++++ src-IL/include/il_internal.h 2014-12-20 01:11:39.000000000 -0500
+@@ -228,5 +228,5 @@
+ ILboolean ilLoadBlpF(ILHANDLE File);
+ ILboolean ilLoadBlpL(const void *Lump, ILuint Size);
+-ILboolean ilIsValidBmp(ILconst_string CONST_RESTRICT FileName);
++ILboolean ilIsValidBmp(ILconst_string FileName);
+ ILboolean ilIsValidBmpF(ILHANDLE File);
+ ILboolean ilIsValidBmpL(const void *Lump, ILuint Size);
+--- src-IL/src/il_exr.cpp 2009-03-08 03:10:09.000000000 -0400
++++ src-IL/src/il_exr.cpp 2014-12-20 01:15:55.000000000 -0500
+@@ -11,5 +11,5 @@
+ //-----------------------------------------------------------------------------
+
+-
++#include <machine/endian.h>
+ #include "il_internal.h"
+ #ifndef IL_NO_EXR
+@@ -246,5 +246,5 @@
+ in.readPixels (dataWindow.min.y, dataWindow.max.y);
+ }
+- catch (const exception &e)
++ catch (const exception)
+ {
+ // If some of the pixels in the file cannot be read,
+@@ -252,5 +252,4 @@
+ // to the caller.
+ ilSetError(IL_LIB_EXR_ERROR); // Could I use something a bit more descriptive based on e?
+- e; // Prevent the compiler from yelling at us about this being unused.
+ return IL_FALSE;
+ }
+--- src-IL/include/il_endian.h 2009-03-08 03:10:08.000000000 -0400
++++ src-IL/include/il_endian.h 2014-12-20 01:28:47.000000000 -0500
+@@ -15,14 +15,7 @@
+
+ #include "il_internal.h"
++#include <machine/endian.h>
+
+-#ifdef WORDS_BIGENDIAN // This is defined by ./configure.
+- #ifndef __BIG_ENDIAN__
+- #define __BIG_ENDIAN__ 1
+- #endif
+-#endif
+-
+-#if (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __BIG_ENDIAN__) \
+- || (defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__))
+- #undef __LITTLE_ENDIAN__
++#if BYTE_ORDER == BIG_ENDIAN
+ #define Short(s) iSwapShort(s)
+ #define UShort(s) iSwapUShort(s)
+@@ -39,7 +32,4 @@
+ #define BigDouble(d)
+ #else
+- #undef __BIG_ENDIAN__
+- #undef __LITTLE_ENDIAN__ // Not sure if it's defined by any compiler...
+- #define __LITTLE_ENDIAN__
+ #define Short(s)
+ #define UShort(s)
+@@ -168,5 +158,5 @@
+ ILushort s;
+ iread(&s, sizeof(ILushort), 1);
+-#ifdef __BIG_ENDIAN__
++#if BYTE_ORDER == BIG_ENDIAN
+ iSwapUShort(&s);
+ #endif
+@@ -177,5 +167,5 @@
+ ILshort s;
+ iread(&s, sizeof(ILshort), 1);
+-#ifdef __BIG_ENDIAN__
++#if BYTE_ORDER == BIG_ENDIAN
+ iSwapShort(&s);
+ #endif
+@@ -186,5 +176,5 @@
+ ILuint i;
+ iread(&i, sizeof(ILuint), 1);
+-#ifdef __BIG_ENDIAN__
++#if BYTE_ORDER == BIG_ENDIAN
+ iSwapUInt(&i);
+ #endif
+@@ -195,5 +185,5 @@
+ ILint i;
+ iread(&i, sizeof(ILint), 1);
+-#ifdef __BIG_ENDIAN__
++#if BYTE_ORDER == BIG_ENDIAN
+ iSwapInt(&i);
+ #endif
+@@ -204,5 +194,5 @@
+ ILfloat f;
+ iread(&f, sizeof(ILfloat), 1);
+-#ifdef __BIG_ENDIAN__
++#if BYTE_ORDER == BIG_ENDIAN
+ iSwapFloat(&f);
+ #endif
+@@ -213,5 +203,5 @@
+ ILdouble d;
+ iread(&d, sizeof(ILdouble), 1);
+-#ifdef __BIG_ENDIAN__
++#if BYTE_ORDER == BIG_ENDIAN
+ iSwapDouble(&d);
+ #endif
+@@ -223,5 +213,5 @@
+ ILushort s;
+ iread(&s, sizeof(ILushort), 1);
+-#ifdef __LITTLE_ENDIAN__
++#if BYTE_ORDER == LITTLE_ENDIAN
+ iSwapUShort(&s);
+ #endif
+@@ -233,5 +223,5 @@
+ ILshort s;
+ iread(&s, sizeof(ILshort), 1);
+-#ifdef __LITTLE_ENDIAN__
++#if BYTE_ORDER == LITTLE_ENDIAN
+ iSwapShort(&s);
+ #endif
+@@ -243,5 +233,5 @@
+ ILuint i;
+ iread(&i, sizeof(ILuint), 1);
+-#ifdef __LITTLE_ENDIAN__
++#if BYTE_ORDER == LITTLE_ENDIAN
+ iSwapUInt(&i);
+ #endif
+@@ -253,5 +243,5 @@
+ ILint i;
+ iread(&i, sizeof(ILint), 1);
+-#ifdef __LITTLE_ENDIAN__
++#if BYTE_ORDER == LITTLE_ENDIAN
+ iSwapInt(&i);
+ #endif
+@@ -263,5 +253,5 @@
+ ILfloat f;
+ iread(&f, sizeof(ILfloat), 1);
+-#ifdef __LITTLE_ENDIAN__
++#if BYTE_ORDER == LITTLE_ENDIAN
+ iSwapFloat(&f);
+ #endif
+@@ -273,5 +263,5 @@
+ ILdouble d;
+ iread(&d, sizeof(ILdouble), 1);
+-#ifdef __LITTLE_ENDIAN__
++#if BYTE_ORDER == LITTLE_ENDIAN
+ iSwapDouble(&d);
+ #endif
+@@ -280,5 +270,5 @@
+
+ INLINE ILubyte SaveLittleUShort(ILushort s) {
+-#ifdef __BIG_ENDIAN__
++#if BYTE_ORDER == BIG_ENDIAN
+ iSwapUShort(&s);
+ #endif
+@@ -287,5 +277,5 @@
+
+ INLINE ILubyte SaveLittleShort(ILshort s) {
+-#ifdef __BIG_ENDIAN__
++#if BYTE_ORDER == BIG_ENDIAN
+ iSwapShort(&s);
+ #endif
+@@ -295,5 +285,5 @@
+
+ INLINE ILubyte SaveLittleUInt(ILuint i) {
+-#ifdef __BIG_ENDIAN__
++#if BYTE_ORDER == BIG_ENDIAN
+ iSwapUInt(&i);
+ #endif
+@@ -303,5 +293,5 @@
+
+ INLINE ILubyte SaveLittleInt(ILint i) {
+-#ifdef __BIG_ENDIAN__
++#if BYTE_ORDER == BIG_ENDIAN
+ iSwapInt(&i);
+ #endif
+@@ -310,5 +300,5 @@
+
+ INLINE ILubyte SaveLittleFloat(ILfloat f) {
+-#ifdef __BIG_ENDIAN__
++#if BYTE_ORDER == BIG_ENDIAN
+ iSwapFloat(&f);
+ #endif
+@@ -318,5 +308,5 @@
+
+ INLINE ILubyte SaveLittleDouble(ILdouble d) {
+-#ifdef __BIG_ENDIAN__
++#if BYTE_ORDER == BIG_ENDIAN
+ iSwapDouble(&d);
+ #endif
+@@ -326,5 +316,5 @@
+
+ INLINE ILubyte SaveBigUShort(ILushort s) {
+-#ifdef __LITTLE_ENDIAN__
++#if BYTE_ORDER == LITTLE_ENDIAN
+ iSwapUShort(&s);
+ #endif
+@@ -334,5 +324,5 @@
+
+ INLINE ILubyte SaveBigShort(ILshort s) {
+-#ifdef __LITTLE_ENDIAN__
++#if BYTE_ORDER == LITTLE_ENDIAN
+ iSwapShort(&s);
+ #endif
+@@ -342,5 +332,5 @@
+
+ INLINE ILubyte SaveBigUInt(ILuint i) {
+-#ifdef __LITTLE_ENDIAN__
++#if BYTE_ORDER == LITTLE_ENDIAN
+ iSwapUInt(&i);
+ #endif
+@@ -350,5 +340,5 @@
+
+ INLINE ILubyte SaveBigInt(ILint i) {
+-#ifdef __LITTLE_ENDIAN__
++#if BYTE_ORDER == LITTLE_ENDIAN
+ iSwapInt(&i);
+ #endif
+@@ -358,5 +348,5 @@
+
+ INLINE ILubyte SaveBigFloat(ILfloat f) {
+-#ifdef __LITTLE_ENDIAN__
++#if BYTE_ORDER == LITTLE_ENDIAN
+ iSwapFloat(&f);
+ #endif
+@@ -366,5 +356,5 @@
+
+ INLINE ILubyte SaveBigDouble(ILdouble d) {
+-#ifdef __LITTLE_ENDIAN__
++#if BYTE_ORDER == LITTLE_ENDIAN
+ iSwapDouble(&d);
+ #endif
+--- ./src-IL/src/il_convert.c 2009-03-08 03:10:09.000000000 -0400
++++ ./src-IL/src/il_convert.c 2014-12-20 01:36:37.000000000 -0500
+@@ -1018,5 +1018,5 @@
+ }
+ /* Swap Colors on Big Endian !!!!!
+-#ifdef __BIG_ENDIAN__
++#if BYTE_ORDER == BIG_ENDIAN
+ // Swap endian
+ EndianSwapData(iCurImage);
+--- ./src-IL/src/il_dicom.c 2009-03-08 03:10:09.000000000 -0400
++++ ./src-IL/src/il_dicom.c 2014-12-20 01:36:37.000000000 -0500
+@@ -536,5 +536,5 @@
+
+ // We may have to swap the order of the data.
+-#ifdef __BIG_ENDIAN__
++#if BYTE_ORDER == BIG_ENDIAN
+ if (!Header.BigEndian) {
+ if (Header.Format == IL_RGB)
+--- ./src-IL/src/il_icon.c 2014-12-20 01:00:18.000000000 -0500
++++ ./src-IL/src/il_icon.c 2014-12-20 01:36:37.000000000 -0500
+@@ -555,5 +555,5 @@
+
+ //fix endianess
+-#ifdef __LITTLE_ENDIAN__
++#if BYTE_ORDER == LITTLE_ENDIAN
+ if (bit_depth == 16)
+ png_set_swap(ico_png_ptr);
+--- ./src-IL/src/il_png.c 2014-12-20 01:00:18.000000000 -0500
++++ ./src-IL/src/il_png.c 2014-12-20 01:36:37.000000000 -0500
+@@ -308,5 +308,5 @@
+
+ //fix endianess
+-#ifdef __LITTLE_ENDIAN__
++#if BYTE_ORDER == LITTLE_ENDIAN
+ if (bit_depth == 16)
+ png_set_swap(png_ptr);
+--- ./src-IL/src/il_psd.c 2009-03-08 03:10:09.000000000 -0400
++++ ./src-IL/src/il_psd.c 2014-12-20 01:36:37.000000000 -0500
+@@ -542,5 +542,5 @@
+ return NULL;
+ }
+-#ifdef __LITTLE_ENDIAN__
++#if BYTE_ORDER == LITTLE_ENDIAN
+ for (i = 0; i < Head->Height * ChannelNum; i++) {
+ iSwapUShort(&RleTable[i]);
+--- ./src-IL/src/il_tiff.c 2009-03-08 03:10:09.000000000 -0400
++++ ./src-IL/src/il_tiff.c 2014-12-20 01:36:37.000000000 -0500
+@@ -611,5 +611,5 @@
+ Image->Origin = IL_ORIGIN_LOWER_LEFT; // eiu...dunno if this is right
+
+-#ifdef __BIG_ENDIAN__ //TIFFReadRGBAImage reads abgr on big endian, convert to rgba
++#if BYTE_ORDER == BIG_ENDIAN //TIFFReadRGBAImage reads abgr on big endian, convert to rgba
+ EndianSwapData(Image);
+ #endif
+@@ -636,5 +636,5 @@
+ case 3:
+ //TODO: why the ifdef??
+-#ifdef __LITTLE_ENDIAN__
++#if BYTE_ORDER == LITTLE_ENDIAN
+ ilConvertImage(IL_RGB, IL_UNSIGNED_BYTE);
+ #endif
+@@ -647,5 +647,5 @@
+ /*
+ //invert alpha
+-#ifdef __LITTLE_ENDIAN__
++#if BYTE_ORDER == LITTLE_ENDIAN
+ pImageData += 3;
+ #endif
+--- ./src-ILUT/src/ilut_sdlsurface.c 2009-03-08 03:10:11.000000000 -0400
++++ ./src-ILUT/src/ilut_sdlsurface.c 2014-12-20 01:36:37.000000000 -0500
+@@ -28,5 +28,5 @@
+ {
+ //#if SDL_BYTEORDER == SDL_BIG_ENDIAN
+-#ifdef __BIG_ENDIAN__
++#if BYTE_ORDER == BIG_ENDIAN
+ isBigEndian = 1;
+ rmask = 0xFF000000;
+@@ -81,5 +81,5 @@
+ }
+ else if (Image->Format != IL_COLOR_INDEX) { // We have to convert the image.
+- #ifdef __BIG_ENDIAN__
++ #if BYTE_ORDER == BIG_ENDIAN
+ Image = iConvertImage(Image, IL_RGBA, IL_UNSIGNED_BYTE);
+ #else
+--- src-IL/src/il_ilbm.c 2009-03-08 04:30:11.000000000 -0400
++++ src-IL/src/il_ilbm.c 2014-12-20 01:38:51.000000000 -0500
+@@ -620,5 +620,5 @@
+ finalcolor = pixelcolor;
+ }
+-#if defined( __LITTLE_ENDIAN__ )
++#if BYTE_ORDER == LITTLE_ENDIAN
+ {
+ *ptr++ = (Uint8)(finalcolor>>16);
+--- src-IL/src/il_sgi.c 2009-03-08 03:10:09.000000000 -0400
++++ src-IL/src/il_sgi.c 2014-12-20 01:40:37.000000000 -0500
+@@ -213,5 +213,5 @@
+ ILboolean iReadRleSgi(iSgiHeader *Head)
+ {
+- #ifdef __LITTLE_ENDIAN__
++ #if BYTE_ORDER == LITTLE_ENDIAN
+ ILuint ixTable;
+ #endif
+@@ -234,5 +234,5 @@
+ goto cleanup_error;
+
+-#ifdef __LITTLE_ENDIAN__
++#if BYTE_ORDER == LITTLE_ENDIAN
+ // Fix the offset/len table (it's big endian format)
+ for (ixTable = 0; ixTable < TableSize; ixTable++) {
+@@ -290,5 +290,5 @@
+ }
+
+- #ifdef __LITTLE_ENDIAN__
++ #if BYTE_ORDER == LITTLE_ENDIAN
+ if (Head->Bpc == 2)
+ sgiSwitchData(iCurImage->Data, iCurImage->SizeOfData);
+@@ -331,5 +331,5 @@
+ return -1;
+
+-#ifndef __LITTLE_ENDIAN__
++#if BYTE_ORDER != LITTLE_ENDIAN
+ iSwapUShort(&Pixel);
+ #endif
+@@ -347,5 +347,5 @@
+ if (iread(&Pixel, Head->Bpc, 1) != 1)
+ return -1;
+-#ifndef __LITTLE_ENDIAN__
++#if BYTE_ORDER != LITTLE_ENDIAN
+ iSwapUShort(&Pixel);
+ #endif
+@@ -742,5 +742,5 @@
+ StartTable[y] = DataOff;
+ DataOff += LenTable[y];
+-#ifdef __LITTLE_ENDIAN__
++#if BYTE_ORDER == LITTLE_ENDIAN
+ iSwapUInt(&StartTable[y]);
+ iSwapUInt(&LenTable[y]);
diff --git a/graphics/devil/files/patch-testing b/graphics/devil/files/patch-testing
new file mode 100644
index 000000000000..228a429aef81
--- /dev/null
+++ b/graphics/devil/files/patch-testing
@@ -0,0 +1,28 @@
+Submitted upstream as https://sourceforge.net/p/openil/patches/53/
+
+Fix to allow running with regular shell. Actually, even bash was erroring
+out for some reason...
+--- test/format_test/format_checks.sh.in 2009-03-08 03:10:07.000000000 -0400
++++ test/format_test/format_checks.sh.in 2016-01-10 23:37:45.922896000 -0500
+@@ -27,8 +27,17 @@
+ do
+ #echo expr match "' $CAN_SAVE '" '.*\s'$EXTENSION'\s.*'
+- if [ $(expr match "' $CAN_SAVE '" '.*\s'$EXTENSION'\s.*') -eq 0 -o $(expr match "' $PROBLEMATIC '" '.*\s'$EXTENSION'\s.*') -ne 0 ]
+- then # This extension is not considered as supported...
+- continue;
+- fi
++ case $CAN_SAVE in
++ *$EXTENSION*)
++ ;;
++ *)
++ # This extension is not considered as supported...
++ continue
++ ;;
++ esac
++ case $PROBLEMATIC in
++ *$EXTENSION*)
++ continue
++ ;;
++ esac
+ test -n "$VERBOSE" && echo $WINE ./testil@EXEEXT@ -e $EXTENSION
+ # EXEEXT comes in when one compiles on platforms that append extensions to executables (testil.exe)
diff --git a/graphics/devil/pkg-plist b/graphics/devil/pkg-plist
index 2a577264e57e..ddc7f2ce7d81 100644
--- a/graphics/devil/pkg-plist
+++ b/graphics/devil/pkg-plist
@@ -3,7 +3,7 @@ include/IL/devil_cpp_wrapper.hpp
include/IL/il.h
include/IL/ilu.h
include/IL/ilu_region.h
-%%X11%%include/IL/ilut.h
+include/IL/ilut.h
lib/libIL.a
lib/libIL.so
lib/libIL.so.1
@@ -12,10 +12,10 @@ lib/libILU.a
lib/libILU.so
lib/libILU.so.1
lib/libILU.so.1.1.0
-%%X11%%lib/libILUT.a
-%%X11%%lib/libILUT.so
-%%X11%%lib/libILUT.so.1
-%%X11%%lib/libILUT.so.1.1.0
+lib/libILUT.a
+lib/libILUT.so
+lib/libILUT.so.1
+lib/libILUT.so.1.1.0
libdata/pkgconfig/IL.pc
libdata/pkgconfig/ILU.pc
-%%X11%%libdata/pkgconfig/ILUT.pc
+libdata/pkgconfig/ILUT.pc