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] [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