8000 mozjs_sys: Honor the `CXXSTDLIB` environment variable by vadorovsky · Pull Request #615 · servo/mozjs · GitHub
[go: up one dir, main page]

Skip to content

Conversation

vadorovsky
Copy link
Contributor

CXXSTDLIB is an environment variable used by cc and many other crates which lets developers to choose a standard C++ library of their choice.

Make use of that variable in mozjs_sys's build.rs as well.

One of the use cases is supporting Linux distributions which use LLVM instead of GCC as the main toolchain (e.g. Chimera, Gentoo musl-llvm profile, OpenMandriva).

Comment on lines 394 to 398
} else if target.contains("windows") && target.contains("gnu") {
println!("cargo:rustc-link-lib=stdc++");
} else {
println!("cargo:rustc-link-lib=stdc++")
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not equivalent to previous code in case we are on windows without gnu.

Suggested change
} else if target.contains("windows") && target.contains("gnu") {
println!("cargo:rustc-link-lib=stdc++");
} else {
println!("cargo:rustc-link-lib=stdc++")
}
} else if target.contains("windows") && target.contains("gnu") {
println!("cargo:rustc-link-lib=stdc++");
} else if !target.contains("windows") {
println!("cargo:rustc-link-lib=stdc++")
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, done

@sagudev
Copy link
Member
sagudev commented Aug 18, 2025

Also this change requires mozjs_sys version bump: 0.137.0-2 -> 0.137.0-3

@vadorovsky
Copy link
Contributor Author

Also this change requires mozjs_sys version bump: 0.137.0-2 -> 0.137.0-3

In the same commit, or a separate one?

@sagudev
Copy link
Member
sagudev commented Aug 19, 2025

Also this change requires mozjs_sys version bump: 0.137.0-2 -> 0.137.0-3

In the same commit, or a separate one?

It doesn't matter because all PRs are squashed on landing.

`CXXSTDLIB` is an environment variable used by `cc` and many other
crates which lets developers to choose a standard C++ library of their
choice.

Make use of that variable in mozjs_sys's build.rs as well.

One of the use cases is supporting Linux distributions which use LLVM
instead of GCC as the main toolchain (e.g. Chimera, Gentoo musl-llvm
profile, OpenMandriva).

Signed-off-by: Michal Rostecki <vadorovsky@disroot.org>
@vadorovsky
Copy link
Contributor Author

Also this change requires mozjs_sys version bump: 0.137.0-2 -> 0.137.0-3

In the same commit, or a separate one?

It doesn't matter because all PRs are squashed on landing.

OK, done

@sagudev sagudev added this pull request to the merge queue Aug 19, 2025
Merged via the queue into servo:main with commit a51d878 Aug 19, 2025
34 checks passed
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

Successfully merging this pull request may close these issues.

2 participants
0