aboutsummaryrefslogtreecommitdiff
blob: ac3a34d97f0e9b60e8043cd79f8e0edafae32845 (plain)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# [eselect](https://wiki.gentoo.org/wiki/Project:Eselect) module for managing Rust compiler symlinks

## User's guide

**eselect-rust** allows you to easily switch between different Rust implementations.

List available implementations:

```
eselect rust list
```

Set implementation you need:

```
eselect rust set TARGET
```

where `TARGET` is the target number or name as listed in the `list` command.

Unset symlinks:

```
eselect rust unset
```

## Packager's guide

Every package that installs Rust implementation on Gentoo should collaborate with this eselect module.

### Target and target suffix

To register your package in eselect-rust you need to install `/etc/env.d/rust/provider-TARGET` file,
where TARGET is your target name as it will be show by eselect.

To differentiate symlink targets installed by different packages target suffix is used.
Target suffix is the part of target name that follows first `-` or target name itself if it includes no `-` characters.
To split out target suffix, command `cut -d- -f2-` is used. Some examples:

```
TARGET                  TARGET SUFFIX

rust-1.0.0_beta2        1.0.0_beta
rust-bin-1.0.0_beta2    bin-1.0.0_beta2
somecrazyimpl           somecrazyimpl
```

### Symlinks

Rust implementation package can include a number of symlinks that can be managed by eselect.
Package itself should install only symlink targets named `PATH/NAME-TARGET_SUFFIX`.
Where `PATH/NAME` is the future symlink location and `TARGET_SUFFIX` is described in the previous paragraf.

*Example*. If package wants to have symlinks `/usr/bin/rustc` and `/usr/bin/rustdoc`
and its target suffix is `1.0.0_beta`, it should install these files:

```
/usr/bin/rustc-1.0.0_beta
/usr/bin/rustdoc-1.0.0_beta
```

The main symlink that **eselect-rust** manages is `/usr/bin/rustc`.
It is the symlink that every package should have and it determines what implementation is shown as active by eselect.

To determine other symlinks that package sets, **eselect-rust** uses the content of the `/etc/env.d/rust/provider-TARGET` file.
This file should contain symlink paths one per line. If this file is empty, **eselect-rust**
behaves as its content were one line `/usr/bin/rustdoc`.

*Example*. If you want to have symlinks `/usr/bin/rustc`, `/usr/bin/rustdoc` and `/usr/bin/rust-gdb`,
then `/etc/env.d/rust/provider-TARGET` should contain:

```
/usr/bin/rustdoc
/usr/bin/rust-gdb
```

Note, that `/usr/bin/rustc` should not be listed, as it is always managed by eselect.