-
Notifications
You must be signed in to change notification settings - Fork 27
/
Dockerfile.builder
124 lines (110 loc) · 5.09 KB
/
Dockerfile.builder
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# golang parameters
ARG GO_VERSION=1.23.3
ARG OS_CODENAME=bookworm
ARG OSK_SDK=macos-13
FROM ghcr.io/gythialy/osx-sdk:${OSK_SDK:-macos-13} AS osx-sdk
FROM golang:${GO_VERSION:-1.23.3}-${OS_CODENAME:-bookworm} AS base
# osxcross parameters
ARG OSX_VERSION_MIN=10.13
ARG OSX_CROSS_COMMIT=ff8d100f3f026b4ffbe4ce96d8aac4ce06f1278b
# ARG APT_MIRROR
# RUN sed -ri "s/(httpredir|deb).debian.org/${APT_MIRROR:-deb.debian.org}/g" /etc/apt/sources.list \
# && sed -ri "s/(security).debian.org/${APT_MIRROR:-security.debian.org}/g" /etc/apt/sources.list
ENV OSX_CROSS_PATH=/osxcross
ARG DEBIAN_FRONTEND=noninteractive
# Install deps
RUN set -x; echo "Starting image build for Debian " \
&& dpkg --add-architecture arm64 \
&& dpkg --add-architecture armel \
&& dpkg --add-architecture armhf \
&& dpkg --add-architecture i386 \
&& dpkg --add-architecture mips \
&& dpkg --add-architecture mipsel \
&& dpkg --add-architecture powerpc \
&& dpkg --add-architecture ppc64el \
&& dpkg --add-architecture s390x \
&& apt-get update \
&& apt-get install -y -q \
autoconf \
automake \
autotools-dev \
bc \
binfmt-support \
binutils-multiarch \
binutils-multiarch-dev \
build-essential \
# clang \
crossbuild-essential-arm64 \
crossbuild-essential-armel \
crossbuild-essential-armhf \
crossbuild-essential-mipsel \
crossbuild-essential-ppc64el \
crossbuild-essential-s390x \
curl \
devscripts \
gdb \
git-core \
libtool \
llvm \
mercurial \
multistrap \
patch \
software-properties-common \
subversion \
wget \
xz-utils \
# cmake \
qemu-user-static \
libxml2-dev \
lzma-dev \
openssl \
mingw-w64 \
musl-tools \
libssl-dev \
unzip \
gnupg \
lsb-release \
&& apt -y autoremove \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# FIXME: install gcc-multilib
# FIXME: add mips and powerpc architectures
ENV PATH=/usr/local/bin:${OSX_CROSS_PATH}/target/bin:$PATH
WORKDIR "${OSX_CROSS_PATH}"
# install osxcross:
RUN \
git clone https://github.com/tpoechtrager/osxcross.git . \
&& git checkout -q "${OSX_CROSS_COMMIT:-ff8d100f3f026b4ffbe4ce96d8aac4ce06f1278b}"
# install osx sdk
COPY --from=osx-sdk "${OSX_CROSS_PATH}/." "${OSX_CROSS_PATH}"
# install cmake
ARG CMAKE_VERSION=3.28.3
RUN \
# wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}.tar.gz \
# && tar -xf cmake-${CMAKE_VERSION}.tar.gz \
# && cd cmake-${CMAKE_VERSION} \
# && ./bootstrap \
# && make \
# && make install \
# && cmake --version \
# && cd .. \
# && rm -rf cmake-${CMAKE_VERSION}.tar.gz cmake-${CMAKE_VERSION}
wget -qO- "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-linux-x86_64.tar.gz" | tar --strip-components=1 -xz -C /usr/local \
&& cmake --version
# https://github.com/tpoechtrager/osxcross/issues/313
COPY patch/osxcross-08-52-08.patch "${OSX_CROSS_PATH}/"
RUN patch -p1 < osxcross-08-52-08.patch
COPY scripts/llvm.sh "${OSX_CROSS_PATH}/"
RUN \
# install clang-16
./llvm.sh 16 \
&& update-alternatives --install /usr/bin/clang clang /usr/bin/clang-16 100 \
&& update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-16 100 \
&& clang --version \
&& clang++ --version \
&& UNATTENDED=yes OSX_VERSION_MIN=${OSX_VERSION_MIN:-10.13} ./build.sh \
&& DISABLE_PARALLEL_ARCH_BUILD=1 ./build_compiler_rt.sh \
&& rm -rf *~ build *.tar.xz \
&& rm -rf ./.git \
&& ls -al "${OSX_CROSS_PATH}/target/bin" \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*