From 83dc767598e28d95a9ae2fa1ab6dc5cf8bfdddec Mon Sep 17 00:00:00 2001 From: Alice D Date: Sun, 1 May 2022 13:49:17 -0400 Subject: [PATCH] Dockerfiles (#278) * add Dockerfiles, Makefile, and .dockerignore * move makefile to other branch, add new pip lib * Dockerfile work * stashing changes, but Windows ANGLE build is almost working * actually compiles ANGLE * fix one typo * more refactoring * more 'fixes' * deck chairs on the titanic * it absolutely must be Visual Studio and not Build Tools because Google * moar space * this ACTUALLY builds ANGLE in a container, yay * stashing makefile changes * move dockerfile directories, port over changes from fork * cleanup * change filename * pre-emptive PR changes, move to misc/ci/ * use proper build args * Dockerfile for building Switch tools for GHA * less deps for switch dockerfile * windows dockerfile improvement * clean up Dockerfiles, move Docker-specific Makefile to /misc/ci * make this actually work * add gnupg * bump switch/debian version in dockerfile * package name change for Switch dockerfile * update and remove cursed ANGLE build (we have GHA for that now) * remove last of ANGLE build nightmare * new Windows build image file --- .dockerignore | 1 + misc/ci/Dockerfile.linux | 28 ++++++++++++++++++++ misc/ci/Dockerfile.switch | 52 +++++++++++++++++++++++++++++++++++++ misc/ci/Dockerfile.windows | 53 ++++++++++++++++++++++++++++++++++++++ misc/ci/Makefile | 24 +++++++++++++++++ 5 files changed, 158 insertions(+) create mode 100644 .dockerignore create mode 100644 misc/ci/Dockerfile.linux create mode 100644 misc/ci/Dockerfile.switch create mode 100644 misc/ci/Dockerfile.windows create mode 100644 misc/ci/Makefile diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000000..a007feab07 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +build/* diff --git a/misc/ci/Dockerfile.linux b/misc/ci/Dockerfile.linux new file mode 100644 index 0000000000..06a0d4194c --- /dev/null +++ b/misc/ci/Dockerfile.linux @@ -0,0 +1,28 @@ +FROM ubuntu:focal + +LABEL maintainer="Alice D. " + +ENV LANG C.UTF-8 +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt update && \ + apt install -y -qq \ + build-essential \ + libsdl2-dev \ + libogg-dev \ + libopusfile-dev \ + libpng-dev \ + libzip-dev \ + libx11-dev \ + libwayland-dev \ + python3-docutils \ + libwebp-dev \ + libfreetype6-dev \ + python3-pip \ + libzstd-dev \ + git + +RUN pip3 install \ + meson==0.56.2 \ + ninja \ + zstandard diff --git a/misc/ci/Dockerfile.switch b/misc/ci/Dockerfile.switch new file mode 100644 index 0000000000..f46f0e8ef7 --- /dev/null +++ b/misc/ci/Dockerfile.switch @@ -0,0 +1,52 @@ +FROM debian:bullseye-slim + +LABEL maintainer="Alice D. " + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + apt-utils \ + sudo \ + ca-certificates \ + pkg-config \ + curl \ + wget \ + bzip2 \ + xz-utils \ + make \ + git \ + libarchive-tools \ + doxygen \ + gnupg \ + build-essential \ + python3-docutils \ + python3-pip \ + gdebi-core \ + cmake && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +RUN pip3 install \ + meson==0.56.2 \ + ninja \ + zstandard \ + python-gnupg + +RUN wget https://github.com/devkitPro/pacman/releases/latest/download/devkitpro-pacman.amd64.deb && \ + gdebi -n devkitpro-pacman.amd64.deb && \ + rm devkitpro-pacman.amd64.deb && \ + dkp-pacman -Scc --noconfirm + +ENV DEVKITPRO=/opt/devkitpro +ENV PATH=${DEVKITPRO}/tools/bin:$PATH + +RUN ln -s /proc/self/mounts /etc/mtab + +RUN dkp-pacman -Syyu --noconfirm \ + switch-dev \ + switch-portlibs \ + dkp-toolchain-vars \ + switch-pkg-config && \ + dkp-pacman -S --needed --noconfirm `dkp-pacman -Slq dkp-libs | grep '^switch-'` && \ + dkp-pacman -Scc --noconfirm diff --git a/misc/ci/Dockerfile.windows b/misc/ci/Dockerfile.windows new file mode 100644 index 0000000000..db6d837f61 --- /dev/null +++ b/misc/ci/Dockerfile.windows @@ -0,0 +1,53 @@ +FROM ubuntu:20.04 + +LABEL maintainer="Alice D. " + +ENV LANG C.UTF-8 +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update -qq && \ + apt-get upgrade -qqy && \ + apt-get install -qqy --no-install-recommends \ + git wget bzip2 file unzip libtool pkg-config cmake build-essential \ + automake yasm gettext autopoint vim-tiny python3 python3-distutils \ + ninja-build ca-certificates curl less zip python3-docutils python3-pip \ + nsis gnupg zlibc && \ + apt-get clean -y && \ + rm -rf /var/lib/apt/lists/* + +RUN pip3 install \ + meson==0.56.2 \ + ninja \ + zstandard \ + python-gnupg + +WORKDIR /build + +ENV TOOLCHAIN_PREFIX=/opt/llvm-mingw + +ARG TOOLCHAIN_ARCHS="i686 x86_64" + +ARG DEFAULT_CRT=ucrt + +# Build everything that uses the llvm monorepo. We need to build the mingw runtime before the compiler-rt/libunwind/libcxxabi/libcxx runtimes. +COPY build-llvm.sh build-lldb-mi.sh strip-llvm.sh install-wrappers.sh build-mingw-w64.sh build-mingw-w64-tools.sh build-compiler-rt.sh build-libcxx.sh build-mingw-w64-libraries.sh build-openmp.sh ./ +COPY wrappers/*.sh wrappers/*.c wrappers/*.h ./wrappers/ +RUN ./build-llvm.sh $TOOLCHAIN_PREFIX && \ + ./build-lldb-mi.sh $TOOLCHAIN_PREFIX && \ + ./strip-llvm.sh $TOOLCHAIN_PREFIX && \ + ./install-wrappers.sh $TOOLCHAIN_PREFIX && \ + ./build-mingw-w64.sh $TOOLCHAIN_PREFIX --with-default-msvcrt=$DEFAULT_CRT && \ + ./build-mingw-w64-tools.sh $TOOLCHAIN_PREFIX && \ + ./build-compiler-rt.sh $TOOLCHAIN_PREFIX && \ + ./build-libcxx.sh $TOOLCHAIN_PREFIX && \ + ./build-mingw-w64-libraries.sh $TOOLCHAIN_PREFIX && \ + ./build-compiler-rt.sh $TOOLCHAIN_PREFIX --build-sanitizers && \ + ./build-openmp.sh $TOOLCHAIN_PREFIX && \ + rm -rf /build/* + +# Build libssp +COPY build-libssp.sh libssp-Makefile ./ +RUN ./build-libssp.sh $TOOLCHAIN_PREFIX && \ + rm -rf /build/* + +ENV PATH=$TOOLCHAIN_PREFIX/bin:$PATH diff --git a/misc/ci/Makefile b/misc/ci/Makefile new file mode 100644 index 0000000000..fd5ee1e9c0 --- /dev/null +++ b/misc/ci/Makefile @@ -0,0 +1,24 @@ +# Taisei Docker Makefile + +tag: +ifndef TAG + @echo "tag not defined, please define one" + @echo "i.e: TAG=20210630 make docker/switch" + @exit 1 +endif + +########## +# docker # +########## + +docker/windows: tag + docker build . -m 8GB -t taiseiproject/windows-toolkit:$(TAG) -f "Dockerfile.windows" + docker push taisei/windows-toolkit:$(TAG) + +docker/switch: tag + docker build . -m 4GB -t taiseiproject/switch-toolkit:$(TAG) -f "Dockerfile.switch" + docker push taiseiproject/switch-toolkit:$(TAG) + +docker/linux: tag + docker build . -m 4GB -t taiseiproject/linux-toolkit:$(TAG) -f "Dockerfile.linux" + docker push taiseiproject/linux-toolkit:$(TAG)