core-foundation-rs icon indicating copy to clipboard operation
core-foundation-rs copied to clipboard

gate the build with target_os = "macos"

Open alexanderkjall opened this issue 2 years ago • 5 comments

so that we don't get build errors on linux.

Ref: https://salsa.debian.org/rust-team/debcargo-conf/-/blob/master/src/core-graphics-types/debian/patches/cnf-macos.patch

alexanderkjall avatar Apr 19 '22 18:04 alexanderkjall

Why is core-graphics-types being compiled on Linux?

jdm avatar Apr 19 '22 22:04 jdm

This is due to the peculiarities of how the Debian resolution of source packaged work, I'll try to explain why I packaged it.

Problem statement

I would like to package the font-kit package, and that depends on core-graphics that depend on core-graphics-types.

A deeper look into why

Each rust crates becomes one source package in Debian, so that the copyright + license information can be reviewed, and in according to the Debian policy of not vendoring dependencies.

Each dependency from Cargo.toml becomes one item in the Debian depends specification, you can see an (unrelated) example here: https://linux-packages.com/debian/package/librust-addr2line-dev

Since the depends resolution happens before cargo starts building the source code, the #[cnf] gating in Cargo.toml in font-kit isn't availible.

Then the option becomes to either patch the font-kit package to remove all unneeded dependencies, or to package those into their own debian packages.

I prefer to reduce the amount of debian specific patches if that is possible, so I packaged core-graphics-types, that turned out to still require a patch, since the code didn't even build on linux, but I thought I could at least provide that patch upstream.

Sorry for the wall of text, but I hope that this explains the background of the patch.

alexanderkjall avatar Apr 20 '22 09:04 alexanderkjall

Does every foundational crate used by a cross-platform rust library require patches like this?

jdm avatar Apr 20 '22 17:04 jdm

I think many build cross platform without trouble as it is today, we also package windows api crates for example: https://packages.debian.org/sid/librust-winapi-dev

I don't know if all of them have gotten patches from some debian package maintainer at some point in time or not :)

alexanderkjall avatar Apr 20 '22 17:04 alexanderkjall

:umbrella: The latest upstream changes (presumably b009c87f2da0038bb474800cd88597843e5dbdae) made this pull request unmergeable. Please resolve the merge conflicts.

bors-servo avatar Jul 25 '23 02:07 bors-servo