unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] gnu: texlive: Fix 'texmf-local' search path.
@ 2016-06-12  8:56 Federico Beffa
  2016-06-20  8:58 ` Andreas Enge
  0 siblings, 1 reply; 4+ messages in thread
From: Federico Beffa @ 2016-06-12  8:56 UTC (permalink / raw)
  To: Guix-devel

[-- Attachment #1: Type: text/plain, Size: 78 bytes --]

see https://lists.gnu.org/archive/html/guix-devel/2016-06/msg00122.html

Fede

[-- Attachment #2: 0001-gnu-texlive-Fix-texmf-local-search-path.patch --]
[-- Type: text/x-patch, Size: 2648 bytes --]

From 0e1a6b04d0180c427aa3c4298084ff0c495c9ff9 Mon Sep 17 00:00:00 2001
From: Federico Beffa <beffa@fbengineering.ch>
Date: Sun, 12 Jun 2016 09:49:06 +0200
Subject: [PATCH] gnu: texlive: Fix 'texmf-local' search path.

* gnu/packages/texlive.scm (texlive, texlive-minimal): Add
  'native-search-paths'.
  (texlive-texmf): Correct 'TEXMFLOCAL' definition in 'texmf.cnf' in
  'texmf-config' phase.
---
 gnu/packages/texlive.scm | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/texlive.scm b/gnu/packages/texlive.scm
index cbcb6c8..cc61f9e 100644
--- a/gnu/packages/texlive.scm
+++ b/gnu/packages/texlive.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2013, 2014, 2015, 2016 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
+;;; Copyright © 2016 Federico Beffa <beffa@fbengineering.ch>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -203,7 +204,10 @@ This package contains the binaries.")
                 ;; Register SHARE as TEXMFROOT in texmf.cnf.
                 (substitute* texmfcnf
                   (("TEXMFROOT = \\$SELFAUTOPARENT")
-                  (string-append "TEXMFROOT = " share)))
+                   (string-append "TEXMFROOT = " share))
+                  (("TEXMFLOCAL = \\$SELFAUTOGRANDPARENT/texmf-local")
+                   "TEXMFLOCAL = $SELFAUTODIR/share/texmf-local")
+                  (("!!\\$TEXMFLOCAL") "$TEXMFLOCAL"))
                 ;; Register paths in texmfcnf.lua, needed for context.
                 (substitute* (string-append texmfroot "/texmfcnf.lua")
                   (("selfautodir:") out)
@@ -238,6 +242,10 @@ This package contains the complete tree of texmf-dist data.")
    (inputs `(("bash" ,bash) ; for wrap-program
              ("texlive-bin" ,texlive-bin)
              ("texlive-texmf" ,texlive-texmf)))
