From 1678be097bb3f6403bbc4ab8414f3e7f02c70e44 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Sun, 2 Jul 2017 15:19:47 +0200 Subject: build-system: texlive: Only build packages in the current directory. * guix/build/texlive-build-system.scm (build): Use scandir instead of find-files. --- guix/build/texlive-build-system.scm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'guix/build') diff --git a/guix/build/texlive-build-system.scm b/guix/build/texlive-build-system.scm index c1fd9fd9af..7b10198fd2 100644 --- a/guix/build/texlive-build-system.scm +++ b/guix/build/texlive-build-system.scm @@ -20,6 +20,7 @@ #:use-module ((guix build gnu-build-system) #:prefix gnu:) #:use-module (guix build utils) #:use-module (ice-9 match) + #:use-module (ice-9 ftw) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:export (%standard-phases @@ -62,7 +63,7 @@ (mkdir "build") (every (cut compile-with-latex tex-format <>) (if build-targets build-targets - (find-files "." "\\.ins$")))) + (scandir "." (cut string-suffix? ".ins" <>))))) (define* (install #:key outputs tex-directory #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) -- cgit v1.2.3 From bb3b35975c61db3d1cb0d8522f80d139009e11a9 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Sun, 2 Jul 2017 15:21:52 +0200 Subject: build-system: texlive: Build union in configure phase. This allows us to use texmf.cnf instead of having to set all required environment variables manually. * guix/build/texlive-build-system.scm (configure): New procedure. (build): Simplify. (%standard-phases): Add configure phase. * guix/build-system/texlive.scm (texlive-build): Include (guix build union) in modules. (%texlive-build-system-modules): Likewise. --- guix/build-system/texlive.scm | 2 ++ guix/build/texlive-build-system.scm | 48 ++++++++++++++++++++----------------- 2 files changed, 28 insertions(+), 22 deletions(-) (limited to 'guix/build') diff --git a/guix/build-system/texlive.scm b/guix/build-system/texlive.scm index 0357c47a47..80882b144b 100644 --- a/guix/build-system/texlive.scm +++ b/guix/build-system/texlive.scm @@ -55,6 +55,7 @@ given Texlive COMPONENT." (define %texlive-build-system-modules ;; Build-side modules imported by default. `((guix build texlive-build-system) + (guix build union) ,@%gnu-build-system-modules)) (define (default-texlive-bin) @@ -114,6 +115,7 @@ given Texlive COMPONENT." (substitutable? #t) (imported-modules %texlive-build-system-modules) (modules '((guix build texlive-build-system) + (guix build union) (guix build utils)))) "Build SOURCE with INPUTS." (define builder diff --git a/guix/build/texlive-build-system.scm b/guix/build/texlive-build-system.scm index 7b10198fd2..c0f262a5c0 100644 --- a/guix/build/texlive-build-system.scm +++ b/guix/build/texlive-build-system.scm @@ -19,6 +19,7 @@ (define-module (guix build texlive-build-system) #:use-module ((guix build gnu-build-system) #:prefix gnu:) #:use-module (guix build utils) + #:use-module (guix build union) #:use-module (ice-9 match) #:use-module (ice-9 ftw) #:use-module (srfi srfi-1) @@ -39,28 +40,31 @@ (string-append "&" format) file))) -(define* (build #:key inputs build-targets tex-format #:allow-other-keys) - ;; Find additional tex and sty files - (setenv "TEXINPUTS" - (string-append - (getcwd) ":" (getcwd) "/build:" - (string-join - (append-map (match-lambda - ((_ . dir) - (find-files dir - (lambda (_ stat) - (eq? 'directory (stat:type stat))) - #:directories? #t - #:stat stat))) - inputs) - ":"))) - (setenv "TEXFORMATS" - (string-append (assoc-ref inputs "texlive-latex-base") - "/share/texmf-dist/web2c/")) - (setenv "LUAINPUTS" - (string-append (assoc-ref inputs "texlive-latex-base") - "/share/texmf-dist/tex/latex/base/")) +(define* (configure #:key inputs #:allow-other-keys) + (let* ((out (string-append (getcwd) "/.texlive-union")) + (texmf.cnf (string-append out "/share/texmf-dist/web2c/texmf.cnf"))) + ;; Build a modifiable union of all inputs (but exclude bash) + (match inputs + (((names . directories) ...) + (union-build out directories + #:create-all-directories? #t + #:log-port (%make-void-port "w")))) + + ;; The configuration file "texmf.cnf" is provided by the + ;; "texlive-bin" package. We take it and override only the + ;; setting for TEXMFROOT and TEXMF. This file won't be consulted + ;; by default, though, so we still need to set TEXMFCNF. + (substitute* texmf.cnf + (("^TEXMFROOT = .*") + (string-append "TEXMFROOT = " out "/share\n")) + (("^TEXMF = .*") + "TEXMF = $TEXMFROOT/share/texmf-dist\n")) + (setenv "TEXMFCNF" (dirname texmf.cnf)) + (setenv "TEXMF" (string-append out "/share/texmf-dist"))) (mkdir "build") + #t) + +(define* (build #:key inputs build-targets tex-format #:allow-other-keys) (every (cut compile-with-latex tex-format <>) (if build-targets build-targets (scandir "." (cut string-suffix? ".ins" <>))))) @@ -77,7 +81,7 @@ (define %standard-phases (modify-phases gnu:%standard-phases - (delete 'configure) + (replace 'configure configure) (replace 'build build) (delete 'check) (replace 'install install))) -- cgit v1.2.3 From 1ab9e483391f8b62b873833ea71cb0074efa03e7 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 10 Jul 2017 00:04:09 +0200 Subject: syscalls: Adjust 'dirent64' struct for GNU/Hurd. Reported by rennes@openmailbox.org. * guix/build/syscalls.scm (file-type->symbol): New procedure. (%struct-dirent-header): Rename to... (%struct-dirent-header/linux): ... this. Rename introduced bindings as well. (%struct-dirent-header/hurd): New C struct. (define-generic-identifier): New macro. (read-dirent-header, %struct-dirent-header, sizeof-dirent-header): Define in terms of 'define-generic-identifier'. --- guix/build/syscalls.scm | 78 +++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 63 insertions(+), 15 deletions(-) (limited to 'guix/build') diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm index 9c082b4352..549612fa3c 100644 --- a/guix/build/syscalls.scm +++ b/guix/build/syscalls.scm @@ -21,6 +21,7 @@ (define-module (guix build syscalls) #:use-module (system foreign) + #:use-module (system base target) ;for cross-compilation support #:use-module (rnrs bytevectors) #:autoload (ice-9 binary-ports) (get-bytevector-n) #:use-module (srfi srfi-1) @@ -824,28 +825,75 @@ system to PUT-OLD." ;;; Opendir & co. ;;; -(define-c-struct %struct-dirent-header - sizeof-dirent-header +(define (file-type->symbol type) + ;; Convert TYPE to symbols like 'stat:type' does. + (cond ((= type DT_REG) 'regular) + ((= type DT_LNK) 'symlink) + ((= type DT_DIR) 'directory) + ((= type DT_FIFO) 'fifo) + ((= type DT_CHR) 'char-special) + ((= type DT_BLK) 'block-special) + ((= type DT_SOCK) 'socket) + (else 'unknown))) + +;; 'struct dirent64' for GNU/Linux. +(define-c-struct %struct-dirent-header/linux + sizeof-dirent-header/linux (lambda (inode offset length type name) - ;; Convert TYPE to symbols like 'stat:type' does. - (let ((type (cond ((= type DT_REG) 'regular) - ((= type DT_LNK) 'symlink) - ((= type DT_DIR) 'directory) - ((= type DT_FIFO) 'fifo) - ((= type DT_CHR) 'char-special) - ((= type DT_BLK) 'block-special) - ((= type DT_SOCK) 'socket) - (else 'unknown)))) - `((type . ,type) - (inode . ,inode)))) - read-dirent-header - write-dirent-header! + `((type . ,(file-type->symbol type)) + (inode . ,inode))) + read-dirent-header/linux + write-dirent-header!/linux (inode int64) (offset int64) (length unsigned-short) (type uint8) (name uint8)) ;first byte of 'd_name' +;; 'struct dirent64' for GNU/Hurd. +(define-c-struct %struct-dirent-header/hurd + sizeof-dirent-header/hurd + (lambda (inode length type name-length name) + `((type . ,(file-type->symbol type)) + (inode . ,inode))) + read-dirent-header/hurd + write-dirent-header!/hurd + (inode int64) + (length unsigned-short) + (type uint8) + (namelen uint8) + (name uint8)) + +(define-syntax define-generic-identifier + (syntax-rules (gnu/linux gnu/hurd =>) + "Define a generic identifier that adjust to the current GNU variant." + ((_ id (gnu/linux => linux) (gnu/hurd => hurd)) + (define-syntax id + (lambda (s) + (syntax-case s () + ((_ args (... ...)) + (if (string-contains (or (target-type) %host-type) + "linux") + #'(linux args (... ...)) + #'(hurd args (... ...)))) + (_ + (if (string-contains (or (target-type) %host-type) + "linux") + #'linux + #'hurd)))))))) + +(define-generic-identifier read-dirent-header + (gnu/linux => read-dirent-header/linux) + (gnu/hurd => read-dirent-header/hurd)) + +(define-generic-identifier %struct-dirent-header + (gnu/linux => %struct-dirent-header/linux) + (gnu/hurd => %struct-dirent-header/hurd)) + +(define-generic-identifier sizeof-dirent-header + (gnu/linux => sizeof-dirent-header/linux) + (gnu/hurd => sizeof-dirent-header/hurd)) + ;; Constants for the 'type' field, from . (define DT_UNKNOWN 0) (define DT_FIFO 1) -- cgit v1.2.3