[GDAL] Update to 2.3.0 (#3478)

Update portfile.cmake for easier version/checksum maintenance.
Update and rename 0001 patch fixing debug build.
Update no-my-bool.patch following source file changes.
Remove no patches which are no longer required due to corresponding
changes in the GDAL source code.

Supports PROJ 4.9.x and 5.x - the latter not in vcpkg ports.
This commit is contained in:
Mateusz Loskot 2018-05-18 08:46:04 +02:00 committed by Robert Schumacher
parent 2978f18ad3
commit 0aad7df944
9 changed files with 57 additions and 124 deletions

View File

@ -1,37 +0,0 @@
diff --git a/nmake.opt b/nmake.opt
index bd5719c2d1..f6101ccd59 100644
--- a/nmake.opt
+++ b/nmake.opt
@@ -127,18 +127,28 @@ CXX_PDB_FLAGS=/Zi /Fd$(GDAL_ROOT)\gdal$(VERSION).pdb
CXX_PDB_FLAGS=
!ENDIF
+# Flags to choose CRT variant to link against (e.g. static: /MT, /MTd, dynamic: /MD, /MDd)
+# Ensure MRSID_CONFIG in mrsid/nmake.opt is set appropriately as well
+!IFNDEF CXX_CRT_FLAGS
+!IFNDEF DEBUG
+CXX_CRT_FLAGS=/MD
+!ELSE
+CXX_CRT_FLAGS=/MDd
+!ENDIF
+!ENDIF
+
!IFNDEF OPTFLAGS
!IF $(MSVC_VER) >= 1400
!IFNDEF DEBUG
-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 /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 /FC /DNDEBUG
+OPTFLAGS= $(CXX_PDB_FLAGS) /nologo $(CXX_CRT_FLAGS) /EHsc /GR /Ox /DNDEBUG
!ELSE
-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

View File

@ -0,0 +1,27 @@
diff -Nuar a/nmake.opt b/nmake.opt
--- a/nmake.opt 2018-05-04 09:05:46.000000000 +0200
+++ b/nmake.opt 2018-05-11 22:58:39.387603800 +0200
@@ -120,11 +120,21 @@
CXX_PDB_FLAGS=
!ENDIF
+# Flags to choose CRT variant to link against (e.g. static: /MT, /MTd, dynamic: /MD, /MDd)
+# Ensure MRSID_CONFIG in mrsid/nmake.opt is set appropriately as well
+!IFNDEF CXX_CRT_FLAGS
+!IFNDEF DEBUG
+CXX_CRT_FLAGS=/MD
+!ELSE
+CXX_CRT_FLAGS=/MDd
+!ENDIF
+!ENDIF
+
!IFNDEF OPTFLAGS
!IFNDEF DEBUG
-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 /MP $(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 /MP /MDd /EHsc /FC /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /DDEBUG
+OPTFLAGS= $(CXX_ANALYZE_FLAGS) $(CXX_PDB_FLAGS) /nologo /MP $(CXX_CRT_FLAGS) /EHsc /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /DDEBUG
!ENDIF
!ENDIF # OPTFLAGS

View File

@ -1,14 +0,0 @@
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,20 +0,0 @@
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,4 +1,4 @@
Source: gdal
Version: 2.2.2-1
Version: 2.3.0-1
Description: The Geographic Data Abstraction Library for reading and writing geospatial raster and vector data.
Build-Depends: proj4, libpng, geos, sqlite3, curl, expat, libpq, libmysql, openjpeg, libwebp, libxml2, liblzma
Build-Depends: proj, libpng, geos, sqlite3, curl, expat, libpq, libmysql, openjpeg, libwebp, libxml2, liblzma

View File

@ -1,13 +1,12 @@
diff --git a/ogr/ogrsf_frmts/mysql/ogrmysqldatasource.cpp b/ogr/ogrsf_frmts/mysql/ogrmysqldatasource.cpp
index 8733af9..f49d862 100644
--- a/ogr/ogrsf_frmts/mysql/ogrmysqldatasource.cpp
+++ b/ogr/ogrsf_frmts/mysql/ogrmysqldatasource.cpp
@@ -259,7 +259,7 @@ int OGRMySQLDataSource::Open( const char * pszNewName, char** papszOpenOptionsIn
// Enable automatic reconnection
// Must be called after mysql_real_connect() on MySQL < 5.0.19
// and at any point on more recent versions.
- my_bool reconnect = 1;
+ bool reconnect = 1;
mysql_options(hConn, MYSQL_OPT_RECONNECT, &reconnect);
}
diff -Nuar a/ogr/ogrsf_frmts/mysql/ogrmysqldatasource.cpp b/ogr/ogrsf_frmts/mysql/ogrmysqldatasource.cpp
--- a/ogr/ogrsf_frmts/mysql/ogrmysqldatasource.cpp 2018-05-04 09:09:26.000000000 +0200
+++ b/ogr/ogrsf_frmts/mysql/ogrmysqldatasource.cpp 2018-05-11 23:07:44.284558300 +0200
@@ -235,7 +235,7 @@
// Enable automatic reconnection
// Must be called after mysql_real_connect() on MySQL < 5.0.19
// and at any point on more recent versions.
- my_bool reconnect = 1;
+ bool reconnect = 1;
mysql_options(hConn, MYSQL_OPT_RECONNECT, &reconnect);
}

View File

@ -1,13 +0,0 @@
diff --git a/ogr/ogrsf_frmts/mysql/ogr_mysql.h b/ogr/ogrsf_frmts/mysql/ogr_mysql.h
index 76a6762..b2f0fcb 100644
--- a/ogr/ogrsf_frmts/mysql/ogr_mysql.h
+++ b/ogr/ogrsf_frmts/mysql/ogr_mysql.h
@@ -43,7 +43,7 @@
#pragma warning( disable : 4211 ) /* nonstandard extension used : redefined extern to static */
#endif
-#include <my_global.h>
+/* #include <my_global.h> */ /* Mysql 8+ no longer ships with my_global.h */
#include <mysql.h>
#ifdef _MSC_VER

View File

@ -1,13 +0,0 @@
diff --git a/ogr/ogrsf_frmts/mysql/ogrmysqldatasource.cpp b/ogr/ogrsf_frmts/mysql/ogrmysqldatasource.cpp
index e694bbd..8733af9 100644
--- a/ogr/ogrsf_frmts/mysql/ogrmysqldatasource.cpp
+++ b/ogr/ogrsf_frmts/mysql/ogrmysqldatasource.cpp
@@ -44,7 +44,7 @@
#pragma clang diagnostic ignored "-Wunknown-pragmas"
#pragma clang diagnostic ignored "-Wdocumentation"
#endif
-#include <my_sys.h>
+/*#include <my_sys.h> mysql 8.1 no longer ships with my_sys.h*/
#ifdef __clang__
#pragma clang diagnostic pop
#endif

View File

@ -1,3 +1,11 @@
# vcpkg portfile.cmake for GDAL
#
# NOTE: update the version and checksum for new GDAL release
set(GDAL_VERSION_STR "2.3.0")
set(GDAL_VERSION_PKG "230")
set(GDAL_VERSION_LIB "203")
set(GDAL_PACKAGE_SUM "f3f790b7ecb28916d6d0628b15ddc6b396a25a8f1f374589ea5e95b5a50addc99e05e363113f907b6c96faa69870b5dc9fdf3d771f9c8937b4aa8819bd78b190")
if (TRIPLET_SYSTEM_ARCH MATCHES "arm")
message(FATAL_ERROR "ARM is currently not supported.")
endif()
@ -11,27 +19,23 @@ endif()
include(vcpkg_common_functions)
vcpkg_download_distfile(ARCHIVE
URLS "http://download.osgeo.org/gdal/2.2.2/gdal222.zip"
FILENAME "gdal222.zip"
SHA512 b886238a7915c97f4acec5920dabe959d1ab15a8be0bc31ba0d05ad69d1d7d96f864faf0aa82921fa1a1b40b733744202b86f2f45ff63d6518cd18a53f3544a8
URLS "http://download.osgeo.org/gdal/${GDAL_VERSION_STR}/gdal${GDAL_VERSION_PKG}.zip"
FILENAME "gdal${GDAL_VERSION_PKG}.zip"
SHA512 ${GDAL_PACKAGE_SUM}
)
# Extract source into architecture 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-2.2.2)
set(SOURCE_PATH_RELEASE ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-release/gdal-2.2.2)
set(SOURCE_PATH_DEBUG ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-debug/gdal-${GDAL_VERSION_STR})
set(SOURCE_PATH_RELEASE ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-release/gdal-${GDAL_VERSION_STR})
foreach(BUILD_TYPE debug release)
file(REMOVE_RECURSE ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-${BUILD_TYPE})
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-2.2.2
SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src-${TARGET_TRIPLET}-${BUILD_TYPE}/gdal-${GDAL_VERSION_STR}
PATCHES
${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
${CMAKE_CURRENT_LIST_DIR}/no-mysql-global-h.patch
${CMAKE_CURRENT_LIST_DIR}/no-mysql-sys-h.patch
${CMAKE_CURRENT_LIST_DIR}/0001-Fix-debug-crt-flags.patch
${CMAKE_CURRENT_LIST_DIR}/no-my-bool.patch
)
endforeach()
@ -220,7 +224,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}/gdal202.dll DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin)
file(COPY ${SOURCE_PATH_DEBUG}/gdal${GDAL_VERSION_LIB}.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)