Skip to content

[CI] Build ninja on Linux Docker CI builds #96969

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/ci/docker/host-x86_64/dist-x86_64-linux/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ COPY host-x86_64/dist-x86_64-linux/build-python.sh /tmp/
# Build Python 3 needed for LLVM 12.
RUN ./build-python.sh 3.9.1

# LLVM needs cmake 3.13.4 or higher.
# Ninja needs cmake 3.15 or higher.
COPY host-x86_64/dist-x86_64-linux/build-cmake.sh /tmp/
RUN ./build-cmake.sh

Expand All @@ -98,6 +98,10 @@ COPY host-x86_64/dist-x86_64-linux/build-clang.sh /tmp/
RUN ./build-clang.sh
ENV CC=clang CXX=clang++

# Build Ninja for faster LLVM builds.
COPY host-x86_64/dist-x86_64-linux/build-ninja.sh /tmp/
RUN ./build-ninja.sh

# rustc-perf version from 2022-04-05
ENV PERF_COMMIT 04fccd80396f954b339c366e30221f4bd52c5e03
RUN curl -LS -o perf.zip https://github.com/rust-lang/rustc-perf/archive/$PERF_COMMIT.zip && \
Expand All @@ -121,7 +125,7 @@ ENV RUST_CONFIGURE_ARGS \
--set target.x86_64-unknown-linux-gnu.ar=/rustroot/bin/llvm-ar \
--set target.x86_64-unknown-linux-gnu.ranlib=/rustroot/bin/llvm-ranlib \
--set llvm.thin-lto=true \
--set llvm.ninja=false \
--set llvm.ninja=true \
--set rust.jemalloc
ENV SCRIPT ../src/ci/pgo.sh python3 ../x.py dist \
--host $HOSTS --target $HOSTS \
Expand Down
2 changes: 1 addition & 1 deletion src/ci/docker/host-x86_64/dist-x86_64-linux/build-cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -ex
source shared.sh

CMAKE=3.13.4
CMAKE=3.15.6
curl -L https://github.com/Kitware/CMake/releases/download/v$CMAKE/cmake-$CMAKE.tar.gz | tar xzf -

mkdir cmake-build
Expand Down
24 changes: 24 additions & 0 deletions src/ci/docker/host-x86_64/dist-x86_64-linux/build-ninja.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash

set -ex

source shared.sh

NINJA=v1.10.2

mkdir ninja
cd ninja

curl -L https://github.com/ninja-build/ninja/archive/refs/tags/$NINJA.tar.gz | \
tar xzf - --strip-components 1

mkdir ninja-build
cd ninja-build

hide_output cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/rustroot

hide_output make -j$(nproc)
hide_output make install

cd ../..
rm -rf ninja