Skip to content

Commit a9e0c6c

Browse files
Revert "Drop building libgc on Linux" (#304)
1 parent 8c3a9f6 commit a9e0c6c

File tree

2 files changed

+25
-12
lines changed

2 files changed

+25
-12
lines changed

linux/Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
FROM debian:11 AS debian
2+
3+
RUN apt-get update \
4+
&& apt-get install -y build-essential libevent-dev libpcre2-dev automake libtool pkg-config git curl llvm-13 clang-13 \
5+
&& (pkg-config || true)
6+
7+
ARG release
8+
ENV CFLAGS="-fPIC -pipe ${release:+-O2}"
9+
ENV CC="clang-13"
10+
11+
# Build libgc
12+
ARG gc_version
13+
14+
RUN git clone https://github.com/ivmai/bdwgc \
15+
&& cd bdwgc \
16+
&& git checkout ${gc_version} \
17+
&& ./autogen.sh \
18+
&& ./configure --disable-debug --disable-shared --enable-large-config \
19+
&& make -j$(nproc)
20+
121
FROM alpine:3.17
222

323
# Install dependencies
@@ -55,10 +75,15 @@ RUN git clone https://github.com/crystal-lang/shards \
5575
\
5676
&& ([ "$(ldd bin/shards 2>&1 | wc -l)" -eq "1" ] || { echo 'shards is not statically linked'; ldd bin/shards; exit 1; })
5777

78+
COPY --from=debian /bdwgc/.libs/libgc.a /libgc-debian.a
79+
5880
ARG package_iteration
5981

6082
RUN \
83+
# Copy libgc.a to /lib/crystal/
6184
mkdir -p /output/lib/crystal/ \
85+
&& cp /libgc-debian.a /output/lib/crystal/libgc.a \
86+
\
6287
# Install crystal
6388
&& make -C /crystal install DESTDIR=/output PREFIX= \
6489
\

linux/bundled.dockerfile

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,6 @@ RUN apt-get update \
55

66
ENV CFLAGS="-fPIC -pipe ${release:+-O2}"
77

8-
# Build libgc
9-
FROM debian AS bdwgc
10-
ARG gc_version
11-
RUN curl -L https://github.com/ivmai/bdwgc/archive/refs/tags/${gc_version}.tar.gz | tar -zx \
12-
&& mv bdwgc-* bdwgc-${gc_version} \
13-
&& cd bdwgc-${gc_version} \
14-
&& ./autogen.sh \
15-
&& ./configure --disable-debug --disable-shared --enable-large-config \
16-
&& make -j$(nproc)
17-
188
# build libpcre2
199
FROM debian AS libpcre2
2010
ARG libpcre2_version
@@ -37,14 +27,12 @@ RUN git clone https://github.com/libevent/libevent \
3727
FROM debian
3828
ARG crystal_version
3929
ARG package_iteration
40-
ARG gc_version
4130
ARG libpcre2_version
4231
ARG libevent_version
4332

4433
RUN mkdir -p /output/lib/crystal/lib/
4534

4635
# Copy libraries
47-
COPY --from=bdwgc bdwgc-${gc_version}/.libs/libgc.a /output/lib/crystal/
4836
COPY --from=libpcre2 pcre2-${libpcre2_version}/.libs/libpcre2-8.a /output/lib/crystal/
4937
COPY --from=libevent libevent/.libs/libevent.a libevent/.libs/libevent_pthreads.a /output/lib/crystal/
5038

0 commit comments

Comments
 (0)