fix(latex): auctex: build tex-site.el

Auctex added a make build step to it's installation. Rather than just
assume the user has the GNU variants of make, sed, and other unix
utilities on their system, I simply generate tex-site.el in elisp,
similar to what we do with org and its org-version.el and
org-loaddefs.el files.

This is a stop-gap measure until I've deployed a mirror+CD on @doomelpa.
This commit is contained in:
Henrik Lissner 2024-07-09 00:24:27 -04:00
parent f2696d7302
commit 96de02c769
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -3,7 +3,39 @@
(package! auctex (package! auctex
:recipe (:files ("*.el" "*.info" "dir" :recipe (:files ("*.el" "*.info" "dir"
"doc" "etc" "images" "latex" "style")) "doc" "etc" "images" "latex" "style")
;; HACK: Auctex has a post-install step that generates tex-site.el
;; and *.texi documentation files, which largely assumes the user
;; is on a Linux system with various shell tools like sed, gnu
;; make, tex, etc. -- an assumption I can't safely make about
;; Doom's users, so reinvent its 'make tex-site.el' task in elisp:
:pre-build
(with-temp-file "tex-site.el"
(insert-file-contents "tex-site.el.in")
(while (re-search-forward "@\\(\\(?:AUCTEX\\|lisp\\)[^@]+\\)@" nil t)
(pcase (match-string 1)
("AUCTEXVERSION"
(replace-match (with-temp-buffer
(insert-file-contents "auctex.el" nil 0 1024)
(save-match-data
(if (re-search-forward "^;; Version: \\([^\n-]+\\)" nil t)
(match-string-no-properties 1)
"Unknown")))
t t))
("AUCTEXDATE"
(when-let* ((time (cdr (doom-call-process "git" "log" "-n1" "--pretty=tformat:%ct")))
(time (string-to-number time)))
(replace-match (format-time-string "%Y-%m-%d %T" time) t t)))
("lispautodir"
(replace-match
(prin1-to-string
`(if (file-writable-p "/usr/local/var/auctex")
"/usr/local/var/auctex"
,(file-name-concat doom-data-dir "auctex")))
t t))
((or "lisppackagedatadir" "lisppackagelispdir")
(replace-match "(directory-file-name (file-name-directory load-file-name))" t t))
(it (error "Unknown substitution variable in tex-site.el.in: %s" it))))))
:pin "764a53c8e93150f0edd169593a4d453810792abe") :pin "764a53c8e93150f0edd169593a4d453810792abe")
(package! adaptive-wrap :pin "dea4e32c18d285a6ca9f72b1eadd61e27a555ed3") (package! adaptive-wrap :pin "dea4e32c18d285a6ca9f72b1eadd61e27a555ed3")
(package! latex-preview-pane :pin "5297668a89996b50b2b62f99cba01cc544dbed2e") (package! latex-preview-pane :pin "5297668a89996b50b2b62f99cba01cc544dbed2e")