Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Aug 2014 11:01:44 +0000 (UTC)
From:      Sunpoet Po-Chuan Hsieh <sunpoet@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r365636 - in head/graphics/gdal: . files
Message-ID:  <201408221101.s7MB1iiJ075332@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: sunpoet
Date: Fri Aug 22 11:01:43 2014
New Revision: 365636
URL: http://svnweb.freebsd.org/changeset/ports/365636
QAT: https://qat.redports.org/buildarchive/r365636/

Log:
  - Add OPENJPEG option
  - Fix build with graphics/openjpeg 2.1.0
  
  Obtained from:	https://trac.osgeo.org/gdal/changeset/27538

Added:
  head/graphics/gdal/files/
  head/graphics/gdal/files/patch-GDALmake.opt.in   (contents, props changed)
  head/graphics/gdal/files/patch-configure   (contents, props changed)
  head/graphics/gdal/files/patch-frmts-openjpeg-GNUmakefile   (contents, props changed)
  head/graphics/gdal/files/patch-frmts-openjpeg-makefile.vc   (contents, props changed)
  head/graphics/gdal/files/patch-frmts-openjpeg-openjpegdataset.cpp   (contents, props changed)
Modified:
  head/graphics/gdal/Makefile

Modified: head/graphics/gdal/Makefile
==============================================================================
--- head/graphics/gdal/Makefile	Fri Aug 22 10:36:40 2014	(r365635)
+++ head/graphics/gdal/Makefile	Fri Aug 22 11:01:43 2014	(r365636)
@@ -16,7 +16,7 @@ LICENSE=	MIT
 
 OPTIONS_DEFINE=	ARMADILLO CFITSIO CURL ECW EXPAT FREEXL GEOS GEOTIFF GIF GTA \
 		HDF5 ICONV JASPER JPEG JSON_C KML LIBXML2 MYSQL NETCDF ODBC \
-		PCRE PGSQL PNG PROJ SQLITE TIFF WEBP XERCES
+		OPENJPEG PCRE PGSQL PNG PROJ SQLITE TIFF WEBP XERCES
 OPTIONS_RADIO=	PDF
 OPTIONS_RADIO_PDF=	PODOFO POPPLER
 OPTIONS_DEFAULT=GEOTIFF GIF JASPER JPEG PNG TIFF
