diff --git a/recipe/bld.bat b/recipe/bld.bat index 86d177d9..87a0864a 100644 --- a/recipe/bld.bat +++ b/recipe/bld.bat @@ -22,6 +22,7 @@ cmake -LAH -G "NMake Makefiles" ^ -DENABLE_NCZARR=on ^ -DENABLE_NCZARR_S3=off ^ -DENABLE_NCZARR_S3_TESTS=off ^ + -DENABLE_EXTERNAL_SERVER_TESTS=OFF ^ %SRC_DIR% if errorlevel 1 exit \b 1 diff --git a/recipe/build.sh b/recipe/build.sh index 0d37f3fa..449d764c 100644 --- a/recipe/build.sh +++ b/recipe/build.sh @@ -59,30 +59,9 @@ fi # DAP Remote tests are causing spurious failures at the momment # https://github.com/Unidata/netcdf-c/issues/2188#issuecomment-1015927961 # -DENABLE_DAP_REMOTE_TESTS=OFF -# Build static. -cmake ${CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX=${PREFIX} \ - -DCMAKE_INSTALL_LIBDIR="lib" \ - -DCMAKE_PREFIX_PATH=${PREFIX} \ - -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \ - -DENABLE_DAP=ON \ - -DENABLE_DAP_REMOTE_TESTS=OFF \ - -DENABLE_HDF4=ON \ - -DENABLE_NETCDF_4=ON \ - -DBUILD_SHARED_LIBS=OFF \ - -DENABLE_TESTS=ON \ - -DBUILD_UTILITIES=ON \ - -DENABLE_DOXYGEN=OFF \ - -DENABLE_CDF5=ON \ - -DENABLE_BYTERANGE=ON \ - ${PARALLEL} \ - -DENABLE_NCZARR=on \ - -DENABLE_NCZARR_S3=off \ - -DENABLE_NCZARR_S3_TESTS=off \ - ${SRC_DIR} -# ctest # Run only for the shared lib build to save time. -make install -j${CPU_COUNT} ${VERBOSE_CM} -make clean +mkdir build-shared +cd build-shared # Build shared. cmake ${CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX=${PREFIX} \ -DCMAKE_INSTALL_LIBDIR="lib" \ @@ -97,6 +76,7 @@ cmake ${CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX=${PREFIX} \ -DBUILD_UTILITIES=ON \ -DENABLE_DOXYGEN=OFF \ -DENABLE_CDF5=ON \ + -DENABLE_EXTERNAL_SERVER_TESTS=OFF \ ${PARALLEL} \ -DENABLE_NCZARR=on \ -DENABLE_NCZARR_S3=off \ @@ -110,6 +90,12 @@ if [[ "${CONDA_BUILD_CROSS_COMPILATION:-}" != "1" || "${CROSSCOMPILING_EMULATOR} ctest -VV --output-on-failure -j${CPU_COUNT} ${SKIP} fi +# +# Clean up build directories +# +cd .. +rm -rf build-shared + # Fix build paths in cmake artifacts for fname in `ls ${PREFIX}/lib/cmake/netCDF/*`; do sed -i.bak "s#${CONDA_BUILD_SYSROOT}/usr/lib/lib\([a-z]*\).so#\1#g" ${fname} diff --git a/recipe/meta.yaml b/recipe/meta.yaml index 911eb5b8..59a3875c 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -1,5 +1,5 @@ -{% set version = "4.8.1" %} -{% set build = 4 %} +{% set version = "4.9.0" %} +{% set build = 0 %} # recipe-lint fails if mpi is undefined {% set mpi = mpi or 'nompi' %} @@ -14,19 +14,22 @@ package: source: url: https://github.com/Unidata/netcdf-c/archive/v{{ version }}.tar.gz - sha256: bc018cc30d5da402622bf76462480664c6668b55eb16ba205a0dfb8647161dd0 + sha256: 9f4cb864f3ab54adb75409984c6202323d2fc66c003e5308f3cdf224ed41c0a6 patches: - patches/0004-Prefer-getenv-TOPSRCDIR-over-STRINGIFY-TOPSRCDIR.patch - patches/0006-Fix-tests-for-Windows-VS2008-define-__func__-as-__FU.patch - - patches/0008-Finish-the-missing-code-to-handle-VS-in-test_common..patch + - patches/0008-Finish-the-missing-code-to-handle-VS-in-test_common.patch - patches/0009-topsrcdir.patch - patches/prevent_MS_runtime_libs_being_installed_again.patch # [win] - patches/strdup.patch - patches/do_not_use_16_processes_in_tests.patch # [ppc64le] + # https://github.com/Unidata/netcdf-c/issues/2390 + # patches/incorrect_library_versionand_filename_in_4.9.0.patch # Revert upstream change in 4.8.1--maybe unnecessary in 4.8.2 - patches/fix_cmake.patch # [win] - # Fix renaming file with multiple builds--will be in 4.8.2 - - patches/fix-rename.patch + - patches/fix-ncjson.patch + - patches/fix-tests.patch + - patches/fix-ncdump-tests-prereq.patch build: number: {{ build }} @@ -81,6 +84,7 @@ requirements: - hdf5 * {{ mpi_prefix }}_* - jpeg - libzip + - zstd run: - {{ mpi }} # [mpi != 'nompi'] - curl @@ -88,7 +92,7 @@ requirements: test: commands: - - test -f ${PREFIX}/lib/libnetcdf.a # [not win] + - test ! -f ${PREFIX}/lib/libnetcdf.a # [not win] - test -f ${PREFIX}/lib/libnetcdf${SHLIB_EXT} # [not win] - nc-config --all # [not win] diff --git a/recipe/patches/0006-Fix-tests-for-Windows-VS2008-define-__func__-as-__FU.patch b/recipe/patches/0006-Fix-tests-for-Windows-VS2008-define-__func__-as-__FU.patch index 74eb08a4..eda84b82 100644 --- a/recipe/patches/0006-Fix-tests-for-Windows-VS2008-define-__func__-as-__FU.patch +++ b/recipe/patches/0006-Fix-tests-for-Windows-VS2008-define-__func__-as-__FU.patch @@ -1,12 +1,13 @@ ---- netcdf-c-4.6.3.orig/config.h.cmake.in 2019-02-28 17:40:34.000000000 -0300 -+++ netcdf-c-4.6.3/config.h.cmake.in 2019-03-04 12:40:57.383805113 -0300 -@@ -67,6 +67,9 @@ - #endif +--- netcdf-c-4.9.0.orig/config.h.cmake.in 2022-06-10 18:04:15.000000000 -0300 ++++ netcdf-c-4.9.0/config.h.cmake.in 2022-06-13 09:07:44.793148154 -0300 +@@ -57,6 +57,10 @@ + #define _OFF_T_DEFINED #endif + #if _MSC_VER<1900 + #define __func__ __FUNCTION__ + #endif - ++ #define strdup _strdup #define fdopen _fdopen + #define write _write diff --git a/recipe/patches/0008-Finish-the-missing-code-to-handle-VS-in-test_common..patch b/recipe/patches/0008-Finish-the-missing-code-to-handle-VS-in-test_common.patch similarity index 66% rename from recipe/patches/0008-Finish-the-missing-code-to-handle-VS-in-test_common..patch rename to recipe/patches/0008-Finish-the-missing-code-to-handle-VS-in-test_common.patch index 2c6b2945..91a8e8db 100644 --- a/recipe/patches/0008-Finish-the-missing-code-to-handle-VS-in-test_common..patch +++ b/recipe/patches/0008-Finish-the-missing-code-to-handle-VS-in-test_common.patch @@ -1,10 +1,10 @@ -diff -Naur netcdf-c-4.8.0.orig/CMakeLists.txt netcdf-c-4.8.0/CMakeLists.txt ---- netcdf-c-4.8.0.orig/CMakeLists.txt 2021-03-30 17:23:10.000000000 -0300 -+++ netcdf-c-4.8.0/CMakeLists.txt 2021-03-31 16:20:58.354763274 -0300 -@@ -2247,6 +2247,13 @@ +diff --color -Naur netcdf-c-4.9.0.orig/CMakeLists.txt netcdf-c-4.9.0/CMakeLists.txt +--- netcdf-c-4.9.0.orig/CMakeLists.txt 2022-06-10 18:04:15.000000000 -0300 ++++ netcdf-c-4.9.0/CMakeLists.txt 2022-06-13 09:15:17.540114993 -0300 +@@ -2536,6 +2536,13 @@ + SET(EXTRA_DIST ${EXTRA_DIST} ${CMAKE_CURRENT_SOURCE_DIR}/test_common.in) SET(TOPSRCDIR "${CMAKE_CURRENT_SOURCE_DIR}") SET(TOPBUILDDIR "${CMAKE_CURRENT_BINARY_DIR}") - SET(ISMSVC "${MSVC}") +IF(MSVC) + # Seems this is always upper-case by this point :-( + SET(VS_CONFIGURATION "/${CMAKE_BUILD_TYPE}") @@ -14,11 +14,11 @@ diff -Naur netcdf-c-4.8.0.orig/CMakeLists.txt netcdf-c-4.8.0/CMakeLists.txt + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test_common.in ${CMAKE_CURRENT_BINARY_DIR}/test_common.sh @ONLY NEWLINE_STYLE LF) - -diff -Naur netcdf-c-4.8.0.orig/configure.ac netcdf-c-4.8.0/configure.ac ---- netcdf-c-4.8.0.orig/configure.ac 2021-03-30 17:23:10.000000000 -0300 -+++ netcdf-c-4.8.0/configure.ac 2021-03-31 15:37:39.403933822 -0300 -@@ -1618,6 +1618,7 @@ + ##### +diff --color -Naur netcdf-c-4.9.0.orig/configure.ac netcdf-c-4.9.0/configure.ac +--- netcdf-c-4.9.0.orig/configure.ac 2022-06-10 18:04:15.000000000 -0300 ++++ netcdf-c-4.9.0/configure.ac 2022-06-13 09:14:34.212977819 -0300 +@@ -1857,6 +1857,7 @@ AC_SUBST(HAS_MMAP,[$enable_mmap]) AC_SUBST(HAS_JNA,[$enable_jna]) AC_SUBST(HAS_ERANGE_FILL,[$enable_erange_fill]) @@ -26,9 +26,9 @@ diff -Naur netcdf-c-4.8.0.orig/configure.ac netcdf-c-4.8.0/configure.ac AC_SUBST(HAS_BYTERANGE,[$enable_byterange]) AC_SUBST(RELAX_COORD_BOUND,[yes]) AC_SUBST([HAS_PAR_FILTERS], [$hdf5_supports_par_filters]) -diff -Naur netcdf-c-4.8.0.orig/examples/CDL/do_comps.sh netcdf-c-4.8.0/examples/CDL/do_comps.sh ---- netcdf-c-4.8.0.orig/examples/CDL/do_comps.sh 2021-03-30 17:23:10.000000000 -0300 -+++ netcdf-c-4.8.0/examples/CDL/do_comps.sh 2021-03-31 16:18:03.592941903 -0300 +diff --color -Naur netcdf-c-4.9.0.orig/examples/CDL/do_comps.sh netcdf-c-4.9.0/examples/CDL/do_comps.sh +--- netcdf-c-4.9.0.orig/examples/CDL/do_comps.sh 2022-06-10 18:04:15.000000000 -0300 ++++ netcdf-c-4.9.0/examples/CDL/do_comps.sh 2022-06-13 09:16:42.730419193 -0300 @@ -9,6 +9,8 @@ # This shell script runs the cmp test on the example programs. # $Id: do_comps.sh,v 1.1 2006/06/27 17:44:54 ed Exp $ @@ -55,10 +55,10 @@ diff -Naur netcdf-c-4.8.0.orig/examples/CDL/do_comps.sh netcdf-c-4.8.0/examples/ echo "*** All example creations worked!" -diff -Naur netcdf-c-4.8.0.orig/test_common.in netcdf-c-4.8.0/test_common.in ---- netcdf-c-4.8.0.orig/test_common.in 2021-03-30 17:23:10.000000000 -0300 -+++ netcdf-c-4.8.0/test_common.in 2021-03-31 16:20:05.514199909 -0300 -@@ -77,8 +77,8 @@ +diff --color -Naur netcdf-c-4.9.0.orig/test_common.in netcdf-c-4.9.0/test_common.in +--- netcdf-c-4.9.0.orig/test_common.in 2022-06-10 18:04:15.000000000 -0300 ++++ netcdf-c-4.9.0/test_common.in 2022-06-13 09:17:29.281492909 -0300 +@@ -101,8 +101,8 @@ top_srcdir="$TOPSRCDIR" top_builddir="$TOPBUILDDIR" @@ -69,7 +69,7 @@ diff -Naur netcdf-c-4.8.0.orig/test_common.in netcdf-c-4.8.0/test_common.in # srcdir may or may not be defined, but if not, then create it if test "x$srcdir" = x ; then -@@ -95,6 +95,12 @@ +@@ -119,6 +119,12 @@ # execdir is an alias for builddir execdir="${builddir}" diff --git a/recipe/patches/fix-ncdump-tests-prereq.patch b/recipe/patches/fix-ncdump-tests-prereq.patch new file mode 100644 index 00000000..d820d88c --- /dev/null +++ b/recipe/patches/fix-ncdump-tests-prereq.patch @@ -0,0 +1,13 @@ +diff --git a/netcdf-c-v4.9.0/ncdump/CMakeLists.txt b/netcdf-c-fixed/ncdump/CMakeLists.txt +index 056810f..52dae3b 100644 +--- a/netcdf-c-v4.9.0/ncdump/CMakeLists.txt ++++ b/netcdf-c-fixed/ncdump/CMakeLists.txt +@@ -256,7 +256,7 @@ endif() + add_sh_test(ncdump tst_netcdf4_4) + add_sh_test(ncdump tst_nccopy4) + +- SET_TESTS_PROPERTIES(ncdump_tst_nccopy4 PROPERTIES DEPENDS "ncdump_run_ncgen_tests;ncdump_tst_output;ncdump_tst_ncgen4;ncdump_tst_fillbug;ncdump_tst_netcdf4_4;ncdump_tst_h_scalar;tst_comp;tst_comp2") ++ SET_TESTS_PROPERTIES(ncdump_tst_nccopy4 PROPERTIES DEPENDS "ncdump_run_ncgen_tests;ncdump_tst_output;ncdump_tst_ncgen4;ncdump_sh_tst_fillbug;ncdump_tst_netcdf4_4;ncdump_tst_h_scalar;tst_comp;tst_comp2;tst_nans;tst_opaque_data;tst_create_files;tst_special_atts") + SET_TESTS_PROPERTIES(ncdump_tst_nccopy5 PROPERTIES DEPENDS "ncdump_tst_nccopy4") + + ENDIF(USE_HDF5) \ No newline at end of file diff --git a/recipe/patches/fix-ncjson.patch b/recipe/patches/fix-ncjson.patch new file mode 100644 index 00000000..86b0c43c --- /dev/null +++ b/recipe/patches/fix-ncjson.patch @@ -0,0 +1,834 @@ +diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt +index 08017c7f8..224bd2bb3 100644 +--- a/include/CMakeLists.txt ++++ b/include/CMakeLists.txt +@@ -41,9 +41,9 @@ IF(ENABLE_PNETCDF OR ENABLE_PARALLEL4) + COMPONENT headers) + ENDIF() + +-#INSTALL(FILES ${netCDF_BINARY_DIR}/include/netcdf_json.h +-# DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +-# COMPONENT headers) ++INSTALL(FILES ${netCDF_SOURCE_DIR}/include/netcdf_json.h ++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ++ COMPONENT headers) + + FILE(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.h) + SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} Makefile.am CMakeLists.txt) +diff --git a/include/Makefile.am b/include/Makefile.am +index 0a4a58e05..3b7e13839 100644 +--- a/include/Makefile.am ++++ b/include/Makefile.am +@@ -32,7 +32,15 @@ endif + + EXTRA_DIST = CMakeLists.txt XGetopt.h netcdf_meta.h.in netcdf_dispatch.h.in + ++# netcdf_json.h is constructed as a header-only file for use by ++# nczarr code wrappers in the plugin directory. It is ++# constructed by joining libdispatch/ncjson.c with ++# include/ncjson.h. Additionally all the entry points are ++# marked with a macro (OPTSTATIC) that marks the entry point as ++# static inside netcdf_json.h. This is an ugly hack to avoid ++# having to reference libnetcdf in the nczarr code wrappers. ++ + # Give the recipe for rebuilding netcdf_json.h +-makencjson:: ++makepluginjson:: + sed -e 's/NCJSON_H/NETCDF_JSON_H/' -e '/ncjson.h/d' <${srcdir}/ncjson.h > netcdf_json.h + sed -e '/ncjson.h/d' < ${srcdir}/../libdispatch/ncjson.c >> netcdf_json.h +diff --git a/include/ncjson.h b/include/ncjson.h +index c065bc2ed..c4974cfb5 100644 +--- a/include/ncjson.h ++++ b/include/ncjson.h +@@ -2,9 +2,20 @@ + See the COPYRIGHT file for more information. + */ + ++ + #ifndef NCJSON_H + #define NCJSON_H 1 + ++/* ++WARNING: ++If you modify this file, ++then you need to got to ++the include/ directory ++and do the command: ++ make makepluginjson ++*/ ++ ++/* Inside libnetcdf and for plugins, export the json symbols */ + #ifndef DLLEXPORT + #ifdef _WIN32 + #define DLLEXPORT __declspec(dllexport) +@@ -13,6 +24,13 @@ + #endif + #endif + ++/* Override for plugins */ ++#ifdef NETCDF_JSON_H ++#define OPTEXPORT static ++#else ++#define OPTEXPORT DLLEXPORT ++#endif /*NETCDF_JSON_H*/ ++ + /**************************************************/ + /* Json object sorts (note use of term sort rather than e.g. type or discriminant) */ + #define NCJ_UNDEF 0 +@@ -57,48 +75,47 @@ extern "C" { + #endif + + /* Parse a string to NCjson*/ +-DLLEXPORT int NCJparse(const char* text, unsigned flags, NCjson** jsonp); ++OPTEXPORT int NCJparse(const char* text, unsigned flags, NCjson** jsonp); + + /* Parse a counted string to NCjson*/ +-DLLEXPORT int NCJparsen(size_t len, const char* text, unsigned flags, NCjson** jsonp); ++OPTEXPORT int NCJparsen(size_t len, const char* text, unsigned flags, NCjson** jsonp); + + /* Reclaim a JSON tree */ +-DLLEXPORT extern void NCJreclaim(NCjson* json); ++OPTEXPORT void NCJreclaim(NCjson* json); + + /* Create a new JSON node of a given sort */ +-DLLEXPORT extern int NCJnew(int sort, NCjson** objectp); ++OPTEXPORT int NCJnew(int sort, NCjson** objectp); + + /* Create new json object with given string content */ +-DLLEXPORT extern int NCJnewstring(int sort, const char* value, NCjson** jsonp); ++OPTEXPORT int NCJnewstring(int sort, const char* value, NCjson** jsonp); + + /* Create new json object with given counted string content */ +-DLLEXPORT extern int NCJnewstringn(int sort, size_t len, const char* value, NCjson** jsonp); ++OPTEXPORT int NCJnewstringn(int sort, size_t len, const char* value, NCjson** jsonp); + + /* Get dict key value by name */ +-DLLEXPORT extern int NCJdictget(const NCjson* dict, const char* key, NCjson** valuep); ++OPTEXPORT int NCJdictget(const NCjson* dict, const char* key, NCjson** valuep); + + /* Convert one json sort to value of another type; don't use union so we can know when to reclaim sval */ +-DLLEXPORT extern int NCJcvt(const NCjson* value, int outsort, struct NCJconst* output); +- +-#ifndef NETCDF_JSON_H ++OPTEXPORT int NCJcvt(const NCjson* value, int outsort, struct NCJconst* output); + + /* Insert an atomic value to an array or dict object. */ +-DLLEXPORT int NCJaddstring(NCjson* json, int sort, const char* s); ++OPTEXPORT int NCJaddstring(NCjson* json, int sort, const char* s); + + /* Append value to an array or dict object. */ +-DLLEXPORT extern int NCJappend(NCjson* object, NCjson* value); ++OPTEXPORT int NCJappend(NCjson* object, NCjson* value); + + /* Insert key-value pair into a dict object. key will be copied */ +-DLLEXPORT extern int NCJinsert(NCjson* object, char* key, NCjson* value); ++OPTEXPORT int NCJinsert(NCjson* object, char* key, NCjson* value); + + /* Unparser to convert NCjson object to text in buffer */ +-DLLEXPORT extern int NCJunparse(const NCjson* json, unsigned flags, char** textp); ++OPTEXPORT int NCJunparse(const NCjson* json, unsigned flags, char** textp); + + /* Deep clone a json object */ +-DLLEXPORT extern int NCJclone(const NCjson* json, NCjson** clonep); ++OPTEXPORT int NCJclone(const NCjson* json, NCjson** clonep); + ++#ifndef NETCDF_JSON_H + /* dump NCjson* object to output file */ +-DLLEXPORT extern void NCJdump(const NCjson* json, unsigned flags, FILE*); ++OPTEXPORT void NCJdump(const NCjson* json, unsigned flags, FILE*); + #endif + + #if defined(__cplusplus) +diff --git a/include/netcdf_json.h b/include/netcdf_json.h +index 9c6860c92..d53944a8a 100644 +--- a/include/netcdf_json.h ++++ b/include/netcdf_json.h +@@ -5,6 +5,7 @@ + #ifndef NETCDF_JSON_H + #define NETCDF_JSON_H 1 + ++/* Inside libnetcdf and for plugins, export the json symbols */ + #ifndef DLLEXPORT + #ifdef _WIN32 + #define DLLEXPORT __declspec(dllexport) +@@ -13,6 +14,13 @@ + #endif + #endif + ++/* Override for plugins */ ++#ifdef NETCDF_JSON_H ++#define OPTEXPORT static ++#else ++#define OPTEXPORT DLLEXPORT ++#endif /*NETCDF_JSON_H*/ ++ + /**************************************************/ + /* Json object sorts (note use of term sort rather than e.g. type or discriminant) */ + #define NCJ_UNDEF 0 +@@ -56,46 +64,48 @@ struct NCJconst {int bval; long long ival; double dval; char* sval;}; + extern "C" { + #endif + +-/* Parse a JSON string */ +-DLLEXPORT int NCJparse(const char* text, unsigned flags, NCjson** jsonp); ++/* Parse a string to NCjson*/ ++OPTEXPORT int NCJparse(const char* text, unsigned flags, NCjson** jsonp); ++ ++/* Parse a counted string to NCjson*/ ++OPTEXPORT int NCJparsen(size_t len, const char* text, unsigned flags, NCjson** jsonp); + + /* Reclaim a JSON tree */ +-DLLEXPORT extern void NCJreclaim(NCjson* json); ++OPTEXPORT void NCJreclaim(NCjson* json); + + /* Create a new JSON node of a given sort */ +-DLLEXPORT extern int NCJnew(int sort, NCjson** objectp); ++OPTEXPORT int NCJnew(int sort, NCjson** objectp); + + /* Create new json object with given string content */ +-DLLEXPORT extern int NCJnewstring(int sort, const char* value, NCjson** jsonp); ++OPTEXPORT int NCJnewstring(int sort, const char* value, NCjson** jsonp); + + /* Create new json object with given counted string content */ +-DLLEXPORT extern int NCJnewstringn(int sort, size_t len, const char* value, NCjson** jsonp); ++OPTEXPORT int NCJnewstringn(int sort, size_t len, const char* value, NCjson** jsonp); + + /* Get dict key value by name */ +-DLLEXPORT extern int NCJdictget(const NCjson* dict, const char* key, NCjson** valuep); ++OPTEXPORT int NCJdictget(const NCjson* dict, const char* key, NCjson** valuep); + + /* Convert one json sort to value of another type; don't use union so we can know when to reclaim sval */ +-DLLEXPORT extern int NCJcvt(const NCjson* value, int outsort, struct NCJconst* output); +- +-#ifndef NETCDF_JSON_H ++OPTEXPORT int NCJcvt(const NCjson* value, int outsort, struct NCJconst* output); + + /* Insert an atomic value to an array or dict object. */ +-DLLEXPORT int NCJaddstring(NCjson* json, int sort, const char* s); ++OPTEXPORT int NCJaddstring(NCjson* json, int sort, const char* s); + + /* Append value to an array or dict object. */ +-DLLEXPORT extern int NCJappend(NCjson* object, NCjson* value); ++OPTEXPORT int NCJappend(NCjson* object, NCjson* value); + + /* Insert key-value pair into a dict object. key will be copied */ +-DLLEXPORT extern int NCJinsert(NCjson* object, char* key, NCjson* value); ++OPTEXPORT int NCJinsert(NCjson* object, char* key, NCjson* value); + + /* Unparser to convert NCjson object to text in buffer */ +-DLLEXPORT extern int NCJunparse(const NCjson* json, unsigned flags, char** textp); ++OPTEXPORT int NCJunparse(const NCjson* json, unsigned flags, char** textp); + + /* Deep clone a json object */ +-DLLEXPORT extern int NCJclone(const NCjson* json, NCjson** clonep); ++OPTEXPORT int NCJclone(const NCjson* json, NCjson** clonep); + ++#ifndef NETCDF_JSON_H + /* dump NCjson* object to output file */ +-DLLEXPORT extern void NCJdump(const NCjson* json, unsigned flags, FILE*); ++OPTEXPORT void NCJdump(const NCjson* json, unsigned flags, FILE*); + #endif + + #if defined(__cplusplus) +@@ -130,8 +140,6 @@ DLLEXPORT extern void NCJdump(const NCjson* json, unsigned flags, FILE*); + TODO: make utf8 safe + */ + +-#define NCJSON_INTERNAL +- + #include + #include + #include +@@ -185,7 +193,7 @@ typedef struct NCJbuf { + + /**************************************************/ + +-#ifdef _WIN32 ++#if defined(_WIN32) && !defined(__MINGW32__) + #define strdup _strdup + #define strcasecmp _stricmp + #else +@@ -217,39 +225,58 @@ static int NCJyytext(NCJparser*, char* start, size_t pdlen); + static void NCJreclaimArray(struct NCjlist*); + static void NCJreclaimDict(struct NCjlist*); + static int NCJunescape(NCJparser* parser); ++static int unescape1(int c); + static int listappend(struct NCjlist* list, NCjson* element); + +-#ifndef NETCDF_JSON_H + static int NCJcloneArray(const NCjson* array, NCjson** clonep); + static int NCJcloneDict(const NCjson* dict, NCjson** clonep); + static int NCJunparseR(const NCjson* json, NCJbuf* buf, unsigned flags); + static int bytesappendquoted(NCJbuf* buf, const char* s); + static int bytesappend(NCJbuf* buf, const char* s); + static int bytesappendc(NCJbuf* bufp, const char c); +-#endif ++ ++/* Hide these for plugins */ ++#ifdef NETCDF_JSON_H ++#define OPTSTATIC static ++static int NCJparsen(size_t len, const char* text, unsigned flags, NCjson** jsonp); ++static int NCJnew(int sort, NCjson** objectp); ++static int NCJnewstring(int sort, const char* value, NCjson** jsonp); ++static int NCJnewstringn(int sort, size_t len, const char* value, NCjson** jsonp); ++static int NCJclone(const NCjson* json, NCjson** clonep); ++static int NCJaddstring(NCjson* json, int sort, const char* s); ++static int NCJinsert(NCjson* object, char* key, NCjson* jvalue); ++static int NCJappend(NCjson* object, NCjson* value); ++static int NCJunparse(const NCjson* json, unsigned flags, char** textp); ++#else /*!NETCDF_JSON_H*/ ++#define OPTSTATIC ++#endif /*NETCDF_JSON_H*/ + + /**************************************************/ + +-int ++OPTSTATIC int + NCJparse(const char* text, unsigned flags, NCjson** jsonp) ++{ ++ return NCJparsen(strlen(text),text,flags,jsonp); ++} ++ ++OPTSTATIC int ++NCJparsen(size_t len, const char* text, unsigned flags, NCjson** jsonp) + { + int stat = NCJ_OK; +- size_t len; + NCJparser* parser = NULL; + NCjson* json = NULL; + + /* Need at least 1 character of input */ +- if(text == NULL || text[0] == '\0') ++ if(len == 0 || text == NULL) + {stat = NCJTHROW(NCJ_ERR); goto done;} + if(jsonp == NULL) goto done; + parser = calloc(1,sizeof(NCJparser)); + if(parser == NULL) + {stat = NCJTHROW(NCJ_ERR); goto done;} +- len = strlen(text); + parser->text = (char*)malloc(len+1+1); + if(parser->text == NULL) + {stat = NCJTHROW(NCJ_ERR); goto done;} +- strcpy(parser->text,text); ++ memcpy(parser->text,text,len); + parser->text[len] = '\0'; + parser->text[len+1] = '\0'; + parser->pos = &parser->text[0]; +@@ -457,16 +484,21 @@ NCJlex(NCJparser* parser) + c = *parser->pos; + if(c == '\0') { + token = NCJ_EOF; +- } else if(c <= ' ' || c == '\177') { ++ } else if(c <= ' ' || c == '\177') {/* ignore whitespace */ + parser->pos++; +- continue; /* ignore whitespace */ ++ continue; ++ } else if(c == NCJ_ESCAPE) { ++ parser->pos++; ++ c = *parser->pos; ++ *parser->pos = unescape1(c); ++ continue; + } else if(strchr(JSON_WORD, c) != NULL) { + start = parser->pos; + for(;;) { + c = *parser->pos++; + if(c == '\0' || strchr(JSON_WORD,c) == NULL) break; /* end of word */ + } +- /* Pushback c if not whitespace */ ++ /* Pushback c */ + parser->pos--; + count = ((parser->pos) - start); + if(NCJyytext(parser,start,count)) goto done; +@@ -579,7 +611,7 @@ NCJyytext(NCJparser* parser, char* start, size_t pdlen) + + /**************************************************/ + +-void ++OPTSTATIC void + NCJreclaim(NCjson* json) + { + if(json == NULL) return; +@@ -621,7 +653,7 @@ NCJreclaimDict(struct NCjlist* dict) + /**************************************************/ + /* Build Functions */ + +-int ++OPTSTATIC int + NCJnew(int sort, NCjson** objectp) + { + int stat = NCJ_OK; +@@ -651,13 +683,13 @@ done: + return NCJTHROW(stat); + } + +-int ++OPTSTATIC int + NCJnewstring(int sort, const char* value, NCjson** jsonp) + { + return NCJTHROW(NCJnewstringn(sort,strlen(value),value,jsonp)); + } + +-int ++OPTSTATIC int + NCJnewstringn(int sort, size_t len, const char* value, NCjson** jsonp) + { + int stat = NCJ_OK; +@@ -679,7 +711,7 @@ done: + return NCJTHROW(stat); + } + +-int ++OPTSTATIC int + NCJdictget(const NCjson* dict, const char* key, NCjson** valuep) + { + int i,stat = NCJ_OK; +@@ -727,6 +759,21 @@ NCJunescape(NCJparser* parser) + return NCJTHROW(NCJ_OK); + } + ++/* Unescape a single character */ ++static int ++unescape1(int c) ++{ ++ switch (c) { ++ case 'b': c = '\b'; break; ++ case 'f': c = '\f'; break; ++ case 'n': c = '\n'; break; ++ case 'r': c = '\r'; break; ++ case 't': c = '\t'; break; ++ default: c = c; break;/* technically not Json conformant */ ++ } ++ return c; ++} ++ + #ifdef NCJDEBUG + static char* + tokenname(int token) +@@ -755,7 +802,7 @@ tokenname(int token) + #endif + + /* Convert a JSON value to an equivalent value of a specified sort */ +-int ++OPTSTATIC int + NCJcvt(const NCjson* jvalue, int outsort, struct NCJconst* output) + { + int stat = NCJ_OK; +@@ -864,9 +911,7 @@ done: + + /**************************************************/ + +-#ifndef NETCDF_JSON_H +- +-int ++OPTSTATIC int + NCJclone(const NCjson* json, NCjson** clonep) + { + int stat = NCJ_OK; +@@ -934,7 +979,7 @@ done: + return NCJTHROW(stat); + } + +-int ++OPTSTATIC int + NCJaddstring(NCjson* json, int sort, const char* s) + { + int stat = NCJ_OK; +@@ -952,7 +997,7 @@ done: + } + + /* Insert key-value pair into a dict object. key will be strdup'd */ +-int ++OPTSTATIC int + NCJinsert(NCjson* object, char* key, NCjson* jvalue) + { + int stat = NCJ_OK; +@@ -967,7 +1012,7 @@ done: + } + + /* Append value to an array or dict object. */ +-int ++OPTSTATIC int + NCJappend(NCjson* object, NCjson* value) + { + if(object == NULL || value == NULL) +@@ -986,7 +1031,7 @@ NCJappend(NCjson* object, NCjson* value) + /**************************************************/ + /* Unparser to convert NCjson object to text in buffer */ + +-int ++OPTSTATIC int + NCJunparse(const NCjson* json, unsigned flags, char** textp) + { + int stat = NCJ_OK; +@@ -1019,7 +1064,7 @@ NCJunparseR(const NCjson* json, NCJbuf* buf, unsigned flags) + if(json->list.len > 0 && json->list.contents != NULL) { + int shortlist = 0; + for(i=0;!shortlist && i < json->list.len;i+=2) { +- if(i > 0) bytesappendc(buf,NCJ_COMMA); ++ if(i > 0) {bytesappendc(buf,NCJ_COMMA);bytesappendc(buf,' ');}; + NCJunparseR(json->list.contents[i],buf,flags); /* key */ + bytesappendc(buf,NCJ_COLON); + bytesappendc(buf,' '); +@@ -1068,7 +1113,7 @@ escape(const char* text, NCJbuf* buf) + case '\n': replace = 'n'; break; + case '\r': replace = 'r'; break; + case '\t': replace = 't'; break; +- case NCJ_QUOTE: replace = '\''; break; ++ case NCJ_QUOTE: replace = '\"'; break; + case NCJ_ESCAPE: replace = '\\'; break; + default: break; + } +@@ -1090,17 +1135,6 @@ bytesappendquoted(NCJbuf* buf, const char* s) + return NCJTHROW(NCJ_OK); + } + +-void +-NCJdump(const NCjson* json, unsigned flags, FILE* out) +-{ +- char* text = NULL; +- (void)NCJunparse(json,0,&text); +- if(out == NULL) out = stderr; +- fprintf(out,"%s\n",text); +- fflush(out); +- nullfree(text); +-} +- + static int + bytesappend(NCJbuf* buf, const char* s) + { +@@ -1140,4 +1174,28 @@ bytesappendc(NCJbuf* bufp, const char c) + s[1] = '\0'; + return bytesappend(bufp,s); + } +-#endif /*!NETCDF_JSON_H*/ ++ ++OPTSTATIC void ++NCJdump(const NCjson* json, unsigned flags, FILE* out) ++{ ++ char* text = NULL; ++ (void)NCJunparse(json,0,&text); ++ if(out == NULL) out = stderr; ++ fprintf(out,"%s\n",text); ++ fflush(out); ++ nullfree(text); ++} ++ ++/* Hack to avoid static unused warning */ ++void ++netcdf_supresswarnings(void) ++{ ++ void* ignore; ++ ignore = (void*)NCJdump; ++ ignore = (void*)NCJinsert; ++ ignore = (void*)NCJaddstring; ++ ignore = (void*)NCJcvt; ++ ignore = (void*)NCJdictget; ++ ignore = (void*)NCJparse; ++ ignore = ignore; ++} +diff --git a/libdispatch/dhttp.c b/libdispatch/dhttp.c +index 250ddab17..70b8106c3 100644 +--- a/libdispatch/dhttp.c ++++ b/libdispatch/dhttp.c +@@ -482,6 +482,7 @@ setupconn(NC_HTTP_STATE* state, const char* objecturl) + cstat = curl_easy_setopt(state->curl, CURLOPT_FOLLOWLOCATION, 1); + if (cstat != CURLE_OK) goto fail; + ++ + /* Set the method */ + if((stat = nc_http_set_method(state,state->request.method))) goto done; + +diff --git a/libdispatch/drc.c b/libdispatch/drc.c +index e427eb8a7..e93689648 100644 +--- a/libdispatch/drc.c ++++ b/libdispatch/drc.c +@@ -130,6 +130,7 @@ NC_rcclear(NCRCinfo* info) + nullfree(info->rchome); + rcfreeentries(info->entries); + freeprofilelist(info->s3profiles); ++ + } + + static void +@@ -1024,6 +1025,8 @@ aws_load_credentials(NCglobalstate* gstate) + nclistpush(profiles,noprof); noprof = NULL; + } + ++ if(gstate->rcinfo->s3profiles) ++ freeprofilelist(gstate->rcinfo->s3profiles); + gstate->rcinfo->s3profiles = profiles; profiles = NULL; + + #ifdef AWSDEBUG +diff --git a/libdispatch/ncjson.c b/libdispatch/ncjson.c +index c0f85dd3f..b716fbdec 100644 +--- a/libdispatch/ncjson.c ++++ b/libdispatch/ncjson.c +@@ -6,7 +6,14 @@ + TODO: make utf8 safe + */ + +-#define NCJSON_INTERNAL ++/* ++WARNING: ++If you modify this file, ++then you need to got to ++the include/ directory ++and do the command: ++ make makenetcdfjson ++*/ + + #include + #include +@@ -97,24 +104,38 @@ static int NCJunescape(NCJparser* parser); + static int unescape1(int c); + static int listappend(struct NCjlist* list, NCjson* element); + +-#ifndef NETCDF_JSON_H + static int NCJcloneArray(const NCjson* array, NCjson** clonep); + static int NCJcloneDict(const NCjson* dict, NCjson** clonep); + static int NCJunparseR(const NCjson* json, NCJbuf* buf, unsigned flags); + static int bytesappendquoted(NCJbuf* buf, const char* s); + static int bytesappend(NCJbuf* buf, const char* s); + static int bytesappendc(NCJbuf* bufp, const char c); +-#endif ++ ++/* Hide these for plugins */ ++#ifdef NETCDF_JSON_H ++#define OPTSTATIC static ++static int NCJparsen(size_t len, const char* text, unsigned flags, NCjson** jsonp); ++static int NCJnew(int sort, NCjson** objectp); ++static int NCJnewstring(int sort, const char* value, NCjson** jsonp); ++static int NCJnewstringn(int sort, size_t len, const char* value, NCjson** jsonp); ++static int NCJclone(const NCjson* json, NCjson** clonep); ++static int NCJaddstring(NCjson* json, int sort, const char* s); ++static int NCJinsert(NCjson* object, char* key, NCjson* jvalue); ++static int NCJappend(NCjson* object, NCjson* value); ++static int NCJunparse(const NCjson* json, unsigned flags, char** textp); ++#else /*!NETCDF_JSON_H*/ ++#define OPTSTATIC ++#endif /*NETCDF_JSON_H*/ + + /**************************************************/ + +-int ++OPTSTATIC int + NCJparse(const char* text, unsigned flags, NCjson** jsonp) + { + return NCJparsen(strlen(text),text,flags,jsonp); + } + +-int ++OPTSTATIC int + NCJparsen(size_t len, const char* text, unsigned flags, NCjson** jsonp) + { + int stat = NCJ_OK; +@@ -466,7 +487,7 @@ NCJyytext(NCJparser* parser, char* start, size_t pdlen) + + /**************************************************/ + +-void ++OPTSTATIC void + NCJreclaim(NCjson* json) + { + if(json == NULL) return; +@@ -508,7 +529,7 @@ NCJreclaimDict(struct NCjlist* dict) + /**************************************************/ + /* Build Functions */ + +-int ++OPTSTATIC int + NCJnew(int sort, NCjson** objectp) + { + int stat = NCJ_OK; +@@ -538,13 +559,13 @@ done: + return NCJTHROW(stat); + } + +-int ++OPTSTATIC int + NCJnewstring(int sort, const char* value, NCjson** jsonp) + { + return NCJTHROW(NCJnewstringn(sort,strlen(value),value,jsonp)); + } + +-int ++OPTSTATIC int + NCJnewstringn(int sort, size_t len, const char* value, NCjson** jsonp) + { + int stat = NCJ_OK; +@@ -566,7 +587,7 @@ done: + return NCJTHROW(stat); + } + +-int ++OPTSTATIC int + NCJdictget(const NCjson* dict, const char* key, NCjson** valuep) + { + int i,stat = NCJ_OK; +@@ -657,7 +678,7 @@ tokenname(int token) + #endif + + /* Convert a JSON value to an equivalent value of a specified sort */ +-int ++OPTSTATIC int + NCJcvt(const NCjson* jvalue, int outsort, struct NCJconst* output) + { + int stat = NCJ_OK; +@@ -766,9 +787,7 @@ done: + + /**************************************************/ + +-#ifndef NETCDF_JSON_H +- +-int ++OPTSTATIC int + NCJclone(const NCjson* json, NCjson** clonep) + { + int stat = NCJ_OK; +@@ -836,7 +855,7 @@ done: + return NCJTHROW(stat); + } + +-int ++OPTSTATIC int + NCJaddstring(NCjson* json, int sort, const char* s) + { + int stat = NCJ_OK; +@@ -854,7 +873,7 @@ done: + } + + /* Insert key-value pair into a dict object. key will be strdup'd */ +-int ++OPTSTATIC int + NCJinsert(NCjson* object, char* key, NCjson* jvalue) + { + int stat = NCJ_OK; +@@ -869,7 +888,7 @@ done: + } + + /* Append value to an array or dict object. */ +-int ++OPTSTATIC int + NCJappend(NCjson* object, NCjson* value) + { + if(object == NULL || value == NULL) +@@ -888,7 +907,7 @@ NCJappend(NCjson* object, NCjson* value) + /**************************************************/ + /* Unparser to convert NCjson object to text in buffer */ + +-int ++OPTSTATIC int + NCJunparse(const NCjson* json, unsigned flags, char** textp) + { + int stat = NCJ_OK; +@@ -992,17 +1011,6 @@ bytesappendquoted(NCJbuf* buf, const char* s) + return NCJTHROW(NCJ_OK); + } + +-void +-NCJdump(const NCjson* json, unsigned flags, FILE* out) +-{ +- char* text = NULL; +- (void)NCJunparse(json,0,&text); +- if(out == NULL) out = stderr; +- fprintf(out,"%s\n",text); +- fflush(out); +- nullfree(text); +-} +- + static int + bytesappend(NCJbuf* buf, const char* s) + { +@@ -1042,4 +1050,29 @@ bytesappendc(NCJbuf* bufp, const char c) + s[1] = '\0'; + return bytesappend(bufp,s); + } +-#endif /*!NETCDF_JSON_H*/ ++ ++OPTSTATIC void ++NCJdump(const NCjson* json, unsigned flags, FILE* out) ++{ ++ char* text = NULL; ++ (void)NCJunparse(json,0,&text); ++ if(out == NULL) out = stderr; ++ fprintf(out,"%s\n",text); ++ fflush(out); ++ nullfree(text); ++} ++ ++/* Hack to avoid static unused warning */ ++static void ++netcdf_supresswarnings(void) ++{ ++ void* ignore; ++ ignore = (void*)netcdf_supresswarnings; ++ ignore = (void*)NCJdump; ++ ignore = (void*)NCJinsert; ++ ignore = (void*)NCJaddstring; ++ ignore = (void*)NCJcvt; ++ ignore = (void*)NCJdictget; ++ ignore = (void*)NCJparse; ++ ignore = ignore; ++} +diff --git a/nc_test4/tst_vars3.c b/nc_test4/tst_vars3.c +index 1b5a7ce79..734017c4d 100644 +--- a/nc_test4/tst_vars3.c ++++ b/nc_test4/tst_vars3.c +@@ -748,9 +748,9 @@ main(int argc, char **argv) + params[1] = NC_SZIP_EC_BPP_IN; /* pixels_per_block */ + if (nc_def_var_chunking(ncid, varid, NC_CHUNKED, NULL)) ERR; + { int stat; +- if ((stat = nc_def_var_filter(ncid, varid, H5_FILTER_SZIP, NUM_PARAMS_IN, +- params)) != NC_ENOFILTER) +- ERR; ++ stat = nc_def_var_filter(ncid, varid, H5_FILTER_SZIP, NUM_PARAMS_IN, params); ++ if(stat != NC_ENOFILTER) ++ ERR; + } + if (nc_def_var_szip(ncid, varid, NC_SZIP_NN, + NC_SZIP_EC_BPP_IN) != NC_ENOFILTER) ERR; +diff --git a/ncdump/tst_vlen_data.c b/ncdump/tst_vlen_data.c +index 9b1850e8f..ad5d18388 100644 +--- a/ncdump/tst_vlen_data.c ++++ b/ncdump/tst_vlen_data.c +@@ -28,6 +28,10 @@ The leak may be in HDF5. + #define ATT5_LEN 1 + #define NROWS 5 + ++/* Use reclaim_data */ ++#undef RECLAIM ++ ++ + int + main(int argc, char **argv) + { +@@ -64,7 +68,7 @@ main(int argc, char **argv) + if (nc_def_var(ncid, VAR5_NAME, typeid, VAR5_RANK, var_dims, &varid)) ERR; + + /* Create and write a variable attribute of the vlen type */ +-#if 0 ++#ifdef RECLAIM + /* In order to use ncaux_reclaim_data, all the interior nodes must have been alloc'd */ + missing_val.p = (float*)malloc(sizeof(missing_value)); + memcpy((void*)missing_val.p,&missing_value,sizeof(missing_value)); +@@ -74,7 +78,7 @@ main(int argc, char **argv) + missing_val.len = 1; + if (nc_put_att(ncid, varid, ATT5_NAME, typeid, ATT5_LEN, (void *) &missing_val)) ERR; + if (nc_enddef(ncid)) ERR; +-#if 0 ++#ifdef RECLAIM + /* reclaim */ + if(ncaux_reclaim_data(ncid,typeid,&missing_val,1)) ERR; + #endif +diff --git a/ncgen3/run_tests.sh b/ncgen3/run_tests.sh +index fcba7489e..8e300092c 100755 +--- a/ncgen3/run_tests.sh ++++ b/ncgen3/run_tests.sh +@@ -3,6 +3,7 @@ + # $Id: run_tests.sh,v 1.9 2009/09/24 18:19:11 dmh Exp $ + + echo "*** Testing ncgen3." ++ + set -e + + if test "x$srcdir" = x ;then srcdir=`pwd`; fi diff --git a/recipe/patches/fix-rename.patch b/recipe/patches/fix-rename.patch deleted file mode 100644 index d4603e50..00000000 --- a/recipe/patches/fix-rename.patch +++ /dev/null @@ -1,26 +0,0 @@ -commit 4f37d1a82648123d696e8490bfc54a792d21de1e -Author: Dennis Heimbigner -Date: Tue Aug 24 15:11:26 2021 -0600 - - Make Issue https://github.com/Unidata/netcdf-c/issues/2077 work when build is repeated. - - re: https://github.com/Unidata/netcdf-c/pull/2075 - - The long file name fix fails when the build is manually repeated - because the source file has already been renamed. Solution is to - test if the dest file exists or not before doing the rename. - -diff --git a/dap4_test/baselinethredds/CMakeLists.txt b/dap4_test/baselinethredds/CMakeLists.txt -index 4420c0e54..50bc61111 100644 ---- a/dap4_test/baselinethredds/CMakeLists.txt -+++ b/dap4_test/baselinethredds/CMakeLists.txt -@@ -12,7 +12,9 @@ FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSION - ## - # Rename file in support of https://github.com/Unidata/netcdf-c/issues/2077 - ## -+IF(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/GOES16_CONUS_20170821_020218_0.47_1km_33.3N_91.4W.nc4.thredds) - FILE(RENAME ${CMAKE_CURRENT_BINARY_DIR}/GOES16_TEST1.nc4.thredds ${CMAKE_CURRENT_BINARY_DIR}/GOES16_CONUS_20170821_020218_0.47_1km_33.3N_91.4W.nc4.thredds) -+ENDIF() - - FILE(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*) - SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt) diff --git a/recipe/patches/fix-tests.patch b/recipe/patches/fix-tests.patch new file mode 100644 index 00000000..c7bd2fd1 --- /dev/null +++ b/recipe/patches/fix-tests.patch @@ -0,0 +1,93 @@ +commit 46ed3a1da720ca9ec180974f3ebfb97b4286e6ce +Author: Dennis Heimbigner +Date: Fri Sep 16 18:58:36 2022 -0600 + + Cleanup built test sources in nczarr_test + + re: https://github.com/conda-forge/libnetcdf-feedstock/pull/140 + + Some test are BUILTSOURCE in nczarr_test. But apparently + I did not do it correctly. SO try to cleanup their construction. + +diff --git a/nczarr_test/Makefile.am b/nczarr_test/Makefile.am +index 6c237d778..1798455aa 100644 +--- a/nczarr_test/Makefile.am ++++ b/nczarr_test/Makefile.am +@@ -129,7 +129,7 @@ EXTRA_DIST = CMakeLists.txt \ + run_ut_map.sh run_ut_mapapi.sh run_ut_misc.sh run_ut_chunk.sh run_ncgen4.sh \ + run_nccopyz.sh run_fillonlyz.sh run_chunkcases.sh test_nczarr.sh run_perf_chunks1.sh run_s3_cleanup.sh \ + run_purezarr.sh run_interop.sh run_misc.sh \ +-run_filter.sh run_specific_filters.sh \ ++run_filter.sh \ + run_newformat.sh run_nczarr_fill.sh run_quantize.sh \ + run_jsonconvention.sh run_nczfilter.sh run_unknown.sh \ + run_scalar.sh run_strings.sh run_nulls.sh +@@ -161,7 +161,7 @@ EXTRA_DIST += ref_power_901_constants_orig.zip ref_power_901_constants.cdl ref_q + + CLEANFILES = ut_*.txt ut*.cdl tmp*.nc tmp*.cdl tmp*.txt tmp*.dmp tmp*.zip tmp*.nc tmp*.dump tmp*.tmp tmp_ngc.c ref_zarr_test_data.cdl tst_*.nc.zip ref_quotes.zip ref_power_901_constants.zip + +-BUILT_SOURCES = test_quantize.c test_filter_avail.c run_specific_filters.sh run_filterinstall.sh ++BUILT_SOURCES = test_quantize.c test_filter_avail.c run_specific_filters.sh run_filterinstall.sh run_unknown.sh + test_quantize.c: $(top_srcdir)/nc_test4/tst_quantize.c + rm -f $@ + echo "#define TESTNCZARR" > $@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ba66a6d..f987eb5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1057,17 +1078,26 @@ OPTION(ENABLE_BYTERANGE "Enable byte-range access to remote datasets.." OFF) + # Check for the math library so it can be explicitly linked. + IF(NOT WIN32) + FIND_LIBRARY(HAVE_LIBM NAMES math m libm) +- MESSAGE(STATUS "Found Math library: ${HAVE_LIBM}") + IF(NOT HAVE_LIBM) +- MESSAGE(FATAL_ERROR "Unable to find the math library.") ++ CHECK_FUNCTION_EXISTS(exp HAVE_LIBM_FUNC) ++ IF(NOT HAVE_LIBM_FUNC) ++ MESSAGE(FATAL_ERROR "Unable to find the math library.") ++ ELSE(NOT HAVE_LIBM_FUNC) ++ SET(HAVE_LIBM "") ++ ENDIF() ++ ELSE(NOT HAVE_LIBM) ++ MESSAGE(STATUS "Found Math library: ${HAVE_LIBM}") + ENDIF() + ENDIF() + + # Option to Enable DAP long tests, remote tests. + OPTION(ENABLE_DAP_REMOTE_TESTS "Enable DAP remote tests." ON) ++OPTION(ENABLE_EXTERNAL_SERVER_TESTS "Enable external Server remote tests." OFF) + OPTION(ENABLE_DAP_LONG_TESTS "Enable DAP long tests." OFF) + SET(REMOTETESTSERVERS "remotetest.unidata.ucar.edu" CACHE STRING "test servers to use for remote test") + ++SET(REMOTETESTSERVERS "remotetest.unidata.ucar.edu" CACHE STRING "test servers to use for remote test") ++ + # See if we have zlib + FIND_PACKAGE(ZLIB) + @@ -1057,17 +1078,26 @@ OPTION(ENABLE_BYTERANGE "Enable byte-range access to remote datasets.." OFF) + # Check for the math library so it can be explicitly linked. + IF(NOT WIN32) + FIND_LIBRARY(HAVE_LIBM NAMES math m libm) +- MESSAGE(STATUS "Found Math library: ${HAVE_LIBM}") + IF(NOT HAVE_LIBM) +- MESSAGE(FATAL_ERROR "Unable to find the math library.") ++ CHECK_FUNCTION_EXISTS(exp HAVE_LIBM_FUNC) ++ IF(NOT HAVE_LIBM_FUNC) ++ MESSAGE(FATAL_ERROR "Unable to find the math library.") ++ ELSE(NOT HAVE_LIBM_FUNC) ++ SET(HAVE_LIBM "") ++ ENDIF() ++ ELSE(NOT HAVE_LIBM) ++ MESSAGE(STATUS "Found Math library: ${HAVE_LIBM}") + ENDIF() + ENDIF() + + # Option to Enable DAP long tests, remote tests. + OPTION(ENABLE_DAP_REMOTE_TESTS "Enable DAP remote tests." ON) ++OPTION(ENABLE_EXTERNAL_SERVER_TESTS "Enable external Server remote tests." OFF) + OPTION(ENABLE_DAP_LONG_TESTS "Enable DAP long tests." OFF) + SET(REMOTETESTSERVERS "remotetest.unidata.ucar.edu" CACHE STRING "test servers to use for remote test") + ++SET(REMOTETESTSERVERS "remotetest.unidata.ucar.edu" CACHE STRING "test servers to use for remote test") ++ + # See if we have zlib + FIND_PACKAGE(ZLIB) \ No newline at end of file diff --git a/recipe/patches/fix_cmake.patch b/recipe/patches/fix_cmake.patch index 59a32c5a..7f40c2eb 100644 --- a/recipe/patches/fix_cmake.patch +++ b/recipe/patches/fix_cmake.patch @@ -1,19 +1,19 @@ -commit 793ae8c2b4cc651d9c6670bb03ebb0740987f4f6 -Author: Ryan May -Date: Wed Aug 25 16:29:45 2021 -0600 - - Revert "Simply version check logic" - - This reverts commit e755a08f11dc7a3b31039a912334505bdd90ecd8. - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index e1b620fee..dc95eeae9 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -818,11 +818,19 @@ IF(USE_HDF5) +diff --color -Naur netcdf-c-4.9.0.orig/CMakeLists.txt netcdf-c-4.9.0/CMakeLists.txt +--- netcdf-c-4.9.0.orig/CMakeLists.txt 2022-06-10 18:04:15.000000000 -0300 ++++ netcdf-c-4.9.0/CMakeLists.txt 2022-06-13 10:29:40.177921583 -0300 +@@ -39,7 +39,7 @@ + SET(PACKAGE_VERSION ${VERSION}) + # These values should match those in configure.ac +-SET(netCDF_LIB_VERSION 19}) ++SET(netCDF_LIB_VERSION 19) + SET(netCDF_SO_VERSION 19) + + # Version of the dispatch table. This must match the value in +@@ -893,11 +893,19 @@ # Check to see if HDF5 library is 1.10.6 or greater. # Used to control path name conversion + #### - IF(${HDF5_VERSION} VERSION_GREATER "1.10.5") - SET(HDF5_UTF8_PATHS ON) - ELSE() @@ -33,13 +33,12 @@ index e1b620fee..dc95eeae9 100644 + SET(HDF5_UTF8_PATHS ON) + ENDIF(HDF5_VERSION_1106) - MESSAGE("-- Checking for HDF5 version 1.10.6 or later: ${HDF5_UTF8_PATHS}") + MESSAGE("-- HDF5_UTF8_PATHS (HDF5 version 1.10.6+): ${HDF5_UTF8_PATHS}") -diff --git a/nc_test4/CMakeLists.txt b/nc_test4/CMakeLists.txt -index c5c345005..d4f97bfd7 100644 ---- a/nc_test4/CMakeLists.txt -+++ b/nc_test4/CMakeLists.txt -@@ -47,10 +47,6 @@ ENDIF(ENABLE_FILTER_TESTING) +diff --color -Naur netcdf-c-4.9.0.orig/nc_test4/CMakeLists.txt netcdf-c-4.9.0/nc_test4/CMakeLists.txt +--- netcdf-c-4.9.0.orig/nc_test4/CMakeLists.txt 2022-06-10 18:04:15.000000000 -0300 ++++ netcdf-c-4.9.0/nc_test4/CMakeLists.txt 2022-06-13 10:29:54.401820897 -0300 +@@ -59,10 +59,6 @@ ENDIF(BUILD_UTILITIES) diff --git a/recipe/patches/incorrect_library_versionand_filename_in_4.9.0.patch b/recipe/patches/incorrect_library_versionand_filename_in_4.9.0.patch new file mode 100644 index 00000000..c5feb5f2 --- /dev/null +++ b/recipe/patches/incorrect_library_versionand_filename_in_4.9.0.patch @@ -0,0 +1,11 @@ +--- netcdf-c-4.9.0.orig/CMakeLists.txt 2022-06-10 18:04:15.000000000 -0300 ++++ netcdf-c-4.9.0/CMakeLists.txt 2022-06-13 09:22:39.516181352 -0300 +@@ -39,7 +39,7 @@ + SET(PACKAGE_VERSION ${VERSION}) + + # These values should match those in configure.ac +-SET(netCDF_LIB_VERSION 19}) ++SET(netCDF_LIB_VERSION 19) + SET(netCDF_SO_VERSION 19) + + # Version of the dispatch table. This must match the value in