Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add support for loongarch64-unknown-linux-{gnu,musl} #248

Merged
merged 2 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 45 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,16 @@ jobs:
rust: stable
target: aarch64-unknown-linux-gnu
features: full-async
- task: bindings
os: ubuntu-24.04
rust: nightly
target: loongarch64-unknown-linux-musl
features: full-async
- task: bindings
os: ubuntu-24.04
rust: nightly
target: loongarch64-unknown-linux-gnu
features: full-async
- task: bindings
os: ubuntu-latest
rust: stable
Expand Down Expand Up @@ -270,7 +280,7 @@ jobs:
with:
submodules: true
- name: Setup cross linux toolchain
if: contains(matrix.target, '-linux-') && !startsWith(matrix.target, 'aarch64') && !startsWith(matrix.target, 'x86_64-') && !endsWith(matrix.target, '-musl')
if: contains(matrix.target, '-linux-') && !startsWith(matrix.target, 'aarch64') && !startsWith(matrix.target, 'loongarch64') && !startsWith(matrix.target, 'x86_64-') && !endsWith(matrix.target, '-musl')
run: |
case "${{ matrix.target }}" in
i686-*) SYSTEM_ARCH=i386 ;;
Expand Down Expand Up @@ -324,6 +334,40 @@ jobs:
echo "[target.aarch64-unknown-linux-gnu]" >> ~/.cargo/config.toml
echo 'rustflags = ["-C", "linker=aarch64-linux-gnu-gcc"]' >> ~/.cargo/config.toml

echo "/musl/bin" >> $GITHUB_PATH
- name: Setup cross loongarch64
if: startsWith(matrix.target, 'loongarch64') && contains(matrix.target, '-linux-')
run: |
sudo apt-get update -y
sudo apt-get install -y \
curl \
libc6-dev-loong64-cross \
gcc-14-loongarch64-linux-gnu \
g++-14-loongarch64-linux-gnu \
clang \
qemu-user

curl -L --retry 5 https://github.com/musl-cross/musl-cross/releases/download/20241103/loongarch64-unknown-linux-musl.tar.xz | tar xJf -
sudo mv loongarch64-unknown-linux-musl /musl

echo "CC_loongarch64_unknown_linux_musl=loongarch64-unknown-linux-musl-gcc" >> $GITHUB_ENV
echo "CXX_loongarch64_unknown_linux_musl=loongarch64-unknown-linux-musl-g++" >> $GITHUB_ENV
echo "AR_loongarch64_unknown_linux_musl=loongarch64-unknown-linux-musl-ar" >> $GITHUB_ENV
echo "CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_MUSL_LINKER=loongarch64-unknown-linux-musl-gcc" >> $GITHUB_ENV
echo "CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_MUSL_RUNNER=qemu-loongarch64" >> $GITHUB_ENV

echo "CC_loongarch64_unknown_linux_gnu=loongarch64-linux-gnu-gcc-14" >> $GITHUB_ENV
echo "CXX_loongarch64_unknown_linux_gnu=loongarch64-linux-gnu-g++-14" >> $GITHUB_ENV
echo "AR_loongarch64_unknown_linux_gnu=loongarch64-linux-gnu-ar" >> $GITHUB_ENV
echo "CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_GNU_LINKER=loongarch64-linux-gnu-gcc-14" >> $GITHUB_ENV
echo "CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_GNU_RUNNER=qemu-loongarch64 -L /usr/loongarch64-linux-gnu" >> $GITHUB_ENV

mkdir -p ~/.cargo/
echo "[target.loongarch64-unknown-linux-musl]" >> ~/.cargo/config.toml
echo 'rustflags = ["-C", "target-feature=+crt-static", "-C", "link-self-contained=yes", "-C", "linker=rust-lld"]' >> ~/.cargo/config.toml
echo "[target.loongarch64-unknown-linux-gnu]" >> ~/.cargo/config.toml
echo 'rustflags = ["-C", "linker=loongarch64-linux-gnu-gcc-14"]' >> ~/.cargo/config.toml

echo "/musl/bin" >> $GITHUB_PATH
- name: Setup msys2 toolchains
if: startsWith(matrix.os, 'windows') && endsWith(matrix.target, '-gnu')
Expand Down
32 changes: 17 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,23 @@ In general you can allways try to compile rquickjs with the `bindgen` feature, t
Rquickjs ships bindings for a limited set of platforms, for these platforms you don't have to enable the `bindgen` feature.
See below for a list of supported platforms.

| **platform** | **shipped bindings** | **tested** | **supported by quickjs** |
|----------------------------|:--------------------:|:----------:|:------------------------:|
| | | | |
| x86_64-unknown-linux-gnu | ✅ | ✅ | ✅ |
| i686-unknown-linux-gnu | ✅ | ✅ | ✅ |
| aarch64-unknown-linux-gnu | ✅ | ✅ | ✅ |
| x86_64-unknown-linux-musl | ✅ | ✅ | ✅ |
| aarch64-unknown-linux-musl | ✅ | ✅ | ✅ |
| x86_64-pc-windows-gnu | ✅ | ✅ | ✅ |
| i686-pc-windows-gnu | ✅ | ✅ | ✅ |
| x86_64-pc-windows-mvsc | ✅ | ✅ | ❌ experimental! |
| x86_64-apple-darwin | ✅ | ✅ | ✅ |
| aarch64-apple-darwin | ✅ | ❌ | ✅ |
| wasm32-wasi | ✅ | ❌ | ✅ |
| other | ❌ | ❌ | Unknown |
| **platform** | **shipped bindings** | **tested** | **supported by quickjs** |
|--------------------------------|:--------------------:|:----------:|:------------------------:|
| | | | |
| x86_64-unknown-linux-gnu | ✅ | ✅ | ✅ |
| i686-unknown-linux-gnu | ✅ | ✅ | ✅ |
| aarch64-unknown-linux-gnu | ✅ | ✅ | ✅ |
| loongarch64-unknown-linux-gnu | ✅ | ✅ | ✅ |
| x86_64-unknown-linux-musl | ✅ | ✅ | ✅ |
| aarch64-unknown-linux-musl | ✅ | ✅ | ✅ |
| loongarch64-unknown-linux-musl | ✅ | ✅ | ✅ |
| x86_64-pc-windows-gnu | ✅ | ✅ | ✅ |
| i686-pc-windows-gnu | ✅ | ✅ | ✅ |
| x86_64-pc-windows-mvsc | ✅ | ✅ | ❌ experimental! |
| x86_64-apple-darwin | ✅ | ✅ | ✅ |
| aarch64-apple-darwin | ✅ | ❌ | ✅ |
| wasm32-wasi | ✅ | ❌ | ✅ |
| other | ❌ | ❌ | Unknown |

## License

Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@
//! - `i686-unknown-linux-gnu`
//! - `x86_64-unknown-linux-gnu`
//! - `x86_64-unknown-linux-musl`
//! - `loongarch64-unknown-linux-gnu`
//! - `loongarch64-unknown-linux-musl`
//! - macOS:
//! - `aarch64-apple-darwin`
//! - `x86_64-apple-darwin`
Expand Down