Skip to content

Commit

Permalink
only generate x86_64 packages
Browse files Browse the repository at this point in the history
  • Loading branch information
alexreinking committed Aug 29, 2024
1 parent d32bc8d commit 344637d
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 36 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
matrix:
arch:
- x86_64
- aarch64
# - aarch64
version:
- major: 17
full: 17.0.6
Expand All @@ -49,11 +49,10 @@ jobs:
- name: Build and push image
uses: docker/[email protected]
with:
context: .
context: manylinux_2_28_${{ matrix.arch }}-llvm
push: true
tags: |
${{ env.REGISTRY }}/${{ github.repository_owner }}/manylinux_2_28_${{ matrix.arch }}-llvm:${{ matrix.version.full }}
${{ env.REGISTRY }}/${{ github.repository_owner }}/manylinux_2_28_${{ matrix.arch }}-llvm:${{ matrix.version.major }}
build-args: |
LLVM_TAG=llvmorg-${{ matrix.version.full }}
ARCH=${{ matrix.arch }}
LLVM_VERSION=${{ matrix.version.full }}
19 changes: 10 additions & 9 deletions build-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,17 @@ set -eo pipefail

[[ "$1" == "" ]] && echo "You must specify the LLVM version as an argument, e.g. 17.0.6" && exit

LLVM_TAG="$1"
LLVM_VERSION="$1"
LLVM_VERSION_MAJOR="${LLVM_VERSION%%.*}"

build_arch () {
ARCH="$1"
build_image () {
IMAGE="$1"; shift
docker build \
--tag "ghcr.io/halide/manylinux_2_28_$ARCH-llvm:$LLVM_TAG" \
--build-arg "LLVM_TAG=llvmorg-$LLVM_TAG" \
--build-arg "ARCH=$ARCH" \
.
--tag "ghcr.io/halide/$IMAGE:$LLVM_VERSION" \
--tag "ghcr.io/halide/$IMAGE:$LLVM_VERSION_MAJOR" \
--build-arg "LLVM_VERSION=$LLVM_VERSION" \
"$@" \
"$IMAGE"
}

build_arch aarch64
build_arch x86_64
build_image manylinux_2_28_x86_64-llvm
45 changes: 22 additions & 23 deletions Dockerfile → manylinux_2_28_x86_64-llvm/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,38 +1,30 @@
ARG ARCH=x86_64
FROM messense/manylinux_2_28-cross:$ARCH

LABEL org.opencontainers.image.source=https://github.com/halide/docker-images
FROM quay.io/pypa/manylinux_2_28_x86_64 AS base

WORKDIR /ws

## Install Ninja & CMake
RUN apt-get remove -y cmake && \
apt-get -y autoremove && \
python -m pip install ninja==1.11.1.1 cmake==3.28.4

## Set the prefix path to an arch-specific folder
ENV CMAKE_PREFIX_PATH=/usr/local/$CARGO_BUILD_TARGET
## Install Ninja
RUN pipx install ninja==1.11.1.1

## Install flatbuffers
ARG FB_VERSION=v23.5.26
RUN git clone --depth 1 --branch ${FB_VERSION} https://github.com/google/flatbuffers.git && \
FROM base AS flatbuffers
ARG FB_VERSION=23.5.26
RUN git clone --depth 1 --branch v${FB_VERSION} https://github.com/google/flatbuffers.git && \
cmake -G Ninja -S flatbuffers -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local/$CARGO_BUILD_TARGET \
-DCMAKE_TOOLCHAIN_FILE=$TARGET_CMAKE_TOOLCHAIN_FILE_PATH \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DFLATBUFFERS_BUILD_TESTS=OFF \
&& \
cmake --build build --target install && \
rm -rf flatbuffers build

## Install flatbuffers
FROM base AS wabt
ARG WABT_VERSION=1.0.36
RUN git clone --depth 1 --branch ${WABT_VERSION} https://github.com/WebAssembly/wabt.git && \
git -C wabt submodule update --init third_party/picosha2 && \
cmake -G Ninja -S wabt -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local/$CARGO_BUILD_TARGET \
-DCMAKE_TOOLCHAIN_FILE=$TARGET_CMAKE_TOOLCHAIN_FILE_PATH \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DWITH_EXCEPTIONS=ON \
-DBUILD_TESTS=OFF \
-DBUILD_TOOLS=OFF \
Expand All @@ -43,15 +35,14 @@ RUN git clone --depth 1 --branch ${WABT_VERSION} https://github.com/WebAssembly/
rm -rf wabt build

# Install LLVM
ARG LLVM_TAG=llvmorg-18.1.8
RUN git clone --depth 1 --branch ${LLVM_TAG} https://github.com/llvm/llvm-project.git && \
FROM base AS llvm
ARG LLVM_VERSION=18.1.8
RUN git clone --depth 1 --branch llvmorg-${LLVM_VERSION} https://github.com/llvm/llvm-project.git && \
cmake -G Ninja -S llvm-project/llvm -B build \
"-DLLVM_ENABLE_PROJECTS=clang;lld" \
"-DLLVM_ENABLE_RUNTIMES=compiler-rt" \
"-DLLVM_TARGETS_TO_BUILD=WebAssembly;X86;AArch64;ARM;Hexagon;NVPTX;PowerPC;RISCV" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local/$CARGO_BUILD_TARGET \
-DCMAKE_TOOLCHAIN_FILE=$TARGET_CMAKE_TOOLCHAIN_FILE_PATH \
-DLLVM_BUILD_32_BITS=OFF \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_ENABLE_BINDINGS=OFF \
Expand All @@ -75,6 +66,14 @@ RUN git clone --depth 1 --branch ${LLVM_TAG} https://github.com/llvm/llvm-projec
cmake --build build --target install && \
rm -rf llvm-project build

# Configure qemu
ENV QEMU_LD_PREFIX=$TARGET_SYSROOT
##
# Graft the final build products into a quay-derived manylinux image

FROM base

LABEL org.opencontainers.image.source=https://github.com/halide/docker-images

COPY --from=llvm /usr/local /usr/local
COPY --from=wabt /usr/local /usr/local
COPY --from=flatbuffers /usr/local /usr/local

0 comments on commit 344637d

Please sign in to comment.