Skip to content

Commit 4092769

Browse files
committed
download libgit2 as tarball
1 parent 5a72b35 commit 4092769

File tree

4 files changed

+26
-16
lines changed

4 files changed

+26
-16
lines changed

build

+24-13
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ appname=gitstatusd-"$GITSTATUS_KERNEL"-"$GITSTATUS_ARCH"
5959
6060
cleanup() {
6161
cd /
62-
rm -rf -- "$workdir" "$outdir"/usrbin/"$appname".tmp
62+
rm -rf -- "$workdir" "$outdir"/usrbin/"$appname".$$ "$outdir"/deps/libgit2.$$
6363
trap - INT QUIT TERM EXIT ILL PIPE
6464
}
6565
trap cleanup INT QUIT TERM EXIT ILL PIPE
@@ -100,7 +100,7 @@ case "$GITSTATUS_KERNEL" in
100100
>&2 echo "[error] please install homebrew from https://brew.sh/ and retry"
101101
exit 1
102102
fi
103-
brew install libiconv cmake git
103+
brew install libiconv cmake git wget
104104
mkdir -- "$workdir"/lib
105105
ln -s -- /usr/local/opt/libiconv/lib/libiconv.a "$workdir"/lib
106106
libgit2_cmake_flags="$libgit2_cmake_flags -DUSE_ICONV=ON"
@@ -115,7 +115,7 @@ case "$GITSTATUS_KERNEL" in
115115
gitstatus_ldflags="$gitstatus_ldflags -static"
116116
;;
117117
cygwin*)
118-
for cmd in cmake gcc g++ git ld make; do
118+
for cmd in cmake gcc g++ git ld make wget; do
119119
if ! command -v "$cmd" >/dev/null 2>&1; then
120120
>&2 echo "[error] command not found: $cmd"
121121
>&2 echo ""
@@ -138,11 +138,22 @@ case "$GITSTATUS_KERNEL" in
138138
esac
139139
140140
. "$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
146157
147158
CFLAGS="$libgit2_cflags" cmake \
148159
-DCMAKE_BUILD_TYPE=Release \
@@ -162,7 +173,7 @@ CFLAGS="$libgit2_cflags" cmake \
162173
..
163174
make -j "$cpus" VERBOSE=1
164175
165-
APPNAME="$appname".tmp \
176+
APPNAME="$appname".$$ \
166177
OBJDIR="$workdir"/gitstatus \
167178
CXX="$gitstatus_cxx" \
168179
CXXFLAGS="$gitstatus_cxxflags" \
@@ -172,20 +183,20 @@ APPNAME="$appname".tmp \
172183
173184
app="$outdir"/usrbin/"$appname"
174185
175-
strip "$app".tmp
186+
strip "$app".$$
176187
177188
mkdir -- "$workdir"/repo
178189
git -C "$workdir"/repo init --
179190
git -C "$workdir"/repo config user.email "[email protected]"
180191
git -C "$workdir"/repo commit --allow-empty --allow-empty-message -m ''
181192
182-
resp="$(printf "hello\037$workdir/repo\036" | "$app".tmp)"
193+
resp="$(printf "hello\037$workdir/repo\036" | "$app".$$)"
183194
[ -n "$resp" -a -z "${resp##hello*1*$workdir/repo*master*}" ]
184195
185-
resp="$(printf 'hello\037\036' | "$app".tmp)"
196+
resp="$(printf 'hello\037\036' | "$app".$$)"
186197
[ -n "$resp" -a -z "${resp##hello*0*}" ]
187198
188-
mv -f -- "$app".tmp "$app"
199+
mv -f -- "$app".$$ "$app"
189200
190201
cleanup
191202

build.info

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
# This file is used by Makefile and build.
22
version="v1.0.0"
3-
libgit2_url="https://github.com/romkatv/libgit2.git"
4-
libgit2_ref="bb77509f4436901f3958e30272026f63d2247d7d"
3+
libgit2_tag="tag-81ae1b9a28a490c7dc9bbe9b986607c92341ae57"

deps/.gitkeep

Whitespace-only changes.

mbuild

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
# - Install 64-bit and 32-bit msys2: https://www.msys2.org/.
4141
# - Install 64-bit and 32-bit cygwin: https://cygwin.com/install.html.
4242
# - Choose to install 32-bit to c:/cygwin32 instead of the default c:/cygwin.
43-
# - Select these packages: binutils, cmake, gcc-core, gcc-g++, git, make.
43+
# - Select these packages: binutils, cmake, gcc-core, gcc-g++, git, make, wget.
4444
# - Install OpenSSH: https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse.
4545
# ps> Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
4646
# ps> Start-Service sshd

0 commit comments

Comments
 (0)