FROM archlinux:base@sha256:b0deabeb3d283da2c7f7dbf0eea051b7b2cd0554e0b737cc457fd21683bdcdd1

RUN pacman -Syu --noconfirm --needed \
	cairo \
	fontconfig \
	diffutils \
	gcc \
	gtk3 \
	ibus \
	harfbuzz \
	libx11 \
	libxcb \
	libxkbcommon \
	make \
	noto-fonts-emoji \
	pango \
	pkgconf \
	plan9port \
	python \
	ttf-dejavu \
	ttf-jigmo \
	valgrind \
	which \
	xorg-server-xvfb \
	xcb-imdkit \
	dbus \
	&& pacman -Scc --noconfirm

RUN export DEBUGINFOD_URLS=https://debuginfod.archlinux.org \
	&& buildid="$(readelf -n /usr/lib/ld-linux-x86-64.so.2 | sed -n 's/.*Build ID: //p')" \
	&& test -n "$buildid" \
	&& debugdir="/usr/lib/debug/.build-id/$(printf '%.2s' "$buildid")" \
	&& mkdir -p "$debugdir" \
	&& install -m 0644 "$(debuginfod-find debuginfo /usr/lib/ld-linux-x86-64.so.2)" \
		"$debugdir/${buildid#??}.debug" \
	&& rm -rf /root/.cache/debuginfod_client

RUN dbus-uuidgen --ensure=/etc/machine-id

ENV PLAN9=/usr/lib/plan9
ENV PATH=$PATH:/usr/lib/plan9/bin

WORKDIR /src
