Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add GDAL builder #293

Merged
merged 9 commits into from
Jan 19, 2020
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions G/GDAL/build_tarballs.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
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",
"./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_6_2"
fi

# 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 \
--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()
visr marked this conversation as resolved.
Show resolved Hide resolved
platforms = expand_cxxstring_abis(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)
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