summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/hdf-eos2-1-fixes.patch138
-rw-r--r--src/hdf-eos2-test.c39
-rw-r--r--src/hdf-eos2.mk36
3 files changed, 213 insertions, 0 deletions
diff --git a/src/hdf-eos2-1-fixes.patch b/src/hdf-eos2-1-fixes.patch
new file mode 100644
index 0000000..5f08537
--- /dev/null
+++ b/src/hdf-eos2-1-fixes.patch
@@ -0,0 +1,138 @@
+This file is part of MXE.
+See index.html for further information.
+
+Contains ad hoc patches for cross building.
+
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Thomas Danckaert <thomas.danckaert@gmail.com>
+Date: Thu, 3 Mar 2016 17:13:29 +0100
+Subject: [PATCH] Remove AC_TRY_RUN to fix cross compiling.
+
+
+diff --git a/configure.ac b/configure.ac
+index 1111111..2222222 100755
+--- a/configure.ac
++++ b/configure.ac
+@@ -160,17 +160,7 @@ dnl Check if -Df2cFortran is specified
+ dnl Running only the preprocessor may not be a good idea
+ dnl because this can be hard-coded.
+ AC_MSG_CHECKING([for fc2Fortran macro])
+-AC_CACHE_VAL([he2_cv_f2cFortran_defined],
+- [AC_TRY_RUN([
+- int main(void)
+- {
+- #ifdef f2cFortran
+- return 0;
+- #else
+- return 1;
+- #endif
+- }
+- ], [he2_cv_f2cFortran_defined=yes], [he2_cv_f2cFortran_defined=no],)])
++AC_CACHE_VAL([he2_cv_f2cFortran_defined],[he2_cv_f2cFortran_defined=yes])
+ if test ${he2_cv_f2cFortran_defined} = "yes"; then
+ F2CFORTRAN_MACRO="yes"
+ AC_MSG_RESULT([defined])
+@@ -181,18 +171,7 @@ fi
+
+ if test ${he2_cv_f2cFortran_defined} = "yes"; then
+
+- AC_CHECK_SIZEOF([int*])
+- AC_CACHE_VAL([he2_cv_32ptr],
+- [AC_TRY_RUN([
+- int main(void)
+- {
+-#ifdef SIZEOF_INTP
+- return SIZEOF_INTP == 4 ? 0 : 1;
+-#else
+-#error SIZEOF_INTP is not defined
+-#endif
+- }
+- ], [he2_cv_32ptr=yes], [he2_cv_32ptr=no],)])
++ AC_CACHE_VAL([he2_cv_32ptr],[he2_cv_32ptr=no])
+ if test ${he2_cv_32ptr} = "yes"; then
+ AC_MSG_NOTICE([possibly 32 bit system])
+ F2CFORTRAN_32PTR="yes"
+@@ -346,32 +325,9 @@ if test "X$HAVE_SZLIB" = "Xyes"; then
+
+ AC_MSG_CHECKING([for szlib encoder])
+
+- AC_CACHE_VAL([he2_cv_szlib_functional],
+- [AC_TRY_RUN([
+- #include <stddef.h>
+- #include <szlib.h>
+-
+- int main(void)
+- {
+- SZ_encoder_enabled();
+- exit(0);
+- }
+- ], [he2_cv_szlib_functional=yes], [he2_cv_szlib_functional=no],)])
+-
+- AC_CACHE_VAL([he2_cv_szlib_can_encode],
+- [AC_TRY_RUN([
+- #include <stddef.h>
+- #include <szlib.h>
+-
+- int main(void)
+- {
+- /* SZ_encoder_enabled returns 1 if encoder is present */
+- if(SZ_encoder_enabled() == 1)
+- exit(0);
+- else
+- exit(1);
+- }
+- ], [he2_cv_szlib_can_encode=yes], [he2_cv_szlib_can_encode=no],)])
++ AC_CACHE_VAL([he2_cv_szlib_functional],[he2_cv_szlib_functional=no])
++
++ AC_CACHE_VAL([he2_cv_szlib_can_encode],[he2_cv_szlib_can_encode=no])
+
+ CC="$saved_CC"
+ rm -f $SZIP_CC
+@@ -477,22 +433,7 @@ if test "x$HAVE_HDF4" = "xyes"; then
+ dnl Check if HDF4 is linked with SZIP encoder
+
+ AC_MSG_CHECKING([for hdf4 szip decoding filter])
+- AC_CACHE_VAL([he2_cv_hdf4_szip_can_decode],
+- [AC_TRY_RUN([
+- #include <hdf.h>
+-
+- int main(void)
+- {
+- comp_coder_t codertype = COMP_CODE_SZIP;
+- uint32 configinfo;
+- int decoder = 0;
+-
+- HCget_config_info(codertype, &configinfo);
+- decoder = configinfo & COMP_DECODER_ENABLED;
+- if (decoder) exit(0);
+- else exit(1);
+- }
+- ], [he2_cv_hdf4_szip_can_decode=yes], [he2_cv_hdf4_szip_can_decode=no],)])
++ AC_CACHE_VAL([he2_cv_hdf4_szip_can_decode],[he2_cv_hdf4_szip_can_decode=no])
+ if test ${he2_cv_hdf4_szip_can_decode} = "yes"; then
+ AC_DEFINE(HAVE_HDF4_SZIP_DECODER, 1,
+ [Define if HDF4 has szip decoder filter])
+@@ -502,22 +443,7 @@ if test "x$HAVE_HDF4" = "xyes"; then
+ fi
+
+ AC_MSG_CHECKING([for hdf4 szip encoding filter])
+- AC_CACHE_VAL([he2_cv_hdf4_szip_can_encode],
+- [AC_TRY_RUN([
+- #include <hdf.h>
+-
+- int main(void)
+- {
+- comp_coder_t codertype = COMP_CODE_SZIP;
+- uint32 configinfo;
+- int encoder = 0;
+-
+- HCget_config_info(codertype, &configinfo);
+- encoder = configinfo & COMP_ENCODER_ENABLED;
+- if (encoder) exit(0);
+- else exit(1);
+- }
+- ], [he2_cv_hdf4_szip_can_encode=yes], [he2_cv_hdf4_szip_can_encode=no],)])
++ AC_CACHE_VAL([he2_cv_hdf4_szip_can_encode],[he2_cv_hdf4_szip_can_encode=no])
+
+ if test ${he2_cv_hdf4_szip_can_encode} = "yes"; then
+ AC_DEFINE(HAVE_HDF4_SZIP_ENCODER, 1,
diff --git a/src/hdf-eos2-test.c b/src/hdf-eos2-test.c
new file mode 100644
index 0000000..ac5f2e1
--- /dev/null
+++ b/src/hdf-eos2-test.c
@@ -0,0 +1,39 @@
+/*
+ * This file is part of MXE.
+ * See index.html for further information.
+ */
+
+#include <hdf.h>
+#include <HdfEosDef.h>
+#include <mfhdf.h>
+
+#include <stdio.h>
+
+int main() {
+ char filename[] = "test.he4";
+ int fid = SWopen(filename, DFACC_CREATE);
+ char swathname[] = "myswath";
+ int swid = SWcreate(fid, swathname);
+
+ char dimname[] = "mydim";
+ const int32 dimlen = 10;
+ int rc = SWdefdim(swid, dimname, dimlen);
+ printf("SWdefdim: %d\n", rc);
+ char fieldname[] = "test_field";
+ rc = SWdefdatafield(swid, fieldname, dimname, DFNT_FLOAT, 0);
+ printf("SWdefdatafield: %d\n", rc);
+
+ int32 start = 0;
+ int32 edge = dimlen;
+ float data[dimlen];
+ for (int i=0; i<dimlen; ++i) {
+ data[i] = 1.0 + i;
+ }
+ rc = SWwritefield(swid, fieldname, &start, NULL, &edge, data);
+ printf("SWwritefield: %d\n", rc);
+
+ rc = SWdetach(swid);
+ printf("SWdetach: %d\n", rc);
+ rc = SWclose(fid);
+ printf("SWclose: %d\n", rc);
+}
diff --git a/src/hdf-eos2.mk b/src/hdf-eos2.mk
new file mode 100644
index 0000000..75b9fd3
--- /dev/null
+++ b/src/hdf-eos2.mk
@@ -0,0 +1,36 @@
+# This file is part of MXE.
+# See index.html for further information.
+
+PKG := hdf-eos2
+$(PKG)_IGNORE :=
+$(PKG)_VERSION := 19v1.00
+$(PKG)_CHECKSUM := 3fffa081466e85d2b9436d984bc44fe97bbb33ad9d8b7055a322095dc4672e31
+$(PKG)_SUBDIR := hdfeos
+$(PKG)_FILE := HDF-EOS2.$($(PKG)_VERSION).tar.Z
+$(PKG)_URL := ftp://edhs1.gsfc.nasa.gov/edhs/hdfeos/latest_release/$($(PKG)_FILE)
+$(PKG)_DEPS := gcc hdf4
+
+define $(PKG)_UPDATE
+ echo 'TODO: write update script for hdf-eos2.' >&2;
+ echo $(hdf-eos2_VERSION)
+endef
+
+define $(PKG)_BUILD
+ cd '$(1)' && chmod -R ugo+w .
+ cd '$(1)' && autoconf
+ cd '$(1)' && \
+ ac_cv_func_malloc_0_nonnull=yes \
+ ac_cv_func_realloc_0_nonnull=yes \
+ ./configure $(MXE_CONFIGURE_OPTS) \
+ --enable-install-include
+
+ $(MAKE) -C '$(1)' -j '$(JOBS)'
+ $(MAKE) -C '$(1)' -j 1 install
+
+ '$(TARGET)-gcc' \
+ -std=c99 -W -Wall -Werror -pedantic \
+ '$(2).c' -o '$(PREFIX)/$(TARGET)/bin/test-$(PKG).exe' \
+ -lhdfeos -lmfhdf -ldf -lz -ljpeg -lportablexdr -lws2_32
+endef
+
+$(PKG)_BUILD_SHARED =