Skip to content

Commit

Permalink
[GDAL] Customise name of PROJ lib to link against
Browse files Browse the repository at this point in the history
  • Loading branch information
giordano committed Dec 24, 2019
1 parent 9f270c1 commit b7eae71
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 1 deletion.
6 changes: 5 additions & 1 deletion G/GDAL/build_tarballs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
73 changes: 73 additions & 0 deletions G/GDAL/bundled/patches/configure_ac_proj_libs.patch
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit b7eae71

Please sign in to comment.