add instruction to compile the vterm module and add dependencies

This commit is contained in:
Valentin Boettcher 2024-09-15 12:50:59 -04:00
parent e8f01d926d
commit 0ac651621f
No known key found for this signature in database
GPG key ID: E034E12B7AF56ACE
4 changed files with 14 additions and 4 deletions

1
.gitignore vendored
View file

@ -1,5 +1,6 @@
_requirements.el _requirements.el
_reminders.json _reminders.json
_native_deps
pkg pkg
*.elc *.elc

View file

@ -17,8 +17,8 @@ term: image
$(DOCKER) run -it --rm --entrypoint=/bin/bash ${DOCKER_OPTIONS} ${IMAGE_NAME} $(DOCKER) run -it --rm --entrypoint=/bin/bash ${DOCKER_OPTIONS} ${IMAGE_NAME}
.PHONY: image .PHONY: image
image: image: _requirements.el _native_deps
@$(DOCKER) build --build-arg PACKAGE_MAIN ${DOCKER_OUTPUT} \ @$(DOCKER) build --build-arg NATIVE_DEPS="$$(cat _native_deps)" --build-arg PACKAGE_MAIN ${DOCKER_OUTPUT} \
--tag ${IMAGE_NAME} -f docker/Dockerfile . --tag ${IMAGE_NAME} -f docker/Dockerfile .
.PHONY: test-melpazoid .PHONY: test-melpazoid

View file

@ -2,8 +2,10 @@
# <https://ubuntuhandbook.org/index.php/2023/08/gnu-emacs-29-1-ubuntu-ppa/> # <https://ubuntuhandbook.org/index.php/2023/08/gnu-emacs-29-1-ubuntu-ppa/>
FROM ubuntu:22.04 FROM ubuntu:22.04
ARG NATIVE_DEPS=""
ENV NATIVE_DEPS="${NATIVE_DEPS}"
RUN apt-get update \ RUN apt-get update \
&& apt-get -y install curl gnupg openssh-client wget \ && apt-get -y install curl gnupg openssh-client wget ${NATIVE_DEPS} \
&& apt-get -y --no-install-recommends install software-properties-common \ && apt-get -y --no-install-recommends install software-properties-common \
&& add-apt-repository ppa:ubuntuhandbook1/emacs \ && add-apt-repository ppa:ubuntuhandbook1/emacs \
&& apt-get -y install emacs emacs-common \ && apt-get -y install emacs emacs-common \

View file

@ -238,7 +238,8 @@ def _main_file(files: list[Path], recipe: str) -> Path | None:
def _write_requirements(files: list[Path]) -> None: def _write_requirements(files: list[Path]) -> None:
"""Create a little elisp script that Docker will run as setup.""" """Create a little elisp script that Docker will run as setup."""
with Path('_requirements.el').open('w', encoding='utf-8') as requirements_el: with (Path('_requirements.el').open('w', encoding='utf-8') as requirements_el,
Path('_native_deps').open('w', encoding='utf-8') as native_deps):
requirements_el.write( requirements_el.write(
f";; {time.strftime('%Y-%m-%d')} ; helps to invalidate old Docker cache\n\n" f";; {time.strftime('%Y-%m-%d')} ; helps to invalidate old Docker cache\n\n"
+ ";; NOTE: emacs --script <file.el> will set `load-file-name' to <file.el>\n" + ";; NOTE: emacs --script <file.el> will set `load-file-name' to <file.el>\n"
@ -265,12 +266,18 @@ def _write_requirements(files: list[Path]) -> None:
_fail( _fail(
"- Don't require marginalia: https://github.com/minad/marginalia#adding-custom-annotators-or-classifiers" "- Don't require marginalia: https://github.com/minad/marginalia#adding-custom-annotators-or-classifiers"
) )
# always install the latest available version of the dependency. # always install the latest available version of the dependency.
requirements_el.write( requirements_el.write(
f'\n(message "Installing {req_} {version} or later")\n' f'\n(message "Installing {req_} {version} or later")\n'
+ f"(ignore-errors (package-install (cadr (assq '{req_} package-archive-contents))))\n" + f"(ignore-errors (package-install (cadr (assq '{req_} package-archive-contents))))\n"
) )
if req == 'vterm':
native_deps.write("cmake libvterm-dev ")
requirements_el.write('(setq vterm-always-compile-module t)\n')
requirements_el.write('(vterm-module-compile)\n')
def requirements(files: list[Path]) -> set[str]: def requirements(files: list[Path]) -> set[str]:
"""Return (downcased) requirements given a listing of files. """Return (downcased) requirements given a listing of files.