📄 mpiinstall.in
字号:
#! /bin/sh# MPICH-V2# Copyright (C) 2002, 2003 Groupe Cluster et Grid, LRI, Universite de Paris Sud### This file is part of MPICH-V2.## MPICH-V2 is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 2 of the License, or# (at your option) any later version.## MPICH-V2 is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.## You should have received a copy of the GNU General Public License# along with MPICH-V2; if not, write to the Free Software# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA## $Id: mpiinstall.in,v 1.1.1.1 2004/01/30 15:49:38 lemarini Exp $## This is a script to install mpi. It can be called from the top-level # Makefile or directly. Note that this script needs to be built by configure.## As the install takes place, it keeps a list of files that were installed# in a form that allows their easy removal## Bug: If there is an error before the install is finished, the mpiuninstall# file will not contain the directories to remove.# Possible fix: add a routine that appends these to the uninstall file# that can be called before any exit## *CHANGE*# In previous versions, files were not overwritten. This caused mysterious# problems for users that did a reinstall over a damaged or incorrect # installation (for example, installing a correction produced by a patch).# The previous behavior is available with the -noreplace option# *CHANGE*# We now build the libraries in lib and the binaries in bin.# Installation into architecture-specific directories is done by this script,# not by the original build.# *CHANGE IN PROGRESS*# Changing the various "FixupFile" proceedures to work with the configured# versions, looking for specific directory assignment statements such as# prefix=... and includedir=... (config.status does something similar).# This requires changing the affected scripts to follow a standard format; # see mpif90.in for an exampleCPP_DIR=@CPP_DIR@buildcpp=@buildcpp@CPP_COMPILER="@CPP_COMPILER@"ARCH=@ARCH@COMM=@COMM@PREFIX=@PREFIX@prefix=@prefix@DEVICE=@DEVICE@CPRP="@CPRP@"MAKE="@MAKE@"RSHCOMMAND="@RSHCOMMAND@"NOMPE=@NOMPE@SHAREDLIB_LOCALDIR=@SHAREDLIB_LOCALDIR@MPIR_HOME=@MPIR_HOME@## Default paths (set at configure time) exec_prefix=@exec_prefix@ bindir=@bindir@ sbindir=@sbindir@ includedir=@includedir@ sysconfdir=@sysconfdir@ libdir=@libdir@ sharedlib_dir=@sharedlib_dir@ messagecat_dir=@messagecat_dir@ mandir=@mandir@ htmldir=@htmldir@ datadir=@datadir@ docdir=@docdir@# Location of sourcestop_srcdir=@top_srcdir@#includebuild_dir=@includebuild_dir@binbuild_dir=@binbuild_dir@libbuild_dir=@libbuild_dir@# File access mode. Does not include group write.MODE=0644XMODE=0755replace=1# Propagate install arguments to mpe installmpeargs=""# If we're doing -libonly, we may want a different file....## dirlist is used to uninstall empty directories at the enddirlist=""#inlib=0#errs=0## 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=0for arg in "$@" ; do case "$arg" in -echo) set -x ;; -mode=*) MODE=`echo $arg | sed -e 's/-mode=//g'` ;; -xmode=*)XMODE=`echo $arg | sed -e 's/-xmode=//g'` ;; -prefix=*) # make install passes the prefix. If the old and # new prefix are the same, don't set the override # switch incase mandir etc. were set on the configure # line (it uses the PREFIX, not prefix, value) prefix=`echo $arg | sed -e 's/-prefix=//g'` if [ "$prefix" != "$PREFIX" ] ; then prefix_override=1 fi ;; -aprefix=*)APREFIX=`echo $arg | sed -e 's/-aprefix=//g'` arg="" ;; # aprefix not valid for mpeargs -shliblocal=*) SHAREDLIB_LOCALDIR=`echo A$arg | sed -e 's/A-shliblocal=//g'` arg="" ;; # shliblocal not valid for mpeargs -noreplace|-no_replace) replace=0 ;; -replace) replace=1 ;; -noman) noman=1 ;; -device=*) DEVICE=`echo A$arg | sed -e 's/A-device=//g'` COMM=$DEVICE arg="" ;; # device not valid for mpeargs -manpath=*)mandir=`echo $arg | sed -e 's/-manpath=//g'` mandir_override=1 arg="" ;; # manpath not valid for mpeargs -libonly) libonly=1 arg="" ;; # libonly not valid for mpeargs # -inlib is a private option -inlib) inlib=1 arg="" ;; # inlib not valid for mpeargs #-arch=*) ARCH=`echo A$arg | sed -e 's/A-arch=//g'` ;; -no_verbose|-noverbose) verbose=0 ;; -verbose) verbose=1 ;; -soft) failmode="soft" ; chmodfailmode="soft" ;; -hard) failmode="hard" ; chmodfailmode="hard" ;; -softchmod) chmodfailmode="soft" ;; -t) Show=echo just_testing=1 failmode="soft" ;; -help|-u|-usage|-h)cat <<EOFInstall MPICH into $prefix.-mode=nnnn - mode for regular files. Default is $MODE .-xmode=nnnn - mode for execuables and directories. Default is $XMODE .-prefix=path - Destination directory.-aprefix=path- Path to use in sample files. Default is same as prefix.-t - Try only; do no installation.-libonly - Install only the libraries; this is appropriate for installing a second device.-manpath=path- Set an alternate path for the man pages-noman - Do not install the man pages.-device=name - Select a different device type to install-noreplace - Do not replace files that are found in the installation directory-soft - Do not abort on failure-softchmod - Do not abort on failure of chmodEOF exit 1 ;; *) if [ -n "$arg" ] ; then # allow empty arguments echo "Unrecognized argument $arg ." exit 1 fi ;; esac # If arg isn't appropriate for mpe, set it to null if [ -n "$arg" ] ; then mpeargs="$mpeargs $arg" fidoneif [ "$SHELL_ECHO" = "on" ] ; then set -x fi# Installation directories# If the prefix was set, we want to override these choicesif [ "$prefix_override" = 1 ] ; then bindir=$prefix/bin sbindir=$prefix/sbin includedir=$prefix/include sysconfdir=$prefix/etc libdir=$prefix/lib sharedlib_dir=$libdir/shared messagecat_dir=$libdir htmldir=${prefix}/www if [ "$mandir_override" != 1 ] ; then mandir=$prefix/man fi datadir=$prefix/share docdir=$prefix/docfi# Uninstall filenameif [ -z "$UNINSTALLFILE" ] ; then UNINSTALLFILE="$sbindir/mpiuninstall"fiif [ -z "$APREFIX" ] ; then APREFIX=$prefixfi## Check final directoriesif [ -z "$bindir" ] ; then echo "No bindir" ; exit 1 ; fiif [ -z "$libdir" ] ; then echo "No libdir" ; exit 1 ; fiif [ -z "$includedir" ] ; then echo "No includedir" ; exit 1 ; fiif [ -z "$datadir" ] ; then echo "No datadir" ; exit 1 ; fi### If libonly, we need to get the correct default machine etc. We could # get this from the config.status for the device, but the problem is that# there are MANY items to restore. A better approach is to use an install# script from the library directory itself.if [ -n "$libonly" ] ; then if [ $inlib = 0 -a -x $binbuild_dir/mpiinstall ] ; then $binbuild_dir/mpiinstall -inlib "$@" exit $? fifi## We could use install, but install is too different and too hard to # test. So here are the routines to copy file, make directories, and # replace #...# and @...@ in filesCP=cp#CopyFile() {if [ -z "$3" ] ; then mode=$MODEelse mode=$3fiif [ -d $2 ] ; then dest=$2/`basename $1`else dest=$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 copied <<<" 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 ; fielse if [ $verbose = 1 ] ; then echo "Copying $1 to $dest" ; fi # We don't delete the file in the event that we are copying the # file over itself (we SHOULD check for that separately, by checking # that directories are distinct) #if [ -f $dest ] ; then $Show /bin/rm -f $dest ; fi $Show $CP $1 $dest rc=$? if [ $rc != 0 ] ; then echo "**Error copying file $1 to $dest **" errs=`expr $errs + 1` if [ $failmode = "hard" ] ; then exit $rc ; fi else echo "/bin/rm -f $dest" >> $UNINSTALLFILE fi $Show chmod $mode $dest rc=$? if [ $rc != 0 ] ; then echo "**Error setting mode on file $dest**" errs=`expr $errs + 1` if [ $chmodefailmode = "hard" ] ; then exit $rc ; fi fifi}## A version of copy file that preserves file datesCopyFileP() { CP="$CPRP -p" CopyFile $1 $2 $3 CP=cp}## Make the given directory. This handles building intermediate directories# as required, and maintains a list of created directories in dirlist.MkDir() {if [ ! -d $1 ] ; then dir_to_make=`echo $1 | sed 's%/% /%g'` path_to_date='' for path in $dir_to_make ; do path_to_date="$path_to_date$path" if [ ! -d $path_to_date ] ; then if [ $verbose = 1 ] ; then echo "Creating directory $1" ; fi $Show "mkdir $path_to_date" rc=$? if [ $rc != 0 ] ; then echo "**Error making directory $1**" 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 $Show chmod $XMODE $path_to_date rc=$? if [ $rc != 0 ] ; then echo "**Error setting mode on directory $path_to_date**" errs=`expr $errs + 1` if [ $chmodfailmode = "hard" ] ; then exit $rc ; fi fi fi donefi}## Fixup files that need #...# replaced# Only mpireconfig and ch4p_servs. chp4_servs should be replaced with a# perl program. mpireconfig can use FixupFile2 .#FixupFile() {if [ -d $2 ] ; then dest=$2/`basename $1`else dest=$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 copied"else if [ -f $dest ] ; then $Show /bin/rm -f $dest ; fi if [ $just_testing = 0 ] ; then sed \ -e "s%\#datadir\#%$datadir%g" \ -e "s%\#DEFAULT_ARCH\#%$ARCH%g" \ -e "s%\#MPIR_HOME\#%$prefix%g" \ -e "s%\#PREFIX\#%$prefix%g" \ -e "s%\#RSHCOMMAND\#%$RSHCOMMAND%g" \ -e "s%\#top_srcdir\#%@top_srcdir@%g" \ -e "s%\#bindir\#%@bindir@%g" \ -e "s%\#binbuild_dir\#%@bindir@%g" \ $1 > $dest rc=$? if [ $rc != 0 ] ; then echo "**Error fixing up file $dest**" errs=`expr $errs + 1` if [ $failmode = "hard" ] ; then exit $rc ; fi else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -