Skip to content

Commit

Permalink
[GDAL] build 3.4.1 (#4193)
Browse files Browse the repository at this point in the history
* GDAL version 3.4.0

* build 3.4.1

* strip extra context from patch

* use GCC 6

The GEOS build also uses this, and without this we get errors while detecting GEOS:

```
libgeos_c.so: undefined reference to `std::runtime_error::runtime_error(char const*)@GLIBCXX_3.4.21'
```

* help libproj find libcurl

* use libgeotiff 1.7, built with the same PROJ
  • Loading branch information
visr authored Jan 7, 2022
1 parent eefc25b commit 6d762fd
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 185 deletions.
19 changes: 0 additions & 19 deletions G/GDAL/GDAL@julia-1.3/build_tarballs.jl

This file was deleted.

19 changes: 0 additions & 19 deletions G/GDAL/GDAL@julia-1.6/build_tarballs.jl

This file was deleted.

129 changes: 129 additions & 0 deletions G/GDAL/build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# Note that this script can accept some limited command-line arguments, run
# `julia build_tarballs.jl --help` to see a usage message.
using BinaryBuilder, Pkg

name = "GDAL"
upstream_version = v"3.4.1"
version_offset = v"0.0.0"
version = VersionNumber(upstream_version.major * 100 + version_offset.major,
upstream_version.minor * 100 + version_offset.minor,
upstream_version.patch * 100 + version_offset.patch)

# Collection of sources required to build GDAL
sources = [
ArchiveSource("https://github.com/OSGeo/gdal/releases/download/v$upstream_version/gdal-$upstream_version.tar.gz",
"e360387bc25ec24940f46afbeada48002d72c74aaf9eccf2a40e8d74e711a2e4"),
DirectorySource("./bundled"),
]

# Bash recipe for building across all platforms
script = raw"""
cd $WORKSPACE/srcdir/gdal-*/
if [[ ${target} == *mingw* ]]; then
export LDFLAGS="-L${libdir}"
# Apply patch to customise PROJ library
atomic_patch -p1 "$WORKSPACE/srcdir/patches/configure_ac_proj_libs.patch"
autoreconf -vi
export PROJ_LIBS="proj_8_2"
elif [[ "${target}" == *-linux-* ]]; then
# Hint to find libstdc++, required to link against C++ libs when using C compiler
if [[ "${nbits}" == 32 ]]; then
export CFLAGS="-Wl,-rpath-link,/opt/${target}/${target}/lib"
else
export CFLAGS="-Wl,-rpath-link,/opt/${target}/${target}/lib64"
fi
# Use same flags also for GEOS
atomic_patch -p1 "$WORKSPACE/srcdir/patches/geos-m4-extra-cflags.patch"
export EXTRA_GEOS_CFLAGS="${CFLAGS}"
if [[ "${target}" == powerpc64le-* ]]; then
atomic_patch -p1 "$WORKSPACE/srcdir/patches/sqlite3-m4-extra-libs.patch"
export EXTRA_GEOS_LIBS="${EXTRA_GEOS_LIBS} -lm"
export EXTRA_SQLITE3_LIBS="-lm"
# libpthread and libldl are needed for libgdal, so let's always use them
export LDFLAGS="$LDFLAGS -lpthread -ldl"
fi
autoreconf -vi
fi
# same fix as used for PROJ
if [[ "${target}" == x86_64-linux-musl* ]]; then
export LDFLAGS="$LDFLAGS -lcurl"
fi
# Clear out `.la` files since they're often wrong and screw us up
rm -f ${prefix}/lib/*.la
# Read the options in the log file
./configure --help
./configure --prefix=${prefix} --build=${MACHTYPE} --host=${target} \
--with-geos=${bindir}/geos-config \
--with-proj=$prefix \
--with-tiff=$prefix \
--with-geotiff=$prefix \
--with-libz=$prefix \
--with-expat=$prefix \
--with-zstd=$prefix \
--with-sqlite3=$prefix \
--with-curl=${bindir}/curl-config \
--with-openjpeg \
--with-python=no \
--enable-shared \
--disable-static
# Make sure that some important libraries are found
grep "HAVE_GEOS='yes'" config.log
grep "HAVE_SQLITE='yes'" config.log
grep "CURL_SETTING='yes'" config.log
grep "ZSTD_SETTING='yes'" config.log
grep "HAVE_EXPAT='yes'" config.log
make -j${nproc}
make install
"""

# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
platforms = expand_cxxstring_abis(supported_platforms())

# The products that we will ensure are always built
products = [
LibraryProduct("libgdal", :libgdal),
ExecutableProduct("gdal_contour", :gdal_contour_path),
ExecutableProduct("gdal_grid", :gdal_grid_path),
ExecutableProduct("gdal_rasterize", :gdal_rasterize_path),
ExecutableProduct("gdal_translate", :gdal_translate_path),
ExecutableProduct("gdaladdo", :gdaladdo_path),
ExecutableProduct("gdalbuildvrt", :gdalbuildvrt_path),
ExecutableProduct("gdaldem", :gdaldem_path),
ExecutableProduct("gdalinfo", :gdalinfo_path),
ExecutableProduct("gdallocationinfo", :gdallocationinfo_path),
ExecutableProduct("gdalmanage", :gdalmanage_path),
ExecutableProduct("gdalsrsinfo", :gdalsrsinfo_path),
ExecutableProduct("gdaltindex", :gdaltindex_path),
ExecutableProduct("gdaltransform", :gdaltransform_path),
ExecutableProduct("gdalwarp", :gdalwarp_path),
ExecutableProduct("nearblack", :nearblack_path),
ExecutableProduct("ogr2ogr", :ogr2ogr_path),
ExecutableProduct("ogrinfo", :ogrinfo_path),
ExecutableProduct("ogrlineref", :ogrlineref_path),
ExecutableProduct("ogrtindex", :ogrtindex_path),
]

# Dependencies that must be installed before this package can be built
dependencies = [
Dependency("GEOS_jll"; compat="~3.10"),
Dependency("PROJ_jll"; compat="~800.200"),
Dependency("Zlib_jll"),
Dependency("SQLite_jll"),
Dependency("OpenJpeg_jll"),
Dependency("Expat_jll"; compat="~2.2.10"),
Dependency("Zstd_jll"),
Dependency("Libtiff_jll"; compat="4.3"),
Dependency("libgeotiff_jll"; compat="1.7"),
Dependency("LibCURL_jll"),
]

# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; julia_compat="1.6", preferred_gcc_version=v"6")
4 changes: 2 additions & 2 deletions G/GDAL/bundled/patches/configure_ac_proj_libs.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/configure.ac
+++ b/configure.ac
@@ -1392,15 +1392,18 @@ if test "x$with_proj" = "xno" ; then
@@ -1454,15 +1454,18 @@ if test "x$with_proj" = "xno" ; then

else

Expand All @@ -22,7 +22,7 @@
AC_LANG_POP([C++])
if test "$PROJ_FOUND" = "yes"; then
PROJ_INCLUDE="-DPROJ_RENAME_SYMBOLS"
@@ -1426,34 +1429,34 @@ else
@@ -1488,34 +1491,34 @@ else
fi
else
ORIG_LIBS="$LIBS"
Expand Down
4 changes: 2 additions & 2 deletions G/GDAL/bundled/patches/geos-m4-extra-cflags.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- a/m4/geos.m4
+++ b/m4/geos.m4
@@ -122,7 +122,7 @@
@@ -125,7 +125,7 @@
HAVE_GEOS="no"

GEOS_LIBS="`${GEOS_CONFIG} --ldflags` -lgeos_c"
Expand All @@ -9,7 +9,7 @@
GEOS_VERSION="`${GEOS_CONFIG} --version`"

ax_save_LIBS="${LIBS}"
@@ -134,7 +134,7 @@
@@ -137,7 +137,7 @@
[GEOSversion],
[HAVE_GEOS="yes"],
[HAVE_GEOS="no"],
Expand Down
143 changes: 0 additions & 143 deletions G/GDAL/common.jl

This file was deleted.

0 comments on commit 6d762fd

Please sign in to comment.