Skip to content

Commit bdafdd7

Browse files
Drop libevent (#385)
`libevent` is no longer a required dependency on any major platform. Since [release 1.15](https://crystal-lang.org/2025/01/09/1.15.0-released/index.html#lifetime-eventloop) (crystal-lang/crystal#14996) we're directly using the system selectors (epoll, kqueue) on Linux, macOS, and FreeBSD. Libevent is still supported, but it needs opt-in via a compile-time flag [`-Devloop=libevent`](https://crystal-lang.org/2024/11/05/lifetime-event-loop/#effects). It's safe to assume that barely anyone uses that. So we should be able to remove this library from our distribution artifacts, reducing dependencies and size. With this change, libevent is still supported, but it's an optional dependency, and you have to install it explicitly if you want to use it. We may want to use libevent in stdlib specs, so I'm adding it to the `-build` images.
1 parent 24d0335 commit bdafdd7

File tree

9 files changed

+8
-47
lines changed

9 files changed

+8
-47
lines changed

docker/alpine.Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ ARG llvm_version=20
55
RUN \
66
apk add --update --no-cache --force-overwrite \
77
# core dependencies
8-
gcc gmp-dev libevent-static musl-dev pcre-dev pcre2-dev pcre2-static \
8+
gcc gmp-dev musl-dev pcre-dev pcre2-dev pcre2-static \
99
# stdlib dependencies
1010
gc-dev gc-static libxml2-dev libxml2-static openssl-dev openssl-libs-static tzdata yaml-static zlib-static xz-static \
1111
# dev tools
@@ -28,6 +28,6 @@ FROM runtime as build
2828
RUN \
2929
apk add --update --no-cache --force-overwrite \
3030
llvm${llvm_version}-dev llvm${llvm_version}-static \
31-
g++ libffi-dev
31+
libevent-static g++ libffi-dev
3232

3333
CMD ["/bin/sh"]

docker/ubuntu.Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ RUN \
88
apt-get update && \
99
DEBIAN_FRONTEND=noninteractive \
1010
apt-get install -y tzdata gcc pkg-config libssl-dev libxml2-dev libyaml-dev libgmp-dev git make \
11-
libpcre3-dev libpcre2-dev libevent-dev libz-dev libgc-dev && \
11+
libpcre3-dev libpcre2-dev libz-dev libgc-dev && \
1212
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
1313

1414
ARG crystal_targz
@@ -24,7 +24,7 @@ FROM runtime as build
2424

2525
RUN \
2626
apt-get update && \
27-
apt-get install -y build-essential llvm-${llvm_version} lld-${llvm_version} libedit-dev gdb libffi-dev && \
27+
apt-get install -y build-essential llvm-${llvm_version} lld-${llvm_version} libedit-dev libevent-dev gdb libffi-dev && \
2828
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
2929

3030
RUN ln -sf /usr/bin/ld.lld-${llvm_version} /usr/bin/ld.lld

linux/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ RUN apk add --no-cache \
2525
# Statically-compiled llvm
2626
llvm${llvm_version}-dev llvm${llvm_version}-static \
2727
# Static stdlib dependencies
28-
gc-dev gc-static zlib-static yaml-static libxml2-static pcre2-dev pcre2-static libevent-static zstd-static \
28+
gc-dev gc-static zlib-static yaml-static libxml2-static pcre2-dev pcre2-static zstd-static \
2929
# Static compiler dependencies
3030
libffi-dev \
3131
# Build tools

linux/Makefile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ PREVIOUS_CRYSTAL_RELEASE_LINUX64_TARGZ ?= https://github.com/crystal-lang/crysta
2626
SHARDS_VERSION = v0.19.1
2727
GC_VERSION = v8.2.8
2828
LIBPCRE2_VERSION = 10.44
29-
LIBEVENT_VERSION = release-2.1.12-stable
3029

3130
OUTPUT_DIR = build
3231
OUTPUT_BASENAME64 = $(OUTPUT_DIR)/crystal-$(CRYSTAL_VERSION)-$(PACKAGE_ITERATION)-linux-$(arch)
@@ -48,8 +47,7 @@ BUILD_ARGS64 = $(BUILD_ARGS_COMMON) \
4847
--build-arg gnu_target=$(arch)-unknown-linux-gnu
4948

5049
BUILD_ARGS64_BUNDLED = $(BUILD_ARGS64) \
51-
--build-arg libpcre2_version=$(LIBPCRE2_VERSION) \
52-
--build-arg libevent_version=$(LIBEVENT_VERSION)
50+
--build-arg libpcre2_version=$(LIBPCRE2_VERSION)
5351

5452
.PHONY: all
5553
all: all64 ## Build all distribution tarballs [default]

linux/bundled.dockerfile

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,15 @@ RUN curl -L https://github.com/PCRE2Project/pcre2/releases/download/pcre2-${libp
1313
&& ./configure --disable-shared --disable-cpp --enable-jit --enable-utf --enable-unicode-properties \
1414
&& make -j$(nproc)
1515

16-
# build libevent
17-
18-
FROM debian AS libevent
19-
ARG libevent_version
20-
RUN git clone https://github.com/libevent/libevent \
21-
&& cd libevent \
22-
&& git checkout ${libevent_version} \
23-
&& ./autogen.sh \
24-
&& ./configure --disable-shared --disable-openssl \
25-
&& make -j$(nproc)
26-
2716
FROM debian
2817
ARG crystal_version
2918
ARG package_iteration
3019
ARG libpcre2_version
31-
ARG libevent_version
3220

3321
RUN mkdir -p /output/lib/crystal/lib/
3422

3523
# Copy libraries
3624
COPY --from=libpcre2 pcre2-${libpcre2_version}/.libs/libpcre2-8.a /output/lib/crystal/
37-
COPY --from=libevent libevent/.libs/libevent.a libevent/.libs/libevent_pthreads.a /output/lib/crystal/
3825

3926
# Create tarball
4027
RUN mv /output /crystal-${crystal_version}-${package_iteration} \

omnibus/config/software/crystal.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
dependency "pcre2"
1717
dependency "bdw-gc"
1818
dependency "llvm_bin" unless FIRST_RUN
19-
dependency "libevent"
2019
dependency "libffi"
2120

2221
env = with_standard_compiler_flags(with_embedded_path(

omnibus/config/software/libevent.rb

Lines changed: 0 additions & 23 deletions
This file was deleted.

snapcraft/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ The following are the suggested packages to be able to use the whole standard li
4444
4545
```
4646
$ sudo apt-get install gcc pkg-config git tzdata \
47-
libpcre2-dev libevent-dev libyaml-dev \
47+
libpcre2-dev libyaml-dev \
4848
libgmp-dev libssl-dev libxml2-dev
4949
```
5050

snapcraft/crystal-snap-wrapper

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ if [ ! -f $SNAP_USER_COMMON/env-check-success ]; then
1414
The following are the suggested packages to be able to use the whole standard library capabilities.
1515
1616
$ sudo apt-get install gcc pkg-config git tzdata \\
17-
libpcre2-dev libevent-dev libyaml-dev \\
17+
libpcre2-dev libyaml-dev \\
1818
libgmp-dev libssl-dev libxml2-dev
1919
2020
You can find more detailed information in:

0 commit comments

Comments
 (0)