So I've hit my first crate that can provide user-usable binaries, aho-corasick which ships binary aho-corasick-dot.
I'm mostly sure its just an example, but anyway.
What I've currently settled upon is:
- Compile the binary with:
src_compile() {
rust-crate_src_compile
ecargo build --release --bins
}
- Install the binary into
/usr/lib/rust/binaries
src_install() {
rust-crate_src_install
exeinto "/usr/lib/rust/binaries/${P}"
doexe "${CARGO_TARGET_DIR}/release/aho-corasick-dot"
}
- employ
alternatives.eclass to provide a symlink:
pkg_postinst() {
alternatives_auto_makesym "/usr/bin/aho-corasick-dot" "/usr/lib/rust/binaries/aho-corasick-[0-9].[0-9].[0-9]/aho-corasick-dot"
}
pkg_postrm() {
alternatives_auto_makesym "/usr/bin/aho-corasick-dot" "/usr/lib/rust/binaries/aho-corasick-[0-9].[0-9].[0-9]/aho-corasick-dot"
}
Though it would be very nice if the rust-crate eclass had some sort of mechanism for handling this generically.
Importantly, it probably needs "${PF}" not "${P}" or whatever, or not, not 100% sure right now. ( I suspect it should use the same naming convention as we use for the /crates/ dir, namely, using the upstream version data only in the path, and not allowing concurrent sub-revisions of the same upstream version ).
So I've hit my first crate that can provide user-usable binaries,
aho-corasickwhich ships binaryaho-corasick-dot.I'm mostly sure its just an example, but anyway.
What I've currently settled upon is:
src_compile() { rust-crate_src_compile ecargo build --release --bins }/usr/lib/rust/binariesalternatives.eclassto provide a symlink:Though it would be very nice if the
rust-crateeclass had some sort of mechanism for handling this generically.Importantly, it probably needs "${PF}" not "${P}" or whatever, or not, not 100% sure right now. ( I suspect it should use the same naming convention as we use for the /crates/ dir, namely, using the upstream version data only in the path, and not allowing concurrent sub-revisions of the same upstream version ).