From owner-freebsd-ports-bugs@FreeBSD.ORG Tue May 4 07:30:02 2010 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EDBF81065676 for ; Tue, 4 May 2010 07:30:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [69.147.83.40]) by mx1.freebsd.org (Postfix) with ESMTP id AD5828FC17 for ; Tue, 4 May 2010 07:30:02 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o447U2RI057892 for ; Tue, 4 May 2010 07:30:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o447U2kH057889; Tue, 4 May 2010 07:30:02 GMT (envelope-from gnats) Resent-Date: Tue, 4 May 2010 07:30:02 GMT Resent-Message-Id: <201005040730.o447U2kH057889@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Sunpoet Po-Chuan Hsieh Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 559541065670 for ; Tue, 4 May 2010 07:23:14 +0000 (UTC) (envelope-from sunpoet@sunpoet.net) Received: from mail-yw0-f181.google.com (mail-yw0-f181.google.com [209.85.211.181]) by mx1.freebsd.org (Postfix) with ESMTP id 0954E8FC14 for ; Tue, 4 May 2010 07:23:13 +0000 (UTC) Received: by ywh11 with SMTP id 11so1604844ywh.7 for ; Tue, 04 May 2010 00:23:02 -0700 (PDT) Received: by 10.90.2.23 with SMTP id 23mr2582553agb.103.1272957781889; Tue, 04 May 2010 00:23:01 -0700 (PDT) Received: from sunpoet.net (sunpoet.net [220.133.12.240]) by mx.google.com with ESMTPS id 22sm4032240ywh.5.2010.05.04.00.22.58 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 04 May 2010 00:23:00 -0700 (PDT) Received: by sunpoet.net (Postfix, from userid 1000) id 0D28F2AEC5A0; Tue, 4 May 2010 15:22:46 +0800 (CST) Message-Id: <20100504072246.0D28F2AEC5A0@sunpoet.net> Date: Tue, 4 May 2010 15:22:46 +0800 (CST) From: Sunpoet Po-Chuan Hsieh To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: dinoex@FreeBSD.org Subject: ports/146290: [PATCH] graphics/jasper: introduce UUID patch X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2010 07:30:03 -0000 >Number: 146290 >Category: ports >Synopsis: [PATCH] graphics/jasper: introduce UUID patch >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Tue May 04 07:30:02 UTC 2010 >Closed-Date: >Last-Modified: >Originator: Sunpoet Po-Chuan Hsieh >Release: FreeBSD 8.0-STABLE amd64 >Organization: SUNPOET.net >Environment: System: FreeBSD bonjour.sunpoet.net 8.0-STABLE FreeBSD 8.0-STABLE #0: Fri Mar 19 09:16:38 CST 2010 >Description: Change: - Introduce UUID patch, which is required by GDAL Added file(s): - files/extra-patch-uuid Port maintainer (dinoex@FreeBSD.org) is cc'd. Generated with FreeBSD Port Tools 0.99 >How-To-Repeat: >From GDAL's configure log without UUID patch: checking for jp2_encode_uuid in -ljasper... no configure: hacked JasPer version not found, GeoJP2 disabled. with UUID patch: checking for jp2_encode_uuid in -ljasper... yes configure: hacked JasPer version found (JasPer UUID), GeoJP2 enabled. >Fix: --- jasper-1.900.1_9.patch begins here --- diff -ruN --exclude=CVS /usr/ports/graphics/jasper/Makefile /usr/ports/sunpoet/jasper/Makefile --- /usr/ports/graphics/jasper/Makefile 2010-02-06 10:46:17.000000000 +0800 +++ /usr/ports/sunpoet/jasper/Makefile 2010-05-04 15:17:56.000000000 +0800 @@ -32,7 +32,8 @@ ftp://ftp.imagemagick.org/pub/%SUBDIR%/ \ ${MASTER_SITE_RINGSERVER:S,%SUBDIR%,graphics/&,} -OPTIONS= OPENGL "OpenGL support" off +OPTIONS= OPENGL "OpenGL support" off \ + UUID "UUID support (required by GDAL)" off .include @@ -45,6 +46,10 @@ PLIST_SUB+= OPENGL="@comment " .endif +.if defined(WITH_UUID) +EXTRA_PATCHES+= ${FILESDIR}/extra-patch-uuid +.endif + .if !defined(NO_INSTALL_MANPAGES) MAN1= imgcmp.1 imginfo.1 jasper.1 jiv.1 .endif diff -ruN --exclude=CVS /usr/ports/graphics/jasper/files/extra-patch-uuid /usr/ports/sunpoet/jasper/files/extra-patch-uuid --- /usr/ports/graphics/jasper/files/extra-patch-uuid 1970-01-01 08:00:00.000000000 +0800 +++ /usr/ports/sunpoet/jasper/files/extra-patch-uuid 2010-05-04 15:17:40.000000000 +0800 @@ -0,0 +1,242 @@ +# +# Jasper with uuid patch, required by GDAL, can be downloaded from: +# - http://download.osgeo.org/gdal/ +# - http://www.gdal.org/dl/ +# - ftp://ftp.remotesensing.org/gdal/ +# +# Current version is jasper-1.900.1.uuid.tar.gz. +# +diff -ruN src/libjasper/jp2/jp2_cod.c.orig src/libjasper/jp2/jp2_cod.c +--- src/libjasper/jp2/jp2_cod.c.orig 2007-01-20 05:43:05.000000000 +0800 ++++ src/libjasper/jp2/jp2_cod.c 2007-03-06 21:49:58.000000000 +0800 +@@ -5,6 +5,11 @@ + * All rights reserved. + */ + ++/* ++ * Modified by Andrey Kiselev to properly handle UUID ++ * box. ++ */ ++ + /* __START_OF_JASPER_LICENSE__ + * + * JasPer License Version 2.0 +@@ -127,6 +132,9 @@ + static int jp2_pclr_getdata(jp2_box_t *box, jas_stream_t *in); + static int jp2_pclr_putdata(jp2_box_t *box, jas_stream_t *out); + static void jp2_pclr_dumpdata(jp2_box_t *box, FILE *out); ++static void jp2_uuid_destroy(jp2_box_t *box); ++static int jp2_uuid_getdata(jp2_box_t *box, jas_stream_t *in); ++static int jp2_uuid_putdata(jp2_box_t *box, jas_stream_t *out); + + /******************************************************************************\ + * Local data. +@@ -164,7 +172,7 @@ + {JP2_BOX_XML, "XML", 0, + {0, 0, 0, 0, 0}}, + {JP2_BOX_UUID, "UUID", 0, +- {0, 0, 0, 0, 0}}, ++ {0, jp2_uuid_destroy, jp2_uuid_getdata, jp2_uuid_putdata, 0}}, + {JP2_BOX_UINF, "UINF", JP2_BOX_SUPER, + {0, 0, 0, 0, 0}}, + {JP2_BOX_ULST, "ULST", 0, +@@ -271,7 +279,7 @@ + } else { + box->datalen = box->len - JP2_BOX_HDRLEN(false); + } +- if (box->len != 0 && box->len < 8) { ++ if (box->len != 0 && box->len < JP2_BOX_HDRLEN(false)) { + goto error; + } + +@@ -876,6 +884,56 @@ + } + } + ++static void jp2_uuid_destroy(jp2_box_t *box) ++{ ++ jp2_uuid_t *uuid = &box->data.uuid; ++ if (uuid->data) ++ { ++ jas_free(uuid->data); ++ uuid->data = NULL; ++ } ++} ++ ++static int jp2_uuid_getdata(jp2_box_t *box, jas_stream_t *in) ++{ ++ jp2_uuid_t *uuid = &box->data.uuid; ++ int i; ++ ++ for (i = 0; i < 16; i++) ++ { ++ if (jp2_getuint8(in, &uuid->uuid[i])) ++ return -1; ++ } ++ ++ uuid->datalen = box->datalen - 16; ++ uuid->data = jas_malloc(uuid->datalen * sizeof(uint_fast8_t)); ++ for (i = 0; i < uuid->datalen; i++) ++ { ++ if (jp2_getuint8(in, &uuid->data[i])) ++ return -1; ++ } ++ return 0; ++} ++ ++static int jp2_uuid_putdata(jp2_box_t *box, jas_stream_t *out) ++{ ++ jp2_uuid_t *uuid = &box->data.uuid; ++ int i; ++ ++ for (i = 0; i < 16; i++) ++ { ++ if (jp2_putuint8(out, uuid->uuid[i])) ++ return -1; ++ } ++ ++ for (i = 0; i < uuid->datalen; i++) ++ { ++ if (jp2_putuint8(out, uuid->data[i])) ++ return -1; ++ } ++ return 0; ++} ++ + static int jp2_getint(jas_stream_t *in, int s, int n, int_fast32_t *val) + { + int c; +diff -ruN src/libjasper/jp2/jp2_cod.h.orig src/libjasper/jp2/jp2_cod.h +--- src/libjasper/jp2/jp2_cod.h.orig 2007-01-20 05:43:05.000000000 +0800 ++++ src/libjasper/jp2/jp2_cod.h 2007-03-06 21:49:58.000000000 +0800 +@@ -5,6 +5,11 @@ + * All rights reserved. + */ + ++/* ++ * Modified by Andrey Kiselev to properly handle UUID ++ * box. ++ */ ++ + /* __START_OF_JASPER_LICENSE__ + * + * JasPer License Version 2.0 +@@ -229,6 +234,12 @@ + jp2_cmapent_t *ents; + } jp2_cmap_t; + ++typedef struct { ++ uint_fast32_t datalen; ++ uint_fast8_t uuid[16]; ++ uint_fast8_t *data; ++} jp2_uuid_t; ++ + #define JP2_CMAP_DIRECT 0 + #define JP2_CMAP_PALETTE 1 + +@@ -257,6 +268,7 @@ + jp2_pclr_t pclr; + jp2_cdef_t cdef; + jp2_cmap_t cmap; ++ jp2_uuid_t uuid; + } data; + + } jp2_box_t; +diff -ruN src/libjasper/jp2/jp2_enc.c.orig src/libjasper/jp2/jp2_enc.c +--- src/libjasper/jp2/jp2_enc.c.orig 2007-01-20 05:43:05.000000000 +0800 ++++ src/libjasper/jp2/jp2_enc.c 2007-03-06 21:49:58.000000000 +0800 +@@ -5,6 +5,11 @@ + * All rights reserved. + */ + ++/* ++ * Modified by Andrey Kiselev to properly handle UUID ++ * box. ++ */ ++ + /* __START_OF_JASPER_LICENSE__ + * + * JasPer License Version 2.0 +@@ -86,7 +91,7 @@ + * Functions. + \******************************************************************************/ + +-int jp2_encode(jas_image_t *image, jas_stream_t *out, char *optstr) ++int jp2_write_header(jas_image_t *image, jas_stream_t *out) + { + jp2_box_t *box; + jp2_ftyp_t *ftyp; +@@ -97,8 +102,6 @@ + long len; + uint_fast16_t cmptno; + jp2_colr_t *colr; +- char buf[4096]; +- uint_fast32_t overhead; + jp2_cdefchan_t *cdefchanent; + jp2_cdef_t *cdef; + int i; +@@ -326,6 +329,26 @@ + jas_stream_close(tmpstream); + tmpstream = 0; + ++ return 0; ++ abort(); ++ ++error: ++ ++ if (box) { ++ jp2_box_destroy(box); ++ } ++ if (tmpstream) { ++ jas_stream_close(tmpstream); ++ } ++ return -1; ++} ++ ++int jp2_write_codestream(jas_image_t *image, jas_stream_t *out, char *optstr) ++{ ++ jp2_box_t *box; ++ char buf[4096]; ++ uint_fast32_t overhead; ++ + /* + * Output the contiguous code stream box. + */ +@@ -358,12 +381,34 @@ + if (box) { + jp2_box_destroy(box); + } +- if (tmpstream) { +- jas_stream_close(tmpstream); +- } + return -1; + } + ++int jp2_encode(jas_image_t *image, jas_stream_t *out, char *optstr) ++{ ++ if (jp2_write_header(image, out) < 0) ++ return -1; ++ if (jp2_write_codestream(image, out, optstr) < 0) ++ return -1; ++ ++ return 0; ++} ++ ++int jp2_encode_uuid(jas_image_t *image, jas_stream_t *out, ++ char *optstr, jp2_box_t *uuid) ++{ ++ if (jp2_write_header(image, out) < 0) ++ return -1; ++ if (uuid) { ++ if (jp2_box_put(uuid, out)) ++ return -1; ++ } ++ if (jp2_write_codestream(image, out, optstr) < 0) ++ return -1; ++ ++ return 0; ++} ++ + static uint_fast32_t jp2_gettypeasoc(int colorspace, int ctype) + { + int type; --- jasper-1.900.1_9.patch ends here --- >Release-Note: >Audit-Trail: >Unformatted: