Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add docker development environment #205

Merged
merged 1 commit into from Jun 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
@@ -0,0 +1 @@
*
19 changes: 19 additions & 0 deletions Dockerfile
@@ -0,0 +1,19 @@
FROM ubuntu:xenial

RUN apt-get update && apt-get install -y \
automake \
build-essential \
curl \
libgif-dev \
libgnutls-dev \
libgtk-3-dev \
libjpeg-dev \
libncurses5-dev \
libtiff-dev \
libxml2-dev \
libxpm-dev \
texinfo

ENV PATH "/root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

RUN curl https://sh.rustup.rs -o rustup.sh && sh rustup.sh --default-toolchain nightly -y && rustup default nightly
30 changes: 22 additions & 8 deletions README.md
Expand Up @@ -143,21 +143,35 @@ more Emacs-y.

1. You will need [Rust installed](https://www.rust-lang.org/en-US/install.html). If you're on macOS, you will need Rust
nightly.

2. You will need a C compiler and toolchain. On Linux, you can do
something like `apt-get install build-essential automake`. On
macOS, you'll need Xcode.

3. You will need some C libraries. On Linux, you can install
everything you need with:

apt-get install texinfo libjpeg-dev libtiff-dev \
libgif-dev libxpm-dev libgtk-3-dev libgnutls-dev \
libncurses5-dev libxml2-dev

On macOS, you'll need libxml2 (via `xcode-select --install`) and
gnutls (via `brew install gnutls`).


#### Dockerized development environment

If you don't want to bother with the above setup you can use the provided docker environment. Make sure you have [docker](https://www.docker.com/) 1.12+ and [docker-compose](https://github.com/docker/compose) 1.8+ available.

To spin up the environment run

``` shell
docker-compose up -d
```

First time you run this command docker will build the image. After that any subsequent startups will happen in less than a second.

The working directory with remacs will be mount under the same path in the container so editing the files on your host machine will automatically be reflected inside the container. To build remacs use the steps from [Building Remacs](#building-remacs) prefixed with `docker-compose exec remacs`, this will ensure the commands are executed inside the container.

### Building Remacs

```
Expand Down Expand Up @@ -246,9 +260,9 @@ $ gcc -Ilib -E src/dummy.c > dummy_exp.c
This gives us a file that ends with:

``` c
static struct Lisp_Subr
static struct Lisp_Subr
# 3 "src/dummy.c" 3 4
_Alignas
_Alignas
# 3 "src/dummy.c"
(8) Snumberp = { { PVEC_SUBR << PSEUDOVECTOR_AREA_BITS }, { .a1 = Fnumberp }, 1, 1, "numberp", 0, 0}; Lisp_Object Fnumberp

Expand All @@ -267,7 +281,7 @@ a `numberp` function that does the actual work, then `defun!` handles
these definitions for us:

``` rust
// This is the function that gets called when
// This is the function that gets called when
// we call numberp in elisp.
fn numberp(object: LispObject) -> LispObject {
if lisp::NUMBERP(object) {
Expand Down
12 changes: 12 additions & 0 deletions docker-compose.yml
@@ -0,0 +1,12 @@
version: '2'

services:
remacs:
build: .
image: remacs-build:latest
working_dir: ${PWD}
tty: true
# Unfortunately dumping doesn't work without this
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presumably this is due to: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=23529 (see also this).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably, but that will never get fixed, not until the old timers run things :/

Maybe one day remacs will fix it itself, or just remove the misfeature completely.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I was mostly linking it for future reference :)

Eventually I want Remacs to have a sensible dumping mechanism, at which point this will just work.

privileged: true
volumes:
- .:${PWD}