...

Text file src/golang.org/x/sys/unix/linux/Dockerfile

Documentation: golang.org/x/sys/unix/linux

     1FROM ubuntu:20.04
     2
     3# Disable interactive prompts on package installation
     4ENV DEBIAN_FRONTEND noninteractive
     5
     6# Dependencies to get the git sources and go binaries
     7RUN 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).
    16WORKDIR /git
    17RUN git config --global advice.detachedHead false
    18# Linux Kernel: Released 07 January 2024
    19RUN git clone --branch v6.7 --depth 1 https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux
    20# GNU C library: Released 1 Feb 2023
    21RUN git clone --branch release/2.37/master --depth 1 https://sourceware.org/git/glibc.git
    22
    23# Get Go
    24ENV GOLANG_VERSION 1.21.0
    25ENV GOLANG_DOWNLOAD_URL https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz
    26ENV GOLANG_DOWNLOAD_SHA256 d0398903a16ba2232b389fb31032ddf57cac34efda306a0eebac34f0965a0742
    27
    28RUN curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \
    29    && echo "$GOLANG_DOWNLOAD_SHA256  golang.tar.gz" | sha256sum -c - \
    30    && tar -C /usr/local -xzf golang.tar.gz \
    31    && rm golang.tar.gz
    32
    33ENV PATH /usr/local/go/bin:$PATH
    34
    35# Linux and Glibc build dependencies and emulator
    36RUN apt-get update && apt-get install -y  --no-install-recommends \
    37        bison gawk make python3 \
    38        gcc gcc-multilib \
    39        gettext texinfo \
    40        qemu-user \
    41    && apt-get clean \
    42    && rm -rf /var/lib/apt/lists/*
    43# Cross compilers (install recommended packages to get cross libc-dev)
    44RUN apt-get update && apt-get install -y \
    45        gcc-aarch64-linux-gnu       gcc-arm-linux-gnueabi     \
    46        gcc-mips-linux-gnu          gcc-mips64-linux-gnuabi64 \
    47        gcc-mips64el-linux-gnuabi64 gcc-mipsel-linux-gnu      \
    48        gcc-powerpc-linux-gnu       gcc-powerpc64-linux-gnu   \
    49        gcc-powerpc64le-linux-gnu   gcc-riscv64-linux-gnu     \
    50        gcc-s390x-linux-gnu         gcc-sparc64-linux-gnu     \
    51    && apt-get clean \
    52    && rm -rf /var/lib/apt/lists/*
    53
    54# Only for loong64, getting tools of qemu-user and gcc-cross-compiler
    55ENV LOONG64_BASE_URL https://github.com/loongson/build-tools/releases/download/2023.08.08
    56ENV LOONG64_GCC  CLFS-loongarch64-8.1-x86_64-cross-tools-gcc-glibc.tar.xz
    57ENV LOONG64_QEMU qemu-loongarch64
    58ENV LOONG64_GCC_DOWNLOAD_URL  $LOONG64_BASE_URL/$LOONG64_GCC
    59ENV LOONG64_QEMU_DOWNLOAD_URL $LOONG64_BASE_URL/$LOONG64_QEMU
    60
    61RUN apt-get update && apt-get install xz-utils -y && mkdir /loong64 && cd /loong64 \
    62    && curl -fsSL "$LOONG64_QEMU_DOWNLOAD_URL" -o /usr/bin/"$LOONG64_QEMU" \
    63    && chmod +x /usr/bin/"$LOONG64_QEMU" \
    64    && curl -fsSL "$LOONG64_GCC_DOWNLOAD_URL" -o "$LOONG64_GCC" \
    65    && tar xf "$LOONG64_GCC" -C /usr/local/ \
    66    && ln -s /usr/local/cross-tools/bin/loongarch64-unknown-linux-gnu-gcc /usr/bin/loongarch64-linux-gnu-gcc \
    67    && rm -rf /loong64
    68
    69# Let the scripts know they are in the docker environment
    70ENV GOLANG_SYS_BUILD docker
    71WORKDIR /build/unix
    72ENTRYPOINT ["go", "run", "linux/mkall.go", "/git/linux", "/git/glibc"]

View as plain text