Bridging Worlds: Using Rust Build Scripts to Leverage Existing Build Infrastructure
summary
Rust build scripts let existing C build steps run inside Cargo so gresource XML gets turned into embedded assets that the Rust binary can load at runtime. The workflow uses build.rs generates Rust source with static and emits cargo:rerun-if-env-changed lines, runs glib-compile-resources, then uses the cc crate to compile generated C into Rust binary. A tiny gbuild crate wraps XML parsing, calls glib-compile-resources, and registers the resource with gio so CSS and files load without extra unsafe code.
AI-written summary · about
chapters (17)
- 0:00Intro
- 0:48Background
- 1:07Recap
- 1:44What is Rust
- 2:56Memory Safety
- 4:00Example
- 6:14Rust Saves the Day
- 7:01Atomicity
- 7:54Mutex
- 9:15Cargo
- 9:48The Problem with Cargo
- 11:35Build Scripts
- 12:29Environment Variables
- 13:48GResource
- 15:01CC Crate
- 16:59Rust Code
- 18:01Outro
related talks
25mRust and C++
53mC++/Rust Interop: A Practical Guide to Bridging the Gap Between C++ and Rust
32mBuilding and Maintaining Rust at Scale
26mPiecing together Rust: It is more than just writing code
21m"What Happens When You Run Cargo Build?"
08mLightning Talk: C++ and Rust Bindings - Mixing It Best With CMake
28mInterfacing Rust with Xen
26mIntroducing Rust into a Legacy Embedded System
