mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-22 12:20:07 +00:00
Merge commit '6696212ddecbb5ffae8d71467518cc5651c90b3f'
This commit is contained in:
commit
90df734bf8
4 changed files with 46 additions and 89 deletions
|
@ -511,83 +511,17 @@ by shell bindings automatically.
|
||||||
When you update shell bindings, they may refuse to work with the binary you've built earlier. In
|
When you update shell bindings, they may refuse to work with the binary you've built earlier. In
|
||||||
this case you'll need to rebuild.
|
this case you'll need to rebuild.
|
||||||
|
|
||||||
|
If you are using gitstatus through [Powerlevel10k](https://github.com/romkatv/powerlevel10k), the
|
||||||
|
instructions are the same except that you don't need to clone gitstatus. Instead, change your
|
||||||
|
current directory to `/path/to/powerlevel10k/gitstatus` (`/path/to/powerlevel10k` is the directory
|
||||||
|
where you've installed Powerlevel10k) and run `./build -w -s -d docker` from there as described
|
||||||
|
above.
|
||||||
|
|
||||||
### Compiling for distribution
|
### Compiling for distribution
|
||||||
|
|
||||||
If you want to package gitstatus, it's best to do it based off [releases](
|
It's currently neither easy nor recommended to package and distribute gitstatus. There are no
|
||||||
https://github.com/romkatv/gitstatus/releases).
|
instructions you can follow that would allow you to easily update your package when new versions of
|
||||||
|
gitstatus are released. This may change in the future but not soon.
|
||||||
The following code should work without patching anything in gitstatus sources. If it doesn't, please
|
|
||||||
open an issue.
|
|
||||||
|
|
||||||
**IMPORTANT:** *Change version to what you want to package. This example doesn't get updated when
|
|
||||||
new versions are released.*
|
|
||||||
|
|
||||||
```zsh
|
|
||||||
# Download and extract gitstatus tarball.
|
|
||||||
gitstatus_version=1.1.0 # IMPORTANT: CHANGE VERSION TO WHAT YOU WANT
|
|
||||||
wget https://github.com/romkatv/gitstatus/archive/v"$gitstatus_version".tar.gz
|
|
||||||
tar -xzf v"$gitstatus_version".tar.gz
|
|
||||||
cd gitstatus-"$gitstatus_version"
|
|
||||||
|
|
||||||
# Download libgit2 tarball and compile gitstatusd.
|
|
||||||
./build -w
|
|
||||||
|
|
||||||
# Post-process.
|
|
||||||
rm ./deps/libgit2-*.tar.gz
|
|
||||||
for file in *.zsh install; do
|
|
||||||
zsh -fc "emulate zsh -o no_aliases && zcompile -R -- $file.zwc $file"
|
|
||||||
done
|
|
||||||
```
|
|
||||||
|
|
||||||
This needs binutils, cmake, gcc, g++, git, GNU make, wget, zsh and either shasum or sha256sum.
|
|
||||||
|
|
||||||
Once build completes, *do not delete or move any files*. Package the whole directory as is. Don't
|
|
||||||
add the directory or any of its subdirectories to `PATH`.
|
|
||||||
|
|
||||||
You probably don't want to build in docker, so don't pass `-d` to `./build`.
|
|
||||||
|
|
||||||
gitstatus depends on a [custom fork of libgit2](https://github.com/romkatv/libgit2/). When you run
|
|
||||||
`./build -w`, it'll automatically download the appropriate libgit2 tarball and verify its sha256.
|
|
||||||
If you want to separate the downloading of source tarballs from compilation, you can download the
|
|
||||||
libgit2 tarball manually and invoke `./build` without `-w`.
|
|
||||||
|
|
||||||
```zsh
|
|
||||||
# Download and extract gitstatus tarball.
|
|
||||||
gitstatus_version=1.1.0 # IMPORTANT: CHANGE VERSION TO WHAT YOU WANT
|
|
||||||
wget https://github.com/romkatv/gitstatus/archive/v"$gitstatus_version".tar.gz
|
|
||||||
tar -xzf v"$gitstatus_version".tar.gz
|
|
||||||
cd gitstatus-"$gitstatus_version"
|
|
||||||
|
|
||||||
# Download libgit2 tarball and place it where ./build expects it.
|
|
||||||
. ./build.info
|
|
||||||
libgit2_path=./deps/libgit2-"$libgit2_version".tar.gz
|
|
||||||
libgit2_url=https://github.com/romkatv/libgit2/archive/"$libgit2_version".tar.gz
|
|
||||||
wget -O "$libgit2_path" "$libgit2_url"
|
|
||||||
|
|
||||||
# Compile gitstatusd.
|
|
||||||
./build
|
|
||||||
|
|
||||||
# Post-process.
|
|
||||||
rm ./deps/libgit2-*.tar.gz
|
|
||||||
for file in *.zsh install; do
|
|
||||||
zsh -fc "emulate zsh -o no_aliases && zcompile -R -- $file.zwc $file"
|
|
||||||
done
|
|
||||||
```
|
|
||||||
|
|
||||||
Note that the URL and the content of the libgit2 tarball are fully defined by the main gitstatus
|
|
||||||
tarball. Thus, you can set URLs and sha256 checksums of the two tarball in the same place (package
|
|
||||||
definition) and update them at the same time when bumping package version. In other words, you don't
|
|
||||||
have to extract `libgit2_version` programmatically. You can manually copy it from [build.info](
|
|
||||||
https://github.com/romkatv/gitstatus/blob/master/build.info) to your package definition, if you
|
|
||||||
prefer.
|
|
||||||
|
|
||||||
[Powerlevel10k](https://github.com/romkatv/powerlevel10k) has an embedded version of gitstatus. It
|
|
||||||
must stay that way. If you decide to package both of them, follow the respective instructions from
|
|
||||||
each project. The embedded gitstatus in Powerlevel10k won't conflict with the standalone gitstatus.
|
|
||||||
They can have different versions and can coexist within the same Zsh process. Do not attempt to
|
|
||||||
surgically remove gitstatus from Powerlevel10k, package the result and then force Powerlevel10k to
|
|
||||||
use a separately packaged gitstatus. Instead, treat Powerlevel10k and gitstatus as independent
|
|
||||||
projects that don't depend on each other.
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|
|
@ -110,34 +110,44 @@ cpus="$(command getconf _NPROCESSORS_ONLN 2>/dev/null)" ||
|
||||||
cpus=8
|
cpus=8
|
||||||
|
|
||||||
case "$gitstatus_cpu" in
|
case "$gitstatus_cpu" in
|
||||||
ppc64le)
|
ppc64le) archflag="-mcpu";;
|
||||||
archflag="-mcpu"
|
*) archflag="-march";;
|
||||||
;;
|
|
||||||
*)
|
|
||||||
archflag="-march"
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
cflags="$archflag=$gitstatus_cpu -fno-plt"
|
||||||
|
|
||||||
|
if [ "$gitstatus_cpu" = x86-64 ]; then
|
||||||
|
cflags="$cflags -mtune=generic"
|
||||||
|
fi
|
||||||
|
|
||||||
libgit2_cmake_flags=
|
libgit2_cmake_flags=
|
||||||
libgit2_cflags="$archflag=$gitstatus_cpu"
|
libgit2_cflags="$cflags"
|
||||||
|
|
||||||
gitstatus_cxx=g++
|
gitstatus_cxx=g++
|
||||||
gitstatus_cxxflags="-I${workdir}/libgit2/include -DGITSTATUS_ZERO_NSEC -D_GNU_SOURCE $archflag=$gitstatus_cpu"
|
gitstatus_cxxflags="$cflags -I${workdir}/libgit2/include -DGITSTATUS_ZERO_NSEC -D_GNU_SOURCE"
|
||||||
gitstatus_ldflags="-L${workdir}/libgit2/build"
|
gitstatus_ldflags="-L${workdir}/libgit2/build"
|
||||||
gitstatus_ldlibs=
|
gitstatus_ldlibs=
|
||||||
gitstatus_make=make
|
gitstatus_make=make
|
||||||
|
|
||||||
case "$gitstatus_kernel" in
|
case "$gitstatus_kernel" in
|
||||||
linux)
|
linux)
|
||||||
|
if [ -n "$docker_cmd" ]; then
|
||||||
gitstatus_ldflags="$gitstatus_ldflags -static"
|
gitstatus_ldflags="$gitstatus_ldflags -static"
|
||||||
|
fi
|
||||||
|
gitstatus_ldflags="$gitstatus_ldflags -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now"
|
||||||
|
libgit2_cmake_flags="$libgit2_cmake_flags -DENABLE_REPRODUCIBLE_BUILDS=ON"
|
||||||
;;
|
;;
|
||||||
freebsd)
|
freebsd)
|
||||||
gitstatus_make=gmake
|
gitstatus_make=gmake
|
||||||
gitstatus_ldflags="$gitstatus_ldflags -static"
|
gitstatus_ldflags="$gitstatus_ldflags -static"
|
||||||
|
gitstatus_ldflags="$gitstatus_ldflags -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now"
|
||||||
|
libgit2_cmake_flags="$libgit2_cmake_flags -DENABLE_REPRODUCIBLE_BUILDS=ON"
|
||||||
;;
|
;;
|
||||||
netbsd)
|
netbsd)
|
||||||
gitstatus_make=gmake
|
gitstatus_make=gmake
|
||||||
gitstatus_ldflags="$gitstatus_ldflags -static"
|
gitstatus_ldflags="$gitstatus_ldflags -static"
|
||||||
|
gitstatus_ldflags="$gitstatus_ldflags -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now"
|
||||||
|
libgit2_cmake_flags="$libgit2_cmake_flags -DENABLE_REPRODUCIBLE_BUILDS=ON"
|
||||||
;;
|
;;
|
||||||
darwin)
|
darwin)
|
||||||
command mkdir -- "$workdir"/lib
|
command mkdir -- "$workdir"/lib
|
||||||
|
@ -147,12 +157,15 @@ case "$gitstatus_kernel" in
|
||||||
gitstatus_cxxflags="$gitstatus_cxxflags -I/usr/local/opt/libiconv/include"
|
gitstatus_cxxflags="$gitstatus_cxxflags -I/usr/local/opt/libiconv/include"
|
||||||
gitstatus_ldlibs="$gitstatus_ldlibs -liconv"
|
gitstatus_ldlibs="$gitstatus_ldlibs -liconv"
|
||||||
gitstatus_ldflags="$gitstatus_ldflags -L${workdir}/lib"
|
gitstatus_ldflags="$gitstatus_ldflags -L${workdir}/lib"
|
||||||
|
libgit2_cmake_flags="$libgit2_cmake_flags -DENABLE_REPRODUCIBLE_BUILDS=OFF"
|
||||||
;;
|
;;
|
||||||
msys*|mingw*)
|
msys*|mingw*)
|
||||||
gitstatus_ldflags="$gitstatus_ldflags -static"
|
gitstatus_ldflags="$gitstatus_ldflags -static"
|
||||||
|
libgit2_cmake_flags="$libgit2_cmake_flags -DENABLE_REPRODUCIBLE_BUILDS=ON"
|
||||||
;;
|
;;
|
||||||
cygwin*)
|
cygwin*)
|
||||||
gitstatus_ldflags="$gitstatus_ldflags -static"
|
gitstatus_ldflags="$gitstatus_ldflags -static"
|
||||||
|
libgit2_cmake_flags="$libgit2_cmake_flags -DENABLE_REPRODUCIBLE_BUILDS=ON"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
>&2 echo "[internal error] unhandled kernel: $gitstatus_kernel"
|
>&2 echo "[internal error] unhandled kernel: $gitstatus_kernel"
|
||||||
|
@ -252,7 +265,6 @@ CFLAGS="$libgit2_cflags" command cmake \
|
||||||
-DUSE_GSSAPI=OFF \
|
-DUSE_GSSAPI=OFF \
|
||||||
-DUSE_NTLMCLIENT=OFF \
|
-DUSE_NTLMCLIENT=OFF \
|
||||||
-DBUILD_SHARED_LIBS=OFF \
|
-DBUILD_SHARED_LIBS=OFF \
|
||||||
-DENABLE_REPRODUCIBLE_BUILDS=OFF \
|
|
||||||
$libgit2_cmake_flags \
|
$libgit2_cmake_flags \
|
||||||
..
|
..
|
||||||
command make -j "$cpus" VERBOSE=1
|
command make -j "$cpus" VERBOSE=1
|
||||||
|
@ -490,6 +502,8 @@ fi
|
||||||
|
|
||||||
if [ -n "$docker_cmd" ]; then
|
if [ -n "$docker_cmd" ]; then
|
||||||
"$docker_cmd" run \
|
"$docker_cmd" run \
|
||||||
|
-e docker_cmd="$docker_cmd" \
|
||||||
|
-e docker_image="$docker_image" \
|
||||||
-e gitstatus_kernel="$gitstatus_kernel" \
|
-e gitstatus_kernel="$gitstatus_kernel" \
|
||||||
-e gitstatus_arch="$gitstatus_arch" \
|
-e gitstatus_arch="$gitstatus_arch" \
|
||||||
-e gitstatus_cpu="$gitstatus_cpu" \
|
-e gitstatus_cpu="$gitstatus_cpu" \
|
||||||
|
|
|
@ -367,6 +367,8 @@ END
|
||||||
done <"$gitstatus_dir"/install.info
|
done <"$gitstatus_dir"/install.info
|
||||||
|
|
||||||
>&2 echo "[gitstatus] error: no gitstatusd found for $uname_s $uname_m"
|
>&2 echo "[gitstatus] error: no gitstatusd found for $uname_s $uname_m"
|
||||||
|
>&2 echo ""
|
||||||
|
>&2 echo "See: https://github.com/romkatv/gitstatus/blob/master/README.md#compiling"
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -283,17 +283,24 @@ function mbuild() {
|
||||||
print -r -- "starting build for $platform on $assets[$platform] (pid $!)"
|
print -r -- "starting build for $platform on $assets[$platform] (pid $!)"
|
||||||
pids+=($platform $!)
|
pids+=($platform $!)
|
||||||
done
|
done
|
||||||
|
local failed=()
|
||||||
for platform pid in $pids; do
|
for platform pid in $pids; do
|
||||||
print -rn -- "$platform => "
|
print -rn -- "$platform => "
|
||||||
if wait $pid; then
|
if wait $pid; then
|
||||||
print -r -- "ok"
|
print -r -- "ok"
|
||||||
else
|
else
|
||||||
print -r -- "error $?"
|
print -r -- "error"
|
||||||
print -r -- "---------------------"
|
failed+=$platform
|
||||||
>&2 cat $logs/$platform
|
|
||||||
return 1
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
(( $#failed )) || return 0
|
||||||
|
print
|
||||||
|
print -r -- "Error logs:"
|
||||||
|
print
|
||||||
|
for platform in $failed; do
|
||||||
|
print -r -- " $platform => $logs/$platform"
|
||||||
|
done
|
||||||
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Copied from https://github.com/romkatv/run-process-tree.
|
# Copied from https://github.com/romkatv/run-process-tree.
|
||||||
|
|
Loading…
Reference in a new issue