Created
April 19, 2024 07:21
-
-
Save frodo821/65cf4c961e19727aa37ed4424e58bcb4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:20.04 as xorg | |
WORKDIR /workspace | |
ENV TZ="Asia/Tokyo" DEBIAN_FRONTEND="noninteractive" | |
RUN apt clean \ | |
&& apt update \ | |
&& apt install -y locales \ | |
&& apt install -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" keyboard-configuration \ | |
&& rm -rf /var/lib/apt/lists/* \ | |
&& locale-gen en_US.UTF-8 | |
ENV LANG="en_US.UTF-8" LANGUAGE="en_US:en" LC_ALL="en_US.UTF-8" | |
# Install build requirements | |
RUN dpkg --add-architecture i386 \ | |
&& apt-get update \ | |
&& apt-get install -y --no-install-recommends \ | |
apt-utils software-properties-common build-essential ca-certificates libelf-dev libepoxy-dev \ | |
curl wget vim zip unzip git kmod libc6:i386 pkg-config gnupg2 tzdata automake libtool libssl-dev libpixman-1-dev \ | |
libfontenc-dev libfreetype-dev libtiff-dev libudev-dev glslang-tools pciutils libpciaccess-dev libexpat1-dev libepoxy-dev \ | |
&& bash -c "wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null" \ | |
&& echo "" | add-apt-repository ppa:deadsnakes/ppa \ | |
&& apt-add-repository "deb https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" \ | |
&& bash -c "bash <(curl https://apt.llvm.org/llvm.sh) 15" \ | |
&& apt update \ | |
&& apt install -y llvm-15 llvm-15-dev libclang-15-dev bison flex libxml2-dev cmake libclc-dev python3.10 python3.10-distutils \ | |
&& cp /usr/bin/python3.10 /usr/bin/python \ | |
&& curl -kL https://bootstrap.pypa.io/get-pip.py | python \ | |
&& python -m pip install pip --upgrade \ | |
&& rm -rf /var/lib/apt/lists/* | |
RUN pip install meson ninja mako | |
# Install Autoconf 2.71 | |
RUN wget https://ftp.gnu.org/gnu/autoconf/autoconf-2.71.tar.xz \ | |
&& tar xf autoconf-2.71.tar.xz \ | |
&& cd autoconf-2.71 \ | |
&& ./configure --prefix=/opt/autoconf \ | |
&& make install \ | |
&& cd .. \ | |
&& rm -rf autoconf-2.71 autoconf-2.71.tar.xz | |
ENV PATH=/opt/autoconf/bin/:/lib/llvm-15/bin/:${PATH} | |
# Install GNU m4 | |
RUN wget https://ftp.gnu.org/pub/gnu/m4/m4-1.4.19.tar.gz \ | |
&& tar xf m4-1.4.19.tar.gz \ | |
&& cd m4-1.4.19 \ | |
&& ./configure \ | |
&& make install \ | |
&& cd .. \ | |
&& rm -rf m4-1.4.19 m4-1.4.19.tar.gz | |
# Install libllvmspirv | |
RUN git clone --depth=1 https://github.com/KhronosGroup/SPIRV-LLVM-Translator.git -b llvm_release_150 \ | |
&& mkdir SPIRV-LLVM-Translator/build \ | |
&& cd SPIRV-LLVM-Translator/build \ | |
&& cmake .. \ | |
&& make llvm-spirv -j`nproc` \ | |
&& make install \ | |
&& cd ../.. \ | |
&& rm -rf SPIRV-LLVM-Translator | |
# Install libwayland | |
RUN wget https://gitlab.freedesktop.org/wayland/wayland/-/releases/1.22.0/downloads/wayland-1.22.0.tar.xz \ | |
&& tar xf wayland-1.22.0.tar.xz \ | |
&& cd wayland-1.22.0 \ | |
&& meson setup ./b -Ddocumentation=false \ | |
&& ninja -C ./b install \ | |
&& cd .. \ | |
&& rm -rf wayland-1.22.0 wayland-1.22.0.tar.xz | |
# Install ply | |
RUN git clone --depth=1 https://github.com/dabeaz/ply.git \ | |
&& cd ply \ | |
&& make install \ | |
&& cd .. \ | |
&& rm -rf ply | |
# Install Rust | |
ENV RUST_HOME="/usr/local/lib/rust" RUSTUP_HOME="${RUST_HOME}/rustup" CARGO_HOME="${RUST_HOME}/cargo" | |
RUN mkdir /usr/local/lib/rust && \ | |
chmod 0755 $RUST_HOME | |
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > ${RUST_HOME}/rustup.sh \ | |
&& chmod +x ${RUST_HOME}/rustup.sh \ | |
&& ${RUST_HOME}/rustup.sh -y --default-toolchain nightly --no-modify-path \ | |
&& rm ${RUST_HOME}/rustup.sh | |
ENV PATH="$PATH:$CARGO_HOME/bin" | |
# Install bindgen | |
RUN cargo install bindgen-cli cbindgen | |
# Install X11 macros | |
RUN git clone --depth=1 git://anongit.freedesktop.org/git/xorg/util/macros \ | |
&& cd macros \ | |
&& ./autogen.sh --prefix=/opt/xorg \ | |
&& make install \ | |
&& cd .. \ | |
&& rm -rf macros | |
ENV ACLOCAL="aclocal -I /opt/xorg/share/aclocal" | |
# Install X11 proto | |
RUN git clone --depth=1 git://anongit.freedesktop.org/git/xorg/proto/xorgproto x11proto \ | |
&& cd x11proto \ | |
&& ./autogen.sh --prefix=/opt/xorg \ | |
&& make install \ | |
&& cd .. \ | |
&& rm -rf x11proto | |
ENV PKG_CONFIG_PATH="/opt/xorg/lib/pkgconfig:/opt/xorg/share/pkgconfig:/opt/xorg/lib/x86_64-linux-gnu/pkgconfig:${PKG_CONFIG_PATH}" \ | |
LD_LIBRARY_PATH="/opt/xorg/lib/x86_64-linux-gnu:/usr/local/lib/x86_64-linux-gnu/:/opt/xorg/lib/:${LD_LIBRARY_PATH}" \ | |
LD_RUN_PATH="/opt/xorg/lib/x86_64-linux-gnu/:/usr/local/lib/x86_64-linux-gnu/:${LD_RUN_PATH}" \ | |
PATH="/opt/xorg/bin/:${PATH}" | |
# Install X11 lib: libdrm (-Dintel=enabled is required for building mesa later) | |
RUN git clone --depth=1 git://anongit.freedesktop.org/git/mesa/drm \ | |
&& cd drm \ | |
&& meson setup ./b/ --prefix=/opt/xorg -Dintel=enabled \ | |
&& ninja -C ./b install \ | |
&& cd .. \ | |
&& rm -rf drm | |
# Install X11 lib: libXau | |
RUN git clone --depth=1 git://anongit.freedesktop.org/git/xorg/lib/libXau \ | |
&& cd libXau \ | |
&& meson setup ./b/ --prefix=/opt/xorg \ | |
&& ninja -C ./b install \ | |
&& cd .. \ | |
&& rm -rf libXau | |
# Install X11 lib: libXtrans | |
RUN git clone --depth=1 git://anongit.freedesktop.org/xorg/lib/libxtrans \ | |
&& cd libxtrans \ | |
&& ./autogen.sh --prefix=/opt/xorg \ | |
&& make install \ | |
&& cd .. \ | |
&& rm -rf libxtrans | |
# Install Xcb proto | |
RUN git clone --depth=1 https://gitlab.freedesktop.org/xorg/proto/xcbproto.git \ | |
&& cd xcbproto \ | |
&& ./autogen.sh --prefix=/opt/xorg \ | |
&& make install \ | |
&& cd .. \ | |
&& rm -rf xcbproto | |
# Install X11 lib: libXcb | |
RUN git clone --depth=1 git://anongit.freedesktop.org/xcb/libxcb \ | |
&& cd libxcb \ | |
&& ./autogen.sh --prefix=/opt/xorg \ | |
&& make install \ | |
&& cd .. \ | |
&& rm -rf libxcb | |
# Install X11 lib: libX11 | |
RUN git clone --depth=1 git://anongit.freedesktop.org/xorg/lib/libX11 \ | |
&& cd libX11 \ | |
&& ./autogen.sh --prefix=/opt/xorg \ | |
&& make install \ | |
&& cd .. \ | |
&& rm -rf libX11 | |
# Install X11 lib: libxkbfile | |
RUN git clone --depth=1 git://anongit.freedesktop.org/xorg/lib/libxkbfile \ | |
&& cd libxkbfile \ | |
&& meson setup ./b --prefix=/opt/xorg \ | |
&& ninja -C ./b install \ | |
&& cd .. \ | |
&& rm -rf libxkbfile | |
# Install X11 lib: libxfont | |
RUN git clone --depth=1 https://gitlab.freedesktop.org/xorg/lib/libxfont.git \ | |
&& cd libxfont \ | |
&& mkdir m4 \ | |
&& ./autogen.sh --prefix=/opt/xorg \ | |
&& make install \ | |
&& cd .. \ | |
&& rm -rf libxfont | |
# Install X11 lib: libxcvt | |
RUN git clone --depth=1 https://gitlab.freedesktop.org/xorg/lib/libxcvt.git \ | |
&& cd libxcvt \ | |
&& meson setup ./b --prefix=/opt/xorg \ | |
&& ninja -C ./b install \ | |
&& cd .. \ | |
&& rm -rf libxcvt | |
# Install X11 lib: libxdmcp | |
RUN git clone --depth=1 https://gitlab.freedesktop.org/xorg/lib/libxdmcp.git \ | |
&& cd libxdmcp \ | |
&& mkdir m4 \ | |
&& ./autogen.sh --prefix=/opt/xorg \ | |
&& make install \ | |
&& cd .. \ | |
&& rm -rf libxdmcp | |
# Install X11 lib: libXext | |
RUN git clone --depth=1 https://gitlab.freedesktop.org/xorg/lib/libxext.git \ | |
&& cd libxext \ | |
&& ./autogen.sh --prefix=/opt/xorg \ | |
&& make install \ | |
&& cd .. \ | |
&& rm -rf libxext | |
# Install X11 lib: libXfixes | |
RUN git clone --depth=1 https://gitlab.freedesktop.org/xorg/lib/libxfixes.git \ | |
&& cd libxfixes \ | |
&& mkdir m4 \ | |
&& ./autogen.sh --prefix=/opt/xorg \ | |
&& make install \ | |
&& cd .. \ | |
&& rm -rf libxfixes | |
# Install X11 lib: libxshmfence | |
RUN git clone --depth=1 git://anongit.freedesktop.org/xorg/lib/libxshmfence \ | |
&& cd libxshmfence \ | |
&& mkdir m4 \ | |
&& ./autogen.sh --prefix=/opt/xorg \ | |
&& make install \ | |
&& cd .. \ | |
&& rm -rf libxshmfence | |
# Install X11 lib: libxxf86vm | |
RUN git clone --depth=1 https://gitlab.freedesktop.org/xorg/lib/libxxf86vm.git \ | |
&& cd libxxf86vm \ | |
&& mkdir m4 \ | |
&& ./autogen.sh --prefix=/opt/xorg \ | |
&& make install \ | |
&& cd .. \ | |
&& rm -rf libxxf86vm | |
# Install X11 lib: libxrender | |
RUN git clone --depth=1 https://gitlab.freedesktop.org/xorg/lib/libxrender.git \ | |
&& cd libxrender \ | |
&& mkdir m4 \ | |
&& ./autogen.sh --prefix=/opt/xorg \ | |
&& make install \ | |
&& cd .. \ | |
&& rm -rf libxrender | |
# Install X11 lib: libxrandr | |
RUN git clone --depth=1 https://gitlab.freedesktop.org/xorg/lib/libxrandr.git \ | |
&& cd libxrandr \ | |
&& mkdir m4 \ | |
&& ./autogen.sh --prefix=/opt/xorg \ | |
&& make install \ | |
&& cd .. \ | |
&& rm -rf libxrandr | |
ENV EX_CPATH=$CPATH EX_CC=clang-15 EX_CXX=clang++-15 | |
ENV CPATH=/usr/lib/llvm-15/lib/clang/15.0.7/include/:${CPATH} CC=clang-15 CXX=clang++-15 | |
# Install mesa | |
RUN apt update \ | |
&& sed -i "s/# deb-src/deb-src/" /etc/apt/sources.list \ | |
&& apt update \ | |
&& apt build-dep -y mesa \ | |
&& git clone --depth=1 git://anongit.freedesktop.org/git/mesa/mesa -b mesa-24.0.3 \ | |
&& cd mesa \ | |
# Workaround for meson python detection issue: | |
# c.f. https://stackoverflow.com/questions/77387700/meson-error-usr-local-bin-python3-is-not-a-valid-python-or-it-is-missing | |
&& sed -i "s/import('python').find_installation('python3')/import('python').find_installation('python3.10')/g" meson.build \ | |
&& CC=clang-15 CXX=clang++-15 meson setup ./b --prefix=/opt/xorg -Degl-native-platform=x11 -Dplatforms=x11 \ | |
&& CC=clang-15 CXX=clang++-15 ninja -C ./b install \ | |
&& cd .. \ | |
&& rm -rf mesa /var/lib/apt/lists/* | |
ENV CPATH=$EX_CPATH CC=$EX_CC CXX=$EX_CXX | |
# Install XOrg server | |
RUN git clone --depth=1 git://anongit.freedesktop.org/xorg/xserver \ | |
&& cd xserver \ | |
&& meson setup ./b --prefix=/opt/xorg \ | |
&& ninja -C ./b install \ | |
&& cd .. \ | |
&& rm -rf xserver |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment