build: add x86_64 freebsd build (#2233)

This commit is contained in:
David Knaack 2021-01-30 12:50:38 +01:00 committed by GitHub
parent 9e21e3cf5f
commit 383d2df580
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 1 deletions

View File

@ -82,6 +82,10 @@ jobs:
os: windows-latest os: windows-latest
name: starship-aarch64-pc-windows-msvc.zip name: starship-aarch64-pc-windows-msvc.zip
- target: x86_64-unknown-freebsd
os: ubuntu-latest
name: starship-x86_64-unknown-freebsd.tar.gz
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
continue-on-error: true continue-on-error: true
steps: steps:

2
Cross.toml Normal file
View File

@ -0,0 +1,2 @@
[target.x86_64-unknown-freebsd]
image = "docker.io/rustembedded/cross:x86_64-unknown-freebsd"

View File

@ -37,7 +37,8 @@ SUPPORTED_TARGETS="x86_64-unknown-linux-gnu x86_64-unknown-linux-musl \
i686-unknown-linux-musl aarch64-unknown-linux-musl \ i686-unknown-linux-musl aarch64-unknown-linux-musl \
arm-unknown-linux-musleabihf x86_64-apple-darwin \ arm-unknown-linux-musleabihf x86_64-apple-darwin \
aarch64-apple-darwin x86_64-pc-windows-msvc \ aarch64-apple-darwin x86_64-pc-windows-msvc \
i686-pc-windows-msvc aarch64-pc-windows-msvc" i686-pc-windows-msvc aarch64-pc-windows-msvc \
x86_64-unknown-freebsd"
info() { info() {
printf "%s\n" "${BOLD}${GREY}>${NO_COLOR} $*" printf "%s\n" "${BOLD}${GREY}>${NO_COLOR} $*"
@ -172,6 +173,7 @@ install() {
# - darwin # - darwin
# - linux # - linux
# - linux_musl (Alpine) # - linux_musl (Alpine)
# - freebsd
detect_platform() { detect_platform() {
local platform local platform
platform="$(uname -s | tr '[:upper:]' '[:lower:]')" platform="$(uname -s | tr '[:upper:]' '[:lower:]')"
@ -184,6 +186,7 @@ detect_platform() {
# use the statically compiled musl bins on linux to avoid linking issues. # use the statically compiled musl bins on linux to avoid linking issues.
linux) platform="unknown-linux-musl" ;; linux) platform="unknown-linux-musl" ;;
darwin) platform="apple-darwin" ;; darwin) platform="apple-darwin" ;;
freebsd) platform="unknown-freebsd" ;;
esac esac
echo "${platform}" echo "${platform}"
@ -197,6 +200,7 @@ detect_arch() {
arch="$(uname -m | tr '[:upper:]' '[:lower:]')" arch="$(uname -m | tr '[:upper:]' '[:lower:]')"
case "${arch}" in case "${arch}" in
amd64) arch="x86_64" ;;
armv*) arch="arm" ;; armv*) arch="arm" ;;
arm64) arch="aarch64" ;; arm64) arch="aarch64" ;;
esac esac