Closed panicbit closed 8 years ago
I'll change the generate_cli stuff then.
So, for packaging: cargo-deb
uses the Cargo.toml
file, where you can specify any file that will exist after calling cargo build --release
and where they will be stored in the system path.
I've been researching with @Br1oP and seems that for Bash in Debian/RedHat based distributions, scripts go in /usr/share/bash-completion/completions/
.
For ZSH they go in /usr/share/zsh/site-functions/
, and for FISH they go in /usr/share/fish/vendor_completions.d
. For the cargo-deb
implementation it's straightforward, for the RPM is not so easy, but I can explain it briefly:
The spec file is in rpmbuild/super.spec
. In the %install
section you will need to first create the directories:
mkdir -p %{buildroot}%{_datadir}/bash-completion/completions
mkdir -p %{buildroot}%{_datadir}/fish/vendor_completions.d
mkdir -p %{buildroot}%{_datadir}/zsh/site-functions (only once we have ZSH working)
And then install the actual files, but I don't get them generated in my setup with your branch :/
For ZSH, it might be different depending on the distro. For example, in Debian Jessie I think it is /usr/share/zsh/vendor-completions/
. We should look into it in more detail.
OK, now I understand where the files are generated, in target/debug/build/super-{hash}/out/
. Which is not really useful, since it will change in each build. But it can be changed. Instead of using env!("OUT_DIR")
, we should use env!("CARGO_TARGET_DIR")
. More info. They will be generated in target/release
.
@Razican Turns out that CARGO_TARGET_DIR
is a variable that you can pass to cargo. For buildscripts there is only really OUT_DIR
, so I did OUT_DIR/../../
. The scripts will now be generated in target/release/build/
.
See http://doc.crates.io/environment-variables.html#environment-variables-cargo-sets-for-build-scripts
@panicbit could that have any issue in platforms other than Unix? Maybe it would be better to create a PathBuf
and pop the last two components?
It's probably not an issue, but I agree, we should use Path.
Done :smiley:
Yeah, I'll take a look as soon as I'm off the train :)
Done :)
This does not include packaging of the completion scripts.