|
6 | 6 | # |
7 | 7 | FROM archlinux:base-devel |
8 | 8 |
|
| 9 | +# See ./assets/variables |
9 | 10 | ARG UPSTREAM_BRANCH |
10 | 11 | ARG UPSTREAM_REPO |
11 | 12 | ARG USR |
12 | 13 | ARG USR_HOME |
13 | 14 |
|
14 | | -ENV CC="/usr/bin/clang" \ |
15 | | - CXX="/usr/bin/clang++" \ |
16 | | - CPP="/usr/bin/clang -E" \ |
17 | | - LD="/usr/bin/lld" \ |
18 | | - AR="/usr/bin/llvm-ar" \ |
19 | | - AS="/usr/bin/llvm-as" \ |
20 | | - CFLAGS="-g -flto -fuse-ld=lld" \ |
21 | | - CXXFLAGS="-g -flto -fuse-ld=lld" |
22 | | - |
23 | 15 | COPY assets/ /assets/ |
24 | 16 | COPY scripts/ /scripts/ |
25 | 17 |
|
| 18 | +SHELL ["/bin/bash", "-c"] |
| 19 | + |
26 | 20 | RUN \ |
| 21 | + # Compilation flags for faster builds |
| 22 | + MAKEFLAGS="-j$(nproc)" && \ |
| 23 | + export MAKEFLAGS && \ |
| 24 | + # Install deps |
27 | 25 | pacman -Syu --noconfirm && \ |
28 | | - pacman -U --noconfirm /assets/libgccjit-10.2.0-2-x86_64.pkg.tar.zst && \ |
29 | 26 | pacman -S --noconfirm \ |
30 | 27 | # Emacs deps |
31 | | - alsa-lib \ |
32 | | - cairo \ |
33 | | - clang \ |
34 | | - binutils \ |
35 | | - gnutls \ |
36 | | - gpm \ |
37 | | - gtk3 \ |
38 | | - harfbuzz \ |
39 | | - jansson \ |
40 | | - libotf \ |
41 | | - libxml2 \ |
42 | | - lld \ |
43 | | - llvm \ |
44 | | - webkit2gtk \ |
45 | | - xorgproto \ |
46 | | - # Pipeline deps |
47 | | - bc \ |
48 | | - expac \ |
49 | | - git \ |
50 | | - jq \ |
51 | | - openssh |
52 | | - |
53 | | -RUN \ |
54 | | - groupadd -r "$USR" && useradd --no-log-init -r -g "$USR" "$USR" && \ |
| 28 | + alsa-lib cairo clang binutils gnutls gpm gtk3 harfbuzz jansson libotf \ |
| 29 | + libxml2 lld llvm webkit2gtk xorgproto \ |
| 30 | + # GitHub Actions deps |
| 31 | + bc expac git jq openssh \ |
| 32 | + # yay deps |
| 33 | + go && \ |
| 34 | + # Add $USR user / group with sudo access (for yay) |
| 35 | + groupadd -r "$USR" && \ |
| 36 | + useradd --no-log-init -r -g "$USR" "$USR" && \ |
55 | 37 | mkdir "$USR_HOME" && \ |
56 | 38 | chown -R "$USR":"$USR" "$USR_HOME" && \ |
57 | 39 | echo "$USR ALL=(root) NOPASSWD:ALL" > /etc/sudoers.d/user && \ |
58 | | - chmod 0440 /etc/sudoers.d/user |
| 40 | + chmod 0440 /etc/sudoers.d/user && \ |
| 41 | + # Install yay |
| 42 | + pushd "$USR_HOME" && \ |
| 43 | + su "$USR" -c "git clone https://aur.archlinux.org/yay.git" && \ |
| 44 | + pushd yay && \ |
| 45 | + su "$USR" -c "makepkg -si --noconfirm" && \ |
| 46 | + popd && \ |
| 47 | + # Install su-exec |
| 48 | + su "$USR" -c "yay -S su-exec --noconfirm" && \ |
| 49 | + # Install libgccjit |
| 50 | + su-exec "$USR" yay -S libgccjit --noconfirm && \ |
| 51 | + # Copy needed files to $USR_HOME |
| 52 | + su-exec "$USR" cp /scripts/pull.bash . && \ |
| 53 | + su-exec "$USR" cp /assets/PKGBUILD . && \ |
| 54 | + # Pull Emacs from git repository |
| 55 | + su-exec "$USR" ./pull.bash && \ |
| 56 | + # Compile Emacs in order to cache artifacts in the image and get better |
| 57 | + # compilation time in subsequent builds |
| 58 | + su-exec "$USR" makepkg && \ |
| 59 | + # Cleanup |
| 60 | + rm -rf /var/cache/ .cache yay emacs-1-1-x86_64.pkg.tar.zst && \ |
| 61 | + su-exec "$USR" yay -Rcns --noconfirm go && \ |
| 62 | + su-exec "$USR" yay -Scc --noconfirm |
59 | 63 |
|
60 | 64 | WORKDIR $USR_HOME |
61 | 65 |
|
62 | 66 | USER $USR |
63 | | - |
64 | | -SHELL ["/bin/bash", "-c"] |
65 | | - |
66 | | -# We compile Emacs in order to cache artifacts in the image and get better |
67 | | -# compilation time in subsequent builds. |
68 | | -RUN \ |
69 | | - cp /scripts/pull.bash . && \ |
70 | | - cp /assets/PKGBUILD . && \ |
71 | | - ./pull.bash && \ |
72 | | - makepkg && \ |
73 | | - rm emacs-1-1-x86_64.pkg.tar.zst |
0 commit comments