Skip to content

Commit d3687c1

Browse files
openeuler-ci-botgitee-org
authored andcommitted
!146 [build] Add build script and update README.
From: @cf-zhao Reviewed-by: @liyunfei33 Signed-off-by: @liyunfei33
2 parents cd70802 + 737fa86 commit d3687c1

File tree

3 files changed

+507
-32
lines changed

3 files changed

+507
-32
lines changed

README-zh.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
## 1、项目介绍
2+
3+
欢迎来到openEuler社区的LLVM项目!本仓库是[llvm-project](https://github.com/llvm/llvm-project)下游仓库。
4+
5+
此仓库包含LLVM项目的源代码,LLVM基础设施是一个用于构建高度优化的编译器、优化器和运行时环境的工具包。
6+
7+
LLVM项目有多个组件。该项目的核心组件被称为“LLVM”,它包含处理中间表示及将其转换为目标文件所需的所有工具(包括汇编器、反汇编器、位码分析器和为位码优化器)、库和头文件。
8+
9+
类C语言使用Clang前端,该组件将C、C++、Objective-C和Objective-C++代码编译成LLVM位码,并使用LLVM将其转换为二进制目标文件。
10+
11+
其他组件包括:C++标准库(libc++)、LLD链接器等。
12+
13+
## 2、构建指导
14+
15+
首先通过git下载源码,然后通过build.sh脚本一键式构建LLVM。构建方式有`直接命令行构建``容器化构建`两种。
16+
17+
### 2.1、直接命令行构建
18+
19+
推荐使用openEuler操作系统进行构建,如果您使用其他操作系统,建议使用容器化构建方式。
20+
21+
首先确保系统安装了依赖软件包,可以用如下命令安装。
22+
```
23+
yum install -y gcc g++ make cmake openssl-devel python3 \
24+
python3-setuptools python-wheel texinfo binutils-devel libatomic
25+
```
26+
然后可以通过 `./build.sh -h`查看当前工程支持的构建选项。通过命令行执行一键式构建,例如:
27+
```
28+
./build.sh -r -b release -X X86 -j 8
29+
```
30+
31+
### 2.2、容器化构建
32+
33+
为了解决由于开发环境差异导致的构建失败和构建产物二进制差异问题,openEuler LLVM项目提供了容器化构建方法。得益于[openEuler容器镜像项目](https://gitee.com/openeuler/openeuler-docker-images),提前制作了[llvm-build-deps容器镜像](https://gitee.com/openeuler/openeuler-docker-images/tree/master/llvm-build-deps)。开发者可以通过`build.sh`脚本的`-C`选项启用容器化构建,例如:
34+
```
35+
./build.sh -C -r -b release -X X86 -j 8 // 添加了-C选项
36+
```
37+
38+
相关依赖:
39+
* 开发环境需要正确安装了docker应用。
40+
* 用户加入了docker用户组,使得`build.sh`脚本执行docker命令时不需要再加`sudo`命令。可以通过如下命令将当前用户加入docker用户组。
41+
```
42+
sudo usermod -aG docker ${USER}
43+
```
44+
注意:第一次执行容器化构建时,脚本会自动从镜像仓库拉取llvm-build-deps容器镜像。
45+
46+
## 3、贡献指导
47+
48+
1、Fork 本仓库
49+
2、新建 Feat_xxx 分支
50+
3、提交代码
51+
4、新建 Pull Request
52+
53+
## 4、讨论与求助
54+
55+
### 4.1、上游社区
56+
* 加入[discourse论坛](https://discourse.llvm.org/),提出或参与问题、RFC等交流。
57+
58+
* 社区参与者的[行为规范](https://llvm.org/docs/CodeOfConduct.html).
59+
60+
### 4.1、openEuler社区Compiler SIG
61+
几种方式:
62+
* 订阅[Compiler SIG邮件列表](https://mailweb.openeuler.org/postorius/lists/[email protected]/)
63+
*[openEuler论坛](https://forum.openeuler.org/?locale=zh_CN)发帖讨论。
64+
* 微信交流群:请先添加微信名`Compiler_Assistant`

README.md

Lines changed: 58 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,70 @@
1-
# The LLVM Compiler Infrastructure
1+
## 1. Project Introduction
22

3-
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/llvm/llvm-project/badge)](https://securityscorecards.dev/viewer/?uri=github.com/llvm/llvm-project)
4-
[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/8273/badge)](https://www.bestpractices.dev/projects/8273)
5-
[![libc++](https://github.com/llvm/llvm-project/actions/workflows/libcxx-build-and-test.yaml/badge.svg?branch=main&event=schedule)](https://github.com/llvm/llvm-project/actions/workflows/libcxx-build-and-test.yaml?query=event%3Aschedule)
3+
Welcome to the LLVM project in the openEuler community! This warehouse is the downstream warehouse of [llvm-project](https://github.com/llvm/llvm-project).
64

7-
Welcome to the LLVM project!
5+
This repository contains the source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and run-time environments.
86

9-
This repository contains the source code for LLVM, a toolkit for the
10-
construction of highly optimized compilers, optimizers, and run-time
11-
environments.
7+
The LLVM project has multiple components. The core of the project is itself called "LLVM". This contains all of the tools, libraries, and header files needed to process intermediate representations and convert them into object files. Tools include an assembler, disassembler, bitcode analyzer, and bitcode optimizer.
128

13-
The LLVM project has multiple components. The core of the project is
14-
itself called "LLVM". This contains all of the tools, libraries, and header
15-
files needed to process intermediate representations and convert them into
16-
object files. Tools include an assembler, disassembler, bitcode analyzer, and
17-
bitcode optimizer.
9+
C-like languages use the [Clang](https://clang.llvm.org/) frontend. This component compiles C, C++, Objective-C, and Objective-C++ code into LLVM bitcode -- and from there into object files, using LLVM.
1810

19-
C-like languages use the [Clang](https://clang.llvm.org/) frontend. This
20-
component compiles C, C++, Objective-C, and Objective-C++ code into LLVM bitcode
21-
-- and from there into object files, using LLVM.
11+
Other components include: the [libc++ C++ standard library](https://libcxx.llvm.org/), the [LLD linker](https://lld.llvm.org/), and more.
2212

23-
Other components include:
24-
the [libc++ C++ standard library](https://libcxx.llvm.org),
25-
the [LLD linker](https://lld.llvm.org), and more.
13+
## 2. Construction Guide
2614

27-
## Getting the Source Code and Building LLVM
15+
You can use `git` to download the source code, and then use the `build.sh` script to build the LLVM in one-click mode. There are two build modes: `build with command line` and `build with container`.
2816

29-
Consult the
30-
[Getting Started with LLVM](https://llvm.org/docs/GettingStarted.html#getting-the-source-code-and-building-llvm)
31-
page for information on building and running LLVM.
17+
### 2.1. Build with command line directly
3218

33-
For information on how to contribute to the LLVM project, please take a look at
34-
the [Contributing to LLVM](https://llvm.org/docs/Contributing.html) guide.
19+
You are advised to use the `openEuler` for building. If you use other operating systems, you are advised to use the containerized building mode.
3520

36-
## Getting in touch
21+
Ensure that the dependency software packages are installed. You can run the following command to install the software packages:
3722

38-
Join the [LLVM Discourse forums](https://discourse.llvm.org/), [Discord
39-
chat](https://discord.gg/xS7Z362),
40-
[LLVM Office Hours](https://llvm.org/docs/GettingInvolved.html#office-hours) or
41-
[Regular sync-ups](https://llvm.org/docs/GettingInvolved.html#online-sync-ups).
23+
` ` `
24+
yum install -y gcc g++ make cmake openssl-devel python3 \
25+
python3-setuptools python-wheel texinfo binutils-devel libatomic
26+
` ` `
4227

43-
The LLVM project has adopted a [code of conduct](https://llvm.org/docs/CodeOfConduct.html) for
44-
participants to all modes of communication within the project.
28+
You can run the `./build.sh -h` command to view the build options supported by the current project. Run the following command to perform a one-click build:
29+
30+
` ` `
31+
./build.sh -r -b release -X X86 -j 8
32+
` ` `
33+
34+
### 2.2 Build with container
35+
36+
The openEuler LLVM project provides a containerized building mode to solve the problems of build failures and binary differences of build products caused by development environment differences. Thanks to the [openEuler container image project](https://gitee.com/openeuler/openeuler-docker-images), the [llvm-build-deps container image](https://gitee.com/openeuler/openeuler-docker-images/tree/master/llvm-build-deps) is created in advance. Developers can enable containerized builds using the `-C` option of the `build.sh` script. For example:
37+
38+
` ` `
39+
./build.sh -C -r -b release -X X86 -j 8 // added -C option
40+
` ` `
41+
42+
Dependency:
43+
* The Docker application must be correctly installed in the development environment.
44+
* The user is added to the docker user group so that the `sudo` command is not required when the `build.sh` script executes the docker command. You can run the following command to add the current user to the docker user group:
45+
46+
` ` `
47+
sudo usermod -aG docker ${USER}
48+
` ` `
49+
50+
Note: When you perform a containerized build for the first time, the script automatically pulls the `llvm-build-deps container image` from the image repository.
51+
52+
## 3. Contribution guidance
53+
54+
1. Fork This Warehouse
55+
2. Create the Feat_xxx branch.
56+
3. Submit the code.
57+
4. Create a Pull Request.
58+
59+
## 4. Discussion and help-seeking
60+
61+
### 4.1 Upstream Community
62+
* Join the [Discourse Forum](https://discourse.llvm.org/) .
63+
64+
* [Code of Conduct](https://llvm.org/docs/CodeOfConduct.html) for Community Participants.
65+
66+
### 4.1. Compiler SIG of the openEuler community
67+
There are several ways:
68+
* Subscribe to the [Compiler SIG mailing list](https://mailweb.openeuler.org/postorius/lists/[email protected]/)
69+
* Post a discussion at the [openEuler forum](https://forum.openeuler.org/?locale=zh_CN).
70+
* WeChat communication group: Please add the WeChat name `Compiler_Assistant` first.

0 commit comments

Comments
 (0)