[svn-r23555] Bug fix: HDFFV-8358

The previous change set exec_prefix, libdir and includedir to actual values.
That removed the option for user to hand edit just the first prefix=...
to make "everything" to work.
Changed h5redeploy to do this by default:
## Installation directories:						  ##
## prefix	architecture-independent files.				  ##
## exec_prefix	architecture-dependent files, default is <prefix>.	  ##
## libdir	libraries, default is <exec_prefix>/lib.		  ##
## includedir	header files, default is <prefix/include>.		  ##
############################################################################
This allows users to just change the first line of prefix=<...> and the
effect will change libdir and includedir too.

This was also try to accommodate the -prefix option of h5XX. Unfortunately,
after changing h5redeploy, I found out the h5XX code to support -prefix
actually does not provide the stated efffect. This will be fixed in the
release.

Tested: h5committested plus hand test.
This commit is contained in:
Albert Cheng
2013-04-05 13:29:46 -05:00
parent a99e92e6a4
commit 6b00c16d2a

View File

@@ -30,14 +30,20 @@ usage() {
# A wonderfully informative "usage" message.
echo "usage: $prog_name [OPTIONS]"
echo " OPTIONS:"
echo " -help|help This help message"
echo " -echo Show all the shell commands executed"
echo " -force No prompt, just do it"
echo " -prefix=DIR New directory to find HDF5 lib/ and include/"
echo " subdirectories [default: current directory]"
echo " -tool=TOOL Tool to update. TOOL must be in the current"
echo " directory and writable. [default: $h5tools]"
echo " -show Show the commands without executing them"
echo " -help|help This help message"
echo " -echo Show all the shell commands executed"
echo " -force No prompt, just do it"
echo " -prefix=DIR New directory to find HDF5 lib/ and include/"
echo " subdirectories [default: current directory]"
echo " -exec-prefix=DIR New directory to find HDF5 lib/"
echo " subdirectory [default: <prefix>]"
echo " -libdir=DIR New directory for the HDF5 lib directory"
echo " [default: <exec-prefix>/lib]"
echo " -includedir=DIR New directory for the HDF5 header files"
echo " [default: <prefix>/include]"
echo " -tool=TOOL Tool to update. TOOL must be in the current"
echo " directory and writable. [default: $h5tools]"
echo " -show Show the commands without executing them"
echo " "
exit $EXIT_FAILURE
}
@@ -85,7 +91,7 @@ h5tools="h5cc h5pcc h5fc h5pfc h5c++" # possible hdf5 tools
foundtools= # tools found and will be modified
fmode= # force mode, default is off
prefix=
eprefix=
exec_prefix=
libdir=
includedir=
@@ -95,8 +101,8 @@ for arg in $@ ; do
-prefix=*)
prefix="`echo $arg | cut -f2 -d=`"
;;
-eprefix=*)
eprefix="`echo $arg | cut -f2 -d=`"
-exec-prefix=*)
exec_prefix="`echo $arg | cut -f2 -d=`"
;;
-libdir=*)
libdir="`echo $arg | cut -f2 -d=`"
@@ -127,36 +133,18 @@ for arg in $@ ; do
esac
done
# Set to default value if not given by user
# Set to default value, one above where i am, if not given by user
if [ -z "$prefix" ]; then
prefix=`(cd ..;pwd)`
fi
if [ -z "$eprefix" ]; then
eprefix=$prefix
if [ -z "$exec_prefix" ]; then
exec_prefix='${prefix}' # use single quotes to prevent expansion of $
fi
if [ -z "$libdir" ]; then
libdir=$eprefix/lib
libdir='${exec_prefix}'/lib # use single quotes to prevent expansion of $
fi
if [ -z "$includedir" ]; then
includedir=$prefix/include
fi
# Sanity checks
if [ ! -d $prefix ]; then
ERROR "prefix($prefix) is not an existing directory"
exit $EXIT_FAILURE
fi
if [ ! -d $prefix ]; then
ERROR "prefix($prefix) is not an existing directory"
exit $EXIT_FAILURE
fi
if [ ! -d $prefix ]; then
ERROR "prefix($prefix) is not an existing directory"
exit $EXIT_FAILURE
fi
if [ ! -d $prefix ]; then
ERROR "prefix($prefix) is not an existing directory"
exit $EXIT_FAILURE
includedir='${prefix}'/include # use single quotes to prevent expansion of $
fi
for x in $h5tools; do
@@ -192,19 +180,19 @@ fi
CMDFILE=/tmp/h5redeploy.$$
touch $CMDFILE
chmod 0600 $CMDFILE
echo "/^prefix=/c" >> $CMDFILE
echo prefix=\""$prefix"\" >> $CMDFILE
echo . >> $CMDFILE
echo "/^exec_prefix=/c" >> $CMDFILE
echo exec_prefix=\""$eprefix"\" >> $CMDFILE
echo . >> $CMDFILE
echo "/^libdir=/c" >> $CMDFILE
echo libdir=\""$libdir"\" >> $CMDFILE
echo . >> $CMDFILE
echo "/^includedir=/c" >> $CMDFILE
echo includedir=\""$includedir"\" >> $CMDFILE
echo . >> $CMDFILE
(echo w; echo q) >> $CMDFILE
echo "/^prefix=/c" >> $CMDFILE
echo prefix=\""$prefix"\" >> $CMDFILE
echo . >> $CMDFILE
echo "/^exec_prefix=/c" >> $CMDFILE
echo exec_prefix=\""$exec_prefix"\" >> $CMDFILE
echo . >> $CMDFILE
echo "/^libdir=/c" >> $CMDFILE
echo libdir=\""$libdir"\" >> $CMDFILE
echo . >> $CMDFILE
echo "/^includedir=/c" >> $CMDFILE
echo includedir=\""$includedir"\" >> $CMDFILE
echo . >> $CMDFILE
(echo w; echo q) >> $CMDFILE
# Update them
@@ -228,10 +216,3 @@ done
# Cleanup
rm -f $CMDFILE
exit $EXIT_SUCCESS
# Some possible future features to add
# CCBASE - Name of the alternative C compiler
# CLINKERBASE - Name of the alternative linker
# LDFLAGS - Path to different libraries your application will link with
# (this path should include the path to the zlib library)
# LIBS - Libraries your application will link with