OTB Superbuild: Integrate additional patch for HDF4

Dear developers,

because of https://github.com/CNES/WASP I’m needing a superbuild of OTB-6.2

Currently I can’t compile because the embedded HDF4 doesn’t find XDR:

-- Looking for xdr_int
-- Looking for xdr_int - not found
-- Looking for xdr_int in /usr/lib/libnsl.so
-- Looking for xdr_int in /usr/lib/libnsl.so - not found
-- HDF4 XDR Library will be built

I’m on ArchLinux where libtirpc contains xdr.h at /usr/include/tirpc/rpc/xdr.h and a symlink to /usr/include/rpc/xdr.h

My distro uses this patch to fix HDF4:

diff --git a/src/hdf-4.2.14/configure.ac b/src/hdf-4.2.14/configure.ac
index 3030bad..6d7f654 100644
--- a/src/hdf-4.2.14/configure.ac
+++ b/src/hdf-4.2.14/configure.ac
@@ -685,6 +685,9 @@ case "$host" in
   *-pc-cygwin*)
     LIBS="$LIBS -ltirpc"
     CPPFLAGS="$CPPFLAGS -I/usr/include/tirpc"  ;;
+  *-linux-gnu*)
+    LIBS="$LIBS -ltirpc"
+    CPPFLAGS="$CPPFLAGS -I/usr/include/tirpc"  ;;
   *) ;;
 esac

I’ve tried to append it to hdf4-1-alternative-all.diff, but this doesn’t work.

What’s the right way to apply the patch to HDF4?

copy diff file to SuperBuild/patches/HDF4/hdf-2-xdr-linux.diff and SuperBuild will automatically pick up this patch and apply only on linux.

TODO: should be moved to https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb