From 7c6fb4667dca2cb39003efca48e3de655a38ab35 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Tue, 28 May 2024 15:28:30 +0200 Subject: [PATCH] gnu: Add texlive-chktex-bin. * gnu/packages/tex.scm (texlive-chktex-bin): New variable. (texlive-chktex)[arguments]<#:link-scripts>: Remove as those are now provided by TEXLIVE-CHKTEX-BIN. [inputs]: Remove PERL. [propagated-inputs]: Add TEXLIVE-CHKTEX-BIN. Change-Id: If9801ba8bf677899c6e96b20d17f2f41da0fdc50 --- gnu/packages/tex.scm | 64 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 2 deletions(-) diff --git a/gnu/packages/tex.scm b/gnu/packages/tex.scm index b4c519f4b6..ddc2874368 100644 --- a/gnu/packages/tex.scm +++ b/gnu/packages/tex.scm @@ -33994,8 +33994,7 @@ (define-public texlive-chktex "0qyrllxvcymmr1a4sq9c88fw5zchcx0n6yac69s61fg6xypk18bq"))) (outputs '("out" "doc")) (build-system texlive-build-system) - (arguments (list #:link-scripts #~(list "chkweb.sh" "deweb.pl"))) - (inputs (list perl)) + (propagated-inputs (list texlive-chktex-bin)) (home-page "https://ctan.org/pkg/chktex") (synopsis "Check for errors in LaTeX documents") (description @@ -34003,6 +34002,67 @@ (define-public texlive-chktex Filters are also provided for checking the LaTeX parts of CWEB documents.") (license license:gpl2+))) +(define-public texlive-chktex-bin + (package + (inherit texlive-bin) + (name "texlive-chktex-bin") + (source + (origin + (inherit texlive-source) + (modules '((guix build utils) + (ice-9 ftw))) + (snippet + #~(let ((delete-other-directories + (lambda (root keep) + (with-directory-excursion root + (for-each + delete-file-recursively + (scandir + "." + (lambda (file) + (and (not (member file (append keep '("." "..")))) + (eq? 'directory (stat:type (stat file))))))))))) + (delete-other-directories "libs" '()) + (delete-other-directories "utils" '()) + (delete-other-directories "texk" '("chktex")))))) + (arguments + (substitute-keyword-arguments (package-arguments texlive-bin) + ((#:configure-flags flags) + #~(cons "--enable-chktex" (delete "--enable-web2c" #$flags))) + ((#:phases phases) + #~(modify-phases #$phases + (add-after 'unpack 'locate-global-configuration-file + ;; `chktex' needs to know where its global configuration file is. + ;; However, it cannot understand our convoluted TEXMFMAIN value. + ;; This phase forces configuration file name. + (lambda _ + (substitute* "texk/chktex/chktex-src/OpSys.c" + (("kpse_var_value\\(\"TEXMFMAIN\"\\)") + (string-append "strdup(\"" #$output "/share/texmf-dist\")"))))) + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (with-directory-excursion "texk/chktex" + (invoke "make" "check"))))) + (replace 'install + (lambda _ + (with-directory-excursion "texk/chktex" + (invoke "make" "install")))) + ;; Compilation forces a "/usr/bin/env perl" shebang. Change it. + (add-after 'install 'patch-shebang + (lambda _ + (patch-shebang + (string-append #$output + "/share/texmf-dist/scripts/chktex/deweb.pl")))))))) + (native-inputs (list pkg-config)) + (inputs (list perl texlive-libkpathsea)) + (propagated-inputs '()) + (home-page (package-home-page texlive-chktex)) + (synopsis "Binaries for @code{texlive-chktex}") + (description + "This package provides the binaries for @code{texlive-chktex}.") + (license (package-license texlive-chktex)))) + (define-public texlive-clojure-pamphlet (package (name "texlive-clojure-pamphlet")