Page MenuHomeFreeBSD

lang/rust: Build and install Cargo
ClosedPublic

Authored by dumbbell on Jul 30 2017, 4:29 PM.
Tags
None
Referenced Files
F82070356: D11783.id31832.diff
Thu, Apr 25, 5:48 AM
F82070165: D11783.id31861.diff
Thu, Apr 25, 5:43 AM
F82070162: D11783.id32891.diff
Thu, Apr 25, 5:43 AM
F82070158: D11783.id31830.diff
Thu, Apr 25, 5:43 AM
F82070155: D11783.id32880.diff
Thu, Apr 25, 5:43 AM
F82070153: D11783.id31347.diff
Thu, Apr 25, 5:43 AM
F82070151: D11783.id31411.diff
Thu, Apr 25, 5:43 AM
Unknown Object (File)
Fri, Apr 19, 12:25 PM

Details

Summary

Starting with Rust 1.19.0, we should build Cargo at the same time as Rust. To do that, there is the extended = true flag in config.toml. Therefore this patch merges the old devel/cargo port into lang/rust. The devel/port is removed and ports depending on it now depends on lang/rust.

We also get rid of the Cargo registry snapshot: by setting vendor = true in config.toml, the build process uses the crates provided in the source archives, instead of fresh copies fetched from crates.io. This makes the maintenance of this port lighter and reduces the amount of distfiles.

Now that we use the bundled crates, we discovered two issues which this patch also fixes:

  1. The ino-64 patches were not used: they were applied to the bundled crates, not to the copies in the Cargo registry. There was a compilation failure in x86_64.rs because it was using the type ::u32 which doesn't exist; the correct syntax is u32.
  2. Some users hit an build failure because Cargo verifies file checksums using a file called .cargo-checksum.json in all crates. Because we automatically patch files such as config.rpath or the ino-64 patch was applied, this led to verification failures. Now the port patches those .cargo-checksum.json files. See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=221088.
Test Plan

I tested lang/rust in Poudriere HEAD/amd64. I still need to test on older versions of FreeBSD and on aarch64. But I would like reviews on the bits related to the removal of devel/cargo.

I build-tested Firefox and textproc/ripgrep (which both depended on devel/cargo) in Poudriere HEAD/amd64.

Diff Detail

Repository
rP FreeBSD ports repository
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 11477
Build 11832: arc lint + arc unit

Event Timeline

Fix port name in BUILD_DEPENDS in multimedia/librespot

It compiles fine on 10.3/amd64 and 11.0/i386. I can't test on aarch64 because pkgconf is not installed on ref12-aarch64.freebsd.org.

Fix extra-ino64 patch on HEAD/i386

Like on x86_64, the patch was using ::i32 instead of i32.

vaartis_cock.li added inline comments.
lang/rust/Makefile
299

Maybe we should provide an option to save source code for e.g. racer? At least that's what other packagers in different linux distros do

Ok, I will add an option to keep source code.

lang/rust seems to build fine with the patch on ref11-aarch64 and ref12-aarch64. As Cargo is implicitly updated to 0.20.0, it may fix building Firefox Nightly.

lang/rust/files/extra-patch-ino64
100

As noted in D10799 this is still out of sync.

288

Why x86*.rs (unlike aarch64.rs) aren't consistent in u32 vs. ::uint32_t style between src/liblibc/ and src/vendor/ versions of the same file?

lang/rust/files/extra-patch-ino64
387

Can you regen libc and lzma-sys patches via make makepatch? Alternatively, use post-patch for better readability, to avoid wasting ~167Kb on patch context and not regress WITHOUT_FBSD10_FIX= builds.

$ portlint -C
[...]
WARN: /usr/ports/lang/rust/files/patch-src_vendor_libssh2-sys_.cargo_checksum.json: patch was not generated using ``make makepatch''.  It is recommended to use ``make makepatch'' when you need to [re-]generate a patch to ensure proper patch format.
WARN: /usr/ports/lang/rust/files/patch-src_vendor_lzma-sys_.cargo_checksum.json: patch was not generated using ``make makepatch''.  It is recommended to use ``make makepatch'' when you need to [re-]generate a patch to ensure proper patch format.
jbeich edited reviewers, added: gecko; removed: jbeich.

gecko@ changes look fine but I've only tested via www/firefox (55.0,1). Sorry, not familiar with rust@ ports to review more.

jbeich resigned from this revision.
dumbbell edited edge metadata.

Fix .cargo-checksum.json programmatically

... instead of a regular patch. This way, we don't have to
regenerate any .cargo-checksum.json patches and it works when
WITHOUT_FBSD10_FIX is set.

It also addresses the u32 vs. ::uint32_t inconsistencies and the
forgotten st_lspare, both reported by @jbeich.

dumbbell marked 2 inline comments as done.

Fix a few fatals and warnings from portlint -C

I addressed concerns from @jbeich.

Add a SOURCES option

... to let the user choose if he wants to install rust-src. The default
is to not install Rust sources.

The last revision addresses @vaartis_cock.li suggestion.

The patch is ready for another review!

Looks reasonable as far as I can see.

lang/rust/Makefile
109

typo

Fix typo in "PATHCED"

Reported by @jilles.

The patch is also refreshed, following changes to MOVED, UPDATING and www/firefox.

I refreshed to patch to resolve conflicts and fixed the typo reported by @jilles.

This revision is now accepted and ready to land.Sep 15 2017, 5:04 PM