Skip to content

Commit

Permalink
Build host {clang,llvm}-tblgen before crossing build.
Browse files Browse the repository at this point in the history
Signed-off-by: Tao He <[email protected]>
  • Loading branch information
sighingnow committed Mar 11, 2022
1 parent b575903 commit a911beb
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 16 deletions.
27 changes: 23 additions & 4 deletions .github/workflows/libclang-linux-aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,35 @@ jobs:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: get llvm-project
run: |
wget 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-aarch64-linux-gnu \
g++-7-aarch64-linux-gnu \
gcc-7-aarch64-linux-gnu \
- name: get llvm-project
- name: build host llvmtblgen/clangtblgen
run: |
wget 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
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_TERMINFO=OFF \
-DLLVM_TARGETS_TO_BUILD=X86 \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DCMAKE_CXX_FLAGS_MINSIZEREL="-Os -DNDEBUG -static-libgcc -static-libstdc++ -s" \
-DCMAKE_C_COMPILER=gcc-7 \
-DCMAKE_CXX_COMPILER=g++-7
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
Expand All @@ -36,6 +53,8 @@ jobs:
-DLLVM_DEFAULT_TARGET_TRIPLE=aarch64-linux-gnu \
-DLLVM_TARGET_ARCH=AArch64 \
-DLLVM_TARGETS_TO_BUILD=AArch64 \
-DLLVM_TABLEGEN=/usr/bin/llvm-tblgen \
-DCLANG_TABLEGEN=/usr/bin/clang-tblgen \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DCMAKE_CXX_FLAGS_MINSIZEREL="-Os -DNDEBUG -static-libgcc -static-libstdc++ -s" \
-DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc-7 \
Expand Down
27 changes: 23 additions & 4 deletions .github/workflows/libclang-linux-arm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,35 @@ jobs:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: get llvm-project
run: |
wget 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 \
g++-7-arm-linux-gnueabihf \
gcc-7-arm-linux-gnueabihf \
- name: get llvm-project
- name: build host llvmtblgen/clangtblgen
run: |
wget 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
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_TERMINFO=OFF \
-DLLVM_TARGETS_TO_BUILD=X86 \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DCMAKE_CXX_FLAGS_MINSIZEREL="-Os -DNDEBUG -static-libgcc -static-libstdc++ -s" \
-DCMAKE_C_COMPILER=gcc-7 \
-DCMAKE_CXX_COMPILER=g++-7
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
Expand All @@ -36,6 +53,8 @@ jobs:
-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=MinSizeRel \
-DCMAKE_CXX_FLAGS_MINSIZEREL="-Os -DNDEBUG -static-libgcc -static-libstdc++ -s" \
-DCMAKE_C_FLAGS="-march=armv7" \
Expand Down
9 changes: 1 addition & 8 deletions .github/workflows/libclang-windows-amd64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,7 @@ jobs:
- name: cmake
run: |
cd llvm-project-$env:LLVM_VER/build
cmake ../llvm \
-Thost=x64 \
-DLLVM_ENABLE_PROJECTS=clang \
-DBUILD_SHARED_LIBS=OFF \
-DLLVM_ENABLE_TERMINFO=OFF \
-DLLVM_TARGETS_TO_BUILD=X86 \
-DCMAKE_CXX_FLAGS="/MP" \
-DLLVM_USE_CRT_MINSIZEREL="MT"
cmake ../llvm -Thost=x64 -DLLVM_ENABLE_PROJECTS=clang -DBUILD_SHARED_LIBS=OFF -DLLVM_ENABLE_TERMINFO=OFF -DLLVM_TARGETS_TO_BUILD=X86 -DCMAKE_CXX_FLAGS="/MP" -DLLVM_USE_CRT_MINSIZEREL="MT"
- name: build
run: cd llvm-project-$env:LLVM_VER/build && cmake --build . --config MinSizeRel --target libclang
- name: create and print sha512sum
Expand Down

0 comments on commit a911beb

Please sign in to comment.