summaryrefslogtreecommitdiff
path: root/media-libs/libafterimage
diff options
context:
space:
mode:
Diffstat (limited to 'media-libs/libafterimage')
-rw-r--r--media-libs/libafterimage/Manifest10
-rw-r--r--media-libs/libafterimage/files/libafterimage-config.patch15
-rw-r--r--media-libs/libafterimage/files/libafterimage-gif.patch18
-rw-r--r--media-libs/libafterimage/files/libafterimage-giflib5-v2.patch391
-rw-r--r--media-libs/libafterimage/files/libafterimage-libpng15.patch31
-rw-r--r--media-libs/libafterimage/files/libafterimage-makefile.in.patch62
-rw-r--r--media-libs/libafterimage/libafterimage-1.20-r2.ebuild107
-rw-r--r--media-libs/libafterimage/metadata.xml23
8 files changed, 657 insertions, 0 deletions
diff --git a/media-libs/libafterimage/Manifest b/media-libs/libafterimage/Manifest
new file mode 100644
index 000000000000..193eb4123fef
--- /dev/null
+++ b/media-libs/libafterimage/Manifest
@@ -0,0 +1,10 @@
+AUX libafterimage-config.patch 369 SHA256 75a7683211f8d65a6cb1a6ed99b013d7bcc5b3cb3a241e36748a2c0b5ff960c6 SHA512 8d87d55d5d0df765e824418e3d79d2df2512d775f774896274388c28b5c64b8561cb7f346e327bd03975211f6c6a4e2aeb4af6c125766ddfa5c8087ca4a11de8 WHIRLPOOL 54c088cf2c771ee7ee06aa1336db2917c6ea000180bb926cd5e20422d63a5502710000f7e37c2ef60ff7a9382f1f2e30057bcf931356f8595045fcb57e73ac67
+AUX libafterimage-gif.patch 1436 SHA256 d9e681e5fae08dd6e648ee699e3feb617a924ec5c011fdab81a75d4c3949ea9a SHA512 d4f40c05be0174d2cc9f9ec9d4e911697716710d6ba451dc5d9c92581c84ff73c4a8ffe47f91ddd0917e873e3d141b2a1effa556e84f92dd7ff9cbc7eeb865ab WHIRLPOOL e01f58a89a4a6e998ce3c676efca9d3fbc4362c506543c58343536f18ec2bafa9daf3ae74fb227e5c8f39e70b366c5bc010449f72ec41da8528c1280aabe0b58
+AUX libafterimage-giflib5-v2.patch 11725 SHA256 ada6b4fba8c2838fb539a0edb7bda51599d108f5b1599329126194f467b41d4e SHA512 57d53e7a2138825c6d59120247c3c4d0818710d661231316dc414d53d3e493b58fc98b6423595b3587a348de14eda15eaaf32e1284b4dcc38ce11097c3c97f70 WHIRLPOOL 991cbf2cad3e7a623aa7b37f681a7476900d41be49a82003e0297ea9b2222dacef44c0ed87274469a00570bde71c56e71607ff1c875a319a30166a7a830d5e54
+AUX libafterimage-libpng15.patch 1076 SHA256 bbf95bcddc4c48dcde88745dc9cb772ca53b625e8e466b9d565e4183ce71dbe3 SHA512 67fff22ecb8d2027fecb50a6450b90d3be457c69c8d7c3c0cd16715ead2824634ae5b792cf3877585b74a1323c25934ab31d1462ea983557dc8acc4a6d11bc7a WHIRLPOOL 39a12ef06a584fa24b92757e8ce46adc04f7919aa0f38ef99a927f5d33004c4de4f683630dc4ed9433ff0cf3ae4ae215b0cadbbf9c2fa8f80cfb67959cf0369f
+AUX libafterimage-makefile.in.patch 2168 SHA256 44b2f80b7e5f9bef3852d179e247592f3d5a0983de105082d1b5d1667eb4ced8 SHA512 0fab45a672d4cdecdbd792eb966a31d3ea7e7be7fae52b1e7080d96a513788502099dac41692b4cadfc062ee7fa24bfaceeed4931811488dc4f7c7c34a1e99ec WHIRLPOOL 8b9af84086ff37596aa59af17c0298ebb88895b97f969380eaed639c0d1c1b08373fc10c654f84dfb015adf11ad3d825fd0ccee11ab4d852de4ff0423728e93d
+DIST libAfterImage-1.20.tar.bz2 1017055 SHA256 6e233253f4d1dd22dfce9f9a245cc036d814fc99ba7f6732f4e345de62cfe458 SHA512 4056c73d1ab401480803a3a932d647a66574df9f65efc0d30ba80800e1a3424b4fbfce8e9cdf82c4852862491d92cbb42392f8cce8d6ac21d3b49e4ffe1808c4 WHIRLPOOL 27ee6236ba9b84bb736c9caeabedf0f872fc4223d198f20c530d804d5ace1b91e2f5c26e2015a547899f1cea482a7ea5fcc91e84123ee7390eb38caa3460dd5b
+EBUILD libafterimage-1.20-r2.ebuild 2688 SHA256 f7c268f86539a2cb7342d9cefa8100e3c9058599ce99a22483ca67d636b4c4fc SHA512 e5be4a1c881d3a2abba70b29d109a9e78ae9325d868a812c335e781e4356ea09eef33494492f3d9242e40ff413be042b086f68af61d19a62f6bc7d1ba3a15df5 WHIRLPOOL be7329d959bab3a830e005899aa45f8977421aa73f495bd9b8a762f12c4e4791d745ef0a5e3d37bbb81d6479c0d65a33d299d9fc7415889affe1140e8bdfa7b3
+MISC ChangeLog 4495 SHA256 61ece867f66110b355071df171f961207240ed83641f215254df2250bb482ad3 SHA512 2597d4d8a2175447cc31db7f45239e7f636a7db0ff755d1bdb7291a407661a66931c5880f8194327c4bdfc4742497fa4aed11841d0adb3ad386e43bba9eb7bb5 WHIRLPOOL 4ec0339281e835afc0bfbc07398d333dcea0157e70b86ba043df63de371737071f643ff809560c9a0ffe006138717a34efbbb13e5301f6ff9e84a99b1ca2d83a
+MISC ChangeLog-2015 6700 SHA256 a39147fae97fd06ae2aaa7bf07772b6edc495269d75cd7ef33eb865664123210 SHA512 e7c8d12bdca49795d0d44f71ea6588f823e8687dd0e54ed76d6703ec8e323279c25ebd47d6d95ad3380f8e0e532b156364458782142a56abb2db27c910937008 WHIRLPOOL c3a21b6a641168921d420cae1ff9c2676191c9cf2322c6d29cd7e44b90f978f0b732d9f60a87759385af578ec92ee17bee9f18c10fdb8673501c7c686b6ab02f
+MISC metadata.xml 1083 SHA256 233953c7905909b4edd4afd22ec39dd04f92dc602e8762ec8248f260b2f5ba0b SHA512 dd947905f857f506c4482455b249fd0c98eae17b6c3a5dab2d7c3890b545667eed1e261202f2a3ce47b4b3dce53dc903d86df3eac6c4eac5a97868b1c8278e4b WHIRLPOOL 29f365a2ccc14b0cb0808f9c788ae64d37612f1d6ebee1fda434dde14444346c931edb2eadb42dda4c39672c0709ce4bde8fc268cd74d4fbee5e2974d00786e7
diff --git a/media-libs/libafterimage/files/libafterimage-config.patch b/media-libs/libafterimage/files/libafterimage-config.patch
new file mode 100644
index 000000000000..d2ed9e032953
--- /dev/null
+++ b/media-libs/libafterimage/files/libafterimage-config.patch
@@ -0,0 +1,15 @@
+--- afterimage-config.in 2005-01-12 18:03:36.000000000 +0000
++++ afterimage-config.in.new 2006-10-15 14:16:12.000000000 +0100
+@@ -110,11 +110,7 @@
+ libs="-lAfterBase $libs"
+ fi
+ libs="-lAfterImage $libs"
+- if test "@libdir@" != "/usr/lib" ; then
+- echo -L@libdir@ $libs
+- else
+- echo $libs
+- fi
++ echo $libs
+ else
+ echo $libs
+ fi
diff --git a/media-libs/libafterimage/files/libafterimage-gif.patch b/media-libs/libafterimage/files/libafterimage-gif.patch
new file mode 100644
index 000000000000..8a2ca8e46720
--- /dev/null
+++ b/media-libs/libafterimage/files/libafterimage-gif.patch
@@ -0,0 +1,18 @@
+--- configure.in.orig 2011-03-28 18:55:22.000000000 +0100
++++ configure.in 2011-03-28 18:56:08.000000000 +0100
+@@ -60,12 +60,9 @@
+ dnl# AC_ARG_WITH(xpm_includes, [ --with-xpm-includes=DIR use libXpm includes in DIR( when builtin XPM handling is disabled )], xpm_includes="$withval", xpm_includes=no)
+
+ dnl# standard libgif/ungif should not be used and considered obsolete!
+-dnl# AC_ARG_WITH(ungif, [ --with-ungif support Uncompressed GIF image format using libungif [no]],with_ungif="$withval",with_ungif=no)
+-dnl# AC_ARG_WITH(gif, [ --with-gif support GIF image format using libgif [no]],with_gif="$withval",with_gif=no)
+-dnl# AC_ARG_WITH(gif_includes, [ --with-gif-includes=DIR use GIF includes in DIR], gif_includes="$withval", gif_includes=no)
+-with_ungif=no
+-with_gif=no
+-with_gif_includes=no
++AC_ARG_WITH(ungif, [ --with-ungif support Uncompressed GIF image format using libungif [no]],with_ungif="$withval",with_ungif=no)
++AC_ARG_WITH(gif, [ --with-gif support GIF image format using libgif [no]],with_gif="$withval",with_gif=no)
++AC_ARG_WITH(gif_includes, [ --with-gif-includes=DIR use GIF includes in DIR], gif_includes="$withval", gif_includes=no)
+ AC_ARG_WITH(builtin_gif, [ --with-builtin-gif support Uncompressed GIF image format using builtin libgif [yes]],with_builtin_gif="$withval",with_builtin_gif=yes)
+
+
diff --git a/media-libs/libafterimage/files/libafterimage-giflib5-v2.patch b/media-libs/libafterimage/files/libafterimage-giflib5-v2.patch
new file mode 100644
index 000000000000..85afd5300468
--- /dev/null
+++ b/media-libs/libafterimage/files/libafterimage-giflib5-v2.patch
@@ -0,0 +1,391 @@
+diff -Naurd libAfterImage-1.20.orig/export.c libAfterImage-1.20/export.c
+--- libAfterImage-1.20.orig/export.c 2016-05-01 11:44:19.000000000 +0300
++++ libAfterImage-1.20/export.c 2016-05-02 10:57:59.688984491 +0300
+@@ -1048,6 +1048,9 @@
+ Bool new_image = True ;
+ START_TIME(started);
+ int cmap_size = 1;
++#if (GIFLIB_MAJOR>=5)
++ int errcode;
++#endif
+ #define GIF_NETSCAPE_EXT_BYTES 3
+ unsigned char netscape_ext_bytes[GIF_NETSCAPE_EXT_BYTES] = { 0x1, 0x0, 0x0};
+ #define GIF_GCE_BYTES 4
+@@ -1086,10 +1089,18 @@
+
+ while( cmap_size < 256 && cmap_size < (int)cmap.count+(gce_bytes[0]&0x01) )
+ cmap_size = cmap_size<<1 ;
++#if (GIFLIB_MAJOR>=5)
++ if( (gif_cmap = GifMakeMapObject(cmap_size, NULL )) == NULL )
++#else
+ if( (gif_cmap = MakeMapObject(cmap_size, NULL )) == NULL )
++#endif
+ {
+ free( mapped_im );
++#if (GIFLIB_MAJOR>=5)
++ ASIM_PrintGifError(E_GIF_ERR_NOT_ENOUGH_MEM);
++#else
+ ASIM_PrintGifError();
++#endif
+ return False;
+ }
+ memcpy( &(gif_cmap->Colors[0]), &(cmap.entries[0]), MIN(cmap.count,(unsigned int)cmap_size)*3 );
+@@ -1101,13 +1112,25 @@
+ SavedImage *images = NULL ;
+ int count = 0 ;
+ /* TODO: do something about multiimage files !!! */
++#if (GIFLIB_MAJOR>=5)
++ gif = open_gif_read(infile, &errcode);
++#else
+ gif = open_gif_read(infile);
++#endif
+ if( gif == NULL || get_gif_saved_images(gif, -1, &images, &count) == GIF_ERROR)
+ {
++#if (GIFLIB_MAJOR>=5)
++ ASIM_PrintGifError(errcode);
++#else
+ ASIM_PrintGifError();
++#endif
+ if( gif )
+ {
++#if (GIFLIB_MAJOR>=5)
++ DGifCloseFile(gif, &errcode);
++#else
+ DGifCloseFile(gif);
++#endif
+ gif = NULL ;
+ }
+ if (infile)
+@@ -1123,14 +1146,22 @@
+ gif_src = *gif ;
+ gif->SColorMap = NULL ;
+ gif->Image.ColorMap = NULL ;
++#if (GIFLIB_MAJOR>=5)
++ DGifCloseFile(gif, &errcode);
++#else
+ DGifCloseFile(gif);
++#endif
+ gif = NULL;
+ fclose (infile);
+ infile = NULL;
+ outfile = open_writeable_image_file( path );
+
+ if (outfile)
++#if (GIFLIB_MAJOR>=5)
++ gif = EGifOpenFileHandle(fileno(outfile), &errcode);
++#else
+ gif = EGifOpenFileHandle(fileno(outfile));
++#endif
+
+ if (gif)
+ {
+@@ -1141,26 +1172,46 @@
+ gif_src.SColorMap )) == GIF_OK )
+ status = write_gif_saved_images( gif, images, count );
+ if( status != GIF_OK )
++#if (GIFLIB_MAJOR>=5)
++ ASIM_PrintGifError(status);
++#else
+ ASIM_PrintGifError();
++#endif
+ }
+ if (gif_src.SColorMap)
+ { /* we only want to save private colormap if it is any different from
+ * screen colormap ( saves us 768 bytes per image ) */
+ if( gif_cmap->ColorCount == gif_src.SColorMap->ColorCount )
+ dont_save_cmap = ( memcmp( gif_cmap->Colors, gif_src.SColorMap->Colors, gif_cmap->ColorCount*sizeof(GifColorType)) == 0 );
++#if (GIFLIB_MAJOR>=5)
++ GifFreeMapObject(gif_src.SColorMap);
++#else
+ FreeMapObject(gif_src.SColorMap);
++#endif
+ }
+ if (gif)
+ {
+ EGifPutExtension(gif, GRAPHICS_EXT_FUNC_CODE, GIF_GCE_BYTES, &(gce_bytes[0]));
+ if( get_flags( params->gif.flags, EXPORT_ANIMATION_REPEATS ) )
+ {
++#if (GIFLIB_MAJOR>=5)
++ EGifPutExtensionLeader(gif, APPLICATION_EXT_FUNC_CODE);
++ EGifPutExtensionBlock(gif, 11, "NETSCAPE2.0");
++ EGifPutExtensionBlock(gif, GIF_NETSCAPE_EXT_BYTES, &(netscape_ext_bytes[0]));
++ EGifPutExtensionTrailer(gif);
++#else
+ EGifPutExtensionFirst(gif, APPLICATION_EXT_FUNC_CODE, 11, "NETSCAPE2.0");
+ EGifPutExtensionLast(gif, 0, GIF_NETSCAPE_EXT_BYTES, &(netscape_ext_bytes[0]));
++#endif
+ }
+
++#if (GIFLIB_MAJOR>=5)
++ if( (errcode = EGifPutImageDesc(gif, 0, 0, im->width, im->height, false, (dont_save_cmap)?NULL:gif_cmap )) == GIF_ERROR )
++ ASIM_PrintGifError(errcode);
++#else
+ if( EGifPutImageDesc(gif, 0, 0, im->width, im->height, FALSE, (dont_save_cmap)?NULL:gif_cmap ) == GIF_ERROR )
+ ASIM_PrintGifError();
++#endif
+ }
+ }
+ free_gif_saved_images( images, count );
+@@ -1172,24 +1223,46 @@
+ outfile = open_writeable_image_file(path);
+
+ if (outfile)
++ {
++#if (GIFLIB_MAJOR>=5)
++ gif = EGifOpenFileHandle(fileno(outfile), &errcode);
++ if (errcode != E_GIF_SUCCEEDED)
++ ASIM_PrintGifError(errcode);
++#else
+ if ((gif = EGifOpenFileHandle(fileno(outfile))) == NULL)
+ ASIM_PrintGifError();
++#endif
++ }
+ }
+
+ if( new_image && gif )
+ {
++#if (GIFLIB_MAJOR>=5)
++ if( (errcode = EGifPutScreenDesc(gif, im->width, im->height, cmap_size, 0, gif_cmap )) == GIF_ERROR )
++ ASIM_PrintGifError(errcode);
++#else
+ if( EGifPutScreenDesc(gif, im->width, im->height, cmap_size, 0, gif_cmap ) == GIF_ERROR )
+ ASIM_PrintGifError();
++#endif
+
+ EGifPutExtension(gif, 0xf9, GIF_GCE_BYTES, &(gce_bytes[0]));
+
++#if (GIFLIB_MAJOR>=5)
++ if( (errcode = EGifPutImageDesc(gif, 0, 0, im->width, im->height, false, NULL )) == GIF_ERROR )
++ ASIM_PrintGifError(errcode);
++#else
+ if( EGifPutImageDesc(gif, 0, 0, im->width, im->height, FALSE, NULL ) == GIF_ERROR )
+ ASIM_PrintGifError();
++#endif
+ }
+
+ if( gif_cmap )
+ {
++#if (GIFLIB_MAJOR>=5)
++ GifFreeMapObject(gif_cmap);
++#else
+ FreeMapObject(gif_cmap);
++#endif
+ gif_cmap = NULL ;
+ }
+ if( gif )
+@@ -1203,12 +1276,23 @@
+ register int *src = mapped_im + x*y;
+ while( --x >= 0 )
+ row_pointer[x] = src[x] ;
++#if (GIFLIB_MAJOR>=5)
++ if( (errcode = EGifPutLine(gif, row_pointer, im->width)) == GIF_ERROR)
++ ASIM_PrintGifError(errcode);
++#else
+ if( EGifPutLine(gif, row_pointer, im->width) == GIF_ERROR)
+ ASIM_PrintGifError();
++#endif
+ }
+ free( row_pointer );
++#if (GIFLIB_MAJOR>=5)
++ EGifCloseFile(gif, &errcode);
++ if (errcode != E_GIF_SUCCEEDED)
++ ASIM_PrintGifError(errcode);
++#else
+ if (EGifCloseFile(gif) == GIF_ERROR)
+ ASIM_PrintGifError();
++#endif
+ gif = NULL;
+ }
+ free( mapped_im );
+diff -Naurd libAfterImage-1.20.orig/import.c libAfterImage-1.20/import.c
+--- libAfterImage-1.20.orig/import.c 2016-05-01 11:44:19.000000000 +0300
++++ libAfterImage-1.20/import.c 2016-05-02 11:01:58.979496755 +0300
+@@ -2178,6 +2178,9 @@
+ int transparent = -1 ;
+ unsigned int y;
+ unsigned int width = 0, height = 0;
++#if (GIFLIB_MAJOR>=5)
++ int errcode;
++#endif
+ ColorMapObject *cmap = NULL ;
+
+ START_TIME(started);
+@@ -2186,7 +2189,11 @@
+
+ if ((fp = open_image_file(path)) == NULL)
+ return NULL;
++#if (GIFLIB_MAJOR>=5)
++ if( (gif = open_gif_read(fp, &errcode)) != NULL )
++#else
+ if( (gif = open_gif_read(fp)) != NULL )
++#endif
+ {
+ SavedImage *sp = NULL ;
+ int count = 0 ;
+@@ -2224,7 +2224,7 @@
+ ((((unsigned int) sp->ExtensionBlocks[y].Bytes[GIF_GCE_DELAY_BYTE_HIGH])<<8)&0x00FF00);
+ }else if( sp->ExtensionBlocks[y].Function == APPLICATION_EXT_FUNC_CODE && sp->ExtensionBlocks[y].ByteCount == 11 ) /* application extension */
+ {
+- if( strncmp(&(sp->ExtensionBlocks[y].Bytes[0]), "NETSCAPE2.0", 11 ) == 0 )
++ if( strncmp((const char*)(&sp->ExtensionBlocks[y].Bytes[0]), "NETSCAPE2.0", 11 ) == 0 )
+ {
+ ++y ;
+ if( y < (unsigned int)sp->ExtensionBlockCount && sp->ExtensionBlocks[y].ByteCount == 3 )
+@@ -2289,13 +2296,21 @@
+ }
+ free_gif_saved_images( sp, count );
+ }else if( status != GIF_OK )
++#if (GIFLIB_MAJOR>=5)
++ ASIM_PrintGifError(status);
++#else
+ ASIM_PrintGifError();
++#endif
+ else if( params->subimage == -1 )
+ show_error( "Image file \"%s\" does not have any valid image information.", path );
+ else
+ show_error( "Image file \"%s\" does not have subimage %d.", path, params->subimage );
+
++#if (GIFLIB_MAJOR>=5)
++ DGifCloseFile(gif, &errcode);
++#else
+ DGifCloseFile(gif);
++#endif
+ fclose( fp );
+ }
+ SHOW_TIME("image loading",started);
+diff -Naurd libAfterImage-1.20.orig/ungif.c libAfterImage-1.20/ungif.c
+--- libAfterImage-1.20.orig/ungif.c 2011-01-15 08:52:22.000000000 +0300
++++ libAfterImage-1.20/ungif.c 2016-05-02 16:03:57.590148737 +0300
+@@ -75,13 +75,21 @@
+ if( sp )
+ {
+ if (sp->ImageDesc.ColorMap)
++#if (GIFLIB_MAJOR>=5)
++ GifFreeMapObject(sp->ImageDesc.ColorMap);
++#else
+ FreeMapObject(sp->ImageDesc.ColorMap);
++#endif
+
+ if (sp->RasterBits)
+ free((char *)sp->RasterBits);
+
+ if (sp->ExtensionBlocks)
++#if (GIFLIB_MAJOR>=5)
++ GifFreeExtensions(&sp->ExtensionBlockCount, &sp->ExtensionBlocks);
++#else
+ FreeExtension(sp);
++#endif
+
+ if( !reusable )
+ free( sp );
+@@ -119,11 +127,19 @@
+ return ret;
+ }
+
++#if (GIFLIB_MAJOR>=5)
++GifFileType*
++open_gif_read( FILE *in_stream, int *errcode )
++{
++ return DGifOpen(in_stream, fread_gif, errcode);
++}
++#else
+ GifFileType*
+ open_gif_read( FILE *in_stream )
+ {
+ return DGifOpen(in_stream, fread_gif);
+ }
++#endif
+
+ int
+ get_gif_image_desc( GifFileType *gif, SavedImage *im )
+@@ -151,7 +167,11 @@
+ memcpy( &(im->ImageDesc), &(gif->Image), sizeof(GifImageDesc));
+ if( gif->Image.ColorMap )
+ {
++#if (GIFLIB_MAJOR>=5)
++ im->ImageDesc.ColorMap = GifMakeMapObject(gif->Image.ColorMap->ColorCount, NULL);
++#else
+ im->ImageDesc.ColorMap = MakeMapObject(gif->Image.ColorMap->ColorCount, NULL);
++#endif
+ fseek( gif->UserData, start_pos+9, SEEK_SET );
+ fread( im->ImageDesc.ColorMap->Colors, 1, gif->Image.ColorMap->ColorCount*3, gif->UserData);
+ fseek( gif->UserData, end_pos, SEEK_SET );
+@@ -166,6 +186,9 @@
+ {
+ GifRecordType RecordType;
+ GifByteType *ExtData;
++#if (GIFLIB_MAJOR>=5)
++ int ExtCode;
++#endif
+ SavedImage temp_save;
+ int curr_image = 0, ret_count = *ret_images ;
+ int status = GIF_OK;
+@@ -197,13 +220,23 @@
+ break;
+
+ case EXTENSION_RECORD_TYPE:
++#if (GIFLIB_MAJOR>=5)
++ status = DGifGetExtension(gif,&ExtCode,&ExtData);
++#else
+ status = DGifGetExtension(gif,&temp_save.Function,&ExtData);
++#endif
+ while (ExtData != NULL && status == GIF_OK )
+ {
+ /* Create an extension block with our data */
++#if (GIFLIB_MAJOR>=5)
++ if ((status = GifAddExtensionBlock(&temp_save.ExtensionBlockCount, &temp_save.ExtensionBlocks,
++ ExtCode, sizeof(ExtData), ExtData)) == GIF_OK)
++ status = DGifGetExtension(gif,&ExtCode,&ExtData);
++#else
+ if ((status = AddExtensionBlock(&temp_save, ExtData[0], (char*)&(ExtData[1]))) == GIF_OK)
+ status = DGifGetExtensionNext(gif, &ExtData);
+ temp_save.Function = 0;
++#endif
+ }
+ break;
+
+diff -Naurd libAfterImage-1.20.orig/ungif.h libAfterImage-1.20/ungif.h
+--- libAfterImage-1.20.orig/ungif.h 2011-01-15 08:52:22.000000000 +0300
++++ libAfterImage-1.20/ungif.h 2016-05-02 10:57:59.715983533 +0300
+@@ -7,11 +7,29 @@
+ extern "C" {
+ #endif
+
++#if ((GIFLIB_MAJOR==4) && (GIFLIB_MINOR>=2))
++static inline void PrintGifError(void) {
++ fprintf(stderr, "%s\n", GifErrorString());
++}
++#elif (GIFLIB_MAJOR>=5)
++static inline void PrintGifError(int code) {
++ fprintf(stderr, "%s\n", GifErrorString(code));
++}
++#endif
++
++#if (GIFLIB_MAJOR>=5)
++#ifdef __GNUC__
++#define ASIM_PrintGifError(code) do{ fprintf( stderr, "%s():%d:<%s> ",__FUNCTION__, __LINE__, path?path:"null" ); PrintGifError(code); }while(0)
++#else
++#define ASIM_PrintGifError(code) do{ PrintGifError(code); }while(0)
++#endif
++#else // (GIFLIB_MAJOR>=5)
+ #ifdef __GNUC__
+ #define ASIM_PrintGifError() do{ fprintf( stderr, "%s():%d:<%s> ",__FUNCTION__, __LINE__, path?path:"null" ); PrintGifError(); }while(0)
+ #else
+ #define ASIM_PrintGifError() do{ PrintGifError(); }while(0)
+ #endif
++#endif // (GIFLIB_MAJOR>=5)
+
+ #define GIF_GCE_DELAY_BYTE_LOW 1
+ #define GIF_GCE_DELAY_BYTE_HIGH 2
+@@ -24,7 +42,11 @@
+
+
+ int fread_gif( GifFileType *gif, GifByteType* buf, int len );
++#if (GIFLIB_MAJOR>=5)
++GifFileType* open_gif_read( FILE *in_stream, int *errcode );
++#else
+ GifFileType* open_gif_read( FILE *in_stream );
++#endif
+
+ int get_gif_image_desc( GifFileType *gif, SavedImage *im );
+
diff --git a/media-libs/libafterimage/files/libafterimage-libpng15.patch b/media-libs/libafterimage/files/libafterimage-libpng15.patch
new file mode 100644
index 000000000000..44d5b944007c
--- /dev/null
+++ b/media-libs/libafterimage/files/libafterimage-libpng15.patch
@@ -0,0 +1,31 @@
+--- export.c
++++ export.c
+@@ -496,7 +496,7 @@
+ png_ptr = png_create_write_struct( PNG_LIBPNG_VER_STRING, NULL, NULL, NULL );
+ if ( png_ptr != NULL )
+ if( (info_ptr = png_create_info_struct(png_ptr)) != NULL )
+- if( setjmp(png_ptr->jmpbuf) )
++ if( setjmp(png_jmpbuf(png_ptr)) )
+ {
+ png_destroy_info_struct(png_ptr, (png_infopp) &info_ptr);
+ info_ptr = NULL ;
+--- import.c
++++ import.c
+@@ -1251,7 +1251,7 @@
+ * the normal method of doing things with libpng). REQUIRED unless you
+ * set up your own error handlers in the png_create_read_struct() earlier.
+ */
+- if ( !setjmp (png_ptr->jmpbuf))
++ if ( !setjmp (png_jmpbuf(png_ptr)))
+ {
+ ASFlagType rgb_flags = ASStorage_RLEDiffCompress|ASStorage_32Bit ;
+
+@@ -1468,7 +1468,7 @@
+
+ static void asim_png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
+ {
+- ASImPNGReadBuffer *buf = (ASImPNGReadBuffer *)png_ptr->io_ptr;
++ ASImPNGReadBuffer *buf = (ASImPNGReadBuffer *)png_get_io_ptr(png_ptr);
+ memcpy(data, buf->buffer, length);
+ buf->buffer += length;
+ }
diff --git a/media-libs/libafterimage/files/libafterimage-makefile.in.patch b/media-libs/libafterimage/files/libafterimage-makefile.in.patch
new file mode 100644
index 000000000000..a41f90a64c58
--- /dev/null
+++ b/media-libs/libafterimage/files/libafterimage-makefile.in.patch
@@ -0,0 +1,62 @@
+--- Makefile.in.orig 2005-08-16 10:00:02.000000000 +0200
++++ Makefile.in 2005-08-16 10:00:35.000000000 +0200
+@@ -79,7 +79,7 @@
+ MV = @MV@
+ RM = @RM@
+ RMF = @RM@ -f
+-MKDIR = @MKDIR@
++MKDIR = @MKDIR@ -p
+ FIND = @FIND@
+ XARGS = @XARGS@
+ LDCONFIG = @LDCONFIG@
+@@ -135,20 +135,6 @@
+ @(if [ -d $(LIBDIR) ] && [ -w $(LIBDIR) ]; then \
+ echo "$(INSTALL_LIB) $(LIB_STATIC) $(LIBDIR)"; \
+ $(INSTALL_LIB) $(LIB_STATIC) $(LIBDIR); \
+- if [ `uname` = "Linux" ]; then \
+- if test $(LIBDIR) = "/lib" || test $(LIBDIR) = "/usr/lib"; then \
+- echo "" > /dev/null; \
+- elif grep -q $(LIBDIR) /etc/ld.so.conf > /dev/null 2>&1; then \
+- echo "" > /dev/null; \
+- else \
+- echo "Unable to find $(LIBDIR) in ld.so.conf. In order to use "; \
+- echo "$(LIB_STATIC), you may need to add it or set LD_LIBRARY_PATH."; \
+- fi; \
+- if test -w /etc; then \
+- echo "$(LDCONFIG)"; \
+- $(LDCONFIG); \
+- fi; \
+- fi ;\
+ fi \
+ )
+
+@@ -161,18 +147,6 @@
+ $(RM) -f $(LIBDIR)/$(LIB_SHARED).$(LIBVERMAJOR) $(LIBDIR)/$(LIB_SHARED); \
+ $(LN_S) -f $(LIB_SHARED).$(LIBVER) $(LIBDIR)/$(LIB_SHARED).$(LIBVERMAJOR); \
+ $(LN_S) -f $(LIB_SHARED).$(LIBVERMAJOR) $(LIBDIR)/$(LIB_SHARED); \
+- if test `uname` = "Linux"; then \
+- if test $(LIBDIR) = "/lib" || test $(LIBDIR) = "/usr/lib"; then \
+- echo "" > /dev/null; \
+- elif grep -q $(LIBDIR) /etc/ld.so.conf > /dev/null 2>&1; then \
+- echo "" > /dev/null; \
+- else \
+- echo "Unable to find $(LIBDIR) in ld.so.conf. In order to use "; \
+- echo "$(LIB_SHARED), you may need to add it or set LD_LIBRARY_PATH."; \
+- fi; \
+- echo "$(LDCONFIG)"; \
+- $(LDCONFIG); \
+- fi \
+ )
+
+ install.cyg:
+@@ -393,8 +366,8 @@
+ $(LN_S) -f $(LIB_SHARED).$(LIBVER) $(LIB_SHARED).$(LIBVERMAJOR)
+
+ $(LIB_SHARED).$(LIBVER): $(LIB_OBJS) $(LIB_INCS) config.h
+- $(CC) -shared -Wl,-soname,$(LIB_SHARED).$(LIBVERMAJOR) -o $(LIB_SHARED).$(LIBVER) \
+- $(LIB_OBJS)
++ $(CC) -shared $(USER_LD_FLAGS) -Wl,-soname,$(LIB_SHARED).$(LIBVERMAJOR) -o $(LIB_SHARED).$(LIBVER) \
++ $(LIB_OBJS) $(LIBRARIES)
+
+ install.man:
+ @if [ -d doc/man ] ; then \
diff --git a/media-libs/libafterimage/libafterimage-1.20-r2.ebuild b/media-libs/libafterimage/libafterimage-1.20-r2.ebuild
new file mode 100644
index 000000000000..f2ef350c2460
--- /dev/null
+++ b/media-libs/libafterimage/libafterimage-1.20-r2.ebuild
@@ -0,0 +1,107 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+inherit autotools
+
+MY_PN=libAfterImage
+
+DESCRIPTION="Afterstep's standalone generic image manipulation library"
+HOMEPAGE="http://www.afterstep.org/afterimage/index.php"
+SRC_URI="ftp://ftp.afterstep.org/stable/${MY_PN}/${MY_PN}-${PV}.tar.bz2"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="alpha amd64 hppa ia64 ppc ppc64 sparc x86 ~x86-fbsd ~amd64-linux ~x86-linux"
+IUSE="+X cpu_flags_x86_mmx examples gif jpeg nls opengl png static-libs shm +shaping svg tiff truetype"
+
+RDEPEND="
+ X? ( x11-libs/libSM
+ x11-libs/libXext
+ x11-libs/libXrender )
+ gif? ( media-libs/giflib:0= )
+ jpeg? ( virtual/jpeg:0 )
+ opengl? ( virtual/opengl )
+ png? ( >=media-libs/libpng-1.4:0= )
+ svg? ( gnome-base/librsvg:2 )
+ tiff? ( media-libs/tiff:0 )
+ truetype? ( media-libs/freetype )"
+DEPEND="${RDEPEND}
+ X? ( x11-proto/xextproto )
+ virtual/pkgconfig
+ !!x11-wm/afterstep"
+REQUIRED_USE="
+ opengl? ( X )
+ shaping? ( X )
+ shm? ( X )"
+
+S="${WORKDIR}/${MY_PN}-${PV}"
+
+src_prepare() {
+ default
+
+ # fix some ldconfig problem in makefile.in
+ eapply -p0 "${FILESDIR}"/${PN}-makefile.in.patch
+ # fix lib paths in afterimage-config
+ eapply -p0 "${FILESDIR}"/${PN}-config.patch
+ # fix gif unbundle
+ eapply -p0 "${FILESDIR}"/${PN}-gif.patch
+ # fix for libpng15 compability
+ eapply -p0 "${FILESDIR}"/${PN}-libpng15.patch
+ # add giflib-5 API support, bug 571654
+ eapply "${FILESDIR}"/${PN}-giflib5-v2.patch
+ # do not build examples
+ use examples || sed -i \
+ -e '/^all:/s/apps//' \
+ -e '/^install:/s/install.apps//' \
+ Makefile.in || die "sed failed"
+ # remove forced flags
+ sed -i \
+ -e 's/CFLAGS="-O3"//' \
+ -e 's/ -rdynamic//' \
+ configure.in || die "sed failed"
+
+ mv configure.in configure.ac || die
+ eautoreconf
+}
+
+src_configure() {
+ econf \
+ $(use_enable cpu_flags_x86_mmx mmx-optimization) \
+ $(use_enable opengl glx) \
+ $(use_enable nls i18n) \
+ $(use_enable shaping) \
+ $(use_enable shm shmimage ) \
+ $(use_enable static-libs staticlibs) \
+ $(use_with X x) \
+ $(use_with gif) \
+ $(use_with jpeg) \
+ $(use_with png) \
+ $(use_with svg) \
+ $(use_with tiff) \
+ $(use_with truetype ttf) \
+ --enable-sharedlibs \
+ --with-xpm \
+ --without-builtin-gif \
+ --without-builtin-jpeg \
+ --without-builtin-png \
+ --without-builtin-zlib \
+ --without-afterbase
+}
+
+src_install() {
+ emake \
+ DESTDIR="${D}" \
+ AFTER_DOC_DIR="${ED}/usr/share/doc/${PF}" \
+ install
+ dodoc ChangeLog README
+ if use examples; then
+ cd apps || die
+ mv ascompose.man ascompose.1 || die
+ doman ascompose.1
+ emake clean
+ rm Makefile* ascompose.1 || die
+ insinto /usr/share/doc/${PF}/examples
+ doins *
+ fi
+}
diff --git a/media-libs/libafterimage/metadata.xml b/media-libs/libafterimage/metadata.xml
new file mode 100644
index 000000000000..2366daca2db9
--- /dev/null
+++ b/media-libs/libafterimage/metadata.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer type="project">
+ <email>sci-physics@gentoo.org</email>
+ <name>Gentoo Physics Project</name>
+</maintainer>
+<longdescription lang="en">
+ libAfterImage is a generic image manipulation library.
+ It was initially implemented to address AfterStep Window Manager's needs for
+ image handling, but it evolved into software suitable for project
+ that has needs for handling images. Most of the popular image formats are
+ supported using standard libraries, with XCF, XPM, PPM/PNM, BMP, ICO,
+ TGA and GIF being supported internally. PNG, JPEG and TIFF formats are
+ supported via standard libraries. Text rendering capabilities
+ included, providing support for TrueType fonts using FreeType library,
+ and anti-aliasing of standard fonts from X window system.
+</longdescription>
+<use>
+ <flag name="shaping">Use MIT shaped X windows extention.</flag>
+ <flag name="shm">Use MIT shared memory extention for X image transfer.</flag>
+</use>
+</pkgmetadata>