use cross for building, update Cross.toml and release.yml

This commit is contained in:
Salman Mohammed
2025-01-17 07:22:07 -05:00
parent 5ff918fb45
commit f187310ef6
2 changed files with 25 additions and 72 deletions
+6 -62
View File
@@ -47,75 +47,19 @@ jobs:
toolchain: stable
target: ${{ matrix.architecture }}-${{ matrix.target-suffix }}
# --- X86_64 only ---
- name: Install system libraries on Ubuntu (x86_64)
if: matrix.os == 'ubuntu-latest' && matrix.architecture == 'x86_64'
run: |
sudo apt-get update
# Add needed libs: openssl, dbus, xcb, etc.
sudo apt-get install -y \
pkg-config \
libssl-dev \
libdbus-1-dev \
libxcb1-dev
# --- AARCH64 only ---
- name: Install system libraries on Ubuntu (aarch64)
if: matrix.os == 'ubuntu-latest' && matrix.architecture == 'aarch64'
run: |
if [[ $ImageOS == "ubuntu24" ]]; then
cat <<EOF > deb822sources
Types: deb
URIs: http://archive.ubuntu.com/ubuntu/
Suites: noble
Components: main restricted universe
Architectures: amd64
Types: deb
URIs: http://security.ubuntu.com/ubuntu/
Suites: noble-security
Components: main restricted universe
Architectures: amd64
Types: deb
URIs: http://archive.ubuntu.com/ubuntu/
Suites: noble-updates
Components: main restricted universe
Architectures: amd64
Types: deb
URIs: http://azure.ports.ubuntu.com/ubuntu-ports/
Suites: noble
Components: main restricted multiverse universe
Architectures: arm64
Types: deb
URIs: http://azure.ports.ubuntu.com/ubuntu-ports/
Suites: noble-updates
Components: main restricted multiverse universe
Architectures: arm64
EOF
sudo mv deb822sources /etc/apt/sources.list.d/ubuntu.sources
fi
sudo dpkg --add-architecture arm64
sudo apt-get update
sudo apt-get install -y \
gcc-aarch64-linux-gnu \
libc6-dev-arm64-cross \
libssl-dev:arm64 \
libdbus-1-dev:arm64 \
libxcb1-dev:arm64 \
pkg-config
- name: Install cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Build CLI
env:
CROSS_NO_WARNINGS: 0
run: |
export TARGET="${{ matrix.architecture }}-${{ matrix.target-suffix }}"
rustup target add "${TARGET}"
# 'cross' is used to cross-compile for different architectures (see Cross.toml)
# Only 'goose' binary is needed for CLI release, skipping 'goosed' here
cargo build --release --target ${TARGET} -p goose-cli
cross build --release --target ${TARGET} -p goose-cli
cd target/${TARGET}/release
tar -cjf goose-${TARGET}.tar.bz2 goose
+19 -10
View File
@@ -1,19 +1,28 @@
# Configuration for cross-compiling using cross
[target.aarch64-unknown-linux-gnu]
xargo = false
pre-build = [
"dpkg --add-architecture $CROSS_DEB_ARCH && apt-get update --fix-missing && apt-get install --assume-yes libxcb1-dev:$CROSS_DEB_ARCH libdbus-1-dev:$CROSS_DEB_ARCH",
# Add the ARM64 architecture and install necessary dependencies
"dpkg --add-architecture arm64",
"""\
apt-get update --fix-missing && apt-get install -y \
pkg-config:arm64 \
libssl-dev:arm64 \
libdbus-1-dev:arm64 \
libxcb1-dev:arm64
"""
]
env = { PKG_CONFIG_PATH = "/usr/lib/aarch64-linux-gnu/pkgconfig" }
# If you run the build on your local machine,
# This is a workaround for the missing pkg-config path on aarch64
# You also need to add pkg-config:$CROSS_DEB_ARCH to the apt-get install command above
#[target.aarch64-unknown-linux-gnu.env]
#passthrough = ["PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig"]
# If you run the build on your local machine,
# You need to add pkg-config:$CROSS_DEB_ARCH to the apt-get install command below
[target.x86_64-unknown-linux-gnu]
xargo = false
pre-build = [
"dpkg --add-architecture $CROSS_DEB_ARCH && apt-get update --fix-missing && apt-get install --assume-yes libxcb1-dev:$CROSS_DEB_ARCH libdbus-1-dev:$CROSS_DEB_ARCH",
# Install necessary dependencies for x86_64
"""\
apt-get update && apt-get install -y \
pkg-config \
libssl-dev \
libdbus-1-dev \
libxcb1-dev \
"""
]