diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5557f978..5219fbda 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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 ;; @@ -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') diff --git a/README.md b/README.md index 16954dde..349e252d 100644 --- a/README.md +++ b/README.md @@ -69,21 +69,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 diff --git a/src/lib.rs b/src/lib.rs index 7771d82d..09963d0e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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`