libicns: added recipe for version 0.8.1

This commit is contained in:
Jerome Duval
2014-08-26 16:32:13 +00:00
parent ace3e2fc5a
commit b7f6a2b4dd
2 changed files with 239 additions and 0 deletions

View File

@@ -0,0 +1,85 @@
SUMMARY="A library for the translation of the icns format"
DESCRIPTION="
libicns is a library for manipulation of the Mac OS icns resource format, also \
known as the IconFamily resource type. It can read and write files from the \
Mac OS X icns format, as well as read from Mac OS resource files and macbinary \
encoded Mac OS resource forks.
"
HOMEPAGE="http://sourceforge.net/projects/icns"
COPYRIGHT="
2001-2012 Matthew Eis
"
LICENSE="GNU LGPL v2.1"
SRC_URI="http://sourceforge.net/projects/icns/files/libicns-$portVersion.tar.gz"
CHECKSUM_SHA256="335f10782fc79855cf02beac4926c4bf9f800a742445afbbf7729dab384555c2"
REVISION="1"
ARCHITECTURES="x86_gcc2 x86 x86_64"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"
PATCHES="libicns-$portVersion.patchset"
PROVIDES="
libicns$secondaryArchSuffix = $portVersion compat >= 0.8
lib:libicns$secondaryArchSuffix = 1.2.0 compat >= 1
"
if [ -z $secondaryArchSuffix ]; then
PROVIDES="$PROVIDES
cmd:icns2png
cmd:icontainer2icns
cmd:png2icns
"
fi
REQUIRES="
haiku$secondaryArchSuffix >= $haikuVersion
lib:libjasper$secondaryArchSuffix
lib:libpng15$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel >= $haikuVersion
devel:libjasper$secondaryArchSuffix
devel:libpng15$secondaryArchSuffix
devel:libz$secondaryArchSuffix >= 1.0.4
"
BUILD_PREREQUIRES="
cmd:aclocal
cmd:autoconf
cmd:automake
cmd:gcc$secondaryArchSuffix
cmd:ld$secondaryArchSuffix
cmd:libtoolize
cmd:make
"
BUILD()
{
autoreconf -fi
runConfigure ./configure
make $jobArgs
}
INSTALL()
{
make install
if [ -n $secondaryArchSuffix ]; then
rm -rf $binDir
fi
prepareInstalledDevelLibs libicns
fixPkgconfig
# devel package
packageEntries devel \
$developDir
}
# ----- devel package -------------------------------------------------------
PROVIDES_devel="
libicns${secondaryArchSuffix}_devel = $portVersion compat >= 0.8
devel:libicns$secondaryArchSuffix = 1.2.0 compat >= 1
"
REQUIRES_devel="
libicns$secondaryArchSuffix == $portVersion base
"

View File

