diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2019-07-14 11:04:34 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2019-07-14 11:04:34 +0100 |
commit | dd762ff83c330186ee2ede002e08b2f780cddd51 (patch) | |
tree | 63198edcc3ad5df8e2566c28ff9bd8af50cc2174 /media-libs/libicns | |
parent | 51af5f0eb4cddbe6aa7953717873691d77aae9ff (diff) |
gentoo resync : 14.07.2019
Diffstat (limited to 'media-libs/libicns')
-rw-r--r-- | media-libs/libicns/Manifest | 4 | ||||
-rw-r--r-- | media-libs/libicns/files/libicns-0.8.1-fix-build-system.patch | 61 | ||||
-rw-r--r-- | media-libs/libicns/files/libicns-0.8.1-fix-gcc-warnings.patch | 52 | ||||
-rw-r--r-- | media-libs/libicns/files/libicns-0.8.1-support-libopenjp2.patch | 365 | ||||
-rw-r--r-- | media-libs/libicns/libicns-0.8.1-r1.ebuild | 41 |
5 files changed, 523 insertions, 0 deletions
diff --git a/media-libs/libicns/Manifest b/media-libs/libicns/Manifest index 80330b3bf919..d59e26d89b6e 100644 --- a/media-libs/libicns/Manifest +++ b/media-libs/libicns/Manifest @@ -1,3 +1,7 @@ +AUX libicns-0.8.1-fix-build-system.patch 1873 BLAKE2B 385f98787a65dce2e6295d2360c9b299d0a57cef6ed763f6501eda0a3babac92632e8056e78ef039854dfc54024d0a8204ca2a530cfa5e83528b7ef4f87e61bd SHA512 057617f9cca64d5886810902b22f7ed95dfffe8ea7a2b7e6bdf026f4cfaef8684a225d49151882a1db4fce189e2192a431b40446d14ff09c8f5213bf42c7db19 +AUX libicns-0.8.1-fix-gcc-warnings.patch 1406 BLAKE2B e16cf880e1b73809169f04163d84b01ee135e54a8a7a8580b6796b80b0af9fc9d71fedf18809f36a41c6eac48278ea41b4c3349f6dc23b4975d1354a1d399929 SHA512 3094ae73bf36c5d1621e11bb47f8a40b402b0b430c471ec6e135e84aa8b196906707400916147c6749d9ea3690d50dcc8acf640b1b675a6958ccf9f2b27b3840 +AUX libicns-0.8.1-support-libopenjp2.patch 11807 BLAKE2B ed074caa669d755e5a19fe2a1a079ce9c6bd2e4627902ffbd024160af2b74bc379d8ae7c1c8bd7c41c5182950ee94603cf9cf5ed89f3150b50db4e6006bf09d7 SHA512 be6e1c83c4f580438ac7aad362bc79b33e08b6682841a8aa5ad3cfbab516c4c0a5ff9d273b250494f9aaf6c6f18c10cb56ec23217e186ff163ba2f0d5b813cad DIST libicns-0.8.1.tar.gz 460819 BLAKE2B bc8989d2e58bff343cdf9538ca2d14600e1bee25697e767dfd51dd69b533995c76f83d3076b63c6604c18a2e08bbfd489408f0dd28847ac6b354210b7732b87a SHA512 e9a6da6d639c4e7aa85e21cf0201ec2e8fcad5c8542ef55375dee7628eff6e0136974ebae93f6c7d95447f879d3d001e8f5d480f6590061c8e0ad0e06b52742c +EBUILD libicns-0.8.1-r1.ebuild 816 BLAKE2B 8121da975e1996885eecaa64422992fd403351ab2a36f63eb51879898985aba1a5d866a11860e893ee3549dd17e63a55172ad5a2e13ce3156e0eaaa05aec0ccd SHA512 f975624417f52f2b8ea27870924b2dac7e0c54bdb40bc0fd943aadf6b40c274af58fbefea858fe3c044541d340504310298cc6ba2e2c0de46dc9a0fb61a499f3 EBUILD libicns-0.8.1.ebuild 599 BLAKE2B 8fbd8bfeaa0ccd7144cabad071ee5261f234aa6746faa4a046b63f64f9da32a7af4d054de29fbc968caa4d798fdb670cbffc8fcf0ef622fe53c401ea79649626 SHA512 083e230b61da5b0449f8fa0addbec32a4136485fdc63de0ae72e0718d4a81da507cebc43e2a141bf82bdcabfa1ab23650369ef6a6677fcbdf02b7806ec350f09 MISC metadata.xml 333 BLAKE2B 7e301b02d958a41b5f991e4db560fbe37f78e051ef1166c3721f1ea65f34fdd48f6f56f6718ea9d0f8936f45921b061f9c6d7bf5c8d5e67bd8c1b8af1981b2da SHA512 398c15324aff5d97d6cc431f8b4455f37879c5afa0bc3e41e994e65e052c8c3fd07e3d2c473b4bf42c14d7fe203a91ee6cef28dd149612a289333e8ce7a7d9f6 diff --git a/media-libs/libicns/files/libicns-0.8.1-fix-build-system.patch b/media-libs/libicns/files/libicns-0.8.1-fix-build-system.patch new file mode 100644 index 000000000000..63555b5596e3 --- /dev/null +++ b/media-libs/libicns/files/libicns-0.8.1-fix-build-system.patch @@ -0,0 +1,61 @@ +Use pkg-config instead of brittle AC_CHECK_LIB hackery + +--- a/configure.ac ++++ b/configure.ac +@@ -142,41 +142,11 @@ + ] ) + + # Check for libpng +-AC_CHECK_LIB(png, png_create_read_struct, [ +-AC_SUBST(PNG_LIBS, "-lpng") +-], [ +- AC_CHECK_LIB(png10, png_create_read_struct, [ +- AC_SUBST(PNG_LIBS, "-lpng10") +- ], [ +- AC_CHECK_LIB(png12, png_create_read_struct, [ +- AC_SUBST(PNG_LIBS, "-lpng12") +- ], [ +- AC_MSG_ERROR([cannot find required library png]) +- ], []) +- ], []) +-], []) +-AC_CHECK_HEADERS([png.h libpng/png.h libpng10/png.h libpng12/png.h]) ++PKG_CHECK_MODULES([PNG], [libpng]) + + # Check for libopenjpeg, fall back to libjasper if not available +-AC_CHECK_LIB(jasper, jas_init, [ +-AC_SUBST(JP2000_LIBS, "-ljasper") +-AC_CHECK_HEADERS([jasper/jasper.h]) +-AC_DEFINE([ICNS_JASPER],[1],[We have Jasper]) +-], [ +- AC_CHECK_LIB(openjpeg2, opj_setup_decoder, [ +- AC_SUBST(JP2000_LIBS, "-lopenjpeg2") +- AC_CHECK_HEADERS([openjpeg.h]) +- AC_DEFINE([ICNS_OPENJPEG],[1],[We have OpenJPEG]) +- ], [ +- AC_CHECK_LIB(openjpeg, opj_setup_decoder, [ +- AC_SUBST(JP2000_LIBS, "-lopenjpeg") +- AC_CHECK_HEADERS([openjpeg.h]) +- AC_DEFINE([ICNS_OPENJPEG],[1],[We have OpenJPEG]) +- ], [ +- AC_MSG_WARN([libopenjpeg or libjasper jp2000 codec libraries not found]) +- AC_MSG_WARN([libicns will be built without 256x256 and 512x512 support]) +- ]) +- ]) ++PKG_CHECK_MODULES([JP2000], [libopenjp2], [ ++ AC_DEFINE([ICNS_OPENJPEG], [2], [We have OpenJPEG 2.x]) + ]) + + AC_CONFIG_FILES([Makefile libicns.spec icnsutils/Makefile src/Makefile src/libicns.pc]) +--- a/src/Makefile.am ++++ b/src/Makefile.am +@@ -3,7 +3,8 @@ + + libicns_la_LDFLAGS = -version-info 3:0:2 + +-libicns_la_LIBADD = @PNG_LIBS@ @JP2000_LIBS@ ++libicns_la_LIBADD = $(PNG_LIBS) $(JP2000_LIBS) ++libicns_la_CPPFLAGS = $(PNG_CFLAGS) $(JP2000_CFLAGS) + + libicns_la_SOURCES = \ + icns_debug.c \ diff --git a/media-libs/libicns/files/libicns-0.8.1-fix-gcc-warnings.patch b/media-libs/libicns/files/libicns-0.8.1-fix-gcc-warnings.patch new file mode 100644 index 000000000000..d7f0dd60e216 --- /dev/null +++ b/media-libs/libicns/files/libicns-0.8.1-fix-gcc-warnings.patch @@ -0,0 +1,52 @@ +From: Carlos Maddela <e7appew@gmail.com> +Date: Fri, 11 Nov 2016 17:12:25 +1100 +Subject: Fix GCC warnings. + +Description: Fix GCC warnings. +Author: Carlos Maddela <e7appew@gmail.com> +Origin: vendor +Forwarded: no +Last-Update: 2016-11-11 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- + icnsutils/icns2png.c | 12 +++++++----- + icnsutils/png2icns.c | 2 ++ + 2 files changed, 9 insertions(+), 5 deletions(-) + +--- a/icnsutils/icns2png.c ++++ b/icnsutils/icns2png.c +@@ -530,15 +530,17 @@ + case ICNS_ICON_VERSION: + { + icns_byte_t iconBytes[4]; +- icns_uint32_t iconVersion = 0; +- float iconVersionNumber = 0; ++ union ++ { ++ icns_uint32_t asUint32; ++ float asFloat; ++ } iconVersion = { .asUint32 = 0 }; + if(iconDataSize == 4) { + memcpy(&iconBytes[0],(dataPtr+dataOffset+8),4); +- iconVersion = iconBytes[3]|iconBytes[2]<<8|iconBytes[1]<<16|iconBytes[0]<<24; +- iconVersionNumber = *((float *)(&iconVersion)); ++ iconVersion.asUint32 = iconBytes[3]|iconBytes[2]<<8|iconBytes[1]<<16|iconBytes[0]<<24; + } + if(extractMode & LIST_MODE) { +- printf(" value: %f\n",iconVersionNumber); ++ printf(" value: %f\n",iconVersion.asFloat); + } + } + break; +--- a/icnsutils/png2icns.c ++++ b/icnsutils/png2icns.c +@@ -28,6 +28,8 @@ + #include <png.h>
+ #include <icns.h>
+
++#include <unistd.h>
++
+ #define FALSE 0
+ #define TRUE 1
+
diff --git a/media-libs/libicns/files/libicns-0.8.1-support-libopenjp2.patch b/media-libs/libicns/files/libicns-0.8.1-support-libopenjp2.patch new file mode 100644 index 000000000000..7440ad96a052 --- /dev/null +++ b/media-libs/libicns/files/libicns-0.8.1-support-libopenjp2.patch @@ -0,0 +1,365 @@ +From: Carlos Maddela <e7appew@gmail.com> +Date: Wed, 9 Nov 2016 05:05:01 +1100 +Subject: Add support for linking with openjpeg 2.x library. + +Description: Add support for linking with openjpeg 2.x library. + Even though the Debian package attempted to build with the openjpeg 2.x + library, the resulting binaries didn't support conversion of images with + dimensions of 256x256 or greater, since autoconf was incorrectly trying + to find libopenjpeg2 instead of libopenjp2. Changes were also required + to address the API differences between openjpeg 1.x and openjpeg 2.x. + (Closes: #844055) +Author: Carlos Maddela <e7appew@gmail.com> +Origin: vendor +Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=844055 +Last-Update: 2016-11-12 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- + src/icns_jp2.c | 264 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-- + 1 file changed, 256 insertions(+), 8 deletions(-) + +diff --git a/src/icns_jp2.c b/src/icns_jp2.c +index 6d809fb..e994f58 100644 +--- a/src/icns_jp2.c ++++ b/src/icns_jp2.c +@@ -125,19 +125,19 @@ int icns_image_to_jp2(icns_image_t *image, icns_size_t *dataSizeOut, icns_byte_t + + #ifdef ICNS_JASPER + error = icns_jas_image_to_jp2(image, dataSizeOut, dataPtrOut); +- #else +- #ifdef ICNS_OPENJPEG ++ #elif (ICNS_OPENJPEG == 1) + // OpenJPEG is broken for RGB+A images for now. See a possible patch here: + // http://groups.google.com/group/openjpeg/browse_thread/thread/1cb7807b2053592e + // error = icns_opj_image_to_jp2(image, dataSizeOut, dataPtrOut); + icns_print_err("icns_image_to_jp2: Saving JP2 data with OpenJPEG is not yet supported!\n"); + error = ICNS_STATUS_UNSUPPORTED; ++ #elif (ICNS_OPENJPEG == 2) ++ error = icns_opj_image_to_jp2(image, dataSizeOut, dataPtrOut); + #else + *dataPtrOut = NULL; + error = ICNS_STATUS_UNSUPPORTED; + #endif +- #endif +- ++ + return error; + } + +@@ -547,9 +547,136 @@ int icns_opj_jp2_to_image(icns_size_t dataSize, icns_byte_t *dataPtr, icns_image + return error; + } + ++#if (ICNS_OPENJPEG == 2) ++ ++typedef struct mem_stream ++{ ++ OPJ_BYTE *buffer; ++ OPJ_SIZE_T bufferSize; ++ OPJ_OFF_T offset; ++ OPJ_BOOL readOnly; ++ opj_stream_t *stream; ++} mem_stream_t; ++ ++static OPJ_SIZE_T read_mem_stream(void *buffer, OPJ_SIZE_T numBytes, void *userData) ++{ ++ mem_stream_t *memStream = (mem_stream_t *) userData; ++ OPJ_SIZE_T remaining = memStream->bufferSize - memStream->offset; ++ OPJ_SIZE_T bytesRead = (remaining < numBytes) ? remaining : numBytes; ++ memcpy(buffer, memStream->buffer + memStream->offset, bytesRead); ++ memStream->offset += bytesRead; ++ return bytesRead ? bytesRead : (OPJ_SIZE_T) -1; ++} ++ ++static OPJ_SIZE_T write_mem_stream(void *buffer, OPJ_SIZE_T numBytes, void *userData) ++{ ++ mem_stream_t *memStream = (mem_stream_t *) userData; ++ if(!memStream->readOnly) { ++ OPJ_SIZE_T remaining = memStream->bufferSize - memStream->offset; ++ if(remaining < numBytes) { ++ OPJ_SIZE_T newBufferSize = memStream->bufferSize + numBytes; ++ OPJ_BYTE *newBuffer = (OPJ_BYTE *) realloc(memStream->buffer, newBufferSize); ++ if(!newBuffer) { ++ return (OPJ_SIZE_T) -1; ++ } ++ memStream->buffer = newBuffer; ++ memStream->bufferSize = newBufferSize; ++ opj_stream_set_user_data_length(memStream->stream, newBufferSize); ++ } ++ memcpy(memStream->buffer + memStream->offset, buffer, numBytes); ++ memStream->offset += numBytes; ++ return numBytes ? numBytes : (OPJ_SIZE_T) -1; ++ } ++ return (OPJ_SIZE_T) -1; ++} ++ ++static OPJ_OFF_T skip_mem_stream(OPJ_OFF_T offset, void *userData) ++{ ++ mem_stream_t *memStream = (mem_stream_t *) userData; ++ OPJ_OFF_T remaining = memStream->bufferSize - memStream->offset; ++ if(offset > remaining) { ++ if(!memStream->readOnly) { ++ OPJ_SIZE_T newBufferSize = memStream->bufferSize + offset; ++ OPJ_BYTE *newBuffer = (OPJ_BYTE *) realloc(memStream->buffer, newBufferSize); ++ if(!newBuffer) { ++ return (OPJ_OFF_T) -1; ++ } ++ memStream->buffer = newBuffer; ++ memStream->bufferSize = newBufferSize; ++ opj_stream_set_user_data_length(memStream->stream, newBufferSize); ++ } else { ++ offset = remaining; ++ } ++ } ++ memStream->offset += offset; ++ if(memStream->offset < 0) { ++ offset -= memStream->offset; ++ memStream->offset = 0; ++ } ++ return offset ? offset : (OPJ_OFF_T) -1; ++} ++ ++static OPJ_BOOL seek_mem_stream(OPJ_OFF_T offset, void *userData) ++{ ++ mem_stream_t *memStream = (mem_stream_t *) userData; ++ if(offset < 0) { ++ return OPJ_FALSE; ++ } ++ if((OPJ_SIZE_T) offset > memStream->bufferSize) { ++ if(!memStream->readOnly) { ++ OPJ_SIZE_T newBufferSize = offset; ++ OPJ_BYTE *newBuffer = (OPJ_BYTE *) realloc(memStream->buffer, newBufferSize); ++ if(!newBuffer) { ++ return OPJ_FALSE; ++ } ++ memStream->buffer = newBuffer; ++ memStream->bufferSize = newBufferSize; ++ opj_stream_set_user_data_length(memStream->stream, newBufferSize); ++ } else { ++ return OPJ_FALSE; ++ } ++ } ++ memStream->offset = offset; ++ return OPJ_TRUE; ++} ++ ++static opj_stream_t *create_mem_stream(OPJ_BYTE *buffer, OPJ_SIZE_T bufferSize, OPJ_BOOL readOnly, mem_stream_t **memStreamOut) ++{ ++ opj_stream_t *stream = opj_stream_default_create(readOnly); ++ if(stream) { ++ mem_stream_t *memStream = malloc(sizeof(*memStream)); ++ if(memStream) { ++ memStream->buffer = buffer; ++ memStream->bufferSize = bufferSize; ++ memStream->offset = 0; ++ memStream->readOnly = readOnly; ++ memStream->stream = stream; ++ if(memStreamOut) { ++ *memStreamOut = memStream; ++ } ++ opj_stream_set_user_data(stream, memStream, free); ++ opj_stream_set_user_data_length(stream, bufferSize); ++ opj_stream_set_read_function(stream, read_mem_stream); ++ if(!readOnly) { ++ opj_stream_set_write_function(stream, write_mem_stream); ++ } ++ opj_stream_set_skip_function(stream, skip_mem_stream); ++ opj_stream_set_seek_function(stream, seek_mem_stream); ++ } else { ++ opj_stream_destroy(stream); ++ stream = NULL; ++ } ++ } ++ return stream; ++} ++ ++#endif /* (ICNS_OPENJPEG == 2) */ ++ + // Decode jp2 data using OpenJPEG + int icns_opj_jp2_dec(icns_size_t dataSize, icns_byte_t *dataPtr, opj_image_t **imageOut) + { ++#if (ICNS_OPENJPEG == 1) ++ + opj_event_mgr_t event_mgr; + opj_dparameters_t parameters; + opj_dinfo_t *dinfo = NULL; +@@ -583,6 +710,59 @@ int icns_opj_jp2_dec(icns_size_t dataSize, icns_byte_t *dataPtr, opj_image_t **i + opj_destroy_decompress(dinfo); + + return ICNS_STATUS_OK; ++ ++#else /* (ICNS_OPENJPEG == 2) */ ++ ++ opj_dparameters_t parameters; ++ opj_codec_t *decoder = NULL; ++ opj_stream_t *stream = NULL; ++ opj_image_t *image = NULL; ++ ++ *imageOut = NULL; ++ ++ decoder = opj_create_decompress(OPJ_CODEC_JP2); ++ if(!decoder) { ++ icns_print_err("icns_opj_jp2_dec: failed to create decoder!\n"); ++ return ICNS_STATUS_NO_MEMORY; ++ } ++ ++ opj_set_error_handler(decoder, icns_opj_error_callback, stderr); ++ opj_set_warning_handler(decoder, icns_opj_warning_callback, stderr); ++ opj_set_info_handler(decoder, icns_opj_info_callback, stderr); ++ ++ opj_set_default_decoder_parameters(¶meters); ++ opj_setup_decoder(decoder, ¶meters); ++ ++ stream = create_mem_stream(dataPtr, dataSize, OPJ_TRUE, NULL); ++ if(!stream) { ++ icns_print_err("icns_opj_jp2_dec: failed to create stream!\n"); ++ opj_destroy_codec(decoder); ++ return ICNS_STATUS_NO_MEMORY; ++ } ++ ++ if(!opj_read_header(stream, decoder, &image)) { ++ icns_print_err("icns_opj_jp2_dec: failed to read header!\n"); ++ opj_stream_destroy(stream); ++ opj_destroy_codec(decoder); ++ return ICNS_STATUS_INVALID_DATA; ++ } ++ ++ if(!opj_decode(decoder, stream, image) || !opj_end_decompress(decoder, stream)) { ++ icns_print_err("icns_opj_jp2_dec: failed to decode image!\n"); ++ opj_image_destroy(image); ++ opj_stream_destroy(stream); ++ opj_destroy_codec(decoder); ++ return ICNS_STATUS_INVALID_DATA; ++ } ++ ++ *imageOut = image; ++ ++ opj_stream_destroy(stream); ++ opj_destroy_codec(decoder); ++ ++ return ICNS_STATUS_OK; ++ ++#endif /* (ICNS_OPENJPEG == 2) */ + } + + // Convert from opj_image_t to icns_image_t +@@ -666,18 +846,30 @@ int icns_opj_to_image(opj_image_t *opjImg, icns_image_t *iconImg) + + int icns_opj_image_to_jp2(icns_image_t *iconImg, icns_size_t *dataSizeOut, icns_byte_t **dataPtrOut) + { +- int error = ICNS_STATUS_OK; ++#if (ICNS_OPENJPEG == 1) ++ int error = ICNS_STATUS_OK; + opj_event_mgr_t event_mgr; ++#endif /* (ICNS_OPENJPEG == 1) */ + opj_cparameters_t parameters; ++#if (ICNS_OPENJPEG == 1) + OPJ_COLOR_SPACE color_space = CLRSPC_SRGB; ++#else /* (ICNS_OPENJPEG == 2) */ ++ OPJ_COLOR_SPACE color_space = OPJ_CLRSPC_SRGB; ++#endif /* (ICNS_OPENJPEG == 2) */ + opj_image_cmptparm_t cmptparm[4]; + opj_image_t *opjImg = NULL; + icns_byte_t *dataPtr = NULL; + int i, j; + int rowOffset, colOffset; ++#if (ICNS_OPENJPEG == 1) + opj_cinfo_t *cinfo = NULL; + opj_cio_t *cio = NULL; + int success = 0; ++#else /* (ICNS_OPENJPEG == 2) */ ++ opj_codec_t *encoder = NULL; ++ opj_stream_t *stream = NULL; ++ mem_stream_t *memStream = NULL; ++#endif /* (ICNS_OPENJPEG == 2) */ + + if(iconImg == NULL) + { +@@ -713,12 +905,14 @@ int icns_opj_image_to_jp2(icns_image_t *iconImg, icns_size_t *dataSizeOut, icns_ + + *dataSizeOut = 0; + *dataPtrOut = NULL; +- ++ ++#if (ICNS_OPENJPEG == 1) + memset(&event_mgr, 0, sizeof(opj_event_mgr_t)); + event_mgr.error_handler = icns_opj_error_callback; + event_mgr.warning_handler = icns_opj_warning_callback; + event_mgr.info_handler = icns_opj_info_callback; +- ++#endif /* (ICNS_OPENJPEG == 1) */ ++ + opj_set_default_encoder_parameters(¶meters); + + parameters.tcp_numlayers = 1; +@@ -766,7 +960,9 @@ int icns_opj_image_to_jp2(icns_image_t *iconImg, icns_size_t *dataSizeOut, icns_ + opjImg->comps[3].data[p] = src_pixel->a; + } + } +- ++ ++#if (ICNS_OPENJPEG == 1) ++ + cinfo = opj_create_compress(CODEC_JP2); + opj_set_event_mgr((opj_common_ptr)cinfo, &event_mgr, stderr); + opj_setup_encoder(cinfo, ¶meters, opjImg); +@@ -810,6 +1006,58 @@ exception: + } + + return error; ++ ++#else /* (ICNS_OPENJPEG == 2) */ ++ ++ encoder = opj_create_compress(OPJ_CODEC_JP2); ++ if(!encoder) { ++ icns_print_err("icns_opj_image_to_jp2: failed to create encoder!\n"); ++ opj_image_destroy(opjImg); ++ return ICNS_STATUS_NO_MEMORY; ++ } ++ ++ opj_set_error_handler(encoder, icns_opj_error_callback, stderr); ++ opj_set_warning_handler(encoder, icns_opj_warning_callback, stderr); ++ opj_set_info_handler(encoder, icns_opj_info_callback, stderr); ++ ++ opj_setup_encoder(encoder, ¶meters, opjImg); ++ ++ stream = create_mem_stream(NULL, 0, OPJ_FALSE, &memStream); ++ if(!stream) { ++ icns_print_err("icns_opj_image_to_jp2: failed to create stream!\n"); ++ opj_image_destroy(opjImg); ++ opj_destroy_codec(encoder); ++ return ICNS_STATUS_NO_MEMORY; ++ } ++ ++ if(!opj_start_compress(encoder, opjImg, stream) || !opj_encode(encoder, stream) || !opj_end_compress(encoder, stream)) { ++ icns_print_err("icns_opj_image_to_jp2: Error while encoding jp2 data!\n"); ++ opj_image_destroy(opjImg); ++ opj_stream_destroy(stream); ++ opj_destroy_codec(encoder); ++ return ICNS_STATUS_INVALID_DATA; ++ } ++ ++ *dataSizeOut = memStream->bufferSize + 34; ++ *dataPtrOut = (icns_byte_t *) realloc(memStream->buffer, *dataSizeOut); ++ ++ if(!(*dataPtrOut)) ++ { ++ icns_print_err("icns_opj_image_to_jp2: Unable to allocate memory block of size: %d!\n", (int) *dataSizeOut); ++ opj_image_destroy(opjImg); ++ opj_stream_destroy(stream); ++ opj_destroy_codec(encoder); ++ return ICNS_STATUS_NO_MEMORY; ++ } ++ ++ icns_place_jp2_cdef(*dataPtrOut, *dataSizeOut); ++ ++ opj_image_destroy(opjImg); ++ opj_stream_destroy(stream); ++ opj_destroy_codec(encoder); ++ ++ return ICNS_STATUS_OK; ++#endif /* (ICNS_OPENJPEG == 2) */ + } + + void icns_opj_error_callback(const char *msg, void *client_data) { diff --git a/media-libs/libicns/libicns-0.8.1-r1.ebuild b/media-libs/libicns/libicns-0.8.1-r1.ebuild new file mode 100644 index 000000000000..2573e085ea67 --- /dev/null +++ b/media-libs/libicns/libicns-0.8.1-r1.ebuild @@ -0,0 +1,41 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit autotools + +DESCRIPTION="A library for manipulating MacOS X .icns icon format" +HOMEPAGE="https://sourceforge.net/projects/icns/" +SRC_URI="mirror://sourceforge/icns/${P}.tar.gz" + +LICENSE="GPL-2 LGPL-2.1" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="static-libs" + +RDEPEND=" + media-libs/libpng:0= + media-libs/openjpeg:2=" +DEPEND="${RDEPEND}" +BDEPEND="virtual/pkgconfig" + +PATCHES=( + "${FILESDIR}"/${PN}-0.8.1-fix-build-system.patch + "${FILESDIR}"/${PN}-0.8.1-support-libopenjp2.patch + "${FILESDIR}"/${PN}-0.8.1-fix-gcc-warnings.patch +) + +src_prepare() { + default + eautoreconf +} + +src_configure() { + econf $(use_enable static-libs static) +} + +src_install() { + default + find "${D}" -name '*.la' -delete || die +} |