📄 mpeinstall.in
字号:
#! /bin/sh## This script has to be built by configure.## This is a script to install MPE Profiling Environment. It can be invoked with## make install ( if you used -prefix at configure time )## or,## make install PREFIX=Path_to_the_installation_of_MPE## in the top-level MPE __build__ directory which could be the same# or different from the source directory## Location of sources# top_srcdir=@top_srcdir@top_srcdir=@top_srcdir_abs@ # in absolute path# Build locationsincludebuild_dir=@includebuild_dir@libbuild_dir=@libbuild_dir@binbuild_dir=@binbuild_dir@sbinbuild_dir=@sbinbuild_dir@etcbuild_dir=@etcbuild_dir@# Installation directories: Default paths (set at configure time)prefix=@prefix@exec_prefix=@exec_prefix@includedir=@includedir@libdir=@libdir@bindir=@bindir@sbindir=@sbindir@datadir=@datadir@sysconfdir=@sysconfdir@mandir=@mandir@htmldir=@htmldir@docdir=@docdir@# Assume PROF_LIBNAME=MPE_LIBNAME.PROF_LIBNAME=@MPE_LIBNAME@MPI_IMPL=@MPI_IMPL@MPE_BUILD_FORTRAN2C=@MPE_BUILD_FORTRAN2C@# Determine this package's nametmpname="`echo $top_srcdir | sed -e 's%\(.*\)/\([^/]*\)%\2%'`"pkgname="`echo $tmpname | sed -e 'y%abcdefghijklmnopqrstuvwxyz/%ABCDEFGHIJKLMNOPQRSTUVWXYZ_%'`"if [ "x$pkgname" = "x" ] ; then pkgname="MPE2"fiMAKE="@MAKE@"INSTALL="@INSTALL@"RM="@RM@"LN_S="@LN_S@"# File access modeMODE=0644XMODE=0755DMODE=0755replace=1# set failmode to soft to let failures accumulatefailmode="hard"# chmod can fail for various reasons. Let it?chmodfailmode="hard"Show=eval# set verbose to 0 to suppress success outputverbose=0just_testing=0prefix_override=0# filelist records files that have been installedfilelist=""# dirlist records directories createddirlist=""# cmdlist records commands to be carried out during uninstallcmdlist=""# initialize the error code return countererrs=0# The variable, appendUninstall, is to signal this script to allow uninstall# information to append to an existing uninstall file. Default is NO.appendUninstall=0# Set uninstall file# Should replace basename which is NOT available on all machine ?# Is ok for now. Popular Unix boxes, AIX, solaris, Linux, all have basenameif [ -z "$UNINSTALLFILE" ] ; then INSTALL_base=`basename $0` UNINSTALL_base=`echo $INSTALL_base | sed -e 's/install/uninstall/'` UNINSTALLFILE=$DESTDIR${sbindir}/${UNINSTALL_base}fifor arg in "$@" ; do case "$arg" in -prefix=*) prefix=`echo $arg | sed -e 's/-prefix=//g'` if [ "$prefix" != "@prefix@" ] ; then prefix_override=1 fi ;; -uninstall=*) UNINSTALLFILE=`echo A$arg | sed -e 's/A-uninstall=//g'` appendUninstall=1 ;; -mode=*) MODE=`echo $arg | sed -e 's/-mode=//g'` ;; -xmode=*) XMODE=`echo $arg | sed -e 's/-xmode=//g'` ;; -dmode=*) DMODE=`echo $arg | sed -e 's/-dmode=//g'` ;; -t) Show=echo ; just_testing=1 ; failmode="soft" ;; -noman) noman=1 ;; -echo) set -x ;; -noreplace|-no_replace) replace=0 ;; -replace) replace=1 ;; -no_verbose|-noverbose) verbose=0 ;; -verbose) verbose=1 ;; -soft) failmode="soft" ; chmodfailmode="soft" ;; -hard) failmode="hard" ; chmodfailmode="hard" ;; -softchmod) chmodfailmode="soft" ;; -help|-u|-usage|-h)cat <<EOFInstall $pkgname into $prefix.-prefix=path - Destination directory.-uninstall=file - File to append uninstall information to-mode=nnnn - mode for regular files. Default is $MODE .-xmode=nnnn - mode for execuables. Default is $XMODE .-dmode=nnnn - mode for directories. Default is $DMODE .-t - Try only; do no installation.-manpath=path - Set an alternate path for the man pages-noman - Do not install the man pages.-noreplace - Do not replace files found in the installation directory-soft - Do not abort on failure-softchmod - Do not abort on failure of chmodEOF exit 1 ;; *) # Silently skip empty arguments (these can occur on # some systems and within some scripts; they are # harmless) if [ -n "$arg" ] ; then echo "mpeinstall: Unrecognized argument $arg ." exit 1 fi ;; esacdoneif [ "$SHELL_ECHO" = "on" ] ; then set -x fi################################################################################ Start of Routines###############################################################################INSTALLER="$INSTALL"#InstallFile() {if [ -z "$3" ] ; then mode=$MODEelse mode=$3fiif [ -d $DESTDIR$2 ] ; then dest=$DESTDIR$2/`basename $1` destfile=$2/`basename $1`else dest=$DESTDIR$2 destfile=$2fiif [ $replace = 0 -a -f $dest ] ; then if [ $verbose = 1 ] ; then echo "$dest exists; not changed" ; fielif [ -d $1 ] ; then echo ">>> $1 is a directory; not installed <<<" errs=`expr $errs + 1` if [ $failmode = "hard" ] ; then exit 1 ; fielif [ ! -f $1 ] ; then echo "*** File $1 does not exist (or is not a regular file)! ***" errs=`expr $errs + 1` if [ $failmode = "hard" ] ; then exit 1 ; fielif [ "$1" = "$dest" ] ; then echo "*** File $1 is being installed to itself! ***" errs=`expr $errs + 1` if [ $failmode = "hard" ] ; then exit 1 ; fielse if [ $verbose = 1 ] ; then echo "Installing $1 to $dest" ; fi if [ -f $dest ] ; then echo "Replacing existing file $dest..." $Show $RM -f $dest fi if [ "X$mode" != "X" ] ; then $Show $INSTALLER -m $mode $1 $dest else $Show $INSTALLER $1 $dest fi rc=$? if [ $rc != 0 ] ; then echo "*** Error installing file $1 to $dest with mode $mode. ***" errs=`expr $errs + 1` if [ $failmode = "hard" ] ; then exit $rc ; fi else # store the destination installed filename filelist="$filelist $destfile" fifi}## Recursive directory install that installs or replaces files# (file replacement of replace=1) but excluding directories,# .svn/, old/ and tex/.# $1 is the src directory, $2 is dest directory, $3 is $MODE or $XMODEInstallDirRecur() {if [ -n "$1" -a -n "$2" ] ; then if [ -d $1 ] ; then MkDir $2 # use $4 as a local variable # & set it as the original PWD before "cd $1" set $1 $2 ${3:-"$MODE"} `pwd` cd $1 for file in * ; do if [ -f $file ] ; then InstallFile $file $2/$file $3 fi done for dir in * ; do if [ -d $dir \ -a "$dir" != ".svn" -a "$dir" != "old" \ -a "$dir" != "tex" \ ] ; then InstallDirRecur $dir $2/$dir $3 fi done # cd back where it comes from # counter the effect of "cd $1" above, # so "for" loop still works cd $4 fifi}## Make the given directory. This handles building intermediate directories# as required, and maintains a list of created directories in dirlist.MkDir() {dest=$DESTDIR$1if [ ! -d $dest ] ; then dir=`echo $dest | sed 's%/% /%g'` path_to_date='' for path in $dir ; do path_to_date="$path_to_date$path" if [ ! -d $path_to_date ] ; then if [ $verbose = 1 ] ; then echo "Creating directory $dest" ; fi $Show "mkdir $path_to_date" rc=$? if [ $rc != 0 ] ; then echo "*** Error making directory $dest. ***" errs=`expr $errs + 1` if [ $failmode = "hard" ] ; then exit $rc ; fi echo "Failed to create directory $path_to_date" exit 1 else # Note that we store in inverse order dirlist="$1 $dirlist" fi if [ "X$DMODE" != "X" ] ; then $Show chmod $DMODE $path_to_date rc=$? if [ $rc != 0 ] ; then echo "*** Error setting mode to $DMODE on directory $path_to_date. ***" errs=`expr $errs + 1` if [ $chmodfailmode = "hard" ] ; then exit $rc ; fi fi fi fi donefi}## Fixup files with various xxxxbuild_dir to xxxxdir, install directory.## The MPE_CLINKER/MPE_FLINKER need to sync with mpe2/configure.in#FixInstallFile() {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -