mirror of
https://github.com/golang/sys.git
synced 2026-02-08 11:46:04 +03:00
Right now the process for adding in new constants, errors, or syscalls for Linux is a pain and unreliable. The scripts are designed to be run on the target architecture and use the header files installed on the user's system. This makes it hard to generate files for all the architectures or to have consistency between users. See golang/go#15282. This CL fixes this issue by making all of the files for the 11 supported architectures directly from source checkouts of Linux, glibc, and bluez. This is done using Docker, the gcc cross-compilers, and qemu emulation. Previously discussed here: https://go-review.googlesource.com/c/37589/ A README.md file is also added to explain how all the parts of the build system work. In order to get the build working for all the architectures, I made some changes to the other scripts called from mkall_linux.go: - Files only used for generating linux code, moved to linux/ - linux/mksysnum.pl supports a specified CC compiler. - The generated C code in mkerrors.sh changed to avoid a warning - mkerrors.sh headers changed to fix powerpc64 bug in sys/ioctl.h - linux/types.go no longer needs to export Ptrace structs in lowercase Build instructions: - Host system needs to be x86-64 Linux - Install Docker (https://docs.docker.com/engine/installation/) - ./mkall.sh (That's it!!!) Change-Id: I87067c14442ba12f8d51991349a43a9d73f38ae0 Reviewed-on: https://go-review.googlesource.com/37943 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
49 lines
1.9 KiB
Docker
49 lines
1.9 KiB
Docker
FROM ubuntu:16.04
|
|
|
|
# Dependencies to get the git sources and go binaries
|
|
RUN apt-get update && apt-get install -y \
|
|
curl \
|
|
git \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Get the git sources. If not cached, this takes O(5 minutes).
|
|
WORKDIR /git
|
|
RUN git config --global advice.detachedHead false
|
|
# Linux Kernel: Released 19 Feb 2017
|
|
RUN git clone --branch v4.10 --depth 1 https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux
|
|
# GNU C library: Released 05 Feb 2017 (we should try to get a secure way to clone this)
|
|
RUN git clone --branch glibc-2.25 --depth 1 git://sourceware.org/git/glibc.git
|
|
|
|
# Get Go 1.8 (https://github.com/docker-library/golang/blob/master/1.8/Dockerfile)
|
|
ENV GOLANG_VERSION 1.8
|
|
ENV GOLANG_DOWNLOAD_URL https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz
|
|
ENV GOLANG_DOWNLOAD_SHA256 53ab94104ee3923e228a2cb2116e5e462ad3ebaeea06ff04463479d7f12d27ca
|
|
|
|
RUN curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \
|
|
&& echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - \
|
|
&& tar -C /usr/local -xzf golang.tar.gz \
|
|
&& rm golang.tar.gz
|
|
|
|
ENV PATH /usr/local/go/bin:$PATH
|
|
|
|
# Linux and Glibc build dependencies
|
|
RUN apt-get update && apt-get install -y \
|
|
gawk make python \
|
|
gcc gcc-multilib \
|
|
gettext texinfo \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
# Emulator and cross compilers
|
|
RUN apt-get update && apt-get install -y \
|
|
qemu \
|
|
gcc-aarch64-linux-gnu gcc-arm-linux-gnueabi \
|
|
gcc-mips-linux-gnu gcc-mips64-linux-gnuabi64 \
|
|
gcc-mips64el-linux-gnuabi64 gcc-mipsel-linux-gnu \
|
|
gcc-powerpc64-linux-gnu gcc-powerpc64le-linux-gnu \
|
|
gcc-s390x-linux-gnu gcc-sparc64-linux-gnu \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Let the scripts know they are in the docker environment
|
|
ENV GOLANG_SYS_BUILD docker
|
|
WORKDIR /build
|
|
ENTRYPOINT ["go", "run", "linux/mkall.go", "/git/linux", "/git/glibc"]
|