Skip to content

rust-crate tools for handling binaries #10

Description

@kentfredric

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:

  1. Compile the binary with:
src_compile() {
	rust-crate_src_compile
	ecargo build --release --bins
}
  1. 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"
}
  1. 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 ).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionideas, thoughts and meta issues that may or may not eventually lead to some concrete change

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions