diff --git a/.github/workflows/m68k.yml b/.github/workflows/cross.yml similarity index 82% rename from .github/workflows/m68k.yml rename to .github/workflows/cross.yml index b0866bafb8e..0d4bbc61d93 100644 --- a/.github/workflows/m68k.yml +++ b/.github/workflows/cross.yml @@ -1,6 +1,6 @@ # TODO: check if qemu-user-static-binfmt is needed (perhaps to run some tests since it probably calls exec). -name: m68k CI +name: Cross-compilation CI on: - push @@ -12,8 +12,6 @@ permissions: env: # Enable backtraces for easier debugging RUST_BACKTRACE: 1 - # TODO: remove when confish.sh is removed. - OVERWRITE_TARGET_TRIPLE: m68k-unknown-linux-gnu jobs: build: @@ -22,6 +20,10 @@ jobs: strategy: fail-fast: false matrix: + arch: [ + "m68k", + "arm", + ] commands: [ "--mini-tests", "--std-tests", @@ -51,20 +53,20 @@ jobs: sudo apt-get install qemu qemu-user-static - name: Download artifact - run: curl -LO https://github.com/cross-cg-gcc-tools/cross-gcc/releases/latest/download/gcc-m68k-13.deb + run: curl -LO https://github.com/cross-cg-gcc-tools/cross-gcc/releases/latest/download/gcc-${{ matrix.arch }}-13.deb - name: Download VM artifact uses: dawidd6/action-download-artifact@v2 with: - workflow: m68k.yml - name: debian-m68k + workflow: ${{ matrix.arch }}.yml + name: debian-${{ matrix.arch }} repo: cross-cg-gcc-tools/vms branch: master event: push - name: Setup path to libgccjit run: | - sudo dpkg -i gcc-m68k-13.deb + sudo dpkg -i gcc-${{ matrix.arch }}-13.deb echo /usr/lib/ > gcc_path - name: Set env @@ -85,16 +87,16 @@ jobs: - name: Prepare VM run: | mkdir vm - sudo mount debian-m68k.img vm - sudo cp $(which qemu-m68k-static) vm/usr/bin/ + sudo mount debian-${{ matrix.arch }}.img vm + sudo cp $(which qemu-${{ matrix.arch }}-static) vm/usr/bin/ - name: Build run: | ./y.sh prepare --only-libcore --cross # TODO: remove --features master when it is back to the default. - ./y.sh build --target-triple m68k-unknown-linux-gnu --features master + ./y.sh build --target-triple ${{ matrix.arch }}-unknown-linux-gnu --features master # TODO: remove --features master when it is back to the default. - CG_GCC_TEST_TARGET=m68k-unknown-linux-gnu cargo test --features master + CG_GCC_TEST_TARGET=${{ matrix.arch }}-unknown-linux-gnu cargo test --features master ./y.sh clean all - name: Prepare dependencies diff --git a/Readme.md b/Readme.md index 39ff41acf84..09e817ba9d9 100644 --- a/Readme.md +++ b/Readme.md @@ -324,13 +324,13 @@ generate it in [gimple.md](./doc/gimple.md). * Run `./y.sh prepare --cross` so that the sysroot is patched for the cross-compiling case. * Set the path to the cross-compiling libgccjit in `gcc_path`. * Make sure you have the linker for your target (for instance `m68k-unknown-linux-gnu-gcc`) in your `$PATH`. Currently, the linker name is hardcoded as being `$TARGET-gcc`. Specify the target when building the sysroot: `./y.sh build --target-triple m68k-unknown-linux-gnu`. - * Build your project by specifying the target: `OVERWRITE_TARGET_TRIPLE=m68k-unknown-linux-gnu ../y.sh cargo build --target m68k-unknown-linux-gnu`. + * Build your project by specifying the target: `../y.sh cargo build --target m68k-unknown-linux-gnu`. If the target is not yet supported by the Rust compiler, create a [target specification file](https://docs.rust-embedded.org/embedonomicon/custom-target.html) (note that the `arch` specified in this file must be supported by the rust compiler). Then, you can use it the following way: * Add the target specification file using `--target` as an **absolute** path to build the sysroot: `./y.sh build --target-triple m68k-unknown-linux-gnu --target $(pwd)/m68k-unknown-linux-gnu.json` - * Build your project by specifying the target specification file: `OVERWRITE_TARGET_TRIPLE=m68k-unknown-linux-gnu ../y.sh cargo build --target path/to/m68k-unknown-linux-gnu.json`. + * Build your project by specifying the target specification file: `../y.sh cargo build --target path/to/m68k-unknown-linux-gnu.json`. If you get the following error: diff --git a/build_system/src/config.rs b/build_system/src/config.rs index 1824bdd292f..731191c0b21 100644 --- a/build_system/src/config.rs +++ b/build_system/src/config.rs @@ -116,11 +116,6 @@ impl ConfigInfo { None => return Err("no host found".to_string()), }; - if self.target_triple.is_empty() { - if let Some(overwrite) = env.get("OVERWRITE_TARGET_TRIPLE") { - self.target_triple = overwrite.clone(); - } - } if self.target_triple.is_empty() { self.target_triple = self.host_triple.clone(); }