Skip to content

Commit

Permalink
Merge pull request #10 from bodo-run/build-more-distros-linux
Browse files Browse the repository at this point in the history
Build more distros linux
  • Loading branch information
mohsen1 authored Jan 19, 2025
2 parents bc3e35e + f6ee981 commit 6b00c01
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,10 @@ rustflags = ["-C", "target-cpu=apple-m1"]
rustflags = ["-C", "target-cpu=x86-64-v2"]

[target.aarch64-pc-windows-msvc]
rustflags = ["-C", "target-cpu=generic"]

[target.aarch64-unknown-linux-gnu]
rustflags = ["-C", "target-cpu=generic"]

[target.aarch64-unknown-linux-musl]
rustflags = ["-C", "target-cpu=generic"]
20 changes: 20 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,18 @@ jobs:
target: x86_64-unknown-linux-gnu
artifact_name: yek
asset_name: yek-x86_64-unknown-linux-gnu.tar.gz
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
artifact_name: yek
asset_name: yek-x86_64-unknown-linux-musl.tar.gz
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
artifact_name: yek
asset_name: yek-aarch64-unknown-linux-gnu.tar.gz
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
artifact_name: yek
asset_name: yek-aarch64-unknown-linux-musl.tar.gz
- os: macos-latest
target: x86_64-apple-darwin
artifact_name: yek
Expand All @@ -98,7 +110,15 @@ jobs:
with:
cache-on-failure: true
key: ${{ matrix.target }}
- name: Install cross-compilation tools
if: contains(matrix.target, 'aarch64-unknown-linux')
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu
- name: Build target
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: aarch64-linux-gnu-gcc
run: cargo build --release --target ${{ matrix.target }} --locked
- name: Package
shell: bash
Expand Down
17 changes: 16 additions & 1 deletion scripts/install_yek.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,22 @@ ARCH=$(uname -m)

case "${OS}_${ARCH}" in
Linux_x86_64)
TARGET="x86_64-unknown-linux-gnu"
# Check glibc version
GLIBC_VERSION=$(ldd --version 2>&1 | head -n1 | grep -oP 'GLIBC \K[\d.]+' || echo "")
if [ -z "$GLIBC_VERSION" ] || [ "$(printf '%s\n' "2.31" "$GLIBC_VERSION" | sort -V | head -n1)" = "$GLIBC_VERSION" ]; then
TARGET="x86_64-unknown-linux-musl"
else
TARGET="x86_64-unknown-linux-gnu"
fi
;;
Linux_aarch64)
# Check glibc version for ARM64
GLIBC_VERSION=$(ldd --version 2>&1 | head -n1 | grep -oP 'GLIBC \K[\d.]+' || echo "")
if [ -z "$GLIBC_VERSION" ] || [ "$(printf '%s\n' "2.31" "$GLIBC_VERSION" | sort -V | head -n1)" = "$GLIBC_VERSION" ]; then
TARGET="aarch64-unknown-linux-musl"
else
TARGET="aarch64-unknown-linux-gnu"
fi
;;
Darwin_x86_64)
TARGET="x86_64-apple-darwin"
Expand Down

0 comments on commit 6b00c01

Please sign in to comment.