mirror of
https://github.com/Llewellynvdm/starship.git
synced 2024-11-24 13:47:38 +00:00
build: add builds for various targets (#2137)
* build: add builds for various targets * fix typo Co-authored-by: Matan Kushner <hello@matchai.me> Co-authored-by: Matan Kushner <hello@matchai.me>
This commit is contained in:
parent
00afc82049
commit
132be11790
20
.github/workflows/deploy.yml
vendored
20
.github/workflows/deploy.yml
vendored
@ -52,13 +52,30 @@ jobs:
|
|||||||
os: ubuntu-latest
|
os: ubuntu-latest
|
||||||
name: starship-i686-unknown-linux-musl.tar.gz
|
name: starship-i686-unknown-linux-musl.tar.gz
|
||||||
|
|
||||||
|
- target: aarch64-unknown-linux-musl
|
||||||
|
os: ubuntu-latest
|
||||||
|
name: starship-aarch64-unknown-linux-musl.tar.gz
|
||||||
|
|
||||||
|
- target: arm-unknown-linux-musleabihf
|
||||||
|
os: ubuntu-latest
|
||||||
|
name: starship-arm-unknown-linux-musleabihf.tar.gz
|
||||||
|
|
||||||
- target: x86_64-apple-darwin
|
- target: x86_64-apple-darwin
|
||||||
os: macOS-latest
|
os: macOS-latest
|
||||||
name: starship-x86_64-apple-darwin.tar.gz
|
name: starship-x86_64-apple-darwin.tar.gz
|
||||||
|
|
||||||
|
# TODO: switch to macOS-latest once it reaches 11.0
|
||||||
|
- target: aarch64-apple-darwin
|
||||||
|
os: macos-11.0
|
||||||
|
name: starship-aarch64-apple-darwin.tar.gz
|
||||||
|
|
||||||
- target: x86_64-pc-windows-msvc
|
- target: x86_64-pc-windows-msvc
|
||||||
os: windows-latest
|
os: windows-latest
|
||||||
name: starship-x86_64-pc-windows-msvc.zip
|
name: starship-x86_64-pc-windows-msvc.zip
|
||||||
|
|
||||||
|
- target: i686-pc-windows-msvc
|
||||||
|
os: windows-latest
|
||||||
|
name: starship-i686-pc-windows-msvc.zip
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
@ -101,7 +118,8 @@ jobs:
|
|||||||
if: matrix.os != 'windows-latest'
|
if: matrix.os != 'windows-latest'
|
||||||
run: |
|
run: |
|
||||||
cd target/${{ matrix.target }}/release
|
cd target/${{ matrix.target }}/release
|
||||||
strip starship
|
# TODO: investigate better cross platform stripping
|
||||||
|
strip starship || true
|
||||||
tar czvf ../../../${{ matrix.name }} starship
|
tar czvf ../../../${{ matrix.name }} starship
|
||||||
cd -
|
cd -
|
||||||
|
|
||||||
|
@ -33,7 +33,11 @@ BLUE="$(tput setaf 4 2>/dev/null || echo '')"
|
|||||||
MAGENTA="$(tput setaf 5 2>/dev/null || echo '')"
|
MAGENTA="$(tput setaf 5 2>/dev/null || echo '')"
|
||||||
NO_COLOR="$(tput sgr0 2>/dev/null || echo '')"
|
NO_COLOR="$(tput sgr0 2>/dev/null || echo '')"
|
||||||
|
|
||||||
SUPPORTED_TARGETS="x86_64-unknown-linux-gnu x86_64-unknown-linux-musl i686-unknown-linux-musl x86_64-apple-darwin x86_64-pc-windows-msvc"
|
SUPPORTED_TARGETS="x86_64-unknown-linux-gnu x86_64-unknown-linux-musl \
|
||||||
|
i686-unknown-linux-musl aarch64-unknown-linux-musl \
|
||||||
|
arm-unknown-linux-musleabihf x86_64-apple-darwin \
|
||||||
|
aarch64-apple-darwin x86_64-pc-windows-msvc \
|
||||||
|
i686-pc-windows-msvc"
|
||||||
|
|
||||||
info() {
|
info() {
|
||||||
printf "%s\n" "${BOLD}${GREY}>${NO_COLOR} $*"
|
printf "%s\n" "${BOLD}${GREY}>${NO_COLOR} $*"
|
||||||
@ -192,14 +196,34 @@ detect_arch() {
|
|||||||
local arch
|
local arch
|
||||||
arch="$(uname -m | tr '[:upper:]' '[:lower:]')"
|
arch="$(uname -m | tr '[:upper:]' '[:lower:]')"
|
||||||
|
|
||||||
|
case "${arch}" in
|
||||||
|
armv*) arch="arm" ;;
|
||||||
|
arm64) arch="aarch64" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
# `uname -m` in some cases mis-reports 32-bit OS as 64-bit, so double check
|
# `uname -m` in some cases mis-reports 32-bit OS as 64-bit, so double check
|
||||||
if [ "${arch}" = "x64" ] && [ "$(getconf LONG_BIT)" -eq 32 ]; then
|
if [ "${arch}" = "x64" ] && [ "$(getconf LONG_BIT)" -eq 32 ]; then
|
||||||
arch=i686
|
arch=i686
|
||||||
|
elif [ "${arch}" = "aarch64" ] && [ "$(getconf LONG_BIT)" -eq 32 ]; then
|
||||||
|
arch=arm
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "${arch}"
|
echo "${arch}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
detect_target() {
|
||||||
|
local arch="$1"
|
||||||
|
local platform="$2"
|
||||||
|
local target="$arch-$platform"
|
||||||
|
|
||||||
|
if [ "${target}" = "arm-unknown-linux-musl" ]; then
|
||||||
|
target="${target}eabihf"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "${target}"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
confirm() {
|
confirm() {
|
||||||
if [ -z "${FORCE-}" ]; then
|
if [ -z "${FORCE-}" ]; then
|
||||||
printf "%s " "${MAGENTA}?${NO_COLOR} $* ${BOLD}[y/N]${NO_COLOR}"
|
printf "%s " "${MAGENTA}?${NO_COLOR} $* ${BOLD}[y/N]${NO_COLOR}"
|
||||||
@ -247,8 +271,8 @@ check_bin_dir() {
|
|||||||
is_build_available() {
|
is_build_available() {
|
||||||
local arch="$1"
|
local arch="$1"
|
||||||
local platform="$2"
|
local platform="$2"
|
||||||
|
local target="$3"
|
||||||
|
|
||||||
local target="${arch}-${platform}"
|
|
||||||
local good
|
local good
|
||||||
|
|
||||||
good=$(
|
good=$(
|
||||||
@ -350,7 +374,9 @@ while [ "$#" -gt 0 ]; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
is_build_available "${ARCH}" "${PLATFORM}"
|
TARGET="$(detect_target "${ARCH}" "${PLATFORM}")"
|
||||||
|
|
||||||
|
is_build_available "${ARCH}" "${PLATFORM}" "${TARGET}"
|
||||||
|
|
||||||
printf " %s\n" "${UNDERLINE}Configuration${NO_COLOR}"
|
printf " %s\n" "${UNDERLINE}Configuration${NO_COLOR}"
|
||||||
info "${BOLD}Bin directory${NO_COLOR}: ${GREEN}${BIN_DIR}${NO_COLOR}"
|
info "${BOLD}Bin directory${NO_COLOR}: ${GREEN}${BIN_DIR}${NO_COLOR}"
|
||||||
@ -372,7 +398,7 @@ if [ "${PLATFORM}" = "pc-windows-msvc" ]; then
|
|||||||
EXT=zip
|
EXT=zip
|
||||||
fi
|
fi
|
||||||
|
|
||||||
URL="${BASE_URL}/latest/download/starship-${ARCH}-${PLATFORM}.${EXT}"
|
URL="${BASE_URL}/latest/download/starship-${TARGET}.${EXT}"
|
||||||
info "Tarball URL: ${UNDERLINE}${BLUE}${URL}${NO_COLOR}"
|
info "Tarball URL: ${UNDERLINE}${BLUE}${URL}${NO_COLOR}"
|
||||||
confirm "Install Starship ${GREEN}latest${NO_COLOR} to ${BOLD}${GREEN}${BIN_DIR}${NO_COLOR}?"
|
confirm "Install Starship ${GREEN}latest${NO_COLOR} to ${BOLD}${GREEN}${BIN_DIR}${NO_COLOR}?"
|
||||||
check_bin_dir "${BIN_DIR}"
|
check_bin_dir "${BIN_DIR}"
|
||||||
|
Loading…
Reference in New Issue
Block a user