2
0
mirror of https://github.com/Unidata/netcdf-c.git synced 2025-04-24 18:30:51 +08:00

Added custom targets for autotools-based builds. Added some checks to the postinstall script template so that it would exit if git wasn't found on the system. Also changed it to specify LIBS in case of static-only build.

This commit is contained in:
Ward Fisher 2014-11-19 16:57:51 -07:00
parent c0bc240a3a
commit f20baaf19c
2 changed files with 60 additions and 7 deletions

@ -121,6 +121,33 @@ endif # BUILD_DLL
settingsdir=$(libdir)
settings_DATA=libnetcdf.settings
#####
# 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
# At Unidata, package up binaries.
ftpbin: install
echo "Getting binaries from ${prefix}"
@ -139,12 +166,13 @@ check_nc_config:
$(CC) `./nc-config --cflags` test_prog.c -o test_prog `./nc-config --libs`
./test_prog
install-data-hook:
if BUILD_FORTRAN
chmod u+x $(abs_top_builddir)/postinstall.sh
sh -c "$(abs_top_builddir)/postinstall.sh -t autotools"
endif
# if BUILD_FORTRAN
# chmod u+x $(abs_top_builddir)/postinstall.sh
# sh -c "$(abs_top_builddir)/postinstall.sh -t autotools"
#endif
if BUILD_DLL
cp liblib/netcdfdll.def $(DESTDIR)${prefix}/lib

@ -15,6 +15,17 @@ if [ $# -lt 1 ]; then
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)
@ -72,7 +83,6 @@ if [ ! -d "netcdf-fortran" ]; then
fi
cd netcdf-fortran
#git checkout v4.4.1
###
# Invoke cmake to build netcdf-fortran
@ -97,8 +107,23 @@ fi
if [ "x$DOAUTOTOOL" = "xTRUE" ]; then
if [ "x$DOACTION" = "xbuild" ]; then
CFLAGS="-I@abs_top_builddir@/include" LDFLAGS="-L@abs_top_builddir@/liblib/.libs" ./configure --prefix=@prefix@
make && make check
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