mirror of
https://github.com/romkatv/powerlevel10k.git
synced 2024-11-22 04:10:07 +00:00
Squashed 'gitstatus/' changes from 38d62a47..1c74c8db
1c74c8db add linux-ppc64le 968779b5 fix tar invocation 300f657c create anonymous tar archives a5581d18 force C locale during build (perl complains) 2616cd47 support downloads to usrbin 1e6075dd enable static linking on linux 2975d25f update libgit2 ref bea6f868 add ppc64le target git-subtree-dir: gitstatus git-subtree-split: 1c74c8db0f422aa6f95ced878351e0c6944a9bd6
This commit is contained in:
parent
fa2e337cbd
commit
b015817892
7 changed files with 58 additions and 47 deletions
19
build
19
build
|
@ -9,6 +9,8 @@ if [ -n "${ZSH_VERSION:-}" ]; then
|
|||
emulate sh -o err_exit -o no_unset
|
||||
fi
|
||||
|
||||
export LC_ALL=C
|
||||
|
||||
usage="$(command cat <<\END
|
||||
Usage: build [-m ARCH] [-c CPU] [-d CMD] [-i IMAGE] [-s] [-w]
|
||||
|
||||
|
@ -52,7 +54,7 @@ if [ "$(narg $workdir)" != 1 -o -z "${workdir##*:*}" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
appname=gitstatusd-"$gitstatus_kernel"-"$gitstatus_arch"
|
||||
appname=gitstatusd
|
||||
libgit2_tmp="$outdir"/deps/"$appname".libgit2.tmp
|
||||
|
||||
cleanup() {
|
||||
|
@ -68,8 +70,16 @@ trap cleanup INT QUIT TERM ILL PIPE
|
|||
if [ -n "$gitstatus_install_tools" ]; then
|
||||
case "$gitstatus_kernel" in
|
||||
linux)
|
||||
if command -v apk >/dev/null 2>&1; then
|
||||
command apk update
|
||||
command apk add binutils cmake gcc g++ git make musl-dev perl-utils
|
||||
elif command -v apt-get >/dev/null 2>&1; then
|
||||
apt-get update
|
||||
apt-get install -y binutils cmake gcc g++ make wget
|
||||
else
|
||||
>&2 echo "[error] -s is not supported on this system"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
freebsd)
|
||||
command pkg install -y cmake gmake binutils gcc git perl5
|
||||
|
@ -110,7 +120,7 @@ cpus="$(command getconf _NPROCESSORS_ONLN 2>/dev/null)" ||
|
|||
cpus=8
|
||||
|
||||
case "$gitstatus_cpu" in
|
||||
ppc64le) archflag="-mcpu";;
|
||||
powerpc64le) archflag="-mcpu";;
|
||||
*) archflag="-march";;
|
||||
esac
|
||||
|
||||
|
@ -131,9 +141,7 @@ gitstatus_make=make
|
|||
|
||||
case "$gitstatus_kernel" in
|
||||
linux)
|
||||
if [ -n "$docker_cmd" ]; then
|
||||
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"
|
||||
;;
|
||||
|
@ -446,9 +454,6 @@ case "$gitstatus_kernel" in
|
|||
;;
|
||||
esac
|
||||
fi
|
||||
elif [ -n "$gitstatus_install_tools" ]; then
|
||||
>&2 echo '[error] -s without -d is not supported on linux'
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
freebsd|netbsd|darwin)
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
# read by ./Makefile. `gitstatusd --version` reports it back.
|
||||
#
|
||||
# This value is also read by shell bindings (indirectly, through
|
||||
# ./install) when gitstatusd is from ./usrbin.
|
||||
gitstatus_version="v1.0.0"
|
||||
# ./install) when using GITSTATUS_DAEMON or usrbin/gitstatusd.
|
||||
gitstatus_version="v1.2.0"
|
||||
|
||||
# libgit2 is a build time dependency of gitstatusd. The values of
|
||||
# libgit2_version and libgit2_sha256 are read by ./build.
|
||||
|
@ -18,5 +18,5 @@ gitstatus_version="v1.0.0"
|
|||
#
|
||||
# If sha256 of ./deps/libgit2-${libgit2_version}.tar.gz doesn't match,
|
||||
# build gets aborted.
|
||||
libgit2_version="tag-005f77dca6dbe8788e55139fa1199fc94cc04f9a"
|
||||
libgit2_sha256="6af7c839640ed5474fef9761a80b5c24bcdd87abc771406e31d5c2bf27f48be5"
|
||||
libgit2_version="tag-d6c37a38587c9af2a9e63449fc8bf951dca0e854"
|
||||
libgit2_sha256="e3df79da60963f8711580dce53b1a7ed583bb534be9ebb95589e76346fa986be"
|
||||
|
|
|
@ -146,8 +146,18 @@ function gitstatus_start() {
|
|||
|
||||
local sig=(TERM ILL PIPE)
|
||||
|
||||
if (( UID == EUID )); then
|
||||
local home=~
|
||||
else
|
||||
local user
|
||||
user="$(command id -un)" || return
|
||||
[[ "$user" =~ ^[a-zA-Z0-9_,.-]+$ ]] || return
|
||||
eval "local home=~$user"
|
||||
[[ -n "$home" ]] || return
|
||||
fi
|
||||
|
||||
if [[ -x "$_gitstatus_bash_daemon" ]]; then
|
||||
"$_gitstatus_bash_daemon" \
|
||||
HOME="$home" "$_gitstatus_bash_daemon" \
|
||||
-G "$_gitstatus_bash_version" "${daemon_args[@]}" <&"$fd_in" >&"$fd_out" &
|
||||
local pid=$!
|
||||
trap "trap - ${sig[*]}; kill $pid &>/dev/null" ${sig[@]}
|
||||
|
@ -176,7 +186,7 @@ function gitstatus_start() {
|
|||
[[ -n "$_gitstatus_bash_version" ]] || return
|
||||
[[ "$_gitstatus_bash_downloaded" == 1 ]] || return
|
||||
|
||||
"$_gitstatus_bash_daemon" \
|
||||
HOME="$home" "$_gitstatus_bash_daemon" \
|
||||
-G "$_gitstatus_bash_version" "${daemon_args[@]}" <&"$fd_in" >&"$fd_out" &
|
||||
local pid=$!
|
||||
trap "trap - ${sig[*]}; kill $pid &>/dev/null" ${sig[@]}
|
||||
|
|
|
@ -406,8 +406,17 @@ function _gitstatus_daemon"${1:-}"() {
|
|||
[[ -n $_gitstatus_zsh_version ]] || return
|
||||
[[ $_gitstatus_zsh_downloaded == [01] ]] || return
|
||||
|
||||
if (( UID == EUID )); then
|
||||
local home=~
|
||||
else
|
||||
local user
|
||||
user="$(command id -un)" || return
|
||||
local home=${userdirs[$user]}
|
||||
[[ -n $home ]] || return
|
||||
fi
|
||||
|
||||
if [[ -x $_gitstatus_zsh_daemon ]]; then
|
||||
$_gitstatus_zsh_daemon -G $_gitstatus_zsh_version "${(@)args}" >&$pipe_fd
|
||||
HOME=$home $_gitstatus_zsh_daemon -G $_gitstatus_zsh_version "${(@)args}" >&$pipe_fd
|
||||
local -i ret=$?
|
||||
[[ $ret == (0|129|130|131|137|141|143) ]] && return ret
|
||||
fi
|
||||
|
@ -426,7 +435,7 @@ function _gitstatus_daemon"${1:-}"() {
|
|||
[[ -n $_gitstatus_zsh_version ]] || return
|
||||
[[ $_gitstatus_zsh_downloaded == 1 ]] || return
|
||||
|
||||
$_gitstatus_zsh_daemon -G $_gitstatus_zsh_version "${(@)args}" >&$pipe_fd
|
||||
HOME=$home $_gitstatus_zsh_daemon -G $_gitstatus_zsh_version "${(@)args}" >&$pipe_fd
|
||||
} always {
|
||||
local -i ret=$?
|
||||
zf_rm -f -- $file_prefix.lock $file_prefix.fifo
|
||||
|
|
30
install
30
install
|
@ -131,14 +131,8 @@ END
|
|||
>&2 echo "[gitstatus] error: GITSTATUS_DAEMON is not absolute path: $daemon"
|
||||
return 1
|
||||
fi
|
||||
if [ -z "$daemon" ]; then
|
||||
if [ -z "$daemon" && -e "$gitstatus_dir"/usrbin/gitstatusd ]; then
|
||||
daemon="$gitstatus_dir"/usrbin/gitstatusd
|
||||
if [ ! -e "$daemon" ]; then
|
||||
daemon="$daemon"-"$uname_s"-"$uname_m"
|
||||
if [ ! -e "$daemon" ]; then
|
||||
daemon=
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if [ -n "$daemon" ]; then
|
||||
local gitstatus_version= libgit2_version=
|
||||
|
@ -184,25 +178,15 @@ END
|
|||
|
||||
if [ -z "$no_check" ]; then
|
||||
# Check if a suitable gitstatusd already exists.
|
||||
local daemon="$cache_dir"/"$file"
|
||||
if [ -e "$daemon" ]; then
|
||||
local daemon="$gitstatus_dir"/usrbin/"$file"
|
||||
if [ ! -e "$daemon" ]; then
|
||||
daemon="$cache_dir"/"$file"
|
||||
[ -e "$daemon" ] || daemon=
|
||||
fi
|
||||
if [ -n "$daemon" ]; then
|
||||
[ $# = 0 ] || "$@" "$daemon" "$version" 0
|
||||
return
|
||||
fi
|
||||
daemon="$daemon"-"$uname_s"-"$uname_m"
|
||||
if [ -e "$daemon" ]; then
|
||||
local gitstatus_version= libgit2_version=
|
||||
if ! . "$gitstatus_dir"/build.info; then
|
||||
>&2 echo "[gitstatus] internal error: failed to source build.info"
|
||||
return 1
|
||||
fi
|
||||
if [ -z "$gitstatus_version" ]; then
|
||||
>&2 echo "[gitstatus] internal error: empty gitstatus_version in build.info"
|
||||
return 1
|
||||
fi
|
||||
[ $# = 0 ] || "$@" "$daemon" "$gitstatus_version" 0
|
||||
return
|
||||
fi
|
||||
fi
|
||||
|
||||
# No suitable gitstatusd exists. Need to download.
|
||||
|
|
|
@ -14,6 +14,7 @@ uname_s_glob="linux"; uname_m_glob="aarch64"; file="gitstatusd-${uname_
|
|||
uname_s_glob="linux"; uname_m_glob="armv6l"; file="gitstatusd-${uname_s}-${uname_m}"; version="v1.0.0"; sha256="051a9448d9cb4bb1d95e93cff51a6ab48a085465ec30eec40046977d4213feff";
|
||||
uname_s_glob="linux"; uname_m_glob="armv7l"; file="gitstatusd-${uname_s}-${uname_m}"; version="v1.0.0"; sha256="adaa47c8e8dec1e1e8686c3044ee0f45afda15deaa8388efcb4952747b66246e";
|
||||
uname_s_glob="linux"; uname_m_glob="i686"; file="gitstatusd-${uname_s}-${uname_m}"; version="v1.0.0"; sha256="c80355664e7361e11215e64b523ed75a3d39f72393fa2204fefa85eae0342a67";
|
||||
uname_s_glob="linux"; uname_m_glob="ppc64le"; file="gitstatusd-${uname_s}-${uname_m}"; version="v1.2.0"; sha256="38a60b64f619d9db83747f1653b0b740380b1b2b9b414a0ff94815305cdd76bc";
|
||||
uname_s_glob="linux"; uname_m_glob="x86_64"; file="gitstatusd-${uname_s}-${uname_m}"; version="v1.0.0"; sha256="e33867063f091d3c31ede9916fef079ff8cd6fdcc70d051914f962ab3b8f36fd";
|
||||
uname_s_glob="msys_nt-10.0"; uname_m_glob="i686"; file="gitstatusd-${uname_s}-${uname_m}"; version="v1.0.0"; sha256="2cf6ff92a5c50e4181ceb402217162bebd5e52144eb52eacfef2f6d47d5c20d4";
|
||||
uname_s_glob="msys_nt-10.0"; uname_m_glob="x86_64"; file="gitstatusd-${uname_s}-${uname_m}"; version="v1.0.0"; sha256="960c3d9d90d7b96257a9746f7168faffdf9b5fbda464e354e7b14c42cc473f15";
|
||||
|
|
12
mbuild
12
mbuild
|
@ -117,6 +117,7 @@ local -rA assets=(
|
|||
linux-armv6l build-linux-armv7l
|
||||
linux-armv7l build-linux-armv7l
|
||||
linux-i686 build-linux-x86_64
|
||||
linux-ppc64le build-linux-ppc64le
|
||||
linux-x86_64 build-linux-x86_64
|
||||
)
|
||||
|
||||
|
@ -180,14 +181,15 @@ local build='
|
|||
function build-unix() {
|
||||
local intro flags=(-sw)
|
||||
case $2 in
|
||||
darwin-*) intro='PATH="/usr/local/bin:$PATH"';;
|
||||
linux-ppc64le);;
|
||||
linux-*) flags+=(-d docker);;
|
||||
darwin-*) intro='PATH="/usr/local/bin:$PATH"';;
|
||||
esac
|
||||
ssh $1 -- /bin/sh -uex <<<"
|
||||
$intro
|
||||
cd /tmp
|
||||
$build ${2##*-} ${(j: :)${(@q)flags}}"
|
||||
scp $1:/tmp/gitstatus/usrbin/gitstatusd-$2 $binaries/
|
||||
scp $1:/tmp/gitstatus/usrbin/gitstatusd $binaries/gitstatusd-$2
|
||||
}
|
||||
|
||||
function build-windows() {
|
||||
|
@ -236,7 +238,7 @@ function build-windows() {
|
|||
while true; do
|
||||
IFS= read -u $fd -r line || return 0
|
||||
if [[ $line == *"warning: terminate MSYS2"* ]]; then
|
||||
# At this point the machine is hosed. Rogue process with corrupted name
|
||||
# At this point the machine is hosed. A rogue process with a corrupted name
|
||||
# is eating all CPU. The top SSH connection won't terminate on its own.
|
||||
ssh $1 powershell.exe <<<'Restart-Computer -Force' || true
|
||||
sleep 30
|
||||
|
@ -260,7 +262,7 @@ function build-windows() {
|
|||
cd -- $tmp
|
||||
$build ${2##*-} ${(j: :)${(@q)flags}}
|
||||
exit"
|
||||
scp $1:$c/tmp/gitstatus/usrbin/gitstatusd-$2 $binaries/
|
||||
scp $1:$c/tmp/gitstatus/usrbin/gitstatusd $binaries/gitstatusd-$2
|
||||
chmod +x $binaries/gitstatusd-$2
|
||||
}
|
||||
|
||||
|
@ -272,7 +274,7 @@ function build() (
|
|||
zsystem flock $locks/$machine
|
||||
build-${protocol[(k)$platform]} $machine $platform
|
||||
local tmp=gitstatusd-$platform.tmp.$$.tar.gz
|
||||
( cd -q -- $binaries; GZIP=-9 tar -czf $tmp gitstatusd-$platform )
|
||||
( cd -q -- $binaries; tar --owner=0 --group=0 -I 'gzip -9' -cf $tmp gitstatusd-$platform )
|
||||
mv -f -- $binaries/$tmp $binaries/gitstatusd-$platform.tar.gz
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue