From 31ecd36182a69667641b659156474544641fdbf4 Mon Sep 17 00:00:00 2001 From: Thomas Danckaert Date: Thu, 3 Mar 2016 16:26:22 +0100 Subject: [PATCH 1/3] Treat files ending in .tar.Z as gzipped tar files. --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ba124ccb..8a4fabc6 100644 --- a/Makefile +++ b/Makefile @@ -176,6 +176,7 @@ SHORT_PKG_VERSION = \ UNPACK_ARCHIVE = \ $(if $(filter %.tgz, $(1)),tar xzf '$(1)', \ $(if $(filter %.tar.gz, $(1)),tar xzf '$(1)', \ + $(if $(filter %.tar.Z, $(1)),tar xzf '$(1)', \ $(if $(filter %.tbz2, $(1)),tar xjf '$(1)', \ $(if $(filter %.tar.bz2, $(1)),tar xjf '$(1)', \ $(if $(filter %.tar.lzma,$(1)),xz -dc -F lzma '$(1)' | tar xf -, \ @@ -184,7 +185,7 @@ UNPACK_ARCHIVE = \ $(if $(filter %.7z, $(1)),7za x '$(1)', \ $(if $(filter %.zip, $(1)),unzip -q '$(1)', \ $(if $(filter %.deb, $(1)),ar x '$(1)' && tar xf data.tar*, \ - $(error Unknown archive format: $(1)))))))))))) + $(error Unknown archive format: $(1))))))))))))) UNPACK_PKG_ARCHIVE = \ $(call UNPACK_ARCHIVE,$(PKG_DIR)/$($(1)_FILE)) From b21ca7c1b6cb6a5c9714bcad30d87ab71f1d3e21 Mon Sep 17 00:00:00 2001 From: Thomas Danckaert Date: Thu, 3 Mar 2016 16:27:41 +0100 Subject: [PATCH 2/3] Add package 'HDF-EOS5'. http://hdfeos.org/software/library.php "The HDF-EOS5 is a software library designed built on HDF5* to support the same Grid/Point/Swath functionality in HDF-EOS 2 and to the extent possible it will be built with the same calling sequences as the original HDF-EOS 2 library." --- index.html | 4 + src/hdf-eos5-1-fixes.patch | 158 +++++++++++++++++++++++++++++++++++++ src/hdf-eos5-test.c | 33 ++++++++ src/hdf-eos5.mk | 34 ++++++++ 4 files changed, 229 insertions(+) create mode 100644 src/hdf-eos5-1-fixes.patch create mode 100644 src/hdf-eos5-test.c create mode 100644 src/hdf-eos5.mk diff --git a/index.html b/index.html index 69823910..25edd9fd 100644 --- a/index.html +++ b/index.html @@ -1517,6 +1517,10 @@ local-pkg-list: $(LOCAL_PKG_LIST) harfbuzz HarfBuzz + + hdf-eos5 + HDF-EOS5 + hdf4 HDF4 diff --git a/src/hdf-eos5-1-fixes.patch b/src/hdf-eos5-1-fixes.patch new file mode 100644 index 00000000..3850246a --- /dev/null +++ b/src/hdf-eos5-1-fixes.patch @@ -0,0 +1,158 @@ +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 +Date: Fri, 27 May 2016 17:39:23 +0200 +Subject: [PATCH] fixes + + +diff --git a/configure.ac b/configure.ac +index 1111111..2222222 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -104,17 +104,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([he5_cv_f2cFortran_defined], +- [AC_TRY_RUN([ +- int main(void) +- { +- #ifdef f2cFortran +- return 0; +- #else +- return 1; +- #endif +- } +- ], [he5_cv_f2cFortran_defined=yes], [he5_cv_f2cFortran_defined=no],)]) ++AC_CACHE_VAL([he5_cv_f2cFortran_defined],[he5_cv_f2cFortran_defined=yes]) + if test ${he5_cv_f2cFortran_defined} = "yes"; then + F2CFORTRAN_MACRO="yes" + AC_MSG_RESULT([defined]) +@@ -124,18 +114,7 @@ else + fi + + if test ${he5_cv_f2cFortran_defined} = "yes"; then +- AC_CHECK_SIZEOF([int*]) +- AC_CACHE_VAL([he5_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 +- } +- ], [he5_cv_32ptr=yes], [he5_cv_32ptr=no],)]) ++ AC_CACHE_VAL([he5_cv_32ptr],[he5_cv_32ptr=no]) + if test ${he5_cv_32ptr} = "yes"; then + AC_MSG_NOTICE([possibly 32 bit system]) + F2CFORTRAN_32PTR="yes" +@@ -417,20 +396,7 @@ fi + + # Check whether HDF5 threadsafety is enabled + AC_MSG_CHECKING([if HDF5 threadsafe mode is enabled]) +-AC_TRY_RUN([ +-#include "hdf5.h" +- +-int main(void) { +-#ifdef H5_HAVE_THREADSAFE +- return 0; +-#else +- return 1; +-#endif +-} ], +- [ AC_MSG_RESULT([yes]) +- THREADSAFE="yes"], +- [AC_MSG_RESULT([no]) +- THREADSAFE="no"]) ++THREADSAFE=no + + # Record threadsafe status in config.h and for Makefiles + if test "X$THREADSAFE" = "Xyes"; then +@@ -445,24 +411,7 @@ if test "x$HAVE_HDF5" = "xyes"; then + dnl Check if HDF5 is linked with SZIP encoder + + AC_MSG_CHECKING([for hdf5 szip decoding filter]) +- AC_CACHE_VAL([he5_cv_hdf5_szip_can_decode], +- [AC_TRY_RUN([ +- #include +- #include +- +- int main(int argc, char **argv) +- { +- herr_t ret; +- unsigned int flags = 0; +- int decoder = 0; +- +- ret = H5Zget_filter_info(H5Z_FILTER_SZIP, &flags); +- if (ret < 0) exit(1); +- decoder = flags & H5Z_FILTER_CONFIG_DECODE_ENABLED; +- if (decoder) exit(0); +- else exit(1); +- } +- ], [he5_cv_hdf5_szip_can_decode=yes], [he5_cv_hdf5_szip_can_decode=no],)]) ++ AC_CACHE_VAL([he5_cv_hdf5_szip_can_decode],[he5_cv_hdf5_szip_can_decode=no]) + if test ${he5_cv_hdf5_szip_can_decode} = "yes"; then + AC_DEFINE(HAVE_HDF5_SZIP_DECODER, 1, + [Define if HDF5 has szip decoder filter]) +@@ -474,24 +423,7 @@ if test "x$HAVE_HDF5" = "xyes"; then + fi + + AC_MSG_CHECKING([for hdf5 szip encoding filter]) +- AC_CACHE_VAL([he5_cv_hdf5_szip_can_encode], +- [AC_TRY_RUN([ +- #include +- #include +- +- int main(int argc, char **argv) +- { +- herr_t ret; +- unsigned int flags = 0; +- int encoder = 0; +- +- ret = H5Zget_filter_info(H5Z_FILTER_SZIP, &flags); +- if (ret < 0) exit(1); +- encoder = flags & H5Z_FILTER_CONFIG_ENCODE_ENABLED; +- if (encoder) exit(0); +- else exit(1); +- } +- ], [he5_cv_hdf5_szip_can_encode=yes], [he5_cv_hdf5_szip_can_encode=no],)]) ++ AC_CACHE_VAL([he5_cv_hdf5_szip_can_encode],[he5_cv_hdf5_szip_can_encode=no]) + + if test ${he5_cv_hdf5_szip_can_encode} = "yes"; then + AC_DEFINE(HAVE_HDF5_SZIP_ENCODER, 1, + +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Thomas Danckaert +Date: Fri, 27 May 2016 17:49:30 +0200 +Subject: [PATCH] Fix compilation without SZIP. + +A wrongly placed #endif causes a missing symbol 'HE5_EHHEisHE5' when +compiling without szip. Bug & fix reported upstream. + +diff --git a/src/EHapi.c b/src/EHapi.c +index 1111111..2222222 100755 +--- a/src/EHapi.c ++++ b/src/EHapi.c +@@ -11379,6 +11379,7 @@ int HE5_szip_can_encode(void ) + return(-1); + } + ++#endif /* H5_HAVE_FILTER_SZIP */ + + + /*----------------------------------------------------------------------------| +@@ -11509,8 +11510,6 @@ HE5_EHHEisHE5(char *filename) + } + } + +-#endif /* H5_HAVE_FILTER_SZIP */ +- + + #ifndef __cplusplus + diff --git a/src/hdf-eos5-test.c b/src/hdf-eos5-test.c new file mode 100644 index 00000000..b803dbdc --- /dev/null +++ b/src/hdf-eos5-test.c @@ -0,0 +1,33 @@ +/* + * This file is part of MXE. + * See index.html for further information. + */ + +#include "HE5_HdfEosDef.h" + +int main() { + + char filename[] = "test.he5"; + hid_t output_file = HE5_SWopen(filename, H5F_ACC_TRUNC); + char swathname[] = "testswath"; + hid_t swath_id = HE5_SWcreate(output_file, swathname); + + char dimension[] = "dummydim"; + HE5_SWdefdim(swath_id, dimension, 10); + char fieldname[] = "test_field"; + HE5_SWdefdatafield(swath_id, fieldname, dimension, NULL, HE5T_NATIVE_FLOAT, 0); + + hssize_t start[HE5_DTSETRANKMAX] = {0}; + hsize_t edge[HE5_DTSETRANKMAX] = {10}; + float testdata[10]; + + for(unsigned int i=0; i<10; ++i) + testdata[i] = (float)i; + + HE5_SWwritefield(swath_id, fieldname, start, NULL, edge, testdata); + + HE5_SWdetach(swath_id); + HE5_SWclose(output_file); + + return 0; +} diff --git a/src/hdf-eos5.mk b/src/hdf-eos5.mk new file mode 100644 index 00000000..626930f1 --- /dev/null +++ b/src/hdf-eos5.mk @@ -0,0 +1,34 @@ +# This file is part of MXE. +# See index.html for further information. + +PKG := hdf-eos5 +$(PKG)_IGNORE := +$(PKG)_VERSION := 1.15 +$(PKG)_CHECKSUM := 119588067abf139c1c600a4519b880d04a3933049576c88acdc8ff6fc71803dd +$(PKG)_SUBDIR := hdfeos5 +$(PKG)_FILE := HDF-EOS5.$($(PKG)_VERSION).tar.Z +$(PKG)_URL := ftp://edhs1.gsfc.nasa.gov/edhs/hdfeos5/latest_release/$($(PKG)_FILE) +$(PKG)_DEPS := gcc hdf5 + +define $(PKG)_UPDATE + echo 'TODO: write update script for hdf-eos5.' >&2; + echo $(hdf-eos5_VERSION) +endef + +define $(PKG)_BUILD + cd '$(1)' && chmod -R ugo+w . + cd '$(1)' && autoconf + cd '$(1)' && ./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' \ + -lhe5_hdfeos -lhdf5_hl -lhdf5 -lz +endef + +$(PKG)_BUILD_SHARED = From 88024041f535cbbdb590ef2f0abeeb9ceaa8ab4d Mon Sep 17 00:00:00 2001 From: Thomas Danckaert Date: Thu, 3 Mar 2016 17:20:11 +0100 Subject: [PATCH 3/3] Add package 'HDF-EOS2'. http://hdfeos.org/software/library.php "The HDF-EOS2 is a software library designed built on HDF4 to support EOS-specific data structures, namely Grid, Point, and Swath. The new data structures are constructed from standard HDF data objects, using EOS conventions, through the use of a software library. A key feature of HDF-EOS files is that instrument-independent services, such as subsetting by geolocation, can be applied to the files across a wide variety of data products." --- index.html | 4 ++ src/hdf-eos2-1-fixes.patch | 138 +++++++++++++++++++++++++++++++++++++ src/hdf-eos2-test.c | 39 +++++++++++ src/hdf-eos2.mk | 36 ++++++++++ 4 files changed, 217 insertions(+) create mode 100644 src/hdf-eos2-1-fixes.patch create mode 100644 src/hdf-eos2-test.c create mode 100644 src/hdf-eos2.mk diff --git a/index.html b/index.html index 25edd9fd..cf0ec3dd 100644 --- a/index.html +++ b/index.html @@ -1517,6 +1517,10 @@ local-pkg-list: $(LOCAL_PKG_LIST) harfbuzz HarfBuzz + + hdf-eos2 + HDF-EOS2 + hdf-eos5 HDF-EOS5 diff --git a/src/hdf-eos2-1-fixes.patch b/src/hdf-eos2-1-fixes.patch new file mode 100644 index 00000000..5f085373 --- /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 +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 +- #include +- +- 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 +- #include +- +- 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 +- +- 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 +- +- 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 00000000..ac5f2e11 --- /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 +#include +#include + +#include + +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&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 =