@@ -2,21 +2,10 @@ ARG alpine_image
2
2
ARG debian_image
3
3
FROM ${debian_image} AS debian
4
4
5
- RUN apt-get update \
6
- && apt-get install -y build-essential libevent-core-2.0-5 libevent-dev libevent-extra-2.0-5 libevent-openssl-2.0-5 libevent-pthreads-2.0-5 libpcre3-dev automake libtool pkg-config git software-properties-common apt-transport-https curl \
7
- && (pkg-config || true)
8
-
9
- RUN add-apt-repository "deb http://apt.llvm.org/jessie/ llvm-toolchain-jessie-4.0 main" \
10
- && curl -sSL https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - \
5
+ RUN echo "deb http://deb.debian.org/debian buster-backports main" >> /etc/apt/sources.list \
11
6
&& apt-get update \
12
- && apt-get install -y llvm-4.0-dev
13
-
14
- ARG previous_crystal_release
15
- ADD ${previous_crystal_release} /tmp/crystal.tar.gz
16
- ENV PATH=${PATH}:/tmp/crystal/bin
17
- RUN mkdir -p /tmp/crystal \
18
- && tar xz -f /tmp/crystal.tar.gz -C /tmp/crystal --strip-component=1 \
19
- && crystal --version
7
+ && apt-get install -y -t buster-backports build-essential libevent-dev libpcre3-dev automake libtool pkg-config git curl llvm-8 \
8
+ && (pkg-config || true)
20
9
21
10
ARG release
22
11
ENV CFLAGS="-fPIC -pipe ${release:+-O2}"
@@ -44,19 +33,18 @@ RUN git clone https://github.com/crystal-lang/crystal \
44
33
&& cd crystal \
45
34
&& git checkout ${crystal_sha1} \
46
35
\
47
- && make deps \
48
- \
49
- && bin/crystal build src/compiler/crystal.cr -D without_openssl -D without_zlib \
50
- --cross-compile --target ${musl_target} -o /crystal-musl
36
+ && make deps
51
37
52
38
FROM ${alpine_image}
53
39
40
+ RUN sed -i 's|--list -- "$@"|--list "$@"|' /usr/bin/ldd
41
+
54
42
# Install dependencies
55
43
RUN apk add --no-cache \
56
44
# Statically-compiled llvm
57
- llvm4 -dev llvm4 -static \
58
- # Static zlib, libyaml, pcre, and libevent
59
- zlib-dev yaml-dev pcre-dev libevent-dev \
45
+ llvm8 -dev llvm8 -static \
46
+ # Static zlib, libyaml, libxml2, pcre, and libevent
47
+ zlib-dev yaml-dev libxml2-dev pcre-dev libevent-static \
60
48
# Build tools
61
49
git gcc g++ make automake libtool autoconf bash coreutils
62
50
@@ -77,23 +65,23 @@ RUN git clone https://github.com/ivmai/bdwgc \
77
65
&& make -j$(nproc) CFLAGS=-DNO_GETCONTEXT
78
66
79
67
ENV LIBRARY_PATH=/bdwgc/.libs/
80
- ENV PATH=/usr/lib/llvm4/bin:$PATH
81
68
RUN llvm-config --version
82
69
70
+ ARG previous_crystal_release
71
+ ADD ${previous_crystal_release} /tmp/crystal.tar.gz
72
+ ENV PATH=${PATH}:/tmp/crystal/lib/crystal/bin/
73
+ RUN mkdir -p /tmp/crystal \
74
+ && tar xz -f /tmp/crystal.tar.gz -C /tmp/crystal --strip-component=1 \
75
+ && crystal --version
76
+
83
77
# Build crystal
84
- COPY --from=debian /crystal-musl.o /
85
78
ARG crystal_version
86
79
ARG crystal_sha1
87
80
ARG gnu_target
88
81
RUN git clone https://github.com/crystal-lang/crystal \
89
82
&& cd crystal \
90
83
&& git checkout ${crystal_sha1} \
91
84
\
92
- && make deps \
93
- && mkdir -p .build/crystal-musl \
94
- && cc '/crystal-musl.o' -o '.build/crystal-musl/crystal' -rdynamic src/llvm/ext/llvm_ext.o `llvm-config --libs --system-libs --ldflags` -lstdc++ -lpcre -lm -lgc -lpthread src/ext/libcrystal.a -levent -lrt \
95
- && export PATH=.build/crystal-musl/:$PATH \
96
- \
97
85
&& make crystal stats=true static=true ${release:+release=true} \
98
86
CRYSTAL_CONFIG_TARGET=${gnu_target} \
99
87
&& ([ "$(ldd .build/crystal | wc -l)" -eq "1" ] || { echo './build/crystal is not statically linked' ; ldd .build/crystal; exit 1; })
0 commit comments