[Native] Add initial version of LLVM buildscript
Previously there was no determined way to build LLVM for Kotlin/Native. This commits adds a Python script that allows to do so on all hosts.
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
# LLVM Build Infrastructure
|
||||
|
||||
[package.py](package.py) script automates downloading, building and packing of LLVM distribution used by Kotlin/Native.
|
||||
### Requirements
|
||||
* Check [LLVM requirements](https://llvm.org/docs/GettingStarted.html#requirements). Note that:
|
||||
* Visual Studio 2017 is required on Windows
|
||||
* Xcode is required on macOS
|
||||
* [Python 3](https://www.python.org/)
|
||||
* [ninja](https://ninja-build.org/)
|
||||
* [git](https://git-scm.com/)
|
||||
* [CMake](https://cmake.org/)
|
||||
|
||||
### Usage
|
||||
|
||||
Just run
|
||||
```
|
||||
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.
|
||||
|
||||
### 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
|
||||
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.
|
||||
|
||||
### Known problems
|
||||
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