annotate src/portaudio_20140130/bindings/cpp/build/gnu/install-sh @ 83:ae30d91d2ffe

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