@@ -0,0 +1,154 @@
From 3a6d8929a6b6bd735c21738df62dfd87dbb7ac2e Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Tue, 26 Aug 2014 15:58:58 +0000
Subject: gcc2 patch
diff --git a/icnsutils/icns2png.c b/icnsutils/icns2png.c
index cd53545..a4d7c91 100644
--- a/icnsutils/icns2png.c
+++ b/icnsutils/icns2png.c
@@ -316,7 +316,7 @@ int ExtractAndDescribeIconFamilyFile(char *filepath)
filenamelength = filepathlength-filenamestart;
memcpy(&filename[0],&filepath[filenamestart],filenamelength);
filename[filenamelength] = 0;
-
+{
// Set up the output filepath...
unsigned int outputpathlength = 0;
unsigned int filepathstart = filepathlength;
@@ -379,7 +379,7 @@ int ExtractAndDescribeIconFamilyFile(char *filepath)
outfileprefixlength += (filepathend - filepathstart);
outfileprefix[outfileprefixlength] = 0;
}
-
+}
printf("----------------------------------------------------\n");
printf("Reading icns family from %s...\n",filepath);
diff --git a/icnsutils/icontainer2icns.c b/icnsutils/icontainer2icns.c
index 70c12dc..2facef7 100644
--- a/icnsutils/icontainer2icns.c
+++ b/icnsutils/icontainer2icns.c
@@ -38,6 +38,15 @@ static inline int isChar(char c) {
int main(int argc, char **argv)
{
+ char buffer[118];
+ FILE *icontainer = NULL;
+ FILE *icns = NULL;
+ short i = 0;
+
+ //int iconCounter = 0;
+ int c;
+ char name[256];
+
printf("icontainer2icns, (C) 2005/2007 by Thomas Lübking\n\n");
if (argc < 2) {
printf("\nusage: icontainer2icns foo.icontainer\n\n");
@@ -47,14 +56,6 @@ int main(int argc, char **argv)
printf("\nusage: icontainer2icns foo.icontainer\nif your icontainer file contains spaces etc.,\nuse a system valid form (i.e. use \"my foo.icontainer\" or my\\ foo.icontainer)\n\n");
return -1;
}
- char buffer[118];
- FILE *icontainer = NULL;
- FILE *icns = NULL;
- short i = 0;
-
- //int iconCounter = 0;
- int c;
- char name[256];
if( (icontainer = fopen(argv[1], "r")) == NULL ) {
printf("error while opening file %s\n",argv[1]);
@@ -74,13 +75,13 @@ int main(int argc, char **argv)
if ((c = getc(icontainer)) == 'c') {
if ((c = getc(icontainer)) == 'n') {
if ((c = getc(icontainer)) == 's') { // yupp!
+ short j;
+ short k = 0;
if (icns) fclose(icns); // buffer only contains new icns info
// generate the name
// i - 7 .. i - 2 is the icontainer id
// could be 56-4, so no memcpy please!
// printf("%s\n",buffer);
- short j;
- short k = 0;
if (buffer[clamp(i-1)] == ']') {
j = clamp(i-7);
for (k = 0; k < 6; j = clamp(++j)) {
diff --git a/src/icns_element.c b/src/icns_element.c
index 1b08668..fc4d44b 100644
--- a/src/icns_element.c
+++ b/src/icns_element.c
@@ -330,6 +330,9 @@ int icns_remove_element_in_family(icns_family_t **iconFamilyRef,icns_type_t icon
icns_type_t elementType = ICNS_NULL_TYPE;
icns_size_t elementSize = 0;
icns_uint32_t dataOffset = 0;
+ icns_size_t newIconFamilySize = 0;
+ icns_family_t *newIconFamily = NULL;
+ icns_uint32_t newDataOffset = 0;
if(iconFamilyRef == NULL)
{
@@ -374,10 +377,6 @@ int icns_remove_element_in_family(icns_family_t **iconFamilyRef,icns_type_t icon
return ICNS_STATUS_DATA_NOT_FOUND;
}
- icns_size_t newIconFamilySize = 0;
- icns_family_t *newIconFamily = NULL;
- icns_uint32_t newDataOffset = 0;
-
newIconFamilySize = iconFamilySize - elementSize;
newIconFamily = malloc(newIconFamilySize);
@@ -485,6 +484,12 @@ int icns_update_element_with_image_or_mask(icns_image_t *imageIn,icns_bool_t isM
int error = ICNS_STATUS_OK;
icns_type_t iconType;
icns_icon_info_t iconInfo;
+ icns_size_t imageDataSize = 0;
+ icns_byte_t *imageDataPtr = NULL;
+
+ // For use to easily track deallocation if we use rle24, or jp2
+ icns_size_t newDataSize = 0;
+ icns_byte_t *newDataPtr = NULL;
if(imageIn == NULL)
{
@@ -555,12 +560,6 @@ int icns_update_element_with_image_or_mask(icns_image_t *imageIn,icns_bool_t isM
}
// Finally, done with all the preliminary checks
- icns_size_t imageDataSize = 0;
- icns_byte_t *imageDataPtr = NULL;
-
- // For use to easily track deallocation if we use rle24, or jp2
- icns_size_t newDataSize = 0;
- icns_byte_t *newDataPtr = NULL;
switch(iconType)
{
diff --git a/src/icns_png.c b/src/icns_png.c
index a5b26e3..2100438 100644
--- a/src/icns_png.c
+++ b/src/icns_png.c
@@ -52,7 +52,7 @@ int icns_png_to_image(icns_size_t dataSize, icns_byte_t *dataPtr, icns_image_t *
int32_t color_type;
int row;
int rowsize;
-
+ icns_png_io_ref io_data = { dataPtr, dataSize, 0 };
if(dataPtr == NULL)
{
@@ -96,7 +96,6 @@ int icns_png_to_image(icns_size_t dataSize, icns_byte_t *dataPtr, icns_image_t *
}
// set libpng to read from memory
- icns_png_io_ref io_data = { dataPtr, dataSize, 0 };
png_set_read_fn(png_ptr, (void *)&io_data, &icns_png_read_memory);
png_read_info(png_ptr, info_ptr);
--
1.8.3.4