-
-
Notifications
You must be signed in to change notification settings - Fork 770
Common build.rs script #3782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Common build.rs script #3782
Conversation
This file is unused as far as I can tell.
ca47b9b
to
3f39958
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that this is more principled in actually finding included linker scripts and declaring the dependency on all of them.
One reason we haven't gone to a communal build.rs is doing so adds a little bit of customization to Tock which isn't "normal" (i.e. it's different than how an arbitrary rust crate on github would look). This adds a bit of friction for new developers and for building on Tock.
That being said, I think this PR is a reasonable balance. It doesn't use symlinks or anything custom to find the build.rs file, it uses a documented feature of Cargo.toml. In exchange, we get a much better build.rs and less duplicated code.
I do think we need to update https://github.com/tock/tock/blob/master/doc/OutOfTree.md to discuss this change and what we recommend. Should users copy the new build.rs file? Or somehow point to it? Or just make their own? We have examples of out-of-tree boards in the tock org, specifically for the bootloader (ex: https://github.com/tock/tock-bootloader/tree/master/boards/wm1110_dev-bootloader).
048e840
to
82cf287
Compare
I have updated I see that tock-bootloader does use a custom build script. I haven't mentioned what to do in that case but at least by describing the script in the documentation, out-of-tree boards will know what to reproduce in their own build scripts. Does that sound okay to you? |
82cf287
to
5c73c09
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great.
Marking last call given we talked about it last Friday. |
Pull Request Overview
This pull request consolidates all board
build.rs
scripts into a commonboards/build.rs
.Currently, all build scripts are used to print
cargo:rerun-if-changed=...
lines for the link scripts that they use. Some are missing these lines for scripts that are included inlayout.ld
.One build script (imxrt1050-evkb) was also tracking a
hdr.s
file, but as far as I can tell this file is not used so I have removed it.The motivation for this change is to simplify the repo and make
build.rs
scripts less error prone (e.g. fixing the ones that missrerun-if-changed
lines). I also hope that having only onebuild.rs
script will open Tock up to moving some configuration out ofMakefile
s to Cargo such thatcargo build
works (butmake
would likely still be used).Apologies for another PR that touches loads of files :)
Testing Strategy
make boards
to make sure they all compile.make
for a board to ensure it does not recompile.layout.ld
and runmake
to check that it does recompile / relink.kernel_layout.ld
and runmake
to check that included files trigger recompilation too.TODO or Help Wanted
If, in the future, boards need something else in their
build.rs
script, they will not be able to use this shared script. I think in that case thetrack_link_script
function could be put in a tinybuild-utils
crate or similar and used by individual build scripts as a[build-dependency]
in their custombuild.rs
scripts to avoid duplicating the code. Does that sound acceptable?Documentation Updated
/docs
, or no updates are required.I only found
build.rs
references indoc/Compilation.md
and doc/Porting.md`.Formatting
make prepush
.