Skip to content
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

Support executing .bat script as a compiler on Windows #369

Open
luser opened this issue Jan 30, 2019 · 3 comments
Open

Support executing .bat script as a compiler on Windows #369

luser opened this issue Jan 30, 2019 · 3 comments

Comments

@luser
Copy link

luser commented Jan 30, 2019

rustc has code to execute a .bat script as a linker on Windows because it's difficult to otherwise use a script as a linker there:
https://github.com/rust-lang/rust/blob/d2048b6db375299b681d4f4728b8e7cad9f74d5f/src/librustc_codegen_llvm/back/link.rs#L59

In the Firefox build we don't currently pass compiler paths to cargo for build scripts to use because msys' path translation makes a mess of them (mostly because we're using sccache and having a space in the path breaks things):
https://searchfox.org/mozilla-central/rev/c07aaf12f13037c1f5a343d31f8291549e57373f/config/rules.mk#917

If this crate supported executing a .bat script as a compiler on Windows we could instead put everything we needed in there and simply pass the path to the .bat which ought to work.

@alexcrichton
Copy link
Member

Seems reasonable to me to support! IIRC this is basically just testing for *.bat and then doing cmd /c ..., right?

@MolotovCherry
Copy link

MolotovCherry commented Apr 2, 2021

Just want to chime in here that .cmd is another similar one (it's basically the same as .bat). Android ndk is using .cmd in the replace of clang (pass different target flags to clang to compile differently)

@nico-abram
Copy link
Contributor

Would the correct place to do this be around here?

https://github.com/alexcrichton/cc-rs/blob/388bf178f6c857bb07bcc333ceb31032fbee686c/src/lib.rs#L2901-L2908

Just test for *.bat or *.cmd and if so change the command to cmd and prepend the "/c "{command}" args?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants