annotate src/portaudio_20161030/bindings/cpp/build/gnu/install-sh @ 140:59a8758c56b1

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