Skip to content

Commit

Permalink
update GDAL to 3.9.0 (#164)
Browse files Browse the repository at this point in the history
* upgrade GDAL to 3.9.0

* seems that GDAL is C++17 now

* move C++17 to common

* use a more generic error message pattern

* try building with g++10

* a node-gyp special

* use the same C++ standard everywhere to avoid surprises with conditional compilation in the std lib

* it seems that GDAL 3.9 always returns an extent

* construct the metadata dynamically

* change this test to use 4326

* set the grib resource dir path

* use GNU C++17

* no need for g++-10

* fix the shell syntax

* more syntax

* missing comma

* this is a C++ file

* more C++ files

* remove all other std options

* these sources are not built in GDAL 3.9 anymore

* convert all spaces to tabs in gyp files (path of least changes)

* Set explicitly _HAS_EXCEPTIONS for the whole project

* this test is known to be flaky
  • Loading branch information
mmomtchev authored Jun 18, 2024
1 parent 67c2f36 commit d18567e
Show file tree
Hide file tree
Showing 1,777 changed files with 104,540 additions and 47,913 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [3.9]
## [3.9.0]

### Added
- GDAL 3.9.0

### Changed
- All shared library symbols are now hidden on Linux, allowing to load the binary addon in a process that has loaded a different version of GDAL (on Windows this has always been possible and on maOS, while possible in theory, this particular linking mode is not supported by `node-gyp`)
Expand Down
32 changes: 16 additions & 16 deletions binding.gyp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"includes": [
"includes": [
"common.gypi"
],
"variables": {
Expand Down Expand Up @@ -68,17 +68,17 @@
"src/collections/rasterband_overviews.cpp",
"src/collections/rasterband_pixels.cpp",
"src/collections/gdal_drivers.cpp",
"src/collections/colortable.cpp"
"src/collections/colortable.cpp"
]
},
"conditions": [
["enable_asan == 'true'", {
"variables": {
"debug_extra_ccflags_cc": [ "-fsanitize=address" ],
"debug_extra_ldflags" : [ "-fsanitize=address" ],
# using ASan in a Node.js add-on on Windows requires an /MDd build (RuntimeLibrary: 3)
# which is not a safe build, so this option is to remain out of reach of children
# (see https://github.com/nodejs/node-gyp/issues/1686)
# using ASan in a Node.js add-on on Windows requires an /MDd build (RuntimeLibrary: 3)
# which is not a safe build, so this option is to remain out of reach of children
# (see https://github.com/nodejs/node-gyp/issues/1686)
"debug_extra_VCCLCompilerTool": [ "/fsanitize=address" ],
"debug_extra_VCLinkerTool" : [ "/fsanitize=address" ]
}
Expand All @@ -89,16 +89,16 @@
"debug_extra_ldflags" : [ "-lgcov", "--coverage" ],
},
}],
["OS == 'mac'", {
["OS == 'mac'", {
"variables": {
"debug_extra_ldflags": [ "-Wl,-bind_at_load" ],
}
}],
["OS == 'linux'", {
"debug_extra_ldflags": [ "-Wl,-bind_at_load" ],
}
}],
["OS == 'linux'", {
"variables": {
"debug_extra_ldflags": [ "-Wl,-z,now" ],
}
}]
"debug_extra_ldflags": [ "-Wl,-z,now" ],
}
}]
],
"targets": [
{
Expand All @@ -109,7 +109,7 @@
"product_extension": "node",
"sources": [ "<@(sources_node_gdal)" ],
"include_dirs": [
"include",
"include",
"<!(node -e \"require('nan')\")"
],
"defines": [
Expand Down Expand Up @@ -177,7 +177,7 @@
"actions": [
{
"action_name": "yatag",
"inputs": [ "<@(sources_node_gdal)", "lib/gdal.js" ],
"inputs": [ "<@(sources_node_gdal)", "lib/gdal.js" ],
"outputs": [ "../lib/index.d.ts" ],
"action": [ "npm", "run", "yatag" ]
}
Expand All @@ -187,7 +187,7 @@
"actions": [
{
"action_name": "yatag",
"inputs": [ "<@(sources_node_gdal)", "lib/gdal.js" ],
"inputs": [ "<@(sources_node_gdal)", "lib/gdal.js" ],
"outputs": [ "lib/index.d.ts" ],
"action": [ 'cmd', '/c"npm run yatag"' ]
}
Expand Down
98 changes: 61 additions & 37 deletions common.gypi
Original file line number Diff line number Diff line change
@@ -1,65 +1,89 @@
{
"variables": {
"runtime%": "node",
"runtime%": "node",
"deps_dir": "./deps"
},
"target_defaults": {
"default_configuration": "Release",
"cflags_cc!": ["-fno-rtti", "-fno-exceptions"],
"cflags!": ["-fno-rtti", "-fno-exceptions"],
# node-gyp sets the standard for us and ensures that its include file comes last
# this is the only reliable way to override it
'cflags_cc/': [ ['exclude', '^-std=(?!gnu\+\+17)'] ],
'cflags_cc':[ '-std=gnu++17' ],
"variables": {
"debug_extra_ccflags_cc%": [],
"debug_extra_ldflags%" : [],
"debug_extra_VCCLCompilerTool%": [],
"debug_extra_VCLinkerTool%": []
"debug_extra_VCCLCompilerTool%": [],
"debug_extra_VCLinkerTool%": []
},
"defines": [
"NOGDI=1",
"HAVE_LIBZ=1"
"HAVE_LIBZ=1"
],
"xcode_settings": {
"GCC_ENABLE_CPP_RTTI": "YES",
"GCC_ENABLE_CPP_EXCEPTIONS": "YES",
"CLANG_CXX_LIBRARY": "libc++",
"MACOSX_DEPLOYMENT_TARGET": "10.7",
"CLANG_CXX_LIBRARY": "libc++",
"MACOSX_DEPLOYMENT_TARGET": "10.7",
"OTHER_CFLAGS": [
"-Wno-deprecated-register",
"-Wno-unused-const-variable"
],
"OTHER_CPLUSPLUSFLAGS": [
"-std=gnu++17",
"-Wno-deprecated-register",
"-Wno-unused-const-variable",
"-frtti",
"-fexceptions"
]
],
'OTHER_CPLUSPLUSFLAGS/': [ ['exclude', '^-std=(?!gnu\+\+17)'] ],
},
"msvs_settings": {
"VCCLCompilerTool": {
#"Optimization": 0, # 0:/Od disable, 1:/O1 min size, 2:/O2 max speed, 3:/Ox full optimization
#"InlineFunctionExpansion": 0, #0:/Ob0: disable, 1:/Ob1 inline only marked funtions, 2:/Ob2 inline anything eligible
"AdditionalOptions": [
"/std:c++17",
"/MP", # compile across multiple CPUs
"/GR", # force RTTI
"/EHsc", # same for ExceptionHandling
"/permissive" # for the new MSVC in Github Actions, mostly related to const char to char conversions
],
# see https://github.com/nodejs/node-gyp/issues/2412
"AdditionalOptions/": [
['exclude', '^/GR-$' ],
['exclude', '^[/-]std:(?!c\+\+17)']
],
"ExceptionHandling": 1,
"RuntimeTypeInfo": "true"
}
},
"msvs_settings": {
"VCCLCompilerTool": {
#"Optimization": 0, # 0:/Od disable, 1:/O1 min size, 2:/O2 max speed, 3:/Ox full optimization
#"InlineFunctionExpansion": 0, #0:/Ob0: disable, 1:/Ob1 inline only marked funtions, 2:/Ob2 inline anything eligible
"AdditionalOptions": [
"/MP", # compile across multiple CPUs
"/GR", # force RTTI on (see https://github.com/nodejs/node-gyp/issues/2412)
"/EHsc" # same for ExceptionHandling
"/permissive" # for the new MSVC in Github Actions, mostly related to const char to char conversions
],
"ExceptionHandling": 1,
"RuntimeTypeInfo": "true"
}
},
"conditions": [
["runtime == 'node'", {
"defines": [
]
}],
["runtime == 'node'", {
"defines": [
]
}],
["OS == 'win'", {
"defines": [
"NOMINMAX",
"WIN32",
"CURL_STATICLIB",
"PROJ_DLL=",
"OPJ_EXPORTS"
],
"NOMINMAX",
"WIN32",
"CURL_STATICLIB",
"PROJ_DLL=",
"OPJ_EXPORTS",
# This is one of the most horrible pitfalls ever in the MSVC world, particularly common
# in Node.js addons since Node.js/node-gyp define it by default
# With MSVC, exceptions work with and without this macro
# However, sizeof(std::exception) is not the same with and without it, which produces
# some very subtle memory alignment errors in the compiled code
# (because MSVC carries two different std::exception implementations...)
# You must always know its state for all of your code!
# (it was also the subject of a particularly contentious issue between me and my beloved Node.js core team
# for reasons that go far above and beyond software and transcend into life, the universe and everything)
# https://github.com/nodejs/node-gyp/issues/2903
"_HAS_EXCEPTIONS=1"
],
"defines!": [ "_HAS_EXCEPTIONS=0" ],
"libraries": [
"secur32.lib",
"odbccp32.lib",
Expand All @@ -68,18 +92,18 @@
"ws2_32.lib",
"advapi32.lib",
"wbemuuid.lib",
"Shlwapi.lib"
"Shlwapi.lib"
],
}],
["OS == 'mac'", {
"libraries": [ "-framework Security" ],
"defines": [ "DARWIN" ]
}],
["OS == 'linux'", {
"defines": [ "LINUX" ],
"ldflags": [
"-Wl,--exclude-libs,ALL"
]
"defines": [ "LINUX" ],
"ldflags": [
"-Wl,--exclude-libs,ALL"
]
}]
],
"configurations": {
Expand All @@ -95,7 +119,7 @@
"OTHER_CPLUSPLUSFLAGS": [ "<@(debug_extra_ccflags_cc)" ],
"OTHER_LDFLAGS": [ "<@(debug_extra_ldflags)" ]
}
},
},
"Release": {
"defines": [ "NDEBUG" ],
"defines!": [ "DEBUG" ],
Expand Down
26 changes: 13 additions & 13 deletions deps/libcurl/libcurl.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -170,20 +170,20 @@
"CURL_DISABLE_RTSP=1",
"CURL_DISABLE_SMB=1",
"ENABLE_IPV6=1",
"HAVE_ZLIB_H=1"
"HAVE_ZLIB_H=1"
],
"conditions": [
["runtime == 'electron'", {
"include_dirs": [
"../libgdal/gdal/frmts/zlib"
]
}],
["runtime == 'node' and OS == 'linux'", {
"defines": [
["runtime == 'electron'", {
"include_dirs": [
"../libgdal/gdal/frmts/zlib"
]
}],
["runtime == 'node' and OS == 'linux'", {
"defines": [
"HAVE_LIBSSL=1",
"OPENSSL_API_COMPAT=0x10100001L",
"OPENSSL_CONFIGURED_API=10100",
"OPENSSL_MIN_API=10100",
"OPENSSL_API_COMPAT=0x10100001L",
"OPENSSL_CONFIGURED_API=10100",
"OPENSSL_MIN_API=10100",
"HAVE_OPENSSL_CRYPTO_H=1",
"HAVE_OPENSSL_ERR_H=1",
"HAVE_OPENSSL_PEM_H=1",
Expand All @@ -193,8 +193,8 @@
"HAVE_OPENSSL_VERSION=1",
"HAVE_OPENSSL_X509_H=1",
"USE_OPENSSL=1",
]
}],
]
}],
["OS == 'win'", {
"defines": [
"USE_WINDOWS_SSPI=1",
Expand Down
2 changes: 1 addition & 1 deletion deps/libgdal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -eu
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$DIR/libgdal"

GDAL_VERSION=3.8.5
GDAL_VERSION=3.9.0
GDAL_VERSION_SUFFIX=
dir_gdal=./gdal
dir_formats_gyp=./gyp-formats
Expand Down
12 changes: 6 additions & 6 deletions deps/libgdal/common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@
"CPU_<(endianness)_ENDIAN=1",
"BIGTIFF_SUPPORT=1",
"ZIP_SUPPORT=1",
"HAVE_LIBZ=1",
"HAVE_LIBZ=1",
"JPEG_SUPPORT=1",
"RENAME_INTERNAL_SHAPELIB_SYMBOLS=1",
"flatbuffers=gdal_flatbuffers"
"RENAME_INTERNAL_SHAPELIB_SYMBOLS=1",
"flatbuffers=gdal_flatbuffers"
],
"dependencies": [
"<(deps_dir)/libexpat/libexpat.gyp:libexpat",
Expand All @@ -71,9 +71,9 @@
}],
["OS == 'linux'", {
"defines": [
"ENABLE_UFFD=1",
"HAVE_5ARGS_MREMAP=1"
]
"ENABLE_UFFD=1",
"HAVE_5ARGS_MREMAP=1"
]
}],
["OS == 'freebsd'", {
"include_dirs": ["./arch/bsd"]
Expand Down
4 changes: 3 additions & 1 deletion deps/libgdal/gdal/.clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 4
UseTab: Never

# Add line breaks
SeparateDefinitionBlocks: Always
EmptyLineBeforeAccessModifier: LogicalBlock
---
Language: Json
BasedOnStyle: llvm
3 changes: 2 additions & 1 deletion deps/libgdal/gdal/.git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -196,4 +196,5 @@ cb5dc009cf60be71f12b2718017da4621c92c561
a11bca1150f65804c78b1f3e7ad2f0ef3e47035b
9ea22d57af187eb018a4fc84577381be0817fe95
5247bbb4b27c7bf7cd6074deeeac087c1a4144b8
d7e5c0055c176ff6e70da7aa47a29654ece08ce1
d7e5c0055c176ff6e70da7aa47a29654ece08ce1
c39127b8dca9228e728a56dd93fc8ebf7c212060
2 changes: 2 additions & 0 deletions deps/libgdal/gdal/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ repos:
third_party/|
autotest/ogr/data/|
alg/internal_libqhull/|
apps/argparse/|
frmts/gtiff/libtiff/|
frmts/gtiff/libgeotiff/|
frmts/hdf4/hdf-eos/|
Expand All @@ -51,6 +52,7 @@ repos:
frmts/pcidsk/sdk|
frmts/grib/degrib/degrib|
frmts/grib/degrib/g2clib|
port/utf8.h|
ogr/ogrsf_frmts/cad/libopencad/|
ogr/ogrsf_frmts/geojson/libjson/|
ogr/ogrsf_frmts/flatgeobuf/flatbuffers/|
Expand Down
4 changes: 2 additions & 2 deletions deps/libgdal/gdal/CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ cff-version: 1.2.0
message: Please cite this software using these metadata or in the CITATION file.
type: software
title: GDAL
version: 3.8.5
date-released: 2024-04-02
version: 3.9.0
date-released: 2024-05-06
doi: 10.5281/zenodo.5884351
abstract: GDAL is a translator library for raster and vector geospatial data
formats that is released under an MIT style Open Source License by the Open
Expand Down
Loading

0 comments on commit d18567e

Please sign in to comment.