From 913b88d15b78e027bdcdcb5b9356d4b6dfe59b18 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Sat, 30 Mar 2013 00:55:15 -0500 Subject: [svn-r23497] Bug fix: HDFFV-8358 Change h5redeploy to change all 4 lines, prefix=..., exec_prefix=..., libdir=..., and includedir=... This way, it reset all 4 lines. Should work for both version of h5cc created by configure or by rpm. Tested: hand tested in jam. --- tools/misc/h5redeploy.in | 71 +++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 64 insertions(+), 7 deletions(-) diff --git a/tools/misc/h5redeploy.in b/tools/misc/h5redeploy.in index ae79b70..f90ff13 100644 --- a/tools/misc/h5redeploy.in +++ b/tools/misc/h5redeploy.in @@ -14,9 +14,10 @@ # access to either file, you may request a copy from help@hdfgroup.org. # -## Update HDF5 compiler tools after the HDF5 software has been installed -## in a new location. -## For help page, use "h5redeploy -help" +## Update HDF5 compiler tools after the HDF5 software has been installed ## +## in a new location. ## +## For help page, use "h5redeploy -help" ## +## ## # Constants definitions EXIT_SUCCESS=0 @@ -70,17 +71,38 @@ ERROR() # Main # +############################################################################ +## Installation directories: ## +## prefix architecture-independent files. ## +## exec_prefix architecture-dependent files, default is . ## +## libdir libraries, default is /lib. ## +## includedir header files, default is . ## +## Not used here: ## +## bindir executables, . ## +############################################################################ # Initialization h5tools="h5cc h5pcc h5fc h5pfc h5c++" # possible hdf5 tools foundtools= # tools found and will be modified fmode= # force mode, default is off -prefix=`(cd ..;pwd)` +prefix= +eprefix= +libdir= +includedir= # Parse options for arg in $@ ; do case "$arg" in -prefix=*) - prefix="`expr "$arg" : '-prefix=\(.*\)'`" + prefix="`echo $arg | cut -f2 -d=`" + ;; + -eprefix=*) + eprefix="`echo $arg | cut -f2 -d=`" + ;; + -libdir=*) + libdir="`echo $arg | cut -f2 -d=`" + ;; + -includedir=*) + includedir="`echo $arg | cut -f2 -d=`" ;; -echo) set -x @@ -89,7 +111,7 @@ for arg in $@ ; do SHOW="echo" ;; -tool=*) - h5tools="`expr "$arg" : '-tool=\(.*\)'`" + h5tools="`echo $arg | cut -f2 -d=`" ;; -help|help) usage @@ -105,11 +127,37 @@ for arg in $@ ; do esac done +# Set to default value if not given by user +if [ -z "$prefix" ]; then + prefix=`(cd ..;pwd)` +fi +if [ -z "$eprefix" ]; then + eprefix=$prefix +fi +if [ -z "$libdir" ]; then + libdir=$eprefix/lib +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 +fi for x in $h5tools; do if [ -f $x ]; then @@ -144,9 +192,18 @@ fi CMDFILE=/tmp/h5redeploy.$$ touch $CMDFILE chmod 0600 $CMDFILE -echo "/^prefix/c" >> $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 -- cgit v0.12