Build Scripts: Selecting files which will be built?

Hello.

I am building a library that has different backends. I have created a build script which checks the BACKEND and BINDINGS enviroment variables and saves it as a variable, but now I need to select which file to use.

I want to avoid changing more files other than the build.rs, but if that is not possible, I don't mind having to edit extra files.

The BACKEND and BINDINGS files are not the same, so I have to be able to select both.

My file structure:
v src/
| v backends/
| | v bindings/
| | | libalpm.rs
| | | null.rs
| | | mod.rs
| | v modules/
| | | arch.rs
| | | null.rs
| | · mod.rs
| · mod.rs
| build.rs
· lib.rs
Cargo.toml

Thanks,
Clue

Your build script output can include cfg values, which you could use in the source to conditionally include different modules, like #[cfg(use_alpm)] mod libalpm;

Thanks! I used cargo::rustc-cfg and added cfg to my code and it worked.