github.com/Kalvelign/golang-windows-sys-lib@v0.0.0-20221121121202-63da651435e1/unix/linux/Dockerfile (about)

     1  FROM ubuntu:20.04
     2  
     3  # Disable interactive prompts on package installation
     4  ENV DEBIAN_FRONTEND noninteractive
     5  
     6  # Dependencies to get the git sources and go binaries
     7  RUN apt-get update && apt-get install -y  --no-install-recommends \
     8          ca-certificates \
     9          curl \
    10          git \
    11          rsync \
    12      && apt-get clean \
    13      && rm -rf /var/lib/apt/lists/*
    14  
    15  # Get the git sources. If not cached, this takes O(5 minutes).
    16  WORKDIR /git
    17  RUN git config --global advice.detachedHead false
    18  # Linux Kernel: Released 12 Jun 2022
    19  RUN git clone --branch v5.19-rc2 --depth 1 https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux
    20  # GNU C library: Released 03 Feb 2022
    21  RUN git clone --branch release/2.35/master --depth 1 https://sourceware.org/git/glibc.git
    22  
    23  # Only for loong64, add kernel and glibc patch
    24  RUN git clone https://github.com/loongson/golang-infra.git /git/loong64-patches \
    25      && git config --global user.name "golang" && git config --global user.email "golang@localhost" \
    26      && cd /git/loong64-patches && git checkout glibc-v2.35 && cd /git/glibc && git am /git/loong64-patches/*.patch \
    27      && curl -fsSL https://git.savannah.gnu.org/cgit/config.git/plain/config.sub -o /git/glibc/scripts/config.sub
    28  
    29  # Get Go
    30  ENV GOLANG_VERSION 1.19rc2
    31  ENV GOLANG_DOWNLOAD_URL https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz
    32  ENV GOLANG_DOWNLOAD_SHA256 9130c6f8e87ce9bb4813533a68c3f17c82c7307caf8795d3c9427652b77f81aa
    33  
    34  RUN curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \
    35      && echo "$GOLANG_DOWNLOAD_SHA256  golang.tar.gz" | sha256sum -c - \
    36      && tar -C /usr/local -xzf golang.tar.gz \
    37      && rm golang.tar.gz
    38  
    39  ENV PATH /usr/local/go/bin:$PATH
    40  
    41  # Linux and Glibc build dependencies and emulator
    42  RUN apt-get update && apt-get install -y  --no-install-recommends \
    43          bison gawk make python3 \
    44          gcc gcc-multilib \
    45          gettext texinfo \
    46          qemu-user \
    47      && apt-get clean \
    48      && rm -rf /var/lib/apt/lists/*
    49  # Cross compilers (install recommended packages to get cross libc-dev)
    50  RUN apt-get update && apt-get install -y \
    51          gcc-aarch64-linux-gnu       gcc-arm-linux-gnueabi     \
    52          gcc-mips-linux-gnu          gcc-mips64-linux-gnuabi64 \
    53          gcc-mips64el-linux-gnuabi64 gcc-mipsel-linux-gnu      \
    54          gcc-powerpc-linux-gnu       gcc-powerpc64-linux-gnu   \
    55          gcc-powerpc64le-linux-gnu   gcc-riscv64-linux-gnu     \
    56          gcc-s390x-linux-gnu         gcc-sparc64-linux-gnu     \
    57      && apt-get clean \
    58      && rm -rf /var/lib/apt/lists/*
    59  
    60  # Only for loong64, getting tools of qemu-user and gcc-cross-compiler
    61  RUN apt-get update && apt-get install wget xz-utils -y && mkdir /loong64 && cd /loong64 \
    62      && wget -q https://github.com/loongson/build-tools/releases/download/2021.12.21/qemu-loongarch-2022-4-01.tar.gz \
    63      && tar xf qemu-loongarch-2022-4-01.tar.gz && cp ./4-1/new-world/qemu-loongarch64 /usr/bin/ \
    64      && rm -rf qemu-loongarch-2022-4-01.tar.gz 4-1 \
    65      && wget -q https://github.com/loongson/build-tools/releases/download/2021.12.21/loongarch64-clfs-2022-03-03-cross-tools-gcc-glibc.tar.xz \
    66      && tar xf loongarch64-clfs-2022-03-03-cross-tools-gcc-glibc.tar.xz && mv cross-tools.gcc_glibc /usr/local/cross-tools-loong64 \
    67      && rm -rf loongarch64-clfs-2022-03-03-cross-tools-gcc-glibc.tar.xz \
    68      && ln -s /usr/local/cross-tools-loong64/bin/loongarch64-unknown-linux-gnu-gcc /usr/bin/loongarch64-linux-gnu-gcc \
    69      && rm -rf /loong64
    70  
    71  # Let the scripts know they are in the docker environment
    72  ENV GOLANG_SYS_BUILD docker
    73  WORKDIR /build/unix
    74  ENTRYPOINT ["go", "run", "linux/mkall.go", "/git/linux", "/git/glibc"]