[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Alternatives for reliable build environments for emacs?

From: Yuri Khan
Subject: Re: Alternatives for reliable build environments for emacs?
Date: Thu, 28 Oct 2021 23:07:25 +0700

On Thu, 28 Oct 2021 at 19:57, <joakim@verona.se> wrote:

> I'm finding it increasingly difficult to build emacs in my distro,
> Fedora(Ok, I havent managed to build emacs using distro dependencies for
> a long time)
> What are the alternatives?
> I have tried guix and docker but not yet flatpak.
> These are nice because you can pin the dependency versions, to make sure
> you have a reproducible build environment.
> These all have the drawback that they are inconvenient when making local
> modifications to the emacs source, at least for me. Way back in the days
> when my original build environment worked, I automatically merged some
> branches and applied local patchs with stgit, and its these kind of
> things I've found awkward with the above mentioned containerized build
> systems.

I’m not an Emacs developer but the issue is familiar. I use Docker for
similar cases: (1) building software targeting an older version of the
distribution than is installed on my host system, or (2) building
software using newer versions of the toolchain than I’m comfortable
installing on my host machine.

The trick is that you keep the toolchain and build dependencies in the
container, but bind-mount the source and build trees so they are not
parts of the container image. This way, you work with the source tree
using your local tools; the container is completely disposable.

I’d use the following workspace layout:

  build/     ← out-of-tree build directory
  docker/    ← separate directory so nothing gets into Docker build context
  emacs/     ← source tree
  .env       ← see below
  docker-compose.yml  ← convenience wrapper
  Makefile   ← convenience wrapper over docker-compose

Sample configuration files below are completely untested and provided
only to give an idea.

FROM ubuntu:20.04  # whatever distro is closest to yours

RUN apt-get update && \
    apt-get install --yes \
        build-essential gdb \
        …more toolchain and dependencies…
RUN adduser ubuntu  # non-privileged build user if not already provided by image

version: "3.7"
      context: docker/
    user: ${DOCKER_UID:-1000}:${DOCKER_GID:-1000}
      - ./build:/home/ubuntu/build
      - ./emacs:/home/ubuntu/emacs
      - /tmp/.X11-unix:/tmp/.X11-unix

# If your local user ID or group ID is different from those in the container,
# specify them here

DOCKER_RUN = docker-compose run \
    --rm \
    --user=ubuntu \
    --workdir=/home/ubuntu/emacs \

    $(DOCKER_RUN) ./configure $(CONFIGURE_FLAGS)

    $(DOCKER_RUN) make

    $(DOCKER_RUN) gdb --args ../build/emacs $(ARGS)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]