Meta/Make: separate bootstrap-git dependency
It still needs a working git to bootstrap, but we have to start from somewhere.
Junio C Hamano committed
Mar 13, 2013 at 13:22 UTC
119ae8adf1e118fde4c98981f17b65c9649613ef
1 file changed
+36
-18
Make
+36
-18
@@ -56,7 +56,9 @@ do
56
)
57
done
58
59
-Wall='-Wall -Wdeclaration-after-statement' tests= jobs= skip= oldtest=
59
+Wall='-Wall -Wdeclaration-after-statement'
60
+tests= jobs= skip= oldtest=
61
+
62
case `uname` in
63
OpenBSD)
64
O="-fgnu89-inline"
@@ -76,20 +78,43 @@ SunOS)
78
;;
79
esac
80
81
+old_style_def_fix () {
82
+ rev=$($GIT rev-parse HEAD 2>/dev/null) &&
83
+ case "$($GIT merge-base "$old_style_def_fix" "$rev")" in
84
+ $old_style_def_fix)
85
+ printf "%s\n" "-Wold-style-definition"
86
+ ;;
87
+ esac
88
+}
89
+
90
+determine_branch () {
91
+ expr "$($GIT symbolic-ref HEAD 2>/dev/null)" : 'refs/heads/\(.*\)' ||
92
+ echo detached
93
+}
94
+
95
+determine_version () {
96
+ v=`$GIT describe HEAD`
97
+ expr "$v" : '.*-g[0-9a-f]*$' >/dev/null && {
98
+ echo >&2 "You are on 'snap' but $v is not an official version."
99
+ exit 1
100
+ }
101
+ echo "$v"
102
+}
103
+
104
+determine_long_version () {
105
+ $GIT describe HEAD 2>/dev/null || echo unknown-g00000000 |
106
+ sed -e 's/-/./g'
107
+}
108
+
109
while case $# in 0) break ;; esac
110
do
111
case "$1" in
112
-pedantic | --pedantic)
83
- o= &&
84
- rev=$($GIT rev-parse HEAD) &&
85
- case "$($GIT merge-base "$old_style_def_fix" "$rev")" in
86
- $old_style_def_fix)
87
- o=-Wold-style-definition ;;
88
- esac
113
case "$NO_PEDANTIC" in
114
?*) ;;
115
'')
92
- O="$O -Werror $o -std=c99 -Wno-pointer-to-int-cast"
116
+ O="$O -Werror $(old_style_def_fix) -std=c99"
117
+ O="$O -Wno-pointer-to-int-cast"
118
O="$O -Wpointer-arith -Woverflow -Wunused"
119
;;
120
esac
@@ -151,19 +176,14 @@ fi
176
LC_ALL=$LANG
177
export LANG LC_ALL
178
154
-head=`$GIT symbolic-ref HEAD 2>/dev/null` &&
155
-branch=`expr "$head" : 'refs/heads/\(.*\)'` || branch=detached
179
+branch=$(determine_branch)
180
181
case "$branch" in
182
next | maint | master | pu | jch)
183
prefix="$inst_prefix/git-$branch"
184
;;
185
snap)
162
- v=`$GIT describe HEAD`
163
- expr "$v" : '.*-g[0-9a-f]*$' >/dev/null && {
164
- echo >&2 "You are on 'snap' but $v is not an official version."
165
- exit 1
166
- }
186
+ v=$(determine_version)
187
prefix="$inst_prefix/git-snap-$v"
188
;;
189
*)
@@ -171,9 +191,7 @@ snap)
191
esac
192
d="prefix=$prefix"
193
174
-sh -c 'git describe --abbrev=4 HEAD' >/dev/null 2>&1 || {
175
- $GIT describe --abbrev=4 HEAD | sed -e 's/-/./g' >version
176
-}
194
+determine_long_version >version
195
196
d="$d "'
197
MAN_BASE_URL="http://www.kernel.org/pub/software/scm/git/docs/"