annotate src/portaudio/bindings/cpp/build/gnu/install-sh @ 89:8a15ff55d9af

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