[gdal] Update port to latest GDAL 2.2.2

* Bump GDAL version wherever necessary
* Update download package and checksum.
* Remove 0001-Add-support-for-MSVC1900-backported-from-GDAL2.patch
  no longer necessary.
* Recalculate 000N prefix in patche filenames after the removal.
* Update 0002-Ensures-inclusion-of-PDB-in-release-dll-if-so-reques.patch
  * Patch pushed upstream https://trac.osgeo.org/gdal/ticket/7055
    and should no longer be necessary in GDAL 2.2.3 or later
* Update 0003-Fix-openjpeg-include.patch
This commit is contained in:
Mateusz Loskot 2017-09-26 19:13:28 +02:00
parent 084b1afe9a
commit 6df1629d4d
8 changed files with 52 additions and 147 deletions

View File

@ -1,70 +0,0 @@
From 823171a129401d226ac4821fb997ce585045170c Mon Sep 17 00:00:00 2001
From: Manuel Massing <m.massing@warped-space.de>
Date: Wed, 23 Nov 2016 23:50:12 +0100
Subject: [PATCH] Add support for MSVC1900 (backported from GDAL2)
---
nmake.opt | 6 ++++++
port/cpl_config.h.vc | 8 +++++---
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/nmake.opt b/nmake.opt
index 8900135..4d1c4fa 100644
--- a/nmake.opt
+++ b/nmake.opt
@@ -31,6 +31,7 @@
# Check version of Visual C++ compiler:
# nmake -f makefile.vc MSVC_VER=xxxx
# where xxxx is one of following:
+# 1900 = 14.0(2015)
# 1800 = 12.0(2013)
# 1700 = 11.0(2012)
# 1600 = 10.0(2010)
@@ -627,8 +628,13 @@ GDALLIB = $(GDAL_ROOT)/gdal.lib
!ENDIF
!IFDEF ODBC_SUPPORTED
+!IF $(MSVC_VER) >= 1900
+# legacy_stdio_definitions.lib : https://connect.microsoft.com/VisualStudio/feedback/details/1134693/vs-2015-ctp-5-c-vsnwprintf-s-and-other-functions-are-not-exported-in-appcrt140-dll-breaking-linkage-of-static-libraries
+ODBCLIB = legacy_stdio_definitions.lib odbc32.lib odbccp32.lib user32.lib
+!ELSE
ODBCLIB = odbc32.lib odbccp32.lib user32.lib
!ENDIF
+!ENDIF
!IF DEFINED(MRSID_DIR) || DEFINED(MRSID_RASTER_DIR) || DEFINED(MRSID_LIDAR_DIR)
!IF "$(MRSID_PLUGIN)" != "YES"
diff --git a/port/cpl_config.h.vc b/port/cpl_config.h.vc
index bfff8f6..fe7b82a 100644
--- a/port/cpl_config.h.vc
+++ b/port/cpl_config.h.vc
@@ -1,5 +1,5 @@
-/* We define this here in general so that a VC++ build will publically
+/* We define this here in general so that a VC++ build will publicly
declare STDCALL interfaces even if an application is built against it
using MinGW */
@@ -17,7 +17,9 @@
#if defined(_MSC_VER) && (_MSC_VER < 1500)
# define vsnprintf _vsnprintf
#endif
-#define snprintf _snprintf
+#if defined(_MSC_VER) && (_MSC_VER < 1900)
+# define snprintf _snprintf
+#endif
#define HAVE_GETCWD 1
/* gmt_notunix.h from GMT project also redefines getcwd. See #3138 */
@@ -86,7 +88,7 @@
/* Set the native cpu bit order */
#define HOST_FILLORDER FILLORDER_LSB2MSB
-/* Define as 0 or 1 according to the floating point format suported by the
+/* Define as 0 or 1 according to the floating point format supported by the
machine */
#define HAVE_IEEEFP 1
--
2.10.1.windows.1

View File

