-
Notifications
You must be signed in to change notification settings - Fork 23
123 lines (118 loc) · 4.74 KB
/
libclang-linux-arm.yml
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
name: libclang-linux-arm
on: [push, pull_request]
env:
LLVM_VER: 17.0.6
concurrency:
group: ${{ github.repository }}-${{ github.head_ref || github.sha }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
build-and-deploy:
if: "!contains(github.event.head_commit.message, 'skip ci')"
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: free disk spaces
run: |
./.github/free-disk-space.sh || true
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: install wheel dependencies
run: |
pip3 install wheel
- name: get llvm-project
run: |
wget -q https://github.com/llvm/llvm-project/releases/download/llvmorg-$LLVM_VER/llvm-project-$LLVM_VER.src.tar.xz
tar xf llvm-project-$LLVM_VER.src.tar.xz
mv llvm-project-$LLVM_VER.src llvm-project-$LLVM_VER
- name: install cross compilation toolchain
run: |
sudo apt-get update
sudo apt-get install -y \
binutils-arm-linux-gnueabihf \
gcc-8 \
g++-8 \
gcc-8-arm-linux-gnueabihf \
g++-8-arm-linux-gnueabihf
- name: build host llvmtblgen/clangtblgen
run: |
mkdir llvm-project-$LLVM_VER/build-host
cd llvm-project-$LLVM_VER/build-host
cmake ../llvm \
-DLLVM_ENABLE_PROJECTS=clang \
-DBUILD_SHARED_LIBS=OFF \
-DLLVM_ENABLE_ZLIB=OFF \
-DLLVM_ENABLE_ZSTD=OFF \
-DLLVM_ENABLE_TERMINFO=OFF \
-DLLVM_TARGETS_TO_BUILD=X86 \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-O2 -g -DNDEBUG -static-libgcc -static-libstdc++" \
-DCMAKE_C_COMPILER=gcc-8 \
-DCMAKE_CXX_COMPILER=g++-8
make clang-tblgen llvm-tblgen -j$(nproc)
# copy the artifacts to an absolute path
sudo cp ./bin/* /usr/bin/
- name: make build directory
run: mkdir -p llvm-project-$LLVM_VER/build
- name: cmake
run: |
cd llvm-project-$LLVM_VER/build
cmake ../llvm \
-DLLVM_ENABLE_PROJECTS=clang \
-DBUILD_SHARED_LIBS=OFF \
-DLLVM_ENABLE_ZLIB=OFF \
-DLLVM_ENABLE_ZSTD=OFF \
-DLLVM_ENABLE_TERMINFO=OFF \
-DCMAKE_SYSTEM_NAME=Linux \
-DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \
-DLLVM_TARGET_ARCH=ARM \
-DLLVM_TARGETS_TO_BUILD=ARM \
-DLLVM_TABLEGEN=/usr/bin/llvm-tblgen \
-DCLANG_TABLEGEN=/usr/bin/clang-tblgen \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-O2 -g -DNDEBUG -static-libgcc -static-libstdc++" \
-DCMAKE_C_FLAGS="-march=armv7 -include $(realpath ../../force_glibc_2_17.h)" \
-DCMAKE_CXX_FLAGS="-march=armv7 -include $(realpath ../../force_glibc_2_17.h)" \
-DCMAKE_EXE_LINKER_FLAGS="-lm" \
-DCMAKE_SHARED_LINKER_FLAGS="-lm" \
-DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc-8 \
-DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++-8
- name: build
run: |
cd llvm-project-$LLVM_VER/build
make libclang -j$(nproc)
arm-linux-gnueabihf-strip lib/libclang.so
- name: print dependencies
run: |
du -csh $(realpath llvm-project-$LLVM_VER/build/lib/libclang.so)
file $(realpath llvm-project-$LLVM_VER/build/lib/libclang.so)
strings llvm-project-$LLVM_VER/build/lib/libclang.so | grep GLIBC
nm --dynamic --undefined-only --with-symbol-versions llvm-project-$LLVM_VER/build/lib/libclang.so
- name: create and print sha512sum
run: |
cd llvm-project-$LLVM_VER/build/lib
sha512sum libclang.so > libclang.so.$LLVM_VER.linux-arm.sha512sum
echo "Checksum is: "
cat libclang.so.$LLVM_VER.linux-arm.sha512sum
tar zcvfh libclang.so.$LLVM_VER.linux-arm.tar.gz libclang.so libclang.so.$LLVM_VER.linux-arm.sha512sum
shasum -a512 libclang.so.$LLVM_VER.linux-arm.tar.gz
- uses: actions/upload-artifact@v3
with:
name: libclang.so.${{env.LLVM_VER}}.linux-arm.tar.gz
path: llvm-project-${{env.LLVM_VER}}/build/lib/libclang.so.${{env.LLVM_VER}}.linux-arm.tar.gz
- name: generate wheel package
run: |
cp llvm-project-$LLVM_VER/build/lib/libclang.so native/
python3 setup_ext.py bdist_wheel --universal --plat-name=manylinux2014_armv7l
- uses: actions/upload-artifact@v3
with:
name: wheel-${{env.LLVM_VER}}-manylinux2014_armv7l
path: dist/*.whl
- name: Publish to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages_dir: dist/
password: ${{ secrets.PYPI_TOKEN }}
verbose: true
print_hash: true