+   (native-search-paths
+    (list (search-path-specification
+            (variable "TEXMFLOCAL")
+            (files '("share/texmf-local")))))
    (arguments
     `(#:modules ((guix build utils))
       #:builder
@@ -349,6 +357,10 @@ This package contains a small subset of the texmf-dist data.")))
    (inputs
     `(("texlive-texmf" ,texlive-texmf-minimal)
       ,@(alist-delete "texlive-texmf" (package-inputs texlive))))
+   (native-search-paths
+    (list (search-path-specification
+            (variable "TEXMFLOCAL")
+            (files '("share/texmf-local")))))
    (description
     "TeX Live provides a comprehensive TeX document production system.
 It includes all the major TeX-related programs, macro packages, and fonts
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] gnu: texlive: Fix 'texmf-local' search path.
  2016-06-12  8:56 [PATCH] gnu: texlive: Fix 'texmf-local' search path Federico Beffa
@ 2016-06-20  8:58 ` Andreas Enge
  2016-06-20 16:48   ` Federico Beffa
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Enge @ 2016-06-20  8:58 UTC (permalink / raw)
  To: Federico Beffa; +Cc: Guix-devel

Hello Fede,

apologies for not coming back to you earlier, I have little occasion to
work on Guix right now.

On Sun, Jun 12, 2016 at 10:56:40AM +0200, Federico Beffa wrote:
>                  (substitute* texmfcnf
>                    (("TEXMFROOT = \\$SELFAUTOPARENT")
> -                  (string-append "TEXMFROOT = " share)))
> +                   (string-append "TEXMFROOT = " share))
> +                  (("TEXMFLOCAL = \\$SELFAUTOGRANDPARENT/texmf-local")
> +                   "TEXMFLOCAL = $SELFAUTODIR/share/texmf-local")
> +                  (("!!\\$TEXMFLOCAL") "$TEXMFLOCAL"))

As said before, this change should be benign, but also without effect:
It still points to some place in the store, actually to the directory
   /gnu/store/...-texlive-2015/share/texmf-local ,
which does not exist.
If we keep it, for clarity I would use
   TEXMFLOCAL = $TEXMFROOT/texmf-local
(as for the other variables defined around it), and add a comment that this
declaration does not actually come into effect.

(Well, it _could_ be used by system administrators that define a local
variant of texlive with additional data in this subdirectory.)

I agree that this is a cleaner solution; maybe texmfcnf.lua needs to be
adapted as well?

We could also do something
> +   (native-search-paths
> +    (list (search-path-specification
> +            (variable "TEXMFLOCAL")
> +            (files '("share/texmf-local")))))

This seems to be the main goal of your patch: By redefining TEXMFLOCAL in the
profile, it will point to $HOME/.guix-profile/share/texmf-local. So if we add
packages to the distribution that put data there, it should be available to
texlive. Do you have an example package in mind? Does it work? Currently
I cannot test it on my machine.

There would be an alternative for people running Guix on top of another
distro: We could set TEXMFLOCAL to /usr/share/texmf; then system installed
texlive data could be used. This would work as long as the search path is
not overwritten by a Guix installed package (which we do not have so far).

Looking forward to some more discussion on the topic,

Andreas

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gnu: texlive: Fix 'texmf-local' search path.
  2016-06-20  8:58 ` Andreas Enge
@ 2016-06-20 16:48   ` Federico Beffa
  2016-07-06 16:26     ` Federico Beffa
  0 siblings, 1 reply; 4+ messages in thread
From: Federico Beffa @ 2016-06-20 16:48 UTC (permalink / raw)
  To: Andreas Enge; +Cc: Guix-devel

[-- Attachment #1: Type: text/plain, Size: 3623 bytes --]

On Mon, Jun 20, 2016 at 10:58 AM, Andreas Enge <andreas@enge.fr> wrote:
> Hello Fede,
>
> apologies for not coming back to you earlier, I have little occasion to
> work on Guix right now.
>
> On Sun, Jun 12, 2016 at 10:56:40AM +0200, Federico Beffa wrote:
>>                  (substitute* texmfcnf
>>                    (("TEXMFROOT = \\$SELFAUTOPARENT")
>> -                  (string-append "TEXMFROOT = " share)))
>> +                   (string-append "TEXMFROOT = " share))
>> +                  (("TEXMFLOCAL = \\$SELFAUTOGRANDPARENT/texmf-local")
>> +                   "TEXMFLOCAL = $SELFAUTODIR/share/texmf-local")
>> +                  (("!!\\$TEXMFLOCAL") "$TEXMFLOCAL"))
>
> As said before, this change should be benign, but also without effect:
> It still points to some place in the store, actually to the directory
>    /gnu/store/...-texlive-2015/share/texmf-local ,
> which does not exist.

Hi Andreas,

you are right, TEXMFLOCAL does still point to a nonexistent store
directory, but it is the "right" directory inside of the texlive
package tree. Without this it points to a location outside of every
package/profile tree.  Consider it an aesthetics improvement ;-)

> If we keep it, for clarity I would use
>    TEXMFLOCAL = $TEXMFROOT/texmf-local
> (as for the other variables defined around it), and add a comment that this
> declaration does not actually come into effect.

I think $SELFAUTODIR is the recommended way (in the TeXLive doc and in
comments inside of texmfcnf), but if you prefer we can use TEXMFROOT.

Note that the last entry in 'substitute*' is not just cosmetic: It
instructs TeX & friends not to look for ls-r databases, but to scan
the directory tree. If we would keep the '!!' prefixes to TEXMFLOCAL,
it would not work without adding a profile hook to generate the ls-r
database. As long as we do not have a large set of packages installing
into share/texmf-local, the speed penalty should be essentially
unnoticeable.

> I agree that this is a cleaner solution; maybe texmfcnf.lua needs to be
> adapted as well?

I have no idea about the purpose of this file. I don't find it
mentioned in the documentation
https://www.tug.org/texlive/doc/texlive-en/texlive-en.pdf. What is it
for?

>> +   (native-search-paths
>> +    (list (search-path-specification
>> +            (variable "TEXMFLOCAL")
>> +            (files '("share/texmf-local")))))
>
> This seems to be the main goal of your patch: By redefining TEXMFLOCAL in the
> profile, it will point to $HOME/.guix-profile/share/texmf-local. So if we add
> packages to the distribution that put data there, it should be available to
> texlive. Do you have an example package in mind? Does it work? Currently
> I cannot test it on my machine.

Yes, correct. However, as explained before, it only works in
conjunction with the removal of the '!!' prefix in texmfcnf.

The attached file includes a package called 'chez-web' which installs
a TeX macro. The package 'chez-sockets' makes use of the former and
does work as expected.

>
> There would be an alternative for people running Guix on top of another
> distro: We could set TEXMFLOCAL to /usr/share/texmf; then system installed
> texlive data could be used. This would work as long as the search path is
> not overwritten by a Guix installed package (which we do not have so far).

Personally I would prefer to avoid explicit cross-referencing between
Guix packages and non-Guix ones.

Regards,
Fede

P.S.: I have the package definitions in a local module. If you want to
try the packages I can share it with you. In the future I may send
patches to include them in Guix proper.

[-- Attachment #2: example.scm --]
[-- Type: text/x-scheme, Size: 5393 bytes --]

(define-public chez-web
  (package
    (name "chez-web")
    ;; release 2.0 is different and doesn't work.
    (version "2.0-1.5fd177f")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/arcfide/ChezWEB.git")
             (commit "5fd177fe53f31f466bf88720d03c95a3711a8bea")))
       (sha256
        (base32 "1dq25qygyncbfq4kwwqqgyyakfqjwhp5q23vrf3bff1p66nyfl3b"))))
    (build-system gnu-build-system)
    (native-inputs
     `(("chez-scheme" ,chez-scheme)
       ("texlive" ,texlive)))
    (arguments
     `(#:make-flags (let ((out (assoc-ref %outputs "out")))
                      (list (string-append "PREFIX=" out)
                            (string-append "DOCDIR=" out "/share/doc/"
                                           ,name "-" ,version)
                            (string-append "LIBDIR=" out "/lib/chezweb")
                            (string-append "TEXDIR=" out "/share/texmf-local")))
       #:tests? #f ; no tests
       #:phases
       (modify-phases %standard-phases
         (replace 'configure
           (lambda* _
             (copy-file "config.mk.template" "config.mk")
             (substitute* "tangleit"
               (("\\./cheztangle\\.ss" all)
                (string-append "chez-scheme --program " all)))
             (substitute* "weaveit"
               (("mpost chezweb\\.mp")
                "mpost --tex=tex chezweb.mp")
               (("\\./chezweave" all)
                (string-append "chez-scheme --program " all)))
             (substitute* "installit"
               (("-g \\$GROUP -o \\$OWNER") "")))))))
    (home-page "https://github.com/arcfide/ChezWEB")
    (synopsis "Hygienic Literate Programming for Chez Scheme")
    (description
     "ChezWEB is a system for doing Knuthian style WEB programming in
Scheme, and more particularly, it is implemented in Chez Scheme.")
    (license expat)))

(define-public chez-sockets
  (package
    (name "chez-sockets")
    (version "0.0-1.bce9688")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/arcfide/chez-sockets.git")
             (commit "bce96881c06bd69a6757a6bff139744153924140")))
       (sha256
        (base32 "1n5fbwwz51fdzvjackgmnsgh363g9inyxv7kmzi0469cwavwcx5m"))))
    (build-system gnu-build-system)
    (native-inputs
     `(("chez-scheme" ,chez-scheme)
       ("chez-web" ,chez-web)
       ("texlive" ,texlive)))
    (arguments
     `(#:tests? #f          ; no tests
       #:phases
       (modify-phases %standard-phases
         (replace 'configure
           (lambda* (#:key outputs inputs #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out"))
                    (chez-web (assoc-ref inputs "chez-web"))
                    (chez (assoc-ref inputs "chez-scheme"))
                    (chez-h (dirname (car (find-files chez "scheme\\.h")))))
               (substitute* "Makefile"
                 (("(SCHEMEH=).*$" all var)
                  (string-append var chez-h)))
               #t)))
         (add-before 'build 'tangle
           (lambda _
             ;; just using "make" tries to build the .c files before
             ;; they are created.
             (and (zero? (system* "make" "sockets"))
                  (zero? (system* "make")))))
         (replace 'build
           (lambda* (#:key outputs inputs #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out"))
                    (chez-site (string-append out "/lib/csv"
                                              ,(package-version chez-scheme)
                                              "-site/arcfide")))
               ;; make sure Chez Scheme can find the shared libraries.
               (substitute* "sockets.ss"
                 (("(load-shared-object) \"(socket-ffi-values\\.[sd][oy].*)\""
                   all cmd so)
                  (string-append cmd " \"" chez-site "/" so "\""))
                 (("sockets-stub\\.[sd][oy].*" all)
                  (string-append chez-site "/" all)))
               ;; to compile chez-sockets, the .so files must be
               ;; installed (because of the absolute path we
               ;; inserted above).
               (for-each (lambda (f d) (install-file f d))
                         '("socket-ffi-values.so" "sockets-stub.so")
                         (list chez-site chez-site))
               (zero? (system "echo '(compile-file \"sockets.sls\")' | scheme -q")))))
         (replace 'install
           (lambda* (#:key outputs inputs #:allow-other-keys)
             (let* ((out (assoc-ref outputs "out"))
                    (lib (string-append out "/lib/chez-sockets"))
                    (doc (string-append out "/share/doc/" ,name "-" ,version))
                    (chez-site (string-append out "/lib/csv"
                                              ,(package-version chez-scheme)
                                              "-site/arcfide")))
               (for-each (lambda (f d) (install-file f d))
                         '("sockets.pdf" "sockets.so")
                         (list doc chez-site))
               #t))))))
    (home-page "https://github.com/arcfide/chez-sockets")
    (synopsis "Extensible sockets library for Chez Scheme")
    (description
     "Chez-sockets is an extensible sockets library for Chez Scheme.")
    (license expat)))

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gnu: texlive: Fix 'texmf-local' search path.
  2016-06-20 16:48   ` Federico Beffa
@ 2016-07-06 16:26     ` Federico Beffa
  0 siblings, 0 replies; 4+ messages in thread
From: Federico Beffa @ 2016-07-06 16:26 UTC (permalink / raw)
  To: Andreas Enge; +Cc: Guix-devel

pushed to core-updates

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-07-06 16:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-12  8:56 [PATCH] gnu: texlive: Fix 'texmf-local' search path Federico Beffa
2016-06-20  8:58 ` Andreas Enge
2016-06-20 16:48   ` Federico Beffa
2016-07-06 16:26     ` Federico Beffa

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).