1
0
Fork 0
mirror of https://github.com/romkatv/powerlevel10k.git synced 2024-11-25 13:30:07 +00:00

Squashed 'gitstatus/' changes from 76182238..68bf9e0d

68bf9e0d build: generate byte-for-byte identical gitstatusd if the compiler supports -ffile-prefix-map
d03e8edc add support for s390x architecture
b32bea51 add a few architectures to the build script
7001409e bash: escape non-printable ANSI sequences (#247)

git-subtree-dir: gitstatus
git-subtree-split: 68bf9e0da3695ae989d523527643bef3f88e86ea
This commit is contained in:
Roman Perepelitsa 2021-07-02 11:02:41 +02:00
parent f1ff680487
commit 7759063b74
2 changed files with 25 additions and 13 deletions

20
build
View file

@ -55,7 +55,7 @@ workdir="$(command pwd)"
narg() { echo $#; } narg() { echo $#; }
if [ "$(narg $workdir)" != 1 -o -z "${workdir##*:*}" ]; then if [ "$(narg $workdir)" != 1 -o -z "${workdir##*:*}" -o -z "${workdir##*=*}" ]; then
>&2 echo "[error] cannot build in this directory: $workdir" >&2 echo "[error] cannot build in this directory: $workdir"
exit 1 exit 1
fi fi
@ -138,6 +138,14 @@ esac
cflags="$archflag=$gitstatus_cpu -fno-plt" cflags="$archflag=$gitstatus_cpu -fno-plt"
command touch "$workdir"/file-prefix-map-test.c
if 2>/dev/null "${CC:-/bin/cc}" \
-ffile-prefix-map=x=y \
-c "$workdir"/file-prefix-map-test.c \
-o "$workdir"/file-prefix-map-test.o; then
cflags="$cflags -ffile-prefix-map=$workdir/="
fi
if [ "$gitstatus_cpu" = x86-64 ]; then if [ "$gitstatus_cpu" = x86-64 ]; then
cflags="$cflags -mtune=generic" cflags="$cflags -mtune=generic"
fi fi
@ -450,13 +458,16 @@ fi
if [ -z "$gitstatus_cpu" ]; then if [ -z "$gitstatus_cpu" ]; then
case "$gitstatus_arch" in case "$gitstatus_arch" in
armv6l) gitstatus_cpu=armv6;; armel) gitstatus_cpu=armv5;;
armv6l|armhf) gitstatus_cpu=armv6;;
armv7l) gitstatus_cpu=armv7;; armv7l) gitstatus_cpu=armv7;;
arm64) gitstatus_cpu=armv8;; arm64) gitstatus_cpu=armv8;;
aarch64) gitstatus_cpu=armv8-a;; aarch64) gitstatus_cpu=armv8-a;;
ppc64le) gitstatus_cpu=powerpc64le;; ppc64le) gitstatus_cpu=powerpc64le;;
riscv64) gitstatus_cpu=rv64imafdc;; riscv64) gitstatus_cpu=rv64imafdc;;
x86_64|amd64) gitstatus_cpu=x86-64;; x86_64|amd64) gitstatus_cpu=x86-64;;
x86) gitstatus_cpu=i586;;
s390x) gitstatus_cpu=z900;;
i386|i586|i686) gitstatus_cpu="$gitstatus_arch";; i386|i586|i686) gitstatus_cpu="$gitstatus_arch";;
*) *)
>&2 echo '[error] unable to infer target CPU architecture' >&2 echo '[error] unable to infer target CPU architecture'
@ -486,11 +497,12 @@ case "$gitstatus_kernel" in
if [ -z "$docker_image" ]; then if [ -z "$docker_image" ]; then
case "$gitstatus_arch" in case "$gitstatus_arch" in
x86_64) docker_image=alpine:3.11.6;; x86_64) docker_image=alpine:3.11.6;;
i386|i586|i686) docker_image=i386/alpine:3.11.6;; x86|i386|i586|i686) docker_image=i386/alpine:3.11.6;;
armv6l) docker_image=arm32v6/alpine:3.11.6;; armv6l|armhf) docker_image=arm32v6/alpine:3.11.6;;
armv7l) docker_image=arm32v7/alpine:3.11.6;; armv7l) docker_image=arm32v7/alpine:3.11.6;;
aarch64) docker_image=arm64v8/alpine:3.11.6;; aarch64) docker_image=arm64v8/alpine:3.11.6;;
ppc64le) docker_image=ppc64le/alpine:3.11.6;; ppc64le) docker_image=ppc64le/alpine:3.11.6;;
s390x) docker_image=s390x/alpine:3.11.6;;
*) *)
>&2 echo '[error] unable to infer docker image' >&2 echo '[error] unable to infer docker image'
>&2 echo 'Please specify explicitly with `-i IMAGE`.' >&2 echo 'Please specify explicitly with `-i IMAGE`.'

View file

@ -33,11 +33,11 @@ function gitstatus_prompt_update() {
gitstatus_query "$@" || return 1 # error gitstatus_query "$@" || return 1 # error
[[ "$VCS_STATUS_RESULT" == ok-sync ]] || return 0 # not a git repo [[ "$VCS_STATUS_RESULT" == ok-sync ]] || return 0 # not a git repo
local reset=$'\e[0m' # no color local reset=$'\001\e[0m\002' # no color
local clean=$'\e[38;5;076m' # green foreground local clean=$'\001\e[38;5;076m\002' # green foreground
local untracked=$'\e[38;5;014m' # teal foreground local untracked=$'\001\e[38;5;014m\002' # teal foreground
local modified=$'\e[38;5;011m' # yellow foreground local modified=$'\001\e[38;5;011m\002' # yellow foreground
local conflicted=$'\e[38;5;196m' # red foreground local conflicted=$'\001\e[38;5;196m\002' # red foreground
local p local p