-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathllvm-x86_64-unknown-linux-gnu.yml
More file actions
139 lines (111 loc) · 4.61 KB
/
llvm-x86_64-unknown-linux-gnu.yml
File metadata and controls
139 lines (111 loc) · 4.61 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: llvm-x86_64-unknown-linux-gnu
on:
push:
tags:
- 'llvm-x86_64-unknown-linux-gnu-v*.*.*'
jobs:
build-llvm:
runs-on: ubuntu-latest
container:
image: messense/manylinux_2_28-cross:x86_64
permissions:
contents: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Generating Unique ID
run: |
BASE_NAME=$(echo "$GITHUB_REF" | sed 's|^refs/tags/||')
BUILD_ID="${BASE_NAME}-$GITHUB_RUN_ID"
echo "BUILD_ID=$BUILD_ID" >> $GITHUB_ENV
echo "BASE_NAME=$BASE_NAME" >> $GITHUB_ENV
echo "Unique ID: $BUILD_ID"
echo "Base name: $BASE_NAME"
- name: Installing dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential cmake ninja-build python3 wget libz-dev binutils xz-utils gcc g++
sudo apt-get remove -y llvm-16* clang-16* || true
sudo rm -rf /usr/lib/llvm-16
- name: Downloading LLVM project
run: |
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/llvm-project-17.0.6.src.tar.xz
- name: Unpacking LLVM project
run: |
tar -xf llvm-project-17.0.6.src.tar.xz
mv llvm-project-17.0.6.src llvm-project
- name: Creating host-tools build directory
run: |
mkdir -p host-build
- name: Build host tools first
run: |
cmake ../llvm-project/llvm -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_PROJECTS="llvm" \
-DLLVM_TARGETS_TO_BUILD="X86" \
-DLLVM_BUILD_TESTS=OFF \
-DLLVM_INCLUDE_TESTS=OFF \
-DLLVM_INCLUDE_EXAMPLES=OFF \
-DLLVM_INCLUDE_DOCS=OFF \
-DCMAKE_INSTALL_PREFIX="/host-tools"
ninja -j$(nproc) llvm-tblgen llvm-config
ninja install
working-directory: host-build
- name: Creating cross-compilation build directory
run: |
mkdir -p llvm-build
- name: Configure LLVM for cross-compilation to gnu
run: |
cmake ../llvm-project/llvm -G Ninja \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DCMAKE_C_COMPILER=x86_64-unknown-linux-gnu-gcc \
-DCMAKE_CXX_COMPILER=x86_64-unknown-linux-gnu-g++ \
-DCMAKE_SYSROOT=/usr/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/sysroot/ \
-DLLVM_TABLEGEN=/host-tools/bin/llvm-tblgen \
-DLLVM_ENABLE_PROJECTS="llvm" \
-DLLVM_ENABLE_TERMINFO=OFF \
-DLLVM_ENABLE_ZLIB=ON \
-DLLVM_ENABLE_LIBXML2=OFF \
-DCMAKE_INSTALL_PREFIX="dist" \
-DLLVM_TARGETS_TO_BUILD=all \
-DLLVM_BUILD_TESTS=OFF \
-DLLVM_BUILD_EXAMPLES=OFF \
-DLLVM_INCLUDE_TESTS=OFF \
-DLLVM_INCLUDE_EXAMPLES=OFF \
-DLLVM_INCLUDE_DOCS=OFF
working-directory: llvm-build
- name: Building LLVM
run: |
ninja -j$(nproc)
working-directory: llvm-build
- name: Installing LLVM
run: |
ninja install
working-directory: llvm-build
- name: Cleaning LLVM Binaries
run: |
find llvm-build/dist/bin -type f -executable ! -name "llvm-config" -delete
- name: Preparing distribution files
run: |
mkdir -p tempDir/lib
mkdir -p tempDir/bin
mkdir -p tempDir/include
cp -r llvm-build/dist/lib/* tempDir/lib/
cp -r llvm-build/dist/bin/* tempDir/bin/
cp -r llvm-build/dist/include/* tempDir/include/
- name: Packaging LLVM (LLVM Libraries, Binaries & Includes)
run: |
tar --format=pax -cJf llvm-x86_64-unknown-linux-gnu.tar.xz --exclude='*/*.cmake' --exclude='*/*.o' --exclude='*/*.d' lib bin include
working-directory: tempDir
- name: Releasing LLVM
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.BUILD_ID }}
name: "llvm-x86_64-unknown-linux-gnu"
body: |
## llvm-x86_64-unknown-linux-gnu
LLVM precompiled for x86_64-unknown-linux-gnu host target triple.
The LLVM backend has been precompiled specifically for linking to a system that follows the triple-target convention.
This precompilation is intended solely for building the Thrush Compiler. Both LLVM and Thrush maintain their ability to perform cross-compilation for multiple targets.
files: |
tempDir/llvm-x86_64-unknown-linux-gnu.tar.xz