[K/N] Option to build smaller LLVM distribution.
Also add a few adjustments to `package.py`: * Enable threading in LLVM * Replace `--archive-path` with `--pack` to avoid naming divergence.
This commit is contained in:
@@ -18,24 +18,42 @@ python3 package.py
|
||||
```
|
||||
It will create a `llvm-distribution` folder which contains LLVM distribution.
|
||||
Note that build will take a lot of time and all your machine cores. 😈
|
||||
See [HACKING.md](../../HACKING.md#using-different-llvm-distributions-as-part-of-kotlinnative-compilation-pipeline) on how to use freshly built distribution.
|
||||
See [HACKING.md](../../HACKING.md#using-different-llvm-distributions-as-part-of-kotlinnative-compilation-pipeline)
|
||||
on how to use freshly built distribution.
|
||||
|
||||
### Building distribution for end-users
|
||||
By default, `package.py` installs a lot of LLVM components that is not really required to use Kotlin/Native compiler.
|
||||
To build only essential parts, run the following command:
|
||||
|
||||
```
|
||||
python3 package.py --build-targets install-distribution --distribution-components $DISTRIBUTION_COMPONENTS
|
||||
```
|
||||
Set of required `$DISTRIBUTION_COMPONENTS` is depends on OS:
|
||||
|
||||
| OS | Distribution components |
|
||||
| --- | --- |
|
||||
|Windows | `clang libclang lld llvm-cov llvm-profdata llvm-ar clang-resource-headers` |
|
||||
|macOS | `clang libclang lld llvm-cov llvm-profdata llvm-ar clang-resource-headers` |
|
||||
|Linux | `clang libclang lld llvm-cov llvm-profdata llvm-ar clang-resource-headers compiler_rt` |
|
||||
|
||||
### Tuning
|
||||
Run `python3 package.py -h` to check how one can tune script's behavior.
|
||||
Some examples:
|
||||
* `--archive-path` creates an archive (`zip` on Windows, `tar.gz` on macOS and Linux) with distribution
|
||||
* `--pack` creates an archive (`zip` on Windows, `tar.gz` on macOS and Linux) with distribution
|
||||
alongside with its SHA256.
|
||||
* `--install-path` allows overriding distribution's output directory.
|
||||
* `--num-stages` specifies number of steps in build. Passing 2 or more makes bootstrap build which
|
||||
means that LLVM will build itself by using distribution from the previous step.
|
||||
* `--stage0` allows using existing LLVM toolchain for bootstrapping.
|
||||
* `--build-targets` specifies what targets will be passed to Ninja.
|
||||
* `--distribution-components` is a list of components that will be installed with `install-distribution` build target.
|
||||
|
||||
### Docker
|
||||
|
||||
You can use Docker to build LLVM for Linux:
|
||||
```shell
|
||||
docker build -t kotlin-llvm-builder .
|
||||
docker run --rm -it -v <HOST_PATH>:/output kotlin-llvm-builder --archive-path /output/llvm-11.1.0-linux-x64
|
||||
docker run --rm -it -v <HOST_PATH>:/output kotlin-llvm-builder --install-path /output/llvm-11.1.0-linux-x64 --pack
|
||||
|
||||
```
|
||||
|
||||
@@ -43,5 +61,3 @@ docker run --rm -it -v <HOST_PATH>:/output kotlin-llvm-builder --archive-path /o
|
||||
1. Bootstrap build is not working on macOS for default git branch.
|
||||
2. `libcxx` and `compiler-rt` are built as projects, not runtimes.
|
||||
3. No way to run LLVM tests out of the box.
|
||||
4. No way to override default `install` task out of the box.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user