annotate src/portaudio_20161030/bindings/cpp/build/gnu/install-sh @ 55:284acf908dcd

Add source for PortAudio stable v190600_20161030
author Chris Cannam
date Tue, 03 Jan 2017 13:44:07 +0000
parents src/portaudio/bindings/cpp/build/gnu/install-sh@e13257ea84a4
children
rev   line source
Chris@4 1 #!/bin/sh
Chris@4 2 #
Chris@4 3 # install - install a program, script, or datafile
Chris@4 4 # This comes from X11R5 (mit/util/scripts/install.sh).
Chris@4 5 #
Chris@4 6 # Copyright 1991 by the Massachusetts Institute of Technology
Chris@4 7 #
Chris@4 8 # Permission to use, copy, modify, distribute, and sell this software and its
Chris@4 9 # documentation for any purpose is hereby granted without fee, provided that
Chris@4 10 # the above copyright notice appear in all copies and that both that
Chris@4 11 # copyright notice and this permission notice appear in supporting
Chris@4 12 # documentation, and that the name of M.I.T. not be used in advertising or
Chris@4 13 # publicity pertaining to distribution of the software without specific,
Chris@4 14 # written prior permission. M.I.T. makes no representations about the
Chris@4 15 # suitability of this software for any purpose. It is provided "as is"
Chris@4 16 # without express or implied warranty.
Chris@4 17 #
Chris@4 18 # Calling this script install-sh is preferred over install.sh, to prevent
Chris@4 19 # `make' implicit rules from creating a file called install from it
Chris@4 20 # when there is no Makefile.
Chris@4 21 #
Chris@4 22 # This script is compatible with the BSD install script, but was written
Chris@4 23 # from scratch. It can only install one file at a time, a restriction
Chris@4 24 # shared with many OS's install programs.
Chris@4 25
Chris@4 26
Chris@4 27 # set DOITPROG to echo to test this script
Chris@4 28
Chris@4 29 # Don't use :- since 4.3BSD and earlier shells don't like it.
Chris@4 30 doit="${DOITPROG-}"
Chris@4 31
Chris@4 32
Chris@4 33 # put in absolute paths if you don't have them in your path; or use env. vars.
Chris@4 34
Chris@4 35 mvprog="${MVPROG-mv}"
Chris@4 36 cpprog="${CPPROG-cp}"
Chris@4 37 chmodprog="${CHMODPROG-chmod}"
Chris@4 38 chownprog="${CHOWNPROG-chown}"
Chris@4 39 chgrpprog="${CHGRPPROG-chgrp}"
Chris@4 40 stripprog="${STRIPPROG-strip}"
Chris@4 41 rmprog="${RMPROG-rm}"
Chris@4 42 mkdirprog="${MKDIRPROG-mkdir}"
Chris@4 43
Chris@4 44 transformbasename=""
Chris@4 45 transform_arg=""
Chris@4 46 instcmd="$mvprog"
Chris@4 47 chmodcmd="$chmodprog 0755"
Chris@4 48 chowncmd=""
Chris@4 49 chgrpcmd=""
Chris@4 50 stripcmd=""
Chris@4 51 rmcmd="$rmprog -f"
Chris@4 52 mvcmd="$mvprog"
Chris@4 53 src=""
Chris@4 54 dst=""
Chris@4 55 dir_arg=""
Chris@4 56
Chris@4 57 while [ x"$1" != x ]; do
Chris@4 58 case $1 in
Chris@4 59 -c) instcmd="$cpprog"
Chris@4 60 shift
Chris@4 61 continue;;
Chris@4 62
Chris@4 63 -d) dir_arg=true
Chris@4 64 shift
Chris@4 65 continue;;
Chris@4 66
Chris@4 67 -m) chmodcmd="$chmodprog $2"
Chris@4 68 shift
Chris@4 69 shift
Chris@4 70 continue;;
Chris@4 71
Chris@4 72 -o) chowncmd="$chownprog $2"
Chris@4 73 shift
Chris@4 74 shift
Chris@4 75 continue;;
Chris@4 76
Chris@4 77 -g) chgrpcmd="$chgrpprog $2"
Chris@4 78 shift
Chris@4 79 shift
Chris@4 80 continue;;
Chris@4 81
Chris@4 82 -s) stripcmd="$stripprog"
Chris@4 83 shift
Chris@4 84 continue;;
Chris@4 85
Chris@4 86 -t=*) transformarg=`echo $1 | sed 's/-t=//'`
Chris@4 87 shift
Chris@4 88 continue;;
Chris@4 89
Chris@4 90 -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
Chris@4 91 shift
Chris@4 92 continue;;
Chris@4 93
Chris@4 94 *) if [ x"$src" = x ]
Chris@4 95 then
Chris@4 96 src=$1
Chris@4 97 else
Chris@4 98 # this colon is to work around a 386BSD /bin/sh bug
Chris@4 99 :
Chris@4 100 dst=$1
Chris@4 101 fi
Chris@4 102 shift
Chris@4 103 continue;;
Chris@4 104 esac
Chris@4 105 done
Chris@4 106
Chris@4 107 if [ x"$src" = x ]
Chris@4 108 then
Chris@4 109 echo "install: no input file specified"
Chris@4 110 exit 1
Chris@4 111 else
Chris@4 112 true
Chris@4 113 fi
Chris@4 114
Chris@4 115 if [ x"$dir_arg" != x ]; then
Chris@4 116 dst=$src
Chris@4 117 src=""
Chris@4 118
Chris@4 119 if [ -d $dst ]; then
Chris@4 120 instcmd=:
Chris@4 121 chmodcmd=""
Chris@4 122 else
Chris@4 123 instcmd=mkdir
Chris@4 124 fi
Chris@4 125 else
Chris@4 126
Chris@4 127 # Waiting for this to be detected by the "$instcmd $src $dsttmp" command
Chris@4 128 # might cause directories to be created, which would be especially bad
Chris@4 129 # if $src (and thus $dsttmp) contains '*'.
Chris@4 130
Chris@4 131 if [ -f $src -o -d $src ]
Chris@4 132 then
Chris@4 133 true
Chris@4 134 else
Chris@4 135 echo "install: $src does not exist"
Chris@4 136 exit 1
Chris@4 137 fi
Chris@4 138
Chris@4 139 if [ x"$dst" = x ]
Chris@4 140 then
Chris@4 141 echo "install: no destination specified"
Chris@4 142 exit 1
Chris@4 143 else
Chris@4 144 true
Chris@4 145 fi
Chris@4 146
Chris@4 147 # If destination is a directory, append the input filename; if your system
Chris@4 148 # does not like double slashes in filenames, you may need to add some logic
Chris@4 149
Chris@4 150 if [ -d $dst ]
Chris@4 151 then
Chris@4 152 dst="$dst"/`basename $src`
Chris@4 153 else
Chris@4 154 true
Chris@4 155 fi
Chris@4 156 fi
Chris@4 157
Chris@4 158 ## this sed command emulates the dirname command
Chris@4 159 dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
Chris@4 160
Chris@4 161 # Make sure that the destination directory exists.
Chris@4 162 # this part is taken from Noah Friedman's mkinstalldirs script
Chris@4 163
Chris@4 164 # Skip lots of stat calls in the usual case.
Chris@4 165 if [ ! -d "$dstdir" ]; then
Chris@4 166 defaultIFS='
Chris@4 167 '
Chris@4 168 IFS="${IFS-${defaultIFS}}"
Chris@4 169
Chris@4 170 oIFS="${IFS}"
Chris@4 171 # Some sh's can't handle IFS=/ for some reason.
Chris@4 172 IFS='%'
Chris@4 173 set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
Chris@4 174 IFS="${oIFS}"
Chris@4 175
Chris@4 176 pathcomp=''
Chris@4 177
Chris@4 178 while [ $# -ne 0 ] ; do
Chris@4 179 pathcomp="${pathcomp}${1}"
Chris@4 180 shift
Chris@4 181
Chris@4 182 if [ ! -d "${pathcomp}" ] ;
Chris@4 183 then
Chris@4 184 $mkdirprog "${pathcomp}"
Chris@4 185 else
Chris@4 186 true
Chris@4 187 fi
Chris@4 188
Chris@4 189 pathcomp="${pathcomp}/"
Chris@4 190 done
Chris@4 191 fi
Chris@4 192
Chris@4 193 if [ x"$dir_arg" != x ]
Chris@4 194 then
Chris@4 195 $doit $instcmd $dst &&
Chris@4 196
Chris@4 197 if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
Chris@4 198 if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
Chris@4 199 if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
Chris@4 200 if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
Chris@4 201 else
Chris@4 202
Chris@4 203 # If we're going to rename the final executable, determine the name now.
Chris@4 204
Chris@4 205 if [ x"$transformarg" = x ]
Chris@4 206 then
Chris@4 207 dstfile=`basename $dst`
Chris@4 208 else
Chris@4 209 dstfile=`basename $dst $transformbasename |
Chris@4 210 sed $transformarg`$transformbasename
Chris@4 211 fi
Chris@4 212
Chris@4 213 # don't allow the sed command to completely eliminate the filename
Chris@4 214
Chris@4 215 if [ x"$dstfile" = x ]
Chris@4 216 then
Chris@4 217 dstfile=`basename $dst`
Chris@4 218 else
Chris@4 219 true
Chris@4 220 fi
Chris@4 221
Chris@4 222 # Make a temp file name in the proper directory.
Chris@4 223
Chris@4 224 dsttmp=$dstdir/#inst.$$#
Chris@4 225
Chris@4 226 # Move or copy the file name to the temp name
Chris@4 227
Chris@4 228 $doit $instcmd $src $dsttmp &&
Chris@4 229
Chris@4 230 trap "rm -f ${dsttmp}" 0 &&
Chris@4 231
Chris@4 232 # and set any options; do chmod last to preserve setuid bits
Chris@4 233
Chris@4 234 # If any of these fail, we abort the whole thing. If we want to
Chris@4 235 # ignore errors from any of these, just make sure not to ignore
Chris@4 236 # errors from the above "$doit $instcmd $src $dsttmp" command.
Chris@4 237
Chris@4 238 if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
Chris@4 239 if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
Chris@4 240 if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
Chris@4 241 if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
Chris@4 242
Chris@4 243 # Now rename the file to the real destination.
Chris@4 244
Chris@4 245 $doit $rmcmd -f $dstdir/$dstfile &&
Chris@4 246 $doit $mvcmd $dsttmp $dstdir/$dstfile
Chris@4 247
Chris@4 248 fi &&
Chris@4 249
Chris@4 250
Chris@4 251 exit 0