filename | install-sh |
changeset | 179:18dacd91aa73 |
author | nkeynes |
date | Sat Dec 27 02:59:35 2008 +0000 (15 years ago) |
branch | lxdream-mem |
permissions | -rw-r--r-- |
last change | Replace fpscr_mask/fpscr flags in xlat_cache_block with a single xlat_sh4_mode, which tracks the field of the same name in sh4r - actually a little faster this way. Now depends on SR.MD, FPSCR.PR and FPSCR.SZ (although it doesn't benefit from the SR flag yet). Also fixed the failure to check the flags in the common case (code address returned by previous block) which took away the performance benefits, but oh well. |
file | annotate | diff | log | raw |
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +00001.2 +++ b/install-sh Sat Dec 27 02:59:35 2008 +00001.3 @@ -0,0 +1,294 @@1.4 +#!/bin/sh1.5 +#1.6 +# install - install a program, script, or datafile1.7 +#1.8 +# This originates from X11R5 (mit/util/scripts/install.sh), which was1.9 +# later released in X11R6 (xc/config/util/install.sh) with the1.10 +# following copyright and license.1.11 +#1.12 +# Copyright (C) 1994 X Consortium1.13 +#1.14 +# Permission is hereby granted, free of charge, to any person obtaining a copy1.15 +# of this software and associated documentation files (the "Software"), to1.16 +# deal in the Software without restriction, including without limitation the1.17 +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or1.18 +# sell copies of the Software, and to permit persons to whom the Software is1.19 +# furnished to do so, subject to the following conditions:1.20 +#1.21 +# The above copyright notice and this permission notice shall be included in1.22 +# all copies or substantial portions of the Software.1.23 +#1.24 +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR1.25 +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,1.26 +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE1.27 +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN1.28 +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-1.29 +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.1.30 +#1.31 +# Except as contained in this notice, the name of the X Consortium shall not1.32 +# be used in advertising or otherwise to promote the sale, use or other deal-1.33 +# ings in this Software without prior written authorization from the X Consor-1.34 +# tium.1.35 +#1.36 +#1.37 +# FSF changes to this file are in the public domain.1.38 +#1.39 +# Calling this script install-sh is preferred over install.sh, to prevent1.40 +# `make' implicit rules from creating a file called install from it1.41 +# when there is no Makefile.1.42 +#1.43 +# This script is compatible with the BSD install script, but was written1.44 +# from scratch. It can only install one file at a time, a restriction1.45 +# shared with many OS's install programs.1.46 +1.47 +1.48 +# set DOITPROG to echo to test this script1.49 +1.50 +# Don't use :- since 4.3BSD and earlier shells don't like it.1.51 +doit="${DOITPROG-}"1.52 +1.53 +1.54 +# put in absolute paths if you don't have them in your path; or use env. vars.1.55 +1.56 +mvprog="${MVPROG-mv}"1.57 +cpprog="${CPPROG-cp}"1.58 +chmodprog="${CHMODPROG-chmod}"1.59 +chownprog="${CHOWNPROG-chown}"1.60 +chgrpprog="${CHGRPPROG-chgrp}"1.61 +stripprog="${STRIPPROG-strip}"1.62 +rmprog="${RMPROG-rm}"1.63 +mkdirprog="${MKDIRPROG-mkdir}"1.64 +1.65 +transformbasename=""1.66 +transform_arg=""1.67 +instcmd="$mvprog"1.68 +chmodcmd="$chmodprog 0755"1.69 +chowncmd=""1.70 +chgrpcmd=""1.71 +stripcmd=""1.72 +rmcmd="$rmprog -f"1.73 +mvcmd="$mvprog"1.74 +src=""1.75 +dst=""1.76 +dir_arg=""1.77 +1.78 +while [ x"$1" != x ]; do1.79 + case $1 in1.80 + -c) instcmd=$cpprog1.81 + shift1.82 + continue;;1.83 +1.84 + -d) dir_arg=true1.85 + shift1.86 + continue;;1.87 +1.88 + -m) chmodcmd="$chmodprog $2"1.89 + shift1.90 + shift1.91 + continue;;1.92 +1.93 + -o) chowncmd="$chownprog $2"1.94 + shift1.95 + shift1.96 + continue;;1.97 +1.98 + -g) chgrpcmd="$chgrpprog $2"1.99 + shift1.100 + shift1.101 + continue;;1.102 +1.103 + -s) stripcmd=$stripprog1.104 + shift1.105 + continue;;1.106 +1.107 + -t=*) transformarg=`echo $1 | sed 's/-t=//'`1.108 + shift1.109 + continue;;1.110 +1.111 + -b=*) transformbasename=`echo $1 | sed 's/-b=//'`1.112 + shift1.113 + continue;;1.114 +1.115 + *) if [ x"$src" = x ]1.116 + then1.117 + src=$11.118 + else1.119 + # this colon is to work around a 386BSD /bin/sh bug1.120 + :1.121 + dst=$11.122 + fi1.123 + shift1.124 + continue;;1.125 + esac1.126 +done1.127 +1.128 +if [ x"$src" = x ]1.129 +then1.130 + echo "$0: no input file specified" >&21.131 + exit 11.132 +else1.133 + :1.134 +fi1.135 +1.136 +if [ x"$dir_arg" != x ]; then1.137 + dst=$src1.138 + src=""1.139 +1.140 + if [ -d "$dst" ]; then1.141 + instcmd=:1.142 + chmodcmd=""1.143 + else1.144 + instcmd=$mkdirprog1.145 + fi1.146 +else1.147 +1.148 +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command1.149 +# might cause directories to be created, which would be especially bad1.150 +# if $src (and thus $dsttmp) contains '*'.1.151 +1.152 + if [ -f "$src" ] || [ -d "$src" ]1.153 + then1.154 + :1.155 + else1.156 + echo "$0: $src does not exist" >&21.157 + exit 11.158 + fi1.159 +1.160 + if [ x"$dst" = x ]1.161 + then1.162 + echo "$0: no destination specified" >&21.163 + exit 11.164 + else1.165 + :1.166 + fi1.167 +1.168 +# If destination is a directory, append the input filename; if your system1.169 +# does not like double slashes in filenames, you may need to add some logic1.170 +1.171 + if [ -d "$dst" ]1.172 + then1.173 + dst=$dst/`basename "$src"`1.174 + else1.175 + :1.176 + fi1.177 +fi1.178 +1.179 +## this sed command emulates the dirname command1.180 +dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`1.181 +1.182 +# Make sure that the destination directory exists.1.183 +# this part is taken from Noah Friedman's mkinstalldirs script1.184 +1.185 +# Skip lots of stat calls in the usual case.1.186 +if [ ! -d "$dstdir" ]; then1.187 +defaultIFS='1.188 + '1.189 +IFS="${IFS-$defaultIFS}"1.190 +1.191 +oIFS=$IFS1.192 +# Some sh's can't handle IFS=/ for some reason.1.193 +IFS='%'1.194 +set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`1.195 +IFS=$oIFS1.196 +1.197 +pathcomp=''1.198 +1.199 +while [ $# -ne 0 ] ; do1.200 + pathcomp=$pathcomp$11.201 + shift1.202 +1.203 + if [ ! -d "$pathcomp" ] ;1.204 + then1.205 + $mkdirprog "$pathcomp"1.206 + else1.207 + :1.208 + fi1.209 +1.210 + pathcomp=$pathcomp/1.211 +done1.212 +fi1.213 +1.214 +if [ x"$dir_arg" != x ]1.215 +then1.216 + $doit $instcmd "$dst" &&1.217 +1.218 + if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dst"; else : ; fi &&1.219 + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dst"; else : ; fi &&1.220 + if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dst"; else : ; fi &&1.221 + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dst"; else : ; fi1.222 +else1.223 +1.224 +# If we're going to rename the final executable, determine the name now.1.225 +1.226 + if [ x"$transformarg" = x ]1.227 + then1.228 + dstfile=`basename "$dst"`1.229 + else1.230 + dstfile=`basename "$dst" $transformbasename |1.231 + sed $transformarg`$transformbasename1.232 + fi1.233 +1.234 +# don't allow the sed command to completely eliminate the filename1.235 +1.236 + if [ x"$dstfile" = x ]1.237 + then1.238 + dstfile=`basename "$dst"`1.239 + else1.240 + :1.241 + fi1.242 +1.243 +# Make a couple of temp file names in the proper directory.1.244 +1.245 + dsttmp=$dstdir/_inst.$$_1.246 + rmtmp=$dstdir/_rm.$$_1.247 +1.248 +# Trap to clean up temp files at exit.1.249 +1.250 + trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 01.251 + trap '(exit $?); exit' 1 2 13 151.252 +1.253 +# Move or copy the file name to the temp name1.254 +1.255 + $doit $instcmd "$src" "$dsttmp" &&1.256 +1.257 +# and set any options; do chmod last to preserve setuid bits1.258 +1.259 +# If any of these fail, we abort the whole thing. If we want to1.260 +# ignore errors from any of these, just make sure not to ignore1.261 +# errors from the above "$doit $instcmd $src $dsttmp" command.1.262 +1.263 + if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else :;fi &&1.264 + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else :;fi &&1.265 + if [ x"$stripcmd" != x ]; then $doit $stripcmd "$dsttmp"; else :;fi &&1.266 + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else :;fi &&1.267 +1.268 +# Now remove or move aside any old file at destination location. We try this1.269 +# two ways since rm can't unlink itself on some systems and the destination1.270 +# file might be busy for other reasons. In this case, the final cleanup1.271 +# might fail but the new file should still install successfully.1.272 +1.273 +{1.274 + if [ -f "$dstdir/$dstfile" ]1.275 + then1.276 + $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null ||1.277 + $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null ||1.278 + {1.279 + echo "$0: cannot unlink or rename $dstdir/$dstfile" >&21.280 + (exit 1); exit1.281 + }1.282 + else1.283 + :1.284 + fi1.285 +} &&1.286 +1.287 +# Now rename the file to the real destination.1.288 +1.289 + $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"1.290 +1.291 +fi &&1.292 +1.293 +# The final little trick to "correctly" pass the exit status to the exit trap.1.294 +1.295 +{1.296 + (exit 0); exit1.297 +}
.