From d7e57d261a0a7e011a67f56d51266213bf6b6bbb Mon Sep 17 00:00:00 2001 From: Dennis Heimbigner Date: Tue, 24 May 2022 20:05:19 -0600 Subject: [PATCH] Update to default --with-plugin-dir to yes --- CMakeLists.txt | 38 ++++++++++++++------------------- configure.ac | 15 +++++++------ docs/filters.md | 12 ++++++++++- nc_test/Makefile.am | 8 +++---- nc_test/run_pnetcdf_tests.sh.in | 1 - nc_test4/tst_filterinstall.sh | 2 ++ nczarr_test/Makefile.am | 8 +++---- plugins/CMakeLists.txt | 17 ++++++++------- 8 files changed, 54 insertions(+), 47 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 05870e762..6a3629b05 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1118,9 +1118,9 @@ ELSE() set(STD_FILTERS "${STD_FILTERS} bz2") ENDIF() -# If user wants, then install selected plugins -SET(PLUGIN_INSTALL_DIR "" CACHE STRING "Whether and where we should install plugins") -SET(ENABLE_PLUGIN_INSTALL NO) +# If user wants, then install selected plugins (default on) +SET(PLUGIN_INSTALL_DIR "YES" CACHE STRING "Whether and where we should install plugins; defaults to yes") +SET(ENABLE_PLUGIN_INSTALL YES) IF(DEFINED PLUGIN_INSTALL_DIR) #OR DEFINED CACHE{PLUGIN_INSTALL_DIR} STRING(TOLOWER "${PLUGIN_INSTALL_DIR}" LCPID) IF(LCPID STREQUAL "no") @@ -1130,36 +1130,30 @@ IF(DEFINED PLUGIN_INSTALL_DIR) #OR DEFINED CACHE{PLUGIN_INSTALL_DIR} ENDIF() ENDIF() -IF(PLUGIN_INSTALL_DIR STREQUAL "" OR PLUGIN_INSTALL_DIR STREQUAL "yes") - SET(PLUGIN_INSTALL_DIR "YES") -ENDIF() - IF(ENABLE_PLUGIN_INSTALL AND PLUGIN_INSTALL_DIR STREQUAL "YES") # Default to last dir (lowest search priority) in HDF5_PLUGIN_PATH - IF(DEFINED $ENV{HDF5_PLUGIN_PATH}) - SET(PLUGIN_PATH "$HDF5_PLUGIN_PATH") + IF(DEFINED ENV{HDF5_PLUGIN_PATH}) + SET(PLUGIN_PATH "$ENV{HDF5_PLUGIN_PATH}") ELSE() IF(ISMSVC OR ISMINGW) - SET(PLUGIN_PATH "$ENV{ALLUSERSPROFILE}\\hdfd5\\lib\\plugin") + SET(PLUGIN_PATH "$ENV{ALLUSERSPROFILE}\\hdf5\\lib\\plugin") ELSE() SET(PLUGIN_PATH "/usr/local/hdf5/lib/plugin") ENDIF() ENDIF() ENDIF() -# Assume PLUGIN_PATH is defined -# Use the lowest priority dir in the path -IF(NOT ISMSVC AND NOT ISMINGW) - STRING(REPLACE ":" ";" PATH_LIST ${PLUGIN_PATH}) -ELSE() - SET(PATH_LIST ${PLUGIN_PATH}) -ENDIF() +IF(ENABLE_PLUGIN_INSTALL) + # Use the lowest priority dir in the path + IF(NOT ISMSVC AND NOT ISMINGW) + STRING(REPLACE ":" ";" PATH_LIST ${PLUGIN_PATH}) + ELSE() + SET(PATH_LIST ${PLUGIN_PATH}) + ENDIF() -# Get last element -LIST(GET PATH_LIST -1 PLUGIN_INSTALL_DIR) -MESSAGE(WARNING "Defaulting to -DPLUGIN_INSTALL_DIR=${PLUGIN_INSTALL_DIR}") - -IF(ENABLE_PLUGIN_INSTALL) + # Get last element + LIST(GET PATH_LIST -1 PLUGIN_INSTALL_DIR) + MESSAGE("Defaulting to -DPLUGIN_INSTALL_DIR=${PLUGIN_INSTALL_DIR}") SET(PLUGIN_INSTALL_DIR_SETTING "${PLUGIN_INSTALL_DIR}") ELSE() # No option specified UNSET(PLUGIN_INSTALL_DIR) diff --git a/configure.ac b/configure.ac index 9ce6c6d8a..cce149b3e 100644 --- a/configure.ac +++ b/configure.ac @@ -1891,9 +1891,9 @@ AC_SUBST(STD_FILTERS,[$std_filters]) # If user wants, then install selected standard filters AC_MSG_CHECKING([whether and where we should install plugins]) -AC_ARG_WITH([plugin-dir], [AS_HELP_STRING([--with-plugin-dir=], - [Install selected standard filters in specified directory])], - [],[with_plugin_dir=no]) +AC_ARG_WITH([plugin-dir], [AS_HELP_STRING([--with-plugin-dir=|no|--without-plugin-dir], + [Install selected standard filters in specified or default directory])], + [],[with_plugin_dir=yes]) AC_MSG_RESULT([$with_plugin_dir]) if test "x$with_plugin_dir" = xno ; then # option missing|disabled with_plugin_dir=no @@ -1911,15 +1911,17 @@ elif test "x$with_plugin_dir" = xyes ; then # --with-plugin-dir, no argument fi # Use the lowest priority dir in the path if test "x$ISMSVC" = xyes || test "x$ISMINGW" = xyes; then - PLUGIN_DIR=`echo "$PLUGIN_PATH" | sed -e 's|\([^;]*[;]\)*\(.*\)|\2|'` + PLUGIN_DIR=`echo "$PLUGIN_PATH" | tr ';' ' '` else - PLUGIN_DIR=`echo "$PLUGIN_PATH" | sed -e 's|\([^:]*[:]\)*\(.*\)|\2|'` + PLUGIN_DIR=`echo "$PLUGIN_PATH" | tr ':' ' '` fi + for pp in ${PLUGIN_DIR} ; do last="$pp"; done + PLUGIN_DIR="$last" with_plugin_dir_setting="$PLUGIN_DIR" # canonical form is all forward slashes with_plugin_dir=`echo "$PLUGIN_DIR" | tr '\\\\' '/'` enable_plugin_dir=yes - AC_MSG_NOTICE([Defaulting to --with-plugin-path=$with_plugin_dir]) + AC_MSG_NOTICE([Defaulting to --with-plugin-dir=$with_plugin_dir]) else # --with-plugin-dir= with_plugin_dir_setting="$with_plugin_dir" enable_plugin_dir=yes @@ -2019,7 +2021,6 @@ AC_CONFIG_FILES(test_common.sh:test_common.in) AC_CONFIG_FILES(nc_test4/findplugin.sh:nc_test4/findplugin.in) AC_CONFIG_FILES(nczarr_test/findplugin.sh:nc_test4/findplugin.in) AC_CONFIG_FILES(plugins/findplugin.sh:nc_test4/findplugin.in) -AC_CONFIG_FILES(plugins/stdinstall.sh:plugins/stdinstall.in) AC_CONFIG_FILES(examples/C/findplugin.sh:nc_test4/findplugin.in) AC_CONFIG_FILES(ncdap_test/findtestserver.c:ncdap_test/findtestserver.c.in) AC_CONFIG_FILES([nc_test/run_pnetcdf_tests.sh:nc_test/run_pnetcdf_tests.sh.in],[chmod ugo+x nc_test/run_pnetcdf_tests.sh]) diff --git a/docs/filters.md b/docs/filters.md index be65aca6b..82c2ad6c3 100644 --- a/docs/filters.md +++ b/docs/filters.md @@ -1087,7 +1087,7 @@ It is important to note that in order to use each standard filter, several addit Consider the zstandard compressor, which is one of the supported standard filters. When installing the netcdf library, the following other libraries must be installed. -1. *libzstd.so* | *zstd.dll* | *libzstd.0.dylib* -- The actual zstandard compressor library; typically installed by using your platform specific package manager. +1. *libzstd.so* | *zstd.dll* | *libzstd.dylib* -- The actual zstandard compressor library; typically installed by using your platform specific package manager. 2. The HDF5 wrapper for *libzstd.so* -- There are several options for obtaining this (see [Appendix G](#filters_appendixg).) 3. (Optional) The Zarr wrapper for *libzstd.so* -- you need this if you intend to read/write Zarr datasets that were compressed using zstandard; again see [Appendix G](#filters_appendixg). @@ -1131,6 +1131,16 @@ or its corresponding *cmake* option. or -DPLUGIN_INSTALL_DIR=YES ```` +This option defaults to the value "yes", which means that filters are +installed by default. This can be disabled by one of the following options. +```` +--without-plugin-dir (automake) +or +--with-plugin-dir=no (automake) +or +-DPLUGIN_INSTALL_DIR=NO (CMake) +```` + If the option is specified with no argument (automake) or with the value "YES" (CMake), then it defaults (in order) to the following directories: 1. If the HDF5_PLUGIN_PATH environment variable is defined, then last directory in the list of directories in the path is used. diff --git a/nc_test/Makefile.am b/nc_test/Makefile.am index e102346c6..39ef40596 100644 --- a/nc_test/Makefile.am +++ b/nc_test/Makefile.am @@ -7,10 +7,10 @@ # Ed Hartnett, Dennis Heimbigner, Ward Fisher # Un comment to use a more verbose test driver -SH_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose -sh_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose -LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose -TESTS_ENVIRONMENT = export SETX=1; +#SH_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose +#sh_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose +#LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose +#TESTS_ENVIRONMENT = export SETX=1; # Put together AM_CPPFLAGS and AM_LDFLAGS. include $(top_srcdir)/lib_flags.am diff --git a/nc_test/run_pnetcdf_tests.sh.in b/nc_test/run_pnetcdf_tests.sh.in index 2908f8d3f..9ddb532af 100755 --- a/nc_test/run_pnetcdf_tests.sh.in +++ b/nc_test/run_pnetcdf_tests.sh.in @@ -2,7 +2,6 @@ # This script runs some PnetCDF I/O tests -set -x set -e echo diff --git a/nc_test4/tst_filterinstall.sh b/nc_test4/tst_filterinstall.sh index 465a42141..9b119d88e 100755 --- a/nc_test4/tst_filterinstall.sh +++ b/nc_test4/tst_filterinstall.sh @@ -1,6 +1,8 @@ #!/bin/bash # Test the filter install +# This cannot be run as a regular test +# because installation will not have occurred if test "x$srcdir" = x ; then srcdir=`pwd`; fi . ../test_common.sh diff --git a/nczarr_test/Makefile.am b/nczarr_test/Makefile.am index 261d3dcc9..ca43d28b3 100644 --- a/nczarr_test/Makefile.am +++ b/nczarr_test/Makefile.am @@ -10,10 +10,10 @@ TESTS_ENVIRONMENT = #TEST_EXTENSIONS = .sh -SH_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose -sh_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose -LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose -TESTS_ENVIRONMENT += export SETX=1; +#SH_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose +#sh_LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose +#LOG_DRIVER = $(SHELL) $(top_srcdir)/test-driver-verbose +#TESTS_ENVIRONMENT += export SETX=1; AM_CPPFLAGS += -I${top_srcdir} -I${top_srcdir}/libnczarr AM_LDFLAGS += ${top_builddir}/liblib/libnetcdf.la diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 7634a897b..8ca75c8eb 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -10,7 +10,7 @@ IF(MSVC) SET(PLUGINEXT "dll") SET(PLUGINPRE "__nc") ELSE() - SET(PLUGINPRE "__nc") # Note that CMake will prepend "lib" + SET(PLUGINPRE "lib__nc") if(APPLE) SET(PLUGINEXT "dylib") ELSE() @@ -48,11 +48,12 @@ SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_BINARY_DIR}") SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_BINARY_DIR}") MACRO(buildplugin TARGET TARGETLIB) - SET(MANGLE "${PLUGINPRE}${TARGETLIB}") + SET(MANGLELIB "${PLUGINPRE}${TARGETLIB}") ADD_LIBRARY(${TARGET} MODULE ${${TARGET}_SOURCES}) - SET_TARGET_PROPERTIES(${TARGET} PROPERTIES LIBRARY_OUTPUT_NAME ${MANGLE}) - SET_TARGET_PROPERTIES(${TARGET} PROPERTIES ARCHIVE_OUTPUT_NAME ${MANGLE}) - SET_TARGET_PROPERTIES(${TARGET} PROPERTIES RUNTIME_OUTPUT_NAME ${MANGLE}) + SET_TARGET_PROPERTIES(${TARGET} PROPERTIES LIBRARY_OUTPUT_NAME ${MANGLELIB}) + SET_TARGET_PROPERTIES(${TARGET} PROPERTIES ARCHIVE_OUTPUT_NAME ${MANGLELIB}) + SET_TARGET_PROPERTIES(${TARGET} PROPERTIES RUNTIME_OUTPUT_NAME ${MANGLELIB}) + SET_TARGET_PROPERTIES(${TARGET} PROPERTIES PREFIX "") # Critical that this be set to "" TARGET_LINK_LIBRARIES(${TARGET} ${ALL_TLL_LIBS};${ARGN}) IF(MSVC) target_compile_options(${TARGET} PRIVATE /Zi) @@ -105,9 +106,9 @@ ENDIF() IF(ENABLE_PLUGIN_INSTALL) MACRO(installplugin PLUG) - SET(BUILD_PLUGIN_LIB "${PLUGINPRE}${PLUG}.${PLUGINEXT}") - MESSAGE(STATUS "Installing: ${BUILD_PLUGIN_LIB} into ${PLUGIN_INSTALL_DIR}") - install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${BUILD_PLUGIN_LIB} DESTINATION ${PLUGIN_INSTALL_DIR}) + SET(INSTALLED_PLUGIN_LIB "${PLUGINPRE}${PLUG}.${PLUGINEXT}") + MESSAGE(STATUS "Installing: ${INSTALLED_PLUGIN_LIB} into ${PLUGIN_INSTALL_DIR}") + install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${INSTALLED_PLUGIN_LIB} DESTINATION ${PLUGIN_INSTALL_DIR}) ENDMACRO() install(DIRECTORY DESTINATION ${PLUGIN_INSTALL_DIR})