From 0aad7df94445ea0eb8d6dfe3acf07fac9a4e9fa9 Mon Sep 17 00:00:00 2001 From: Mateusz Loskot Date: Fri, 18 May 2018 08:46:04 +0200 Subject: [PATCH] [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. --- ..._CRT_FLAGS-to-allow-for-selection-of.patch | 37 ------------------- ports/gdal/0001-Fix-debug-crt-flags.patch | 27 ++++++++++++++ ...n-of-PDB-in-release-dll-if-so-reques.patch | 14 ------- ports/gdal/0003-Fix-openjpeg-include.patch | 20 ---------- ports/gdal/CONTROL | 4 +- ports/gdal/no-my-bool.patch | 25 ++++++------- ports/gdal/no-mysql-global-h.patch | 13 ------- ports/gdal/no-mysql-sys-h.patch | 13 ------- ports/gdal/portfile.cmake | 28 ++++++++------ 9 files changed, 57 insertions(+), 124 deletions(-) delete mode 100644 ports/gdal/0001-Add-variable-CXX_CRT_FLAGS-to-allow-for-selection-of.patch create mode 100644 ports/gdal/0001-Fix-debug-crt-flags.patch delete mode 100644 ports/gdal/0002-Ensures-inclusion-of-PDB-in-release-dll-if-so-reques.patch delete mode 100644 ports/gdal/0003-Fix-openjpeg-include.patch delete mode 100644 ports/gdal/no-mysql-global-h.patch delete mode 100644 ports/gdal/no-mysql-sys-h.patch diff --git a/ports/gdal/0001-Add-variable-CXX_CRT_FLAGS-to-allow-for-selection-of.patch b/ports/gdal/0001-Add-variable-CXX_CRT_FLAGS-to-allow-for-selection-of.patch deleted file mode 100644 index 7817c4a38f..0000000000 --- a/ports/gdal/0001-Add-variable-CXX_CRT_FLAGS-to-allow-for-selection-of.patch +++ /dev/null @@ -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 diff --git a/ports/gdal/0001-Fix-debug-crt-flags.patch b/ports/gdal/0001-Fix-debug-crt-flags.patch new file mode 100644 index 0000000000..753d531318 --- /dev/null +++ b/ports/gdal/0001-Fix-debug-crt-flags.patch @@ -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 + diff --git a/ports/gdal/0002-Ensures-inclusion-of-PDB-in-release-dll-if-so-reques.patch b/ports/gdal/0002-Ensures-inclusion-of-PDB-in-release-dll-if-so-reques.patch deleted file mode 100644 index 57030b99b6..0000000000 --- a/ports/gdal/0002-Ensures-inclusion-of-PDB-in-release-dll-if-so-reques.patch +++ /dev/null @@ -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 diff --git a/ports/gdal/0003-Fix-openjpeg-include.patch b/ports/gdal/0003-Fix-openjpeg-include.patch deleted file mode 100644 index 4ea72690cb..0000000000 --- a/ports/gdal/0003-Fix-openjpeg-include.patch +++ /dev/null @@ -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 --#elif defined(OPENJPEG_VERSION) && OPENJPEG_VERSION >= 20100 --#include --#else - #include /* openjpeg.h needs FILE* */ --#include --#endif -+#include - - #ifdef __clang__ - #pragma clang diagnostic pop diff --git a/ports/gdal/CONTROL b/ports/gdal/CONTROL index c958ac671b..be75e66939 100644 --- a/ports/gdal/CONTROL +++ b/ports/gdal/CONTROL @@ -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 diff --git a/ports/gdal/no-my-bool.patch b/ports/gdal/no-my-bool.patch index 1ed0279ee9..2589ff0447 100644 --- a/ports/gdal/no-my-bool.patch +++ b/ports/gdal/no-my-bool.patch @@ -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); + } + diff --git a/ports/gdal/no-mysql-global-h.patch b/ports/gdal/no-mysql-global-h.patch deleted file mode 100644 index 57ff89ce3c..0000000000 --- a/ports/gdal/no-mysql-global-h.patch +++ /dev/null @@ -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 -+/* #include */ /* Mysql 8+ no longer ships with my_global.h */ - #include - - #ifdef _MSC_VER diff --git a/ports/gdal/no-mysql-sys-h.patch b/ports/gdal/no-mysql-sys-h.patch deleted file mode 100644 index 951425386c..0000000000 --- a/ports/gdal/no-mysql-sys-h.patch +++ /dev/null @@ -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 -+/*#include mysql 8.1 no longer ships with my_sys.h*/ - #ifdef __clang__ - #pragma clang diagnostic pop - #endif diff --git a/ports/gdal/portfile.cmake b/ports/gdal/portfile.cmake index ba77b624a1..70eea85836 100644 --- a/ports/gdal/portfile.cmake +++ b/ports/gdal/portfile.cmake @@ -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)