From 6cbff309921248b153b5c468ccdc8d8d86be4c91 Mon Sep 17 00:00:00 2001 From: Martijn Visser Date: Sat, 14 Dec 2019 19:57:26 +0100 Subject: [PATCH 1/9] add GDAL build script --- G/GDAL/build_tarballs.jl | 68 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 G/GDAL/build_tarballs.jl diff --git a/G/GDAL/build_tarballs.jl b/G/GDAL/build_tarballs.jl new file mode 100644 index 00000000000..b41805ecea9 --- /dev/null +++ b/G/GDAL/build_tarballs.jl @@ -0,0 +1,68 @@ +using BinaryBuilder + +name = "GDAL" +version = v"3.0.2" + +# Collection of sources required to build GDAL +sources = [ + "https://github.com/OSGeo/gdal/releases/download/v$version/gdal-$version.tar.gz" => + "787cf150346e58bff0ccf8c131b333139273e35d2abd590ad7196a9ee08f0039", +] + +# Bash recipe for building across all platforms +script = raw""" +cd $WORKSPACE/srcdir/gdal-*/ + +# Show options in the log +./configure --help +./configure --prefix=$prefix --host=$target \ + --with-geos=${bindir}/geos-config \ + --with-proj=$prefix \ + --with-libz=$prefix \ + --with-sqlite3=$prefix \ + --with-curl=${bindir}/curl-config \ + --with-python=no \ + --enable-shared \ + --disable-static + +make -j${nproc} +make install +""" + +platforms = 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 = [ + "GEOS_jll", + "PROJ_jll", + "Zlib_jll", + "SQLite_jll", + "LibCURL_jll", +] + +# Build the tarballs, and possibly a `build.jl` as well. +build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies) From 057325b810c693c877d79f440420f4ee85caa205 Mon Sep 17 00:00:00 2001 From: Martijn Visser Date: Sun, 15 Dec 2019 19:06:03 +0100 Subject: [PATCH 2/9] add CompilerSupportLibraries dependency This gets us past a failure during the `configure` step where it checks the PROJ dependency by compiling test programs. This led to this failure related to `libstdc++`: ``` configure:24103: checking for proj_create_from_wkt in -lproj configure:24128: c++ -std=c++11 -o conftest -DHAVE_AVX_AT_COMPILE_TIME -DHAVE_SSSE3_AT_COMPILE_TIME -DHAVE_SSE_AT_COMPILE_TIME -g -O2 conftest.cpp -lproj -L/workspace/destdir/lib -lproj -lz -L/workspace/destdir -L/workspace/destdir/lib -lpthread -lm -lrt -ldl >&5 /workspace/destdir/lib/libproj.so: undefined reference to `__cxa_throw_bad_array_new_length@CXXABI_1.3.8' /workspace/destdir/lib/libproj.so: undefined reference to `std::__cxx11::basic_string, std::allocator ``` --- G/GDAL/build_tarballs.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/G/GDAL/build_tarballs.jl b/G/GDAL/build_tarballs.jl index b41805ecea9..f33b23d5c88 100644 --- a/G/GDAL/build_tarballs.jl +++ b/G/GDAL/build_tarballs.jl @@ -57,6 +57,7 @@ products = [ # Dependencies that must be installed before this package can be built dependencies = [ + "CompilerSupportLibraries_jll", "GEOS_jll", "PROJ_jll", "Zlib_jll", From fed5e11283b13ffe62acb1b794d23e4dec2c5cf3 Mon Sep 17 00:00:00 2001 From: Martijn Visser Date: Sun, 15 Dec 2019 20:55:25 +0100 Subject: [PATCH 3/9] add review suggestions --- G/GDAL/build_tarballs.jl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/G/GDAL/build_tarballs.jl b/G/GDAL/build_tarballs.jl index f33b23d5c88..5082640d8ab 100644 --- a/G/GDAL/build_tarballs.jl +++ b/G/GDAL/build_tarballs.jl @@ -13,6 +13,11 @@ sources = [ script = raw""" cd $WORKSPACE/srcdir/gdal-*/ +if [[ ${target} == *mingw* ]]; then + export LDFLAGS="${libdir}" + cp ${libdir}/libproj_6_2.dll ${libdir}/libproj.dll +fi + # Show options in the log ./configure --help ./configure --prefix=$prefix --host=$target \ @@ -30,6 +35,7 @@ make install """ platforms = supported_platforms() +platforms = expand_cxxstring_abis(platforms) # The products that we will ensure are always built products = [ @@ -57,7 +63,6 @@ products = [ # Dependencies that must be installed before this package can be built dependencies = [ - "CompilerSupportLibraries_jll", "GEOS_jll", "PROJ_jll", "Zlib_jll", From a8937cab62236647722c424797e89dfdccf94b56 Mon Sep 17 00:00:00 2001 From: Martijn Visser Date: Sun, 15 Dec 2019 23:01:32 +0100 Subject: [PATCH 4/9] add missing -L flag in LDFLAGS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Mosè Giordano --- G/GDAL/build_tarballs.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/G/GDAL/build_tarballs.jl b/G/GDAL/build_tarballs.jl index 5082640d8ab..bc8ce5b6a29 100644 --- a/G/GDAL/build_tarballs.jl +++ b/G/GDAL/build_tarballs.jl @@ -14,7 +14,7 @@ script = raw""" cd $WORKSPACE/srcdir/gdal-*/ if [[ ${target} == *mingw* ]]; then - export LDFLAGS="${libdir}" + export LDFLAGS="-L${libdir}" cp ${libdir}/libproj_6_2.dll ${libdir}/libproj.dll fi From 9f270c1812038df9fc971a531127aed60125b9d9 Mon Sep 17 00:00:00 2001 From: Martijn Visser Date: Tue, 17 Dec 2019 08:31:31 +0100 Subject: [PATCH 5/9] Clear out `.la` files --- G/GDAL/build_tarballs.jl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/G/GDAL/build_tarballs.jl b/G/GDAL/build_tarballs.jl index bc8ce5b6a29..38fc9d4d1c0 100644 --- a/G/GDAL/build_tarballs.jl +++ b/G/GDAL/build_tarballs.jl @@ -18,8 +18,9 @@ if [[ ${target} == *mingw* ]]; then cp ${libdir}/libproj_6_2.dll ${libdir}/libproj.dll fi -# Show options in the log -./configure --help +# Clear out `.la` files since they're often wrong and screw us up +rm -f ${prefix}/lib/*.la + ./configure --prefix=$prefix --host=$target \ --with-geos=${bindir}/geos-config \ --with-proj=$prefix \ From b7eae71ec07e09d9ec47d7870d8a086821543634 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mos=C3=A8=20Giordano?= Date: Tue, 24 Dec 2019 01:37:58 +0100 Subject: [PATCH 6/9] [GDAL] Customise name of PROJ lib to link against --- G/GDAL/build_tarballs.jl | 6 +- .../patches/configure_ac_proj_libs.patch | 73 +++++++++++++++++++ 2 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 G/GDAL/bundled/patches/configure_ac_proj_libs.patch diff --git a/G/GDAL/build_tarballs.jl b/G/GDAL/build_tarballs.jl index 38fc9d4d1c0..1edde744c90 100644 --- a/G/GDAL/build_tarballs.jl +++ b/G/GDAL/build_tarballs.jl @@ -7,6 +7,7 @@ version = v"3.0.2" sources = [ "https://github.com/OSGeo/gdal/releases/download/v$version/gdal-$version.tar.gz" => "787cf150346e58bff0ccf8c131b333139273e35d2abd590ad7196a9ee08f0039", + "./bundled", ] # Bash recipe for building across all platforms @@ -15,7 +16,10 @@ cd $WORKSPACE/srcdir/gdal-*/ if [[ ${target} == *mingw* ]]; then export LDFLAGS="-L${libdir}" - cp ${libdir}/libproj_6_2.dll ${libdir}/libproj.dll + # Apply patch to customise PROJ library + atomic_patch -p1 "$WORKSPACE/srcdir/patches/configure_ac_proj_libs.patch" + autoreconf -vi + export PROJ_LIBS="proj_6_2" fi # Clear out `.la` files since they're often wrong and screw us up diff --git a/G/GDAL/bundled/patches/configure_ac_proj_libs.patch b/G/GDAL/bundled/patches/configure_ac_proj_libs.patch new file mode 100644 index 00000000000..b3a4cc36bbb --- /dev/null +++ b/G/GDAL/bundled/patches/configure_ac_proj_libs.patch @@ -0,0 +1,73 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -1198,15 +1198,18 @@ + + else + ++ if test -z "$PROJ_LIBS"; then ++ PROJ_LIBS="proj" ++ fi + if test "x$with_proj" = "xyes" -o "x$with_proj" = "x"; then + ORIG_LIBS="$LIBS" +- LIBS="-lproj $ORIG_LIBS" ++ LIBS="-l$PROJ_LIBS $ORIG_LIBS" + AC_LANG_PUSH([C++]) +- AC_CHECK_LIB(proj,proj_create_from_wkt,PROJ_FOUND=yes,PROJ_FOUND=no,) ++ AC_CHECK_LIB($PROJ_LIBS,proj_create_from_wkt,PROJ_FOUND=yes,PROJ_FOUND=no,) + AC_LANG_POP([C++]) + if test "$PROJ_FOUND" = "no"; then + AC_LANG_PUSH([C++]) +- AC_CHECK_LIB(proj,internal_proj_create_from_wkt,PROJ_FOUND=yes,PROJ_FOUND=no,) ++ AC_CHECK_LIB($PROJ_LIBS,internal_proj_create_from_wkt,PROJ_FOUND=yes,PROJ_FOUND=no,) + AC_LANG_POP([C++]) + if test "$PROJ_FOUND" = "yes"; then + PROJ_INCLUDE="-DPROJ_RENAME_SYMBOLS" +@@ -1233,27 +1236,27 @@ + else + + ORIG_LIBS="$LIBS" +- LIBS="-L$with_proj/lib -lproj $ORIG_LIBS" ++ LIBS="-L$with_proj/lib -l$PROJ_LIBS $ORIG_LIBS" + AC_LANG_PUSH([C++]) +- AC_CHECK_LIB(proj,proj_create_from_wkt,PROJ_FOUND=yes,PROJ_FOUND=no,) ++ AC_CHECK_LIB($PROJ_LIBS,proj_create_from_wkt,PROJ_FOUND=yes,PROJ_FOUND=no,) + AC_LANG_POP([C++]) + if test "$PROJ_FOUND" = "no"; then +- LIBS="-L$with_proj/lib -lproj -lsqlite3 $ORIG_LIBS" ++ LIBS="-L$with_proj/lib -l$PROJ_LIBS -lsqlite3 $ORIG_LIBS" + unset ac_cv_lib_proj_proj_create_from_wkt + AC_LANG_PUSH([C++]) +- AC_CHECK_LIB(proj,proj_create_from_wkt,PROJ_FOUND=yes,PROJ_FOUND=no,) ++ AC_CHECK_LIB(-l$PROJ_LIBS,proj_create_from_wkt,PROJ_FOUND=yes,PROJ_FOUND=no,) + AC_LANG_POP([C++]) + fi + if test "$PROJ_FOUND" = "no"; then +- LIBS="-L$with_proj/lib -lproj $ORIG_LIBS" ++ LIBS="-L$with_proj/lib -l$PROJ_LIBS $ORIG_LIBS" + AC_LANG_PUSH([C++]) +- AC_CHECK_LIB(proj,internal_proj_create_from_wkt,PROJ_FOUND=yes,PROJ_FOUND=no,) ++ AC_CHECK_LIB($PROJ_LIBS,internal_proj_create_from_wkt,PROJ_FOUND=yes,PROJ_FOUND=no,) + AC_LANG_POP([C++]) + if test "$PROJ_FOUND" = "no"; then +- LIBS="-L$with_proj/lib -lproj -lsqlite3 $ORIG_LIBS" ++ LIBS="-L$with_proj/lib -l$PROJ_LIBS -lsqlite3 $ORIG_LIBS" + unset ac_cv_lib_proj_internal_proj_create_from_wkt + AC_LANG_PUSH([C++]) +- AC_CHECK_LIB(proj,internal_proj_create_from_wkt,PROJ_FOUND=yes,PROJ_FOUND=no,) ++ AC_CHECK_LIB($PROJ_LIBS,internal_proj_create_from_wkt,PROJ_FOUND=yes,PROJ_FOUND=no,) + AC_LANG_POP([C++]) + fi + if test "$PROJ_FOUND" = "yes"; then +@@ -4100,10 +4103,10 @@ + AC_MSG_CHECKING([for spatialite.h in /usr/include or /usr/local/include]) + if test -f "/usr/include/spatialite.h" -o -f "/usr/local/include/spatialite.h"; then + AC_MSG_RESULT(found) +- AC_CHECK_LIB(spatialite,spatialite_init,SPATIALITE_INIT_FOUND=yes,SPATIALITE_INIT_FOUND=no,-lsqlite3 -lproj) ++ AC_CHECK_LIB(spatialite,spatialite_init,SPATIALITE_INIT_FOUND=yes,SPATIALITE_INIT_FOUND=no,-lsqlite3 -l$PROJ_LIBS) + if test "$SPATIALITE_INIT_FOUND" = "yes"; then + HAVE_SPATIALITE=yes +- SPATIALITE_LIBS="-lspatialite -lsqlite3 -lproj" ++ SPATIALITE_LIBS="-lspatialite -lsqlite3 -l$PROJ_LIBS" + LIBS="$LIBS $SPATIALITE_LIBS" + HAVE_SQLITE3=yes + fi From feb16262a22089b687b79edacf7ff3135add5032 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mos=C3=A8=20Giordano?= Date: Sat, 18 Jan 2020 04:04:08 +0000 Subject: [PATCH 7/9] [GDAL] Fixes for Windows and PowerPC --- G/GDAL/build_tarballs.jl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/G/GDAL/build_tarballs.jl b/G/GDAL/build_tarballs.jl index 1edde744c90..edb17524a41 100644 --- a/G/GDAL/build_tarballs.jl +++ b/G/GDAL/build_tarballs.jl @@ -19,7 +19,10 @@ if [[ ${target} == *mingw* ]]; then # Apply patch to customise PROJ library atomic_patch -p1 "$WORKSPACE/srcdir/patches/configure_ac_proj_libs.patch" autoreconf -vi - export PROJ_LIBS="proj_6_2" + export PROJ_LIBS="proj_6_3" +elif [[ "${target}" == powerpc64le-* ]]; then + # Need to remember to link against libpthread and libdl + export LDFLAGS="-lpthread -ldl" fi # Clear out `.la` files since they're often wrong and screw us up From 658845c852be5d6ee59d3d6c9db8ab74380dd804 Mon Sep 17 00:00:00 2001 From: Martijn Visser Date: Sat, 18 Jan 2020 15:56:25 +0100 Subject: [PATCH 8/9] [GDAL] use latest bugfix release 3.0.3 Includes a few build bug fixes: https://github.com/OSGeo/gdal/blob/v3.0.3/gdal/NEWS --- G/GDAL/build_tarballs.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/G/GDAL/build_tarballs.jl b/G/GDAL/build_tarballs.jl index edb17524a41..621a3fdd977 100644 --- a/G/GDAL/build_tarballs.jl +++ b/G/GDAL/build_tarballs.jl @@ -1,12 +1,12 @@ using BinaryBuilder name = "GDAL" -version = v"3.0.2" +version = v"3.0.3" # Collection of sources required to build GDAL sources = [ "https://github.com/OSGeo/gdal/releases/download/v$version/gdal-$version.tar.gz" => - "787cf150346e58bff0ccf8c131b333139273e35d2abd590ad7196a9ee08f0039", + "fe9bbe1cd4f74a4917dec9585a91d9018d3a3b61e379aa9a1b709e278dde11d6", "./bundled", ] From dd30d8088aebd2bf1193542dab1bd1e264cc6bb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mos=C3=A8=20Giordano?= Date: Sun, 19 Jan 2020 03:00:54 +0000 Subject: [PATCH 9/9] [GDAL] Build with GCC v6, for compatibility with GEOS --- G/GDAL/build_tarballs.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/G/GDAL/build_tarballs.jl b/G/GDAL/build_tarballs.jl index 621a3fdd977..e3bddf44120 100644 --- a/G/GDAL/build_tarballs.jl +++ b/G/GDAL/build_tarballs.jl @@ -79,4 +79,4 @@ dependencies = [ ] # Build the tarballs, and possibly a `build.jl` as well. -build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies) +build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; preferred_gcc_version=v"6")