1717 matrix :
1818 arch :
1919 - host_target : " x86_64-unknown-linux-gnu"
20- cross_target : " "
21- - host_target : " m68k-unknown-linux-gnu"
22- cross_target : " m68k"
23- debian_url : " http://ftp.ports.debian.org/debian-ports"
2420
2521 steps :
2622 - uses : actions/checkout@v4
3329 path : " rust"
3430 fetch-depth : 10
3531
36- # The compilation of rustc for m68k requires a lot of disk space, so free some space up.
37- - name : Free Disk Space
38- uses : endersonmenezes/free-disk-space@v3
39- with :
40- remove_android : true
41- remove_dotnet : true
42- remove_haskell : true
43- remove_tool_cache : true
44- remove_swap : true
45- remove_packages : " azure-cli google-cloud-cli microsoft-edge-stable google-chrome-stable firefox postgresql* temurin-* *llvm* mysql* dotnet-sdk-*"
46- remove_packages_one_command : true
47- remove_folders : " /usr/share/swift /usr/share/miniconda /usr/share/az* /usr/local/lib/node_modules /usr/local/share/chromium /usr/local/share/powershell /usr/local/julia /usr/local/aws-cli /usr/local/aws-sam-cli /usr/share/gradle"
48-
49- - name : Install packages
50- if : ${{ matrix.arch.cross_target != '' }}
51- run : |
52- sudo apt-get update
53- sudo apt-get install debootstrap qemu-system qemu-user-static
54-
5532 # `rustup show` installs from rust-toolchain.toml
5633 - name : Setup rust toolchain
5734 run : rustup show
@@ -64,94 +41,22 @@ jobs:
6441 curl -L -o package.deb https://github.com/rust-lang/gcc/releases/latest/download/gcc-15.deb
6542 sudo dpkg --force-overwrite -i package.deb
6643
67- - name : Generate Debian qemu image
68- if : ${{ matrix.arch.cross_target != '' }}
69- run : |
70- dd if=/dev/zero of=debian.img bs=1M count=15360
71- mkfs.ext4 debian.img -L root
72- mkdir vm
73- sudo mount debian.img vm
74- sudo debootstrap --no-check-gpg --arch=${{ matrix.arch.cross_target }} --foreign unstable vm ${{ matrix.arch.debian_url }}
75- sudo cp $(which qemu-${{ matrix.arch.cross_target }}-static) vm/usr/bin/
76-
77- - name : Download cross-compiling libgccjit.so and move it in libgccjit-libs-dir
78- if : ${{ matrix.arch.cross_target != '' }}
79- run : |
80- curl -LO https://github.com/cross-cg-gcc-tools/cross-gcc/releases/latest/download/gcc-${{ matrix.arch.cross_target }}-15.deb
81-
82- sudo dpkg-deb -x gcc-${{ matrix.arch.cross_target }}-15.deb cross-gcc
83- dir=$HOME/libgccjit-libs-dir/x86_64-unknown-linux-gnu/${{ matrix.arch.host_target }}
84- mkdir -p $dir
85- sudo mv cross-gcc/usr/lib/libgccjit.so.0.0.1 $dir/libgccjit.so
86-
87- echo "$(pwd)/cross-gcc/usr/bin" >> $GITHUB_PATH
88-
89- - name : Download native libgccjit.so and move it in libgccjit-libs-dir
90- if : ${{ matrix.arch.cross_target != '' }}
91- run : |
92- curl -LO https://github.com/cross-cg-gcc-tools/native-gcc/releases/latest/download/libgccjit-${{ matrix.arch.cross_target }}.so
93-
94- dir=$HOME/libgccjit-libs-dir/${{ matrix.arch.host_target }}/${{ matrix.arch.host_target }}
95- mkdir -p $dir
96- mv libgccjit-${{ matrix.arch.cross_target }}.so $dir/libgccjit.so
97-
98- - name : Patch linux-raw-sys and rustix.
99- if : ${{ matrix.arch.cross_target != '' }}
100- run : |
101- cd rust
102-
103- cat <<'EOF' > patch.toml
104- [patch.crates-io]
105- linux-raw-sys = { git = "https://github.com/antoyo/linux-raw-sys", branch = "m68k-support" }
106- rustix = { git = "https://github.com/antoyo/rustix", branch = "m68k-support" }
107- EOF
108-
109- cat patch.toml >> Cargo.toml
110- cat patch.toml >> compiler/rustc_codegen_gcc/Cargo.toml
111-
112- cargo update -p rustix
113- cd compiler/rustc_codegen_gcc/
114- cargo update -p rustix
115-
116- cd ../..
117-
118- echo Checking Rust
119- cargo tree -i linux-raw-sys 2>&1 | grep "was not used in the crate graph" && (echo "Unused patches found"; cargo tree; exit 1) || exit 0
120-
121- echo Checking rustc_codegen_gcc
122- cargo tree --manifest-path compiler/rustc_codegen_gcc/Cargo.toml -i linux-raw-sys 2>&1 | grep "was not used in the crate graph" && (echo "Unused patches found"; cargo tree; exit 1) || exit 0
123-
12444 - name : Compile rustc
12545 run : |
12646 cd rust
12747 ./x build --host=${{ matrix.arch.host_target }} --stage 2 --config ../rustc_codegen_gcc/tests/bootstraps/bootstrap.${{ matrix.arch.host_target }}.toml
12848
12949 - name : Link toolchain
130- if : ${{ matrix.arch.cross_target == '' }}
13150 run : |
13251 cd rust
13352 rustup toolchain link my-toolchain build/${{ matrix.arch.host_target }}/stage2
13453
13554 - name : Smoke test
136- if : ${{ matrix.arch.cross_target == '' }}
13755 run : |
13856 rustc +my-toolchain -V > output
13957 grep rustc output
14058
141- - name : Copy toolchain in VM
142- if : ${{ matrix.arch.cross_target != '' }}
143- run : |
144- sudo rsync -a --exclude=stage2/lib/rustlib/src --exclude=stage2/lib/rustlib/rustc-src/ rust/build/${{ matrix.arch.host_target }}/stage2/ vm/home/stage2
145-
146- - name : Smoke test
147- if : ${{ matrix.arch.cross_target != '' }}
148- run : |
149- sudo chroot vm qemu-${{ matrix.arch.cross_target }}-static /bin/sh -c '/home/stage2/bin/rustc' > output
150- grep rustc output
151-
15259 - name : Compile test program
153- # TODO: also compile a test program for m68k when the compiler works.
154- if : ${{ matrix.arch.cross_target == '' }}
15560 run : |
15661 cd rustc_codegen_gcc/tests/hello-world
15762 cargo +my-toolchain build
0 commit comments