Skip to content

Commit

Permalink
Move construction of VERSION file to end of the build
Browse files Browse the repository at this point in the history
re: #2521

Charlie Zender has discovered that the netcdf created file VERSION
conflicts with the C++ version file on OSX case-insensitive file systems,
and maybe other case-insensitvie file systems.

Note:
1. Cmake does not create the VERSION file
2. The VERSION file is not installed
3. It turns out that the VERSION file is not required by the autoconf build.

It is possible that clients or package build system (e.g apt or brew)
might use the VERSION file, so we cannot delete it altogether.

So as a fix, we move the creation of the VERSION file to after the
build is complete by inserting a all-local hook into netcdf-c/Makefile.am.

# Misc. other changes
1. Suppressed warning by making use of the systeminfo command contingent on the platform being Windows.
  • Loading branch information
DennisHeimbigner committed Oct 10, 2022
1 parent 0f198c6 commit 52a4eca
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
8 changes: 8 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,11 @@ install-data-hook:
@echo '| https://www.unidata.ucar.edu |'
@echo '+-------------------------------------------------------------+'
@echo ''


# Create the VERSION file after the build
# in case it is being used by packagers
all-local: liblib/libnetcdf.la
echo ${PACKAGE_VERSION} > VERSION
# Remove the VERSION file
CLEANFILES = VERSION
11 changes: 8 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ AC_SUBST([netCDF_SO_VERSION]) netCDF_SO_VERSION=20:0:1
# pattered after the files generated by libhdf4, libhdf5.
#####

# Create the VERSION file, which contains the package version from
# AC_INIT.
echo AC_PACKAGE_VERSION>VERSION
# Create the VERSION file, which contains the package version from AC_INIT.
# This file is apparently unused. But see the bottom of Makefile.am
# echo AC_PACKAGE_VERSION>VERSION

AC_SUBST(PACKAGE_VERSION)

AC_MSG_NOTICE([netCDF AC_PACKAGE_VERSION])
Expand Down Expand Up @@ -115,7 +116,11 @@ ISMSYS=yes
fi

# Get windows version info
if text "x$ISMSVC" = xyes ; then
WINVER=`systeminfo | sed -e '/^OS Version:/p' -ed | sed -e 's|[^0-9]*\([0-9.]*\).*|\1|'`
else
WINVER="0.0.0"
fi
WINVERMAJOR=`echo $WVER | sed -e 's|\([^.]*\)[.]\([^.]*\)[.]\(.*\)|\1|'`
WINVERBUILD=`echo $WVER | sed -e 's|\([^.]*\)[.]\([^.]*\)[.]\(.*\)|\3|'`
if test "x$WINVERMAJOR" = x ; then WINVERMAJOR=0; fi
Expand Down

0 comments on commit 52a4eca

Please sign in to comment.