Bug 1794001 - Part 6: Patch rure to remove cdylib and staticlib targets, r=#xpcom-reviewers CLOSED TREE

Cargo will attempt to build all targets for dependencies, and there
appears to be no option to turn that functionality off (see
https://github.com/rust-lang/cargo/issues/11232). If we try to build the
`rure` crate as a cdylib during a PGO build, it causes linker issues,
which make the build fail. As this artifact isn't necessary for our
build, we can patch the crate to remove the cdylib and staticlib
crate-type definitions, making the build pass as only the artifact we
need is built.

Differential Revision: https://phabricator.services.mozilla.com/D159332
This commit is contained in:
Nika Layzell 2022-10-13 21:46:07 +00:00
Родитель 28b6c5c09f
Коммит 1e93d06f14
4 изменённых файлов: 11 добавлений и 7 удалений

2
Cargo.lock сгенерированный
Просмотреть файл

@ -4496,8 +4496,6 @@ checksum = "5d79b4b604167921892e84afbbaad9d5ad74e091bf6c511d9dbfb0593f09fabd"
[[package]]
name = "rure"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3de09595e75baee10da378a1fadfb50d04334a031d69dfb74d0cee3a94aa24c"
dependencies = [
"libc",
"regex",

Просмотреть файл

@ -138,6 +138,13 @@ web-sys = { path = "build/rust/dummy-web/web-sys" }
# Overrides to allow easier use of common internal crates.
moz_asserts = { path = "mozglue/static/rust/moz_asserts" }
# Patch `rure` to disable building the cdylib and staticlib targets
# Cargo has no way to disable building targets your dependencies provide which
# you don't depend on, and linking the cdylib breaks during instrumentation
# builds.
# Workaround for https://github.com/rust-lang/cargo/issues/11232
rure = { path = "third_party/rust/rure" }
# Other overrides
async-task = { git = "https://github.com/smol-rs/async-task", rev="f6488e35beccb26eb6e85847b02aa78a42cd3d0e" }
chardetng = { git = "https://github.com/hsivonen/chardetng", rev="3484d3e3ebdc8931493aa5df4d7ee9360a90e76b" }

Просмотреть файл

@ -126,6 +126,10 @@ notes = "This is a first-party crate which is entirely unrelated to the crates.i
audit-as-crates-io = true
notes = "This is a first-party crate which is also published to crates.io, but we should publish audits for it for the benefit of the ecosystem."
[policy.rure]
audit-as-crates-io = true
notes = "Identical to upstream, but with cdylib and staticlib targets disabled to avoid unnecessary build artifacts and linker errors."
[policy.selectors]
audit-as-crates-io = true
notes = "This is a first-party crate which is also published to crates.io, but we should publish audits for it for the benefit of the ecosystem."

5
third_party/rust/rure/Cargo.toml поставляемый
Просмотреть файл

@ -25,11 +25,6 @@ repository = "https://github.com/rust-lang/regex"
[lib]
name = "rure"
crate-type = [
"staticlib",
"cdylib",
"rlib",
]
[dependencies.libc]
version = "0.2"