Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom binary names #13

Merged
merged 4 commits into from
Apr 20, 2022
Merged

Custom binary names #13

merged 4 commits into from
Apr 20, 2022

Conversation

fosskers
Copy link
Owner

This PR accounts for [[bin]] sections in Cargo.toml, allowing the specification of custom binary names.

@fosskers fosskers linked an issue Apr 19, 2022 that may be closed by this pull request
@hisbaan
Copy link

hisbaan commented Apr 20, 2022

Hi! I just checkout out the branch and it seems that while you fixed the issue around strip not being run on the binary, the generated package build still contains the wrong name in some places. For example, with the following Cargo.toml file:

[package]
name = "didyoumean"
authors = ["Hisbaan Noorani"]
version = "1.1.0"
edition = "2021"
license = "GPL-3.0"
description = "A cli spelling corrector"
documentation = "https://github.com/hisbaan/didyoumean"
homepage = "https://github.com/hisbaan/didyoumean"
repository = "https://github.com/hisbaan/didyoumean"
readme = "docs/README.md"
keywords = ["levenshtein", "damerau", "edit-distance"]
categories = ["command-line-utilities"]

[[bin]]
name = "dym"
path = "src/main.rs"

[dependencies]
clap = { version = "3.1.8", features = ["derive"] }
colored = { version = "2" }
cli-clipboard = {version = "0.2.1"}
dialoguer = {version = "0.10.0"}
atty = { version = "0.2.14" }

[target.'cfg(unix)'.dependencies]
nix = { version = "0.23.1" }

[dev-dependencies]
criterion = "0.3"

[[bench]]
name = "edit_distance"
harness = false

the following PKGBUILD is generated

# Maintainer: Hisbaan Noorani
#
# This PKGBUILD was generated by `cargo aur`: https://crates.io/crates/cargo-aur

pkgname=dym-bin
pkgver=1.1.0
pkgrel=1
pkgdesc="A cli spelling corrector"
url="https://github.com/hisbaan/didyoumean"
license=("GPL-3.0")
arch=("x86_64")
provides=("didyoumean")
conflicts=("didyoumean")
source=("https://github.com/hisbaan/didyoumean/releases/download/v$pkgver/didyoumean-$pkgver-x86_64.tar.gz")
sha256sums=("ab689b51e2823c87b8163100613d5ea2632f36e3daae1fb5601d1f4654dc5959")

package() {
    install -Dm755 didyoumean -t "$pkgdir/usr/bin"
    install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

I belive that the name field of the pkgbuild should be the same as the package.name (from before) and the provides/conflicts fields should be the name of the binary. In addition, in the build() function, the file being installed should be the binary and not the package name.

@fosskers
Copy link
Owner Author

fosskers commented Apr 20, 2022

Thanks for pointing those out.

I believe if the package name should be (in this case) didyoumean-bin, then the provides and conflicts are correct. Those are referring to package names as well, not binaries. But certainly the package() section needs to be corrected.

@fosskers
Copy link
Owner Author

Can you try it now?

@hisbaan
Copy link

hisbaan commented Apr 20, 2022

It seems that it is correct now, apart from the provides and conflicts fields which I believe should be the binary that the package provides. Thank you for addressing this :)

Edit: I just read your above comment. I'm new to package builds so I have probably been making them wrong haha 😅. It seems good to me now!

@fosskers fosskers merged commit 6a1269e into master Apr 20, 2022
@fosskers fosskers deleted the colin/binary-name branch April 20, 2022 23:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for differing binary names
2 participants