Repository: Unidata/netcdf-c
Pull request #2707 (2023-06-08 20:54:38)

Remove fortran bootstrap option
Removing the deprecated, always-experimental, poorly-maintained option for bootstrapping netCDF-Fortran when configuring/installing netCDF-C. 


Patch:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6630a1635..b4a95d952 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -442,30 +442,6 @@ OPTION(ENABLE_MMAP "Use MMAP." ON)
 # Option to use examples.
 OPTION(ENABLE_EXAMPLES "Build Examples" ON)
 
-# Option to automatically build netcdf-fortran.
-IF(NOT MSVC)
-  OPTION(ENABLE_REMOTE_FORTRAN_BOOTSTRAP "Download and build netcdf-fortran automatically (EXPERIMENTAL)." OFF)
-  IF(ENABLE_REMOTE_FORTRAN_BOOTSTRAP)
-    SET(BUILD_FORTRAN ON)
-  ENDIF()
-  IF(BUILD_FORTRAN)
-    CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/postinstall.sh.in"
-      "${CMAKE_BINARY_DIR}/postinstall.sh"
-      @ONLY)
-
-    ADD_CUSTOM_TARGET(build-netcdf-fortran
-      COMMAND sh -c "${CMAKE_BINARY_DIR}/postinstall.sh -t cmake -a build"
-      DEPENDS netcdf
-      )
-
-    ADD_CUSTOM_TARGET(install-netcdf-fortran
-      COMMAND sh -c "${CMAKE_BINARY_DIR}/postinstall.sh -t cmake -a install"
-      DEPENDS build-netcdf-fortran
-      )
-
-  ENDIF(BUILD_FORTRAN)
-ENDIF()
-
 ###
 # Allow the user to specify libraries
 # to link against, similar to automakes 'LIBS' variable.
diff --git a/Makefile.am b/Makefile.am
index c24f2c19d..b72b9eee1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -168,32 +168,6 @@ mm4::
 	  b=`basename $$m` ; d=`dirname $$m`;\
 	  pushd $$d; m4 -s $${b}.m4 > $${b}.c ; popd; done
 
-#####
-# If ENABLE_FORTRAN was turned on,
-# we have new make targets, build-netcdf-fortran and
-# install-netcdf-fortran.
-#####
-
-###
-# build-netcdf-fortran
-###
-if BUILD_FORTRAN
-
-build-netcdf-fortran:
-	echo "Downloading and Building NetCDF-Fortran"
-	chmod u+x $(abs_top_builddir)/postinstall.sh
-	sh -c "$(abs_top_builddir)/postinstall.sh -t autotools -a build"
-
-###
-# install-netcdf-fortran
-###
-install-netcdf-fortran:
-	echo "Installing NetCDF-Fortran"
-	chmod u+x $(abs_top_builddir)/postinstall.sh
-	sh -c "$(abs_top_builddir)/postinstall.sh -t autotools -a install"
-
-endif
-
 check_nc_config:
 	$(CC) `./nc-config --cflags` test_prog.c -o test_prog `./nc-config --libs`
 	./test_prog
diff --git a/config.h.cmake.in b/config.h.cmake.in
index ef1384ae8..ab5c03715 100644
--- a/config.h.cmake.in
+++ b/config.h.cmake.in
@@ -74,9 +74,6 @@ are set when opening a binary file on Windows. */
 /* Define if building universal (internal helper macro) */
 #cmakedefine AC_APPLE_UNIVERSAL_BUILD 1
 
-/* If true, will attempt to download and build netcdf-fortran. */
-#cmakedefine BUILD_FORTRAN 1
-
 /* default file chunk cache nelems. */
 #cmakedefine CHUNK_CACHE_NELEMS ${CHUNK_CACHE_NELEMS}
 
diff --git a/configure.ac b/configure.ac
index 1c49a0cb2..f68feaaaa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -352,14 +352,6 @@ if test "x$enable_hdf4_file_tests" = xyes; then
 fi
 AC_MSG_RESULT($enable_hdf4_file_tests)
 
-# Does the user want to try to install netcdf-fortran
-# automatically?
-AC_MSG_CHECKING([whether we should attempt to install netcdf-fortran (EXPERIMENTAL)])
-AC_ARG_ENABLE([remote-fortran-bootstrap], [AS_HELP_STRING([--enable-remote-fortran-bootstrap],
-			 [Download and install netcdf-fortran (EXPERIMENTAL)])])
-test "x$enable_remote_fortran_bootstrap" = xyes || enable_remote_fortran_bootstrap=no
-AC_MSG_RESULT([$enable_remote_fortran_bootstrap])
-
 # Does the user want to run extra parallel tests when parallel netCDF-4 is built?
 AC_MSG_CHECKING([whether parallel IO tests should be run])
 AC_ARG_ENABLE([parallel-tests],
@@ -1757,11 +1749,6 @@ if test "x$enable_erange_fill" = xyes ; then
 fi
 AC_SUBST(M4FLAGS)
 
-# Check for downloading/building fortran via postinstall script.
-if test "x$enable_remote_fortran_bootstrap" = xyes; then
-   AC_DEFINE([BUILD_FORTRAN], 1, [If true, will attempt to download and build netcdf-fortran.])
-fi
-
 # No logging for netcdf-3.
 if test "x$enable_netcdf_4" = xno; then
    enable_logging=no
@@ -1842,7 +1829,6 @@ AM_CONDITIONAL(USE_HDF5, [test x$enable_hdf5 = xyes])
 AM_CONDITIONAL(USE_HDF4, [test x$enable_hdf4 = xyes])
 AM_CONDITIONAL(USE_HDF4_FILE_TESTS, [test x$enable_hdf4_file_tests = xyes])
 AM_CONDITIONAL(USE_RENAMEV3, [test x$enable_netcdf_4 = xyes -o x$enable_dap = xyes])
-AM_CONDITIONAL(BUILD_FORTRAN, [test x$enable_remote_fortran_bootstrap = xyes])
 AM_CONDITIONAL(USE_PNETCDF, [test x$enable_pnetcdf = xyes])
 AM_CONDITIONAL(USE_DISPATCH, [test x$enable_dispatch = xyes])
 AM_CONDITIONAL(BUILD_MMAP, [test x$enable_mmap = xyes])
@@ -2167,7 +2153,6 @@ AC_CONFIG_FILES([nc-config], [chmod 755 nc-config])
 AC_CONFIG_FILES([Makefile
                  netcdf.pc
                  libnetcdf.settings
-                 postinstall.sh
                  include/netcdf_meta.h
                  include/netcdf_dispatch.h
                  include/Makefile
diff --git a/postinstall.sh.in b/postinstall.sh.in
deleted file mode 100644
index 11bfa5d9a..000000000
--- a/postinstall.sh.in
+++ /dev/null
@@ -1,136 +0,0 @@
-#!/bin/bash
-# Script to automatically build, install netcdf-fortran.
-# Very rought draft.
-
-DOCMAKE=""
-DOAUTOTOOL=""
-DOACTION=""
-TARGVERSION="v4.4.4"
-
-MARG=""
-if [ $# -lt 1 ]; then
-    echo ""
-    echo "WARNING! THIS SCRIPT IS NOT MEANT TO BE RUN MANUALLY."
-    echo "WARNING! THIS SCRIPT IS NOT MEANT TO BE RUN MANUALLY."
-    echo ""
-    exit 1
-fi
-
-
-##
-# Check for 'git', exit if it's not found.
-##
-hash git 2>/dev/null
-if [ $? -eq 1 ]; then
-    echo "ERROR: 'git' is required to install netcdf-fortran automatically"
-    echo "through this method. Please reinstall git and try again."
-    exit 1
-fi
-
-while getopts "a:t:" o; do
-    case "${o}" in
-        t)
-            MARG=${OPTARG}
-            ;;
-        a)
-            DOACTION=${OPTARG}
-            ;;
-        *)
-            echo "Specify type with -t. Types are autotools or cmake."
-            exit 1
-            ;;
-    esac
-done
-
-
-###
-# Make sure we're specifying an allowed
-# build system.
-###
-case ${MARG} in
-    cmake)
-        DOCMAKE="TRUE"
-        ;;
-    autotools)
-        DOAUTOTOOL="TRUE"
-        ;;
-    *)
-        echo "Illegal type. Types are autotools or cmake."
-        exit 1
-        ;;
-esac
-
-###
-# Make sure we're performing a valid action.
-###
-case ${DOACTION} in
-    build)
-        ;;
-    install)
-        ;;
-    *)
-        echo "Illegal action."
-        exit 1
-        ;;
-esac
-
-
-###
-# Fetch netcdf-fortran from git if need be.
-###
-
-if [ ! -d "netcdf-fortran" ]; then
-    git clone http://github.com/unidata/netcdf-fortran
-
-fi
-
-cd netcdf-fortran
-git checkout $TARGVERSION
-
-###
-# Invoke cmake to build netcdf-fortran
-###
-
-if [ "x$DOCMAKE" = "xTRUE" ]; then
-
-    mkdir -p build
-    cd build
-
-    if [ "x$DOACTION" = "xbuild" ]; then
-        cmake .. -DCMAKE_PREFIX_PATH=@CMAKE_INSTALL_PREFIX@ -DCMAKE_INSTALL_PREFIX=@CMAKE_INSTALL_PREFIX@ -DBUILD_SHARED_LIBS=@BUILD_SHARED_LIBS@ -DTEST_PARALLEL=@ENABLE_PARALLEL@ &&
-        make && make test
-    fi
-
-    if [ "x$DOACTION" = "xinstall" ]; then
-        make install
-    fi
-
-fi
-
-if [ "x$DOAUTOTOOL" = "xTRUE" ]; then
-
-    if [ "x$DOACTION" = "xbuild" ]; then
-        if [ ! -f "configure" ]; then
-            autoreconf -if
-        fi
-
-        STATIC_BUILD="--disable-static"
-        if [ "x@enable_static@" = "xyes" ]; then
-            STATIC_BUILD="--enable-static"
-        fi
-
-        SHARED_BUILD="--disable-shared"
-        if [ "x@enable_shared@" = "xyes" ]; then
-            SHARED_BUILD="--enable-shared"
-        fi
-
-        LIBS="@LIBS@" CFLAGS="-I@prefix@/include" LDFLAGS="-L@prefix@/lib" ./configure --prefix=@prefix@ $STATIC_BUILD $SHARED_BUILD
-        LIBS="@LIBS@" make
-        LIBS="@LIBS@" make check
-    fi
-
-    if [ "x$DOACTION" = "xinstall" ]; then
-        make install
-    fi
-
-fi


Test patch:
diff --git a/unit_test/Makefile.am b/unit_test/Makefile.am
index 9948bab57..c159af91c 100644
--- a/unit_test/Makefile.am
+++ b/unit_test/Makefile.am
@@ -45,7 +45,7 @@ TESTS += run_s3sdk.sh
 endif
 endif
 
-EXTRA_DIST = CMakeLists.txt run_s3sdk.sh run_reclaim.sh
+EXTRA_DIST = CMakeLists.txt run_s3sdk.sh run_reclaim_tests.sh
 EXTRA_DIST += nctest_netcdf4_classic.nc reclaim_tests.cdl
 
 CLEANFILES = reclaim_tests*.txt reclaim_tests.nc