Package list libsdl2-mixer / c9cd2de
New upstream version 2.0.5~20211214.gffd0589+dfsg Simon McVittie 6 months ago
1 changed file(s) with 162 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 #! /bin/sh
1 # mkinstalldirs --- make directory hierarchy
2
3 scriptversion=2020-07-26.22; # UTC
4
5 # Original author: Noah Friedman <friedman@prep.ai.mit.edu>
6 # Created: 1993-05-16
7 # Public domain.
8 #
9 # This file is maintained in Automake, please report
10 # bugs to <bug-automake@gnu.org> or send patches to
11 # <automake-patches@gnu.org>.
12
13 nl='
14 '
15 IFS=" "" $nl"
16 errstatus=0
17 dirmode=
18
19 usage="\
20 Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
21
22 Create each directory DIR (with mode MODE, if specified), including all
23 leading file name components.
24
25 Report bugs to <bug-automake@gnu.org>."
26
27 # process command line arguments
28 while test $# -gt 0 ; do
29 case $1 in
30 -h | --help | --h*) # -h for help
31 echo "$usage"
32 exit $?
33 ;;
34 -m) # -m PERM arg
35 shift
36 test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
37 dirmode=$1
38 shift
39 ;;
40 --version)
41 echo "$0 $scriptversion"
42 exit $?
43 ;;
44 --) # stop option processing
45 shift
46 break
47 ;;
48 -*) # unknown option
49 echo "$usage" 1>&2
50 exit 1
51 ;;
52 *) # first non-opt arg
53 break
54 ;;
55 esac
56 done
57
58 for file
59 do
60 if test -d "$file"; then
61 shift
62 else
63 break
64 fi
65 done
66
67 case $# in
68 0) exit 0 ;;
69 esac
70
71 # Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and
72 # mkdir -p a/c at the same time, both will detect that a is missing,
73 # one will create a, then the other will try to create a and die with
74 # a "File exists" error. This is a problem when calling mkinstalldirs
75 # from a parallel make. We use --version in the probe to restrict
76 # ourselves to GNU mkdir, which is thread-safe.
77 case $dirmode in
78 '')
79 if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
80 echo "mkdir -p -- $*"
81 exec mkdir -p -- "$@"
82 else
83 # On NextStep and OpenStep, the 'mkdir' command does not
84 # recognize any option. It will interpret all options as
85 # directories to create, and then abort because '.' already
86 # exists.
87 test -d ./-p && rmdir ./-p
88 test -d ./--version && rmdir ./--version
89 fi
90 ;;
91 *)
92 if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 &&
93 test ! -d ./--version; then
94 echo "umask 22"
95 umask 22
96 echo "mkdir -m $dirmode -p -- $*"
97 exec mkdir -m "$dirmode" -p -- "$@"
98 else
99 # Clean up after NextStep and OpenStep mkdir.
100 for d in ./-m ./-p ./--version "./$dirmode";
101 do
102 test -d $d && rmdir $d
103 done
104 fi
105 ;;
106 esac
107
108 echo "umask 22"
109 umask 22
110
111 for file
112 do
113 case $file in
114 /*) pathcomp=/ ;;
115 *) pathcomp= ;;
116 esac
117 oIFS=$IFS
118 IFS=/
119 set fnord $file
120 shift
121 IFS=$oIFS
122
123 for d
124 do
125 test "x$d" = x && continue
126
127 pathcomp=$pathcomp$d
128 case $pathcomp in
129 -*) pathcomp=./$pathcomp ;;
130 esac
131
132 if test ! -d "$pathcomp"; then
133 echo "mkdir $pathcomp"
134
135 mkdir "$pathcomp" || lasterr=$?
136
137 if test ! -d "$pathcomp"; then
138 errstatus=$lasterr
139 fi
140 fi
141
142 pathcomp=$pathcomp/
143 done
144
145 if test ! -z "$dirmode"; then
146 echo "chmod $dirmode $file"
147 chmod "$dirmode" "$file" || errstatus=$?
148 fi
149 done
150
151 exit $errstatus
152
153 # Local Variables:
154 # mode: shell-script
155 # sh-indentation: 2
156 # eval: (add-hook 'before-save-hook 'time-stamp)
157 # time-stamp-start: "scriptversion="
158 # time-stamp-format: "%:y-%02m-%02d.%02H"
159 # time-stamp-time-zone: "UTC0"
160 # time-stamp-end: "; # UTC"
161 # End: