Skip to content

Commit

Permalink
Remove OVERWRITE_TARGET_TRIPLE env var now that config.sh is gone
Browse files Browse the repository at this point in the history
  • Loading branch information
antoyo committed Feb 8, 2024
1 parent 8235b26 commit bf3ead9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/m68k.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -109,4 +107,4 @@ jobs:
- name: Run tests
run: |
# TODO: remove --features master when it is back to the default.
./y.sh test --release --features master --clean --build-sysroot ${{ matrix.commands }}
./y.sh test --target-triple m68k-unknown-linux-gnu --release --features master --clean --build-sysroot ${{ matrix.commands }}
4 changes: 2 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
9 changes: 6 additions & 3 deletions build_system/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,12 @@ impl ConfigInfo {
};

if self.target_triple.is_empty() {
if let Some(overwrite) = env.get("OVERWRITE_TARGET_TRIPLE") {
self.target_triple = overwrite.clone();
}
// TODO: set target triple.
// TODO TODO: why do we even need to set target_triple?
// It seems to only be needed for the linker (we could add an environment variable to
// remove this need) and the sysroot (perhaps we could find another way to find it).
// TODO TODO TODO: seems like we would still need OVERWRITE_TARGET_TRIPLE when using a
// json spec file.
}
if self.target_triple.is_empty() {
self.target_triple = self.host_triple.clone();
Expand Down

0 comments on commit bf3ead9

Please sign in to comment.