diff options
-rw-r--r-- | graphics/gdal/Makefile | 5 | ||||
-rw-r--r-- | graphics/gdal/files/patch-GDALmake.opt.in | 10 | ||||
-rw-r--r-- | graphics/gdal/files/patch-configure | 98 | ||||
-rw-r--r-- | graphics/gdal/files/patch-frmts-openjpeg-GNUmakefile | 13 | ||||
-rw-r--r-- | graphics/gdal/files/patch-frmts-openjpeg-makefile.vc | 15 | ||||
-rw-r--r-- | graphics/gdal/files/patch-frmts-openjpeg-openjpegdataset.cpp | 51 |
6 files changed, 191 insertions, 1 deletions
diff --git a/graphics/gdal/Makefile b/graphics/gdal/Makefile index 9ec462c2c8a2..a77f90358c3e 100644 --- a/graphics/gdal/Makefile +++ b/graphics/gdal/Makefile @@ -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:${PORTSDIR}/science/netcdf 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 diff --git a/graphics/gdal/files/patch-GDALmake.opt.in b/graphics/gdal/files/patch-GDALmake.opt.in new file mode 100644 index 000000000000..16d9dd6d7e2f --- /dev/null +++ b/graphics/gdal/files/patch-GDALmake.opt.in @@ -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 diff --git a/graphics/gdal/files/patch-configure b/graphics/gdal/files/patch-configure new file mode 100644 index 000000000000..9b87b885cc0a --- /dev/null +++ b/graphics/gdal/files/patch-configure @@ -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 + + + diff --git a/graphics/gdal/files/patch-frmts-openjpeg-GNUmakefile b/graphics/gdal/files/patch-frmts-openjpeg-GNUmakefile new file mode 100644 index 000000000000..aa564a6cdfe0 --- /dev/null +++ b/graphics/gdal/files/patch-frmts-openjpeg-GNUmakefile @@ -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: diff --git a/graphics/gdal/files/patch-frmts-openjpeg-makefile.vc b/graphics/gdal/files/patch-frmts-openjpeg-makefile.vc new file mode 100644 index 000000000000..2fb86dae986b --- /dev/null +++ b/graphics/gdal/files/patch-frmts-openjpeg-makefile.vc @@ -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 diff --git a/graphics/gdal/files/patch-frmts-openjpeg-openjpegdataset.cpp b/graphics/gdal/files/patch-frmts-openjpeg-openjpegdataset.cpp new file mode 100644 index 000000000000..5e37cbe5a414 --- /dev/null +++ b/graphics/gdal/files/patch-frmts-openjpeg-openjpegdataset.cpp @@ -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)) + { |