@ -1,18 +1,8 @@
From b25c3dc49ca1bcf9a789cf64c9fa8694e35127f0 Mon Sep 17 00:00:00 2001
From: Manuel Massing <m.massing@warped-space.de>
Date: Sun, 27 Nov 2016 09:57:04 +0100
Subject: [PATCH 2/2] Add variable CXX_CRT_FLAGS to allow for selection of C
runtime linkage in nmake build.
---
nmake.opt | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/nmake.opt b/nmake.opt
index 4d1c4fa..47c2df8 100644
index bd5719c2d1..f6101ccd59 100644
--- a/nmake.opt
+++ b/nmake.opt
@@ -125,18 +125,28 @@ CXX_PDB_FLAGS=/Zi /Fd$(GDAL_ROOT)\gdal$(VERSION).pdb
@@ -127,18 +127,28 @@ CXX_PDB_FLAGS=/Zi /Fd$(GDAL_ROOT)\gdal$(VERSION).pdb
CXX_PDB_FLAGS=
!ENDIF
@ -29,22 +19,19 @@ index 4d1c4fa..47c2df8 100644
!IFNDEF OPTFLAGS
!IF $(MSVC_VER) >= 1400
!IFNDEF DEBUG
-OPTFLAGS= $(CXX_ANALYZE_FLAGS) $(CXX_PDB_FLAGS) /nologo /MD /EHsc /Ox /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /DNDEBUG
-OPTFLAGS= $(CXX_ANALYZE_FLAGS) $(CXX_PDB_FLAGS) /nologo /MP /MD /EHsc /Ox /FC /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /DNDEBUG
+OPTFLAGS= $(CXX_ANALYZE_FLAGS) $(CXX_PDB_FLAGS) /nologo $(CXX_CRT_FLAGS) /EHsc /Ox /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /DNDEBUG
!ELSE
-OPTFLAGS= $(CXX_ANALYZE_FLAGS) $(CXX_PDB_FLAGS) /nologo /MD /EHsc /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /DDEBUG
-OPTFLAGS= $(CXX_ANALYZE_FLAGS) $(CXX_PDB_FLAGS) /nologo /MP /MD /EHsc /FC /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /DDEBUG
+OPTFLAGS= $(CXX_ANALYZE_FLAGS) $(CXX_PDB_FLAGS) /nologo $(CXX_CRT_FLAGS) /EHsc /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /DDEBUG
!ENDIF
!ELSE
!IFNDEF DEBUG
-OPTFLAGS= $(CXX_PDB_FLAGS) /nologo /MD /EHsc /GR /Ox /DNDEBUG
-OPTFLAGS= $(CXX_PDB_FLAGS) /nologo /MD /EHsc /GR /Ox /FC /DNDEBUG
+OPTFLAGS= $(CXX_PDB_FLAGS) /nologo $(CXX_CRT_FLAGS) /EHsc /GR /Ox /DNDEBUG
!ELSE
-OPTFLAGS= $(CXX_PDB_FLAGS) /nologo /MD /EHsc /GR /DDEBUG
-OPTFLAGS= $(CXX_PDB_FLAGS) /nologo /MD /EHsc /GR /FC /DDEBUG
+OPTFLAGS= $(CXX_PDB_FLAGS) /nologo $(CXX_CRT_FLAGS) /EHsc /GR /DDEBUG
!ENDIF
!ENDIF #MSVC_VER
!ENDIF # OPTFLAGS
--
2.10.1.windows.1

View File

@ -0,0 +1,14 @@
diff --git a/nmake.opt b/nmake.opt
index bd5719c2d1..c0ca442cbe 100644
--- a/nmake.opt
+++ b/nmake.opt
@@ -195,6 +205,9 @@ SOFTWARNFLAGS= /wd4244 /wd4702 /wd4701 /wd4013 /wd4706 /wd4057 /wd4210 /wd4305
# Linker debug options
!IFDEF DEBUG
LDEBUG= /debug
+!ELSEIFDEF WITH_PDB
+# Ensures that PDB is included in release DLL if so requested
+LDEBUG= /debug /opt:ref /opt:icf
!ENDIF
# Uncomment the following if you are building for 64-bit windows

View File

@ -1,26 +0,0 @@
From 9da0cb6eed442ebf3eea232cd85e26c155c963ef Mon Sep 17 00:00:00 2001
From: Manuel Massing <m.massing@warped-space.de>
Date: Tue, 29 Nov 2016 12:43:58 +0100
Subject: [PATCH 3/4] - Ensures inclusion of PDB in release dll if so requested
---
gdal/nmake.opt | 3 +++
1 file changed, 3 insertions(+)
diff --git a/nmake.opt b/nmake.opt
index 47c2df8..4844d22 100644
--- a/nmake.opt
+++ b/nmake.opt
@@ -174,6 +174,9 @@ SOFTWARNFLAGS= /wd4244 /wd4702 /wd4701 /wd4013 /wd4706 /wd4057 /wd4210 /wd4305
# Linker debug options
!IFDEF DEBUG
LDEBUG= /debug
+!ELSEIFDEF WITH_PDB
+# Ensures that PDB is included in release DLL if so requested
+LDEBUG= /debug /opt:ref /opt:icf
!ENDIF
# Uncomment the following if you are building for 64-bit windows
--
2.10.1.windows.1

View File