@@ -100,6 +100,9 @@ NETCDF_LIB_DEPENDS=	libnetcdf.so:${PORTS
 ODBC_CONFIGURE_OFF=	--with-odbc=no
 ODBC_CONFIGURE_ON=	--with-odbc=${LOCALBASE}
 ODBC_LIB_DEPENDS=	libodbc.so:${PORTSDIR}/databases/unixODBC
+OPENJPEG_CONFIGURE_OFF=	--with-openjpeg=no
+OPENJPEG_CONFIGURE_ON=	--with-openjpeg=${LOCALBASE}
+OPENJPEG_LIB_DEPENDS=	libopenjp2.so:${PORTSDIR}/graphics/openjpeg
 PCRE_CONFIGURE_OFF=	--with-pcre=no
 PCRE_CONFIGURE_ON=	--with-pcre=${LOCALBASE}
 PCRE_LIB_DEPENDS=	libpcre.so:${PORTSDIR}/devel/pcre

Added: head/graphics/gdal/files/patch-GDALmake.opt.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/gdal/files/patch-GDALmake.opt.in	Fri Aug 22 11:01:43 2014	(r365636)
@@ -0,0 +1,10 @@
+--- GDALmake.opt.in.orig	2014-04-17 04:04:49.000000000 +0800
++++ GDALmake.opt.in	2014-08-22 15:05:34.068301293 +0800
+@@ -192,6 +192,7 @@
+ # JPEG-2000 Support via OpenJPEG library.
+ #
+ HAVE_OPENJPEG   = @HAVE_OPENJPEG@
++OPENJPEG_VERSION = @OPENJPEG_VERSION@
+ 
+ #
+ # MrSID support via LizardTech's DSDK

Added: head/graphics/gdal/files/patch-configure
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/gdal/files/patch-configure	Fri Aug 22 11:01:43 2014	(r365636)
@@ -0,0 +1,98 @@
+--- configure.orig	2014-04-17 04:04:49.000000000 +0800
++++ configure	2014-08-22 15:05:34.087308378 +0800
+@@ -746,6 +746,7 @@
+ FGDB_INC
+ FGDB_LIB
+ FGDB_ENABLED
++OPENJPEG_VERSION
+ HAVE_OPENJPEG
+ JASPER_FLAGS
+ HAVE_JASPER
+@@ -22200,14 +22201,78 @@
+     if test "$HAVE_OPENJPEG" = "yes"; then
+         LIBS="-lopenjp2 $LIBS"
+     fi
++  else
++    for ac_header in openjpeg-2.1/openjpeg.h
++do :
++  ac_fn_c_check_header_mongrel "$LINENO" "openjpeg-2.1/openjpeg.h" "ac_cv_header_openjpeg_2_1_openjpeg_h" "$ac_includes_default"
++if test "x$ac_cv_header_openjpeg_2_1_openjpeg_h" = xyes; then :
++  cat >>confdefs.h <<_ACEOF
++#define HAVE_OPENJPEG_2_1_OPENJPEG_H 1
++_ACEOF
++
++fi
++
++done
++
++    if test "$ac_cv_header_openjpeg_2_1_openjpeg_h" = "yes"; then
++        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for opj_stream_set_user_data_length in -lopenjp2" >&5
++$as_echo_n "checking for opj_stream_set_user_data_length in -lopenjp2... " >&6; }
++if ${ac_cv_lib_openjp2_opj_stream_set_user_data_length+:} false; then :
++  $as_echo_n "(cached) " >&6
++else
++  ac_check_lib_save_LIBS=$LIBS
++LIBS="-lopenjp2  $LIBS"
++cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h.  */
++
++/* Override any GCC internal prototype to avoid an error.
++   Use char because int might match the return type of a GCC
++   builtin and then its argument prototype would still apply.  */
++#ifdef __cplusplus
++extern "C"
++#endif
++char opj_stream_set_user_data_length ();
++int
++main ()
++{
++return opj_stream_set_user_data_length ();
++  ;
++  return 0;
++}
++_ACEOF
++if ac_fn_c_try_link "$LINENO"; then :
++  ac_cv_lib_openjp2_opj_stream_set_user_data_length=yes
++else
++  ac_cv_lib_openjp2_opj_stream_set_user_data_length=no
++fi
++rm -f core conftest.err conftest.$ac_objext \
++    conftest$ac_exeext conftest.$ac_ext
++LIBS=$ac_check_lib_save_LIBS
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_openjp2_opj_stream_set_user_data_length" >&5
++$as_echo "$ac_cv_lib_openjp2_opj_stream_set_user_data_length" >&6; }
++if test "x$ac_cv_lib_openjp2_opj_stream_set_user_data_length" = xyes; then :
++  HAVE_OPENJPEG=yes
++else
++  HAVE_OPENJPEG=no
++fi
++
++        if test "$HAVE_OPENJPEG" = "yes"; then
++            OPENJPEG_VERSION=20100
++            LIBS="-lopenjp2 $LIBS"
++        fi
++    fi
+   fi
+ else
+ 
+   HAVE_OPENJPEG=yes
+   if test -r $with_openjpeg/include/openjpeg-2.0/openjpeg.h ; then
+     EXTRA_INCLUDES="-I$with_openjpeg/include $EXTRA_INCLUDES"
++  elif test -r $with_openjpeg/include/openjpeg-2.1/openjpeg.h ; then
++    OPENJPEG_VERSION=20100
++    EXTRA_INCLUDES="-I$with_openjpeg/include $EXTRA_INCLUDES"
+   else
+-    as_fn_error $? "openjpeg.h not found in $with_openjpeg/include/openjpeg-2.0" "$LINENO" 5
++    as_fn_error $? "openjpeg.h not found in $with_openjpeg/include/openjpeg-2.0 or $with_openjpeg/include/openjpeg-2.1" "$LINENO" 5
+   fi
+ 
+   { $as_echo "$as_me:${as_lineno-$LINENO}: checking for opj_stream_set_user_data_length in -lopenjp2" >&5
+@@ -22266,6 +22331,7 @@
+ 
+ HAVE_OPENJPEG=$HAVE_OPENJPEG
+ 
++OPENJPEG_VERSION=$OPENJPEG_VERSION
+ 
+ 
+ 

Added: head/graphics/gdal/files/patch-frmts-openjpeg-GNUmakefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/gdal/files/patch-frmts-openjpeg-GNUmakefile	Fri Aug 22 11:01:43 2014	(r365636)
@@ -0,0 +1,13 @@
+--- frmts/openjpeg/GNUmakefile.orig	2014-04-17 04:04:48.000000000 +0800
++++ frmts/openjpeg/GNUmakefile	2014-08-22 15:05:34.071310422 +0800
+@@ -5,6 +5,10 @@
+ 
+ CPPFLAGS	:=	$(GDAL_INCLUDE) $(CPPFLAGS)
+ 
++ifneq ($(OPENJPEG_VERSION),)
++CPPFLAGS        :=      $(CPPFLAGS) -DOPENJPEG_VERSION=$(OPENJPEG_VERSION)
++endif
++
+ default:	$(OBJ:.o=.$(OBJ_EXT))
+ 
+ clean:

Added: head/graphics/gdal/files/patch-frmts-openjpeg-makefile.vc
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/gdal/files/patch-frmts-openjpeg-makefile.vc	Fri Aug 22 11:01:43 2014	(r365636)
@@ -0,0 +1,15 @@
+--- frmts/openjpeg/makefile.vc.orig	2014-04-17 04:04:48.000000000 +0800
++++ frmts/openjpeg/makefile.vc	2014-08-22 15:05:34.090310184 +0800
+@@ -5,7 +5,11 @@
+ 
+ !INCLUDE $(GDAL_ROOT)\nmake.opt
+ 
+-EXTRAFLAGS = $(OPENJPEG_CFLAGS)
++EXTRAFLAGS = $(OPENJPEG_CFLAGS) $(OPENJPEG_VERSION_CFLAGS)
++
++!IFDEF OPENJPEG_VERSION
++OPENJPEG_VERSION_CFLAGS = -DOPENJPEG_VERSION=$(OPENJPEG_VERSION)
++!ENDIF
+ 
+ default:	$(OBJ)
+ 	xcopy /D  /Y *.obj ..\o

Added: head/graphics/gdal/files/patch-frmts-openjpeg-openjpegdataset.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/gdal/files/patch-frmts-openjpeg-openjpegdataset.cpp	Fri Aug 22 11:01:43 2014	(r365636)
@@ -0,0 +1,51 @@
+--- frmts/openjpeg/openjpegdataset.cpp.orig	2014-04-17 04:04:48.000000000 +0800
++++ frmts/openjpeg/openjpegdataset.cpp	2014-08-22 15:05:34.093308400 +0800
+@@ -29,8 +29,12 @@
+ 
+ /* This file is to be used with openjpeg 2.0 */
+ 
++#if defined(OPENJPEG_VERSION) && OPENJPEG_VERSION >= 20100
++#include <openjpeg-2.1/openjpeg.h>
++#else
+ #include <stdio.h> /* openjpeg.h needs FILE* */
+ #include <openjpeg-2.0/openjpeg.h>
++#endif
+ #include <vector>
+ 
+ #include "gdaljp2abstractdataset.h"
+@@ -612,7 +616,11 @@
+     opj_stream_set_read_function(pStream, JP2OpenJPEGDataset_Read);
+     opj_stream_set_seek_function(pStream, JP2OpenJPEGDataset_Seek);
+     opj_stream_set_skip_function(pStream, JP2OpenJPEGDataset_Skip);
++#if defined(OPENJPEG_VERSION) && OPENJPEG_VERSION >= 20100
++    opj_stream_set_user_data(pStream, fp, NULL);
++#else
+     opj_stream_set_user_data(pStream, fp);
++#endif
+ 
+     if(!opj_read_header(pStream,pCodec,&psImage))
+     {
+@@ -948,7 +956,11 @@
+     opj_stream_set_read_function(pStream, JP2OpenJPEGDataset_Read);
+     opj_stream_set_seek_function(pStream, JP2OpenJPEGDataset_Seek);
+     opj_stream_set_skip_function(pStream, JP2OpenJPEGDataset_Skip);
++#if defined(OPENJPEG_VERSION) && OPENJPEG_VERSION >= 20100
++    opj_stream_set_user_data(pStream, fp, NULL);
++#else
+     opj_stream_set_user_data(pStream, fp);
++#endif
+ 
+     opj_image_t * psImage = NULL;
+     OPJ_INT32  nX0,nY0;
+@@ -1496,7 +1508,11 @@
+     opj_stream_set_write_function(pStream, JP2OpenJPEGDataset_Write);
+     opj_stream_set_seek_function(pStream, JP2OpenJPEGDataset_Seek);
+     opj_stream_set_skip_function(pStream, JP2OpenJPEGDataset_Skip);
++#if defined(OPENJPEG_VERSION) && OPENJPEG_VERSION >= 20100
++    opj_stream_set_user_data(pStream, fp, NULL);
++#else
+     opj_stream_set_user_data(pStream, fp);
++#endif
+ 
+     if (!opj_start_compress(pCodec,psImage,pStream))
+     {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201408221101.s7MB1iiJ075332>