summaryrefslogtreecommitdiff
path: root/personal/setup/emacs.md
blob: 53fb75f5045f9f42659936538ab29d9d0bf870de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Compiling

This script seems to handle most cases I care about:

- a freshly cloned copy of the repository,
- a repository where compilation has already happened,
- a repository where I want to change the `configure` flags…

``` bash
#!/bin/bash

set -eux

MAKE="make -j$(nproc --all)"
CONFIGURE_FLAGS="--with-xwidgets --with-cairo"

if ! test -f Makefile
then
	${MAKE} configure
fi

check-config ()
{
    if ! test -f src/config.h
    then
        return 1
    fi

    local pattern='#define EMACS_CONFIG_OPTIONS "'${CONFIGURE_FLAGS}'"'
    grep "${pattern}" src/config.h
}

if ! check-config
then
    ./configure ${CONFIGURE_FLAGS}
fi

if ! ${MAKE}
then
    ${MAKE} bootstrap
fi
```