@ -0,0 +1,20 @@
diff --git a/frmts/openjpeg/openjpegdataset.cpp b/frmts/openjpeg/openjpegdataset.cpp
index 5978882bc9..72cc7b9559 100644
--- a/frmts/openjpeg/openjpegdataset.cpp
+++ b/frmts/openjpeg/openjpegdataset.cpp
@@ -34,14 +34,8 @@
#pragma clang diagnostic ignored "-Wdocumentation"
#endif
-#if defined(OPENJPEG_VERSION) && OPENJPEG_VERSION >= 20200
-#include <openjpeg-2.2/openjpeg.h>
-#elif 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 <openjpeg.h>
#ifdef __clang__
#pragma clang diagnostic pop

View File

@ -1,19 +0,0 @@
diff --git a/frmts/openjpeg/openjpegdataset.cpp b/frmts/openjpeg/openjpegdataset.cpp
index 1fd4f4f..417f7a8 100644
--- a/frmts/openjpeg/openjpegdataset.cpp
+++ b/frmts/openjpeg/openjpegdataset.cpp
@@ -29,12 +29,8 @@
/* 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 <stdio.h>
+#include <openjpeg.h>
#include <vector>
#include "gdaljp2abstractdataset.h"

View File

@ -1,4 +1,4 @@
Source: gdal
Version: 1.11.3-5
Version: 2.2.2
Description: The Geographic Data Abstraction Library for reading and writing geospatial raster and vector data.
Build-Depends: proj, libpng, geos, sqlite3, curl, expat, libpq, libmysql, openjpeg, libwebp, libxml2, liblzma

View File

@ -5,25 +5,24 @@ endif()
include(vcpkg_common_functions)
vcpkg_download_distfile(ARCHIVE
URLS "http://download.osgeo.org/gdal/1.11.3/gdal1113.zip"
FILENAME "gdal1113.zip"
SHA512 42feb98a54019d3b6ac54f598f299a57e117db500c662d39faa9d5f5090f03c1b8d7680242e1abd8035738edc4fc3197ae118a0ce50733691a76a5cf377bcd46
)
URLS "http://download.osgeo.org/gdal/2.2.2/gdal222.zip"
FILENAME "gdal222.zip"
SHA512 b886238a7915c97f4acec5920dabe959d1ab15a8be0bc31ba0d05ad69d1d7d96f864faf0aa82921fa1a1b40b733744202b86f2f45ff63d6518cd18a53f3544a8
)
# Extract source into archictecture specific directory, because GDALs' nmake based build currently does not
# support out of source builds.
set(SOURCE_PATH_DEBUG ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-debug/gdal-1.11.3)
set(SOURCE_PATH_RELEASE ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-release/gdal-1.11.3)
set(SOURCE_PATH_DEBUG ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-debug/gdal-2.2.2)
set(SOURCE_PATH_RELEASE ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-release/gdal-2.2.2)
foreach(BUILD_TYPE debug release)
vcpkg_extract_source_archive(${ARCHIVE} ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-${BUILD_TYPE})
vcpkg_apply_patches(
SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-${BUILD_TYPE}/gdal-1.11.3
SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-${BUILD_TYPE}/gdal-2.2.2
PATCHES
${CMAKE_CURRENT_LIST_DIR}/0001-Add-support-for-MSVC1900-backported-from-GDAL2.patch
${CMAKE_CURRENT_LIST_DIR}/0002-Add-variable-CXX_CRT_FLAGS-to-allow-for-selection-of.patch
${CMAKE_CURRENT_LIST_DIR}/0003-Ensures-inclusion-of-PDB-in-release-dll-if-so-reques.patch
${CMAKE_CURRENT_LIST_DIR}/0004-Fix-openjpeg-include.patch
${CMAKE_CURRENT_LIST_DIR}/0001-Add-variable-CXX_CRT_FLAGS-to-allow-for-selection-of.patch
${CMAKE_CURRENT_LIST_DIR}/0002-Ensures-inclusion-of-PDB-in-release-dll-if-so-reques.patch
${CMAKE_CURRENT_LIST_DIR}/0003-Fix-openjpeg-include.patch
)
endforeach()
@ -211,7 +210,7 @@ if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
else()
file(GLOB EXE_FILES ${CURRENT_PACKAGES_DIR}/bin/*.exe)
file(REMOVE ${EXE_FILES} ${CURRENT_PACKAGES_DIR}/lib/gdal.lib)
file(COPY ${SOURCE_PATH_DEBUG}/gdal111.dll DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
file(COPY ${SOURCE_PATH_DEBUG}/gdal202.dll DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
file(COPY ${SOURCE_PATH_DEBUG}/gdal_i.lib DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib)
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/gdal_i.lib ${CURRENT_PACKAGES_DIR}/lib/gdal.lib)
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/gdal_i.lib ${CURRENT_PACKAGES_DIR}/debug/lib/gdald.lib)