Skip to content

Commit

Permalink
mips-unknown-linux-gnu target
Browse files Browse the repository at this point in the history
  • Loading branch information
ssrlive committed Aug 15, 2024
1 parent 7485f34 commit b52f3f5
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/mips-unknown-linux-gnu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

# Change to the directory where the script is located
cd "$(dirname "$0")"

# Set up rust build environment
rustup toolchain install nightly
rustup component add rust-src --toolchain nightly
sudo apt install -y patchelf gcc-mips-linux-gnu binutils-mips-linux-gnu musl-tools

# Set up for glibc
rm -rf ~/.rustup/mips-unknown-linux-gnu.json
rustc +nightly \
-Z unstable-options \
--print target-spec-json \
--target mips-unknown-linux-gnu \
> ~/.rustup/mips-unknown-linux-gnu.json

# Edit the JSON file to change `is-builtin` to `false` and add `+soft-float` to `features` list
sed -i 's/"is-builtin": true/"is-builtin": false/' ~/.rustup/mips-unknown-linux-gnu.json
sed -i 's/"features": "/"features": "\+soft-float,/' ~/.rustup/mips-unknown-linux-gnu.json

cd ../..

# Configure linker
mkdir .cargo
rm -rf .cargo/config.toml
cat > .cargo/config.toml <<EOF
[target.mips-unknown-linux-gnu]
linker = "mips-linux-gnu-gcc"
EOF

cargo +nightly build --release -Zbuild-std --target ~/.rustup/mips-unknown-linux-gnu.json

0 comments on commit b52f3f5

Please sign in to comment.