Skip to content

Commit

Permalink
grass: fix runtime bug with PDAL 2.7.0+
Browse files Browse the repository at this point in the history
Committed upstream OSGeo/grass@544a780
  • Loading branch information
nilason committed Apr 9, 2024
1 parent 83c2ef7 commit 97cbd13
Show file tree
Hide file tree
Showing 2 changed files with 138 additions and 2 deletions.
5 changes: 3 additions & 2 deletions gis/grass/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ epoch 1

name grass
version 8.3.2
revision 0
revision 1

maintainers {yahoo.com:n_larsson @nilason} openmaintainer
categories gis
Expand Down Expand Up @@ -55,7 +55,8 @@ depends_lib-append port:bzip2 \

patchfiles 01_patch-dyld-link.diff \
02_grass-python.diff \
03_patch_python312.diff
03_patch_python312.diff \
04_patch-pdal.diff

# c++17 needed for PDAL 2.4+
compiler.cxx_standard 2017
Expand Down
135 changes: 135 additions & 0 deletions gis/grass/files/04_patch-pdal.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
Addressed upstream: https://github.com/OSGeo/grass/commit/544a78044fb61d74ecac5683268dccbb1320bd38

--- configure.orig 2024-03-06 22:24:05
+++ configure 2024-04-09 10:47:08
@@ -9378,41 +9378,52 @@
}
_ACEOF
if ac_fn_cxx_try_link "$LINENO"; then :
-
+ PDAL_LIBS="$PDAL_LIBS"
else

+ as_fn_error $? "*** Unable to locate suitable (>=1.7.1) PDAL library." "$LINENO" 5
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+
+
+$as_echo "#define HAVE_PDAL 1" >>confdefs.h
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use PDAL NoFilenameWriter" >&5
+$as_echo_n "checking whether to use PDAL NoFilenameWriter... " >&6; }
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-#include <pdal/PointTable.hpp>
- #include <pdal/Streamable.hpp>
- class St:public pdal::Streamable {};
+#include <pdal/Writer.hpp>
+ class St:public pdal::NoFilenameWriter {};
int
main ()
{
-pdal::PointTable table;
+
+ class NFWTest : public pdal::NoFilenameWriter {};
+
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_link "$LINENO"; then :
- PDAL_LIBS="$PDAL_LIBS"
-else

- as_fn_error $? "*** Unable to locate suitable (>=1.7.1) PDAL library." "$LINENO" 5

-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+$as_echo "#define HAVE_PDAL_NOFILENAMEWRITER 1" >>confdefs.h
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }

+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
+
LIBS=${ac_save_libs}
CFLAGS=${ac_save_cflags}
-
-
-$as_echo "#define HAVE_PDAL 1" >>confdefs.h
-
fi


--- configure.ac.orig 2024-03-06 22:24:05
+++ configure.ac 2024-04-09 10:39:46
@@ -1058,18 +1058,26 @@
LIBS="$LIBS $PDAL_LIBS"
CFLAGS="$CFLAGS $PDAL_CFLAGS"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pdal/PointTable.hpp>
- #include <pdal/Streamable.hpp>
- class St:public pdal::Streamable {};]], [[pdal::PointTable table;]])],[],[
- AC_TRY_LINK([#include <pdal/PointTable.hpp>
#include <pdal/Streamable.hpp>
- class St:public pdal::Streamable {};],[pdal::PointTable table;],PDAL_LIBS="$PDAL_LIBS",[
+ class St:public pdal::Streamable {};]], [[pdal::PointTable table;]])],
+ [PDAL_LIBS="$PDAL_LIBS"],[
AC_MSG_ERROR([*** Unable to locate suitable (>=1.7.1) PDAL library.])
])
- ])
+
+ AC_DEFINE(HAVE_PDAL, 1, [Define to 1 if PDAL exists.])
+
+ AC_MSG_CHECKING(whether to use PDAL NoFilenameWriter)
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pdal/Writer.hpp>
+ class St:public pdal::NoFilenameWriter {};]], [[
+ class NFWTest : public pdal::NoFilenameWriter {};
+ ]])],
+ [
+ AC_DEFINE(HAVE_PDAL_NOFILENAMEWRITER, 1, [Define to 1 if PDAL NoFilenameWriter is present.])
+ AC_MSG_RESULT(yes)
+ ],[AC_MSG_RESULT(no)])
+
LIBS=${ac_save_libs}
CFLAGS=${ac_save_cflags}
-
- AC_DEFINE(HAVE_PDAL, 1, [Define to 1 if PDAL is to be used.])
fi

AC_SUBST(PDAL_LIBS)
--- include/grass/config.h.in.orig 2024-03-06 22:24:05
+++ include/grass/config.h.in 2024-04-09 10:44:21
@@ -155,6 +155,9 @@
/* Define to 1 if PDAL is to be used. */
#undef HAVE_PDAL

+/* Define to 1 if PDAL NoFilenameWriter is present. */
+#undef HAVE_PDAL_NOFILENAMEWRITER
+
/* define if glXCreateGLXPixmap exists */
#undef HAVE_PIXMAPS

--- raster/r.in.pdal/grassrasterwriter.h.orig 2024-03-06 22:24:05
+++ raster/r.in.pdal/grassrasterwriter.h 2024-04-09 10:45:31
@@ -32,7 +32,12 @@
#include <pdal/Writer.hpp>

/* Binning code wrapped as a PDAL Writer class */
+#ifdef HAVE_PDAL_NOFILENAMEWRITER
+class GrassRasterWriter : public pdal::NoFilenameWriter,
+ public pdal::Streamable {
+#else
class GrassRasterWriter : public pdal::Writer, public pdal::Streamable {
+#endif
public:
GrassRasterWriter() : n_processed(0) {}

0 comments on commit 97cbd13

Please sign in to comment.