@@ -59,7 +59,7 @@ appname=gitstatusd-"$GITSTATUS_KERNEL"-"$GITSTATUS_ARCH"
59
59
60
60
cleanup() {
61
61
cd /
62
- rm -rf -- "$workdir " "$outdir "/usrbin/"$appname ".tmp
62
+ rm -rf -- "$workdir " "$outdir "/usrbin/"$appname ".$$ " $outdir "/deps/libgit2. $$
63
63
trap - INT QUIT TERM EXIT ILL PIPE
64
64
}
65
65
trap cleanup INT QUIT TERM EXIT ILL PIPE
@@ -100,7 +100,7 @@ case "$GITSTATUS_KERNEL" in
100
100
>&2 echo "[error] please install homebrew from https://brew.sh/ and retry"
101
101
exit 1
102
102
fi
103
- brew install libiconv cmake git
103
+ brew install libiconv cmake git wget
104
104
mkdir -- "$workdir "/lib
105
105
ln -s -- /usr/local/opt/libiconv/lib/libiconv.a "$workdir "/lib
106
106
libgit2_cmake_flags="$libgit2_cmake_flags -DUSE_ICONV=ON"
@@ -115,7 +115,7 @@ case "$GITSTATUS_KERNEL" in
115
115
gitstatus_ldflags="$gitstatus_ldflags -static"
116
116
;;
117
117
cygwin*)
118
- for cmd in cmake gcc g++ git ld make; do
118
+ for cmd in cmake gcc g++ git ld make wget ; do
119
119
if ! command -v "$cmd " >/dev/null 2>&1; then
120
120
>&2 echo "[error] command not found: $cmd "
121
121
>&2 echo ""
@@ -138,11 +138,22 @@ case "$GITSTATUS_KERNEL" in
138
138
esac
139
139
140
140
. "$outdir "/build.info
141
- git clone -- "$libgit2_url " "$workdir "/libgit2
142
- cd -- "$workdir "/libgit2
143
- git checkout "$libgit2_ref "
144
- mkdir build
145
- cd build
141
+ if [ -z "$libgit2_tag " ]; then
142
+ >&2 echo "[internal error] libgit2_tag not set"
143
+ exit 1
144
+ fi
145
+ libgit2_url=https://github.com/romkatv/libgit2/archive/"$libgit2_tag ".tar.gz
146
+ libgit2_tarball="$outdir "/deps/libgit2-"$libgit2_tag ".tar.gz
147
+ if [ ! -e "$libgit2_tarball " ]; then
148
+ wget -O "$outdir "/deps/libgit2.$$ -- "$libgit2_url "
149
+ mv -f -- "$outdir "/deps/libgit2.$$ "$libgit2_tarball "
150
+ fi
151
+
152
+ cd -- "$workdir "
153
+ tar -xzf "$libgit2_tarball "
154
+ mv -- libgit2-"$libgit2_tag " libgit2
155
+ mkdir libgit2/build
156
+ cd libgit2/build
146
157
147
158
CFLAGS="$libgit2_cflags " cmake \
148
159
-DCMAKE_BUILD_TYPE=Release \
@@ -162,7 +173,7 @@ CFLAGS="$libgit2_cflags" cmake \
162
173
..
163
174
make -j "$cpus " VERBOSE=1
164
175
165
- APPNAME="$appname ".tmp \
176
+ APPNAME="$appname ".$$ \
166
177
OBJDIR="$workdir "/gitstatus \
167
178
CXX="$gitstatus_cxx " \
168
179
CXXFLAGS="$gitstatus_cxxflags " \
@@ -172,20 +183,20 @@ APPNAME="$appname".tmp \
172
183
173
184
app="$outdir "/usrbin/"$appname "
174
185
175
- strip "$app ".tmp
186
+ strip "$app ".$$
176
187
177
188
mkdir -- "$workdir "/repo
178
189
git -C "$workdir "/repo init --
179
190
git -C "$workdir "/repo config user.email "[email protected] "
180
191
git -C "$workdir "/repo commit --allow-empty --allow-empty-message -m ''
181
192
182
- resp="$( printf " hello\037$workdir /repo\036" | " $app " .tmp ) "
193
+ resp="$( printf " hello\037$workdir /repo\036" | " $app " .$$ ) "
183
194
[ -n "$resp " -a -z "${resp## hello* 1* $workdir / repo* master* } " ]
184
195
185
- resp="$( printf ' hello\037\036' | " $app " .tmp ) "
196
+ resp="$( printf ' hello\037\036' | " $app " .$$ ) "
186
197
[ -n "$resp " -a -z "${resp## hello* 0* } " ]
187
198
188
- mv -f -- "$app ".tmp "$app "
199
+ mv -f -- "$app ".$$ "$app "
189
200
190
201
cleanup
191
202
0 commit comments