|
1 | 1 | # Clang/LLVM as a main toolchain for Gentoo Linux!
|
2 |
| - |
3 |
| -This is Gentoo Linux overlay experiment allowing to have your stage3 completely _gccfree_. In the future, fully usable stage3 files will be provided. As of now, you can either try to assemble stage yourself, by using provided script, or add profile to your system and rebuild world. |
4 |
| - |
5 | 2 | ### WARNING: Alpha quality!
|
6 | 3 |
|
7 |
| -## Technote |
8 |
| -Since this is not official and tweaked base profile is required (as well as other ARCH-native parent ones), `assets/stage-builder.sh` script |
9 |
| -creates portage overlay via OverlayFS, which combines mainline Gentoo one with the content of `assets/baserepo_overlay` folder. Modifications made there are purely cosmetic thus patch against upstream would be minimal. |
10 |
| - |
11 |
| -## Concept |
12 |
| -GCC and binutils are deeply ingrained in the system, so two virtuals were created: `virtual/toolchain`, which can be either `gcc` or `clang`, and `virtual/binutils`, which can be `binutils` or `llvm`, respectively. Proposed profiles will take care of required USE flags and make required virtual resolutions by masking GCC/binutils. |
| 4 | +This is Gentoo Linux overlay experiment allowing to have your stage3 completely _GCC-free_. You can either grab a release and process with installation as per Gentoo Handbook, or try to switch your current system profile and rebuild world. |
13 | 5 |
|
14 |
| -## Building stage3 by hand |
| 6 | +# Available profiles |
| 7 | +### amd64 |
| 8 | +- `clang` based on `default/linux/amd64/17.1`; |
| 9 | +- `clang/lto` same, but with LTO; |
| 10 | +- `clang/musl` based on `default/linux/amd64/17.0/musl`; |
| 11 | +- `clang/musl/lto` same, but with LTO. |
15 | 12 |
|
16 |
| -As of now, there are profiles for `amd64` only. Once PoC will be done, other archs will be added. |
17 |
| - |
18 |
| -1. Add this overlay to your system as per wiki: |
| 13 | +### NOTE |
| 14 | +`bootstrap` profile is used by catalyst only and shouldn't be selected. |
19 | 15 |
|
| 16 | +# HOWTO |
| 17 | +## Add this overlay |
20 | 18 | ```
|
21 | 19 | eselect repository add toolchain-clang git https://github.com/2b57/toolchain-clang.git
|
22 | 20 | emaint sync -r toolchain-clang
|
23 | 21 | ```
|
24 | 22 |
|
25 |
| -2. Pick a profile (but don't `eselect` it). There are 3 main profiles available: |
| 23 | +## How to use it |
| 24 | +This is your default stage3 + `git` + `eselect-repository` packages for overlay management. You'll get warnings that your profile symlink is invalid, so after chrooting inside be sure to add this overlay (see above) and select right profile: |
| 25 | +``` |
| 26 | +# eselect profile list | grep toolchain-clang:linux/amd64/clang/musl |
| 27 | + [43] toolchain-clang:linux/amd64/clang/musl (exp) |
| 28 | + [44] toolchain-clang:linux/amd64/clang/musl/lto (exp) |
| 29 | +# eselect profile set --force 43 |
| 30 | +# eselect profile list | grep toolchain-clang:linux/amd64/clang/musl |
| 31 | + [43] toolchain-clang:linux/amd64/clang/musl (exp) * |
| 32 | + [44] |
| 33 | +``` |
26 | 34 |
|
27 |
| -- `clang` – based on `default/linux/amd64/17.1`; |
28 |
| -- `clang/lto` – same, but with LTO; |
29 |
| -- `clang/musl` – based on `default/linux/amd64/17.0/musl`; |
30 |
| -- `clang/musl/lto` – same, but with LTO. |
| 35 | +# I want to build stage3 myself |
| 36 | +## Overview |
| 37 | +Apart from custom spec files, some modifications to `scripts/bootstrap.sh` are required. In order to execute right file, provided build script creates OverlayFS mount which will be used as Gentoo Portage tree for catalyst; contents of `/var/db/repos/gentoo` (main tree) is combined with `assets/baserepo_overlay` folder. Catalyst envscripts (`catalystrc`) are created as needed during the process. |
31 | 38 |
|
32 |
| -`bootstrap` profile is used for building `stage1` and should not be explicitly chosen. |
| 39 | +### bootstrap profile |
| 40 | +`bootstrap` profile is used for building `stage1` with GCC if there are no seed `clang` stages available and should not be explicitly chosen. In this case, catalyst build order is `bootstrap-stage1` -> `clang-stage2` -> `clang-stage3`. If `clang` seed stage is present, you'll need to edit spec files accordingly. |
33 | 41 |
|
34 |
| -**NOTE:** if you're using anything `musl`-related, you'll need to clone RelEng repo as well, since `musl` stages require some of the tweaks from there: |
| 42 | +### musl |
| 43 | +If you want to go with anything `musl`-related, you'll need to clone RelEng repo as well, since `musl` stages require some of the tweaks from there: |
35 | 44 | ```
|
36 | 45 | cd /var/db/repos/toolchain-clang
|
37 | 46 | git clone https://github.com/gentoo/releng.git
|
38 | 47 | ```
|
39 | 48 |
|
40 |
| -3. Run `stage-builder.sh` script against corresponding `spec` file: |
| 49 | + |
| 50 | +## Building |
| 51 | +- Add this overlay to your system (see above) |
| 52 | +- Install deps: `catalyst` and `pixz` |
| 53 | +- Pick a profile, but don't `eselect` it |
| 54 | +- Run `stage-builder.sh` script against corresponding `spec` file: |
41 | 55 |
|
42 | 56 | ```
|
43 | 57 | cd /var/db/repos/toolchain-clang
|
44 | 58 | ./assets/scripts/stage-builder.sh specs/clang/musl/stage1.spec
|
45 | 59 | ./assets/scripts/stage-builder.sh specs/clang/musl/stage2.spec
|
46 | 60 | ./assets/scripts/stage-builder.sh specs/clang/musl/stage3.spec
|
47 |
| -``` |
48 |
| - |
49 |
| -3. Cross fingers... |
| 61 | +``` |
0 commit comments