emacs: make trivialBuild know its elisp dependencies in another way (#343201)

This commit is contained in:
Lin Jian
2024-09-21 01:32:20 +08:00
committed by GitHub
3 changed files with 5 additions and 12 deletions
@@ -20,15 +20,4 @@ addEmacsVars () {
if [ -n "${addEmacsNativeLoadPath:-}" ]; then
addToEmacsNativeLoadPath "$1/share/emacs/native-lisp"
fi
# Add sub paths to the Emacs load path if it is a directory
# containing .el files. This is necessary to build some packages,
# e.g., using trivialBuild.
for lispDir in \
"$1/share/emacs/site-lisp/"* \
"$1/share/emacs/site-lisp/elpa/"*; do
if [[ -d $lispDir && "$(echo "$lispDir"/*.el)" ]] ; then
addToEmacsLoadPath "$lispDir"
fi
done
}
@@ -86,10 +86,14 @@ libBuildHelper.extendMkDerivation' stdenv.mkDerivation (finalAttrs:
source ${./emacs-funcs.sh}
addEmacsVars "$out"
# package-activate-all is used to activate packages. In other builder
# helpers, package-initialize is used for this purpose because
# package-activate-all is not available before Emacs 27.
find $out/share/emacs -type f -name '*.el' -not -name ".dir-locals.el" -print0 \
| xargs --verbose -0 -I {} -n 1 -P $NIX_BUILD_CORES sh -c \
"emacs \
--batch \
-f package-activate-all \
--eval '(setq native-comp-eln-load-path (cdr native-comp-eln-load-path))' \
--eval '(setq large-file-warning-threshold nil)' \
--eval '(setq byte-compile-error-on-warn ${if finalAttrs.turnCompilationWarningToError then "t" else "nil"})' \
@@ -19,7 +19,7 @@ args:
foundMakefile=1
fi
emacs -L . --batch -f batch-byte-compile *.el
emacs -l package -f package-initialize -L . --batch -f batch-byte-compile *.el
runHook postBuild
'';