File: rules

package info (click to toggle)
rustup 1.27.1-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,636 kB
  • sloc: sh: 856; python: 233; javascript: 183; makefile: 27
file content (39 lines) | stat: -rwxr-xr-x 1,822 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/make -f
DEB_DESTDIR := $(CURDIR)/debian/tmp
STUB_BINARIES := rustc cargo cargo-clippy cargo-fmt cargo-miri clippy-driver rust-gdb rust-lldb rls rust-analyzer rustdoc rustfmt
SH_COMPLETIONS_FULL := bash zsh
SH_COMPLETIONS_MIN := fish elvish
# create some temporary directories for rustup
# they are needed during the shell completion generation
export RUSTUP_HOME = $(CURDIR)/target/rustup

%:
	dh $@ --buildsystem cargo --with bash-completion

override_dh_auto_install-arch:
	dh_auto_install -O--buildsystem=cargo -- -F no-self-update
	# rename rustup-init to rustup so that rustup will not be in the
	# onboarding tutorial mode
	install -d $(DEB_DESTDIR)/usr/bin/
	mv $(CURDIR)/debian/rustup/usr/bin/rustup-init $(DEB_DESTDIR)/usr/bin/rustup
	# make symbolic links for all the Rust tools
	$(foreach b,$(STUB_BINARIES),ln -sf rustup $(DEB_DESTDIR)/usr/bin/$(b);)
	# generate shell completions
	$(foreach p,rustup cargo,\
	$(foreach s,$(SH_COMPLETIONS_FULL),\
		$(DEB_DESTDIR)/usr/bin/rustup completions $(s) $(p) > $(DEB_DESTDIR)/$(p).$(s);)\
	)
	# for other shells, only rustup completion is supported
	$(foreach s,$(SH_COMPLETIONS_MIN),\
		$(DEB_DESTDIR)/usr/bin/rustup completions $(s) rustup > $(DEB_DESTDIR)/rustup.$(s);)
	# install completions for non-bash shells
	install -d $(DEB_DESTDIR)/usr/share/zsh/vendor-completions/ \
		$(DEB_DESTDIR)/usr/share/fish/vendor_completions.d/ \
		$(DEB_DESTDIR)/usr/share/elvish/lib
	mv $(DEB_DESTDIR)/rustup.zsh $(DEB_DESTDIR)/usr/share/zsh/vendor-completions/_rustup
	mv $(DEB_DESTDIR)/cargo.zsh $(DEB_DESTDIR)/usr/share/zsh/vendor-completions/_cargo
	mv $(DEB_DESTDIR)/*.fish $(DEB_DESTDIR)/usr/share/fish/vendor_completions.d/
	mv $(DEB_DESTDIR)/rustup.elvish $(DEB_DESTDIR)/usr/share/elvish/lib/rustup.elv

refresh: clean Cargo.toml
	$(CURDIR)/debian/refresh.sh