diff options
author | Ludovic Courtès <ludo@gnu.org> | 2019-07-17 15:51:10 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2019-07-17 15:51:10 +0200 |
commit | 64de896a71a9ba3091259834077d54c0146bdab6 (patch) | |
tree | da58cc584fcc42a2b04f692aa3b1ada4c8949f5e /doc | |
parent | 5247aab8d6a18a4081ab7caeddb4fc083bca1f6b (diff) | |
parent | 6bfcb729268e0d20c6ae78224aef0eaad2ee2e74 (diff) | |
download | patches-64de896a71a9ba3091259834077d54c0146bdab6.tar patches-64de896a71a9ba3091259834077d54c0146bdab6.tar.gz |
Merge branch 'master' into core-updates
Diffstat (limited to 'doc')
-rw-r--r-- | doc/build.scm | 369 | ||||
-rw-r--r-- | doc/contributing.texi | 39 | ||||
-rw-r--r-- | doc/guix.texi | 36 |
3 files changed, 267 insertions, 177 deletions
diff --git a/doc/build.scm b/doc/build.scm index e628a91048..7ba9f57bc9 100644 --- a/doc/build.scm +++ b/doc/build.scm @@ -34,6 +34,7 @@ (gnu packages gawk) (gnu packages gettext) (gnu packages guile) + (gnu packages iso-codes) (gnu packages texinfo) (gnu packages tex) (srfi srfi-19) @@ -176,6 +177,9 @@ makeinfo OPTIONS." #:languages languages #:date date)) + (define images + (texinfo-manual-images source)) + (define build (with-imported-modules '((guix build utils)) #~(begin @@ -183,7 +187,7 @@ makeinfo OPTIONS." (ice-9 match)) (define (normalize language) - ;; Normalize LANGUAGE. For instance, "zh_CN" become "zh-cn". + ;; Normalize LANGUAGE. For instance, "zh_CN" becomes "zh-cn". (string-map (match-lambda (#\_ #\-) (chr chr)) @@ -227,7 +231,15 @@ makeinfo OPTIONS." "" (string-append "." language)) ".html") - opts))) + opts) + + ;; Make sure images are available. + (symlink #$images + (string-append #$output "/" (normalize language) + "/images")) + (symlink #$images + (string-append #$output "/" (normalize language) + "/html_node/images")))) '#$languages)))) (computed-file (string-append manual "-html-manual") build)) @@ -365,157 +377,208 @@ from SOURCE." (manual "guix") (date 1)) (define build - (with-imported-modules '((guix build utils)) - #~(begin - (use-modules (guix build utils) - (ice-9 match) - (ice-9 popen) - (sxml simple) - (srfi srfi-19)) - - (define (normalize language) ;XXX: deduplicate - ;; Normalize LANGUAGE. For instance, "zh_CN" become "zh-cn". - (string-map (match-lambda - (#\_ #\-) - (chr chr)) - (string-downcase language))) - - (define-syntax-rule (with-language language exp ...) - (let ((lang (getenv "LANGUAGE"))) - (dynamic-wind - (lambda () - (setenv "LANGUAGE" language) - (setlocale LC_MESSAGES)) - (lambda () exp ...) - (lambda () - (if lang - (setenv "LANGUAGE" lang) - (unsetenv "LANGUAGE")) - (setlocale LC_MESSAGES))))) - - ;; (put 'with-language 'scheme-indent-function 1) - (define* (translate str language - #:key (domain "guix-manual")) - (define exp - `(begin - (bindtextdomain "guix-manual" - #+(guix-manual-text-domain - source - languages)) - (write (gettext ,str "guix-manual")))) - - (with-language language - ;; Since the 'gettext' function caches msgid translations, - ;; regardless of $LANGUAGE, we have to spawn a new process each - ;; time we want to translate to a different language. Bah! - (let* ((pipe (open-pipe* OPEN_READ - #+(file-append guile-2.2 - "/bin/guile") - "-c" (object->string exp))) - (str (read pipe))) - (close-pipe pipe) - str))) - - (define (seconds->string seconds language) - (let* ((time (make-time time-utc 0 seconds)) - (date (time-utc->date time))) - (with-language language (date->string date "~e ~B ~Y")))) - - (define (guix-url path) - (string-append #$%web-site-url path)) - - (define (sxml-index language) - (define title - (translate "GNU Guix Reference Manual" language)) - - ;; FIXME: Avoid duplicating styling info from guix-artwork.git. - `(html (@ (lang ,language)) - (head - (title ,(string-append title " — GNU Guix")) - (meta (@ (charset "UTF-8"))) - (meta (@ (name "viewport") (content "width=device-width, initial-scale=1.0"))) - ;; Menu prefetch. - (link (@ (rel "prefetch") (href ,(guix-url "menu/index.html")))) - ;; Base CSS. - (link (@ (rel "stylesheet") (href ,(guix-url "static/base/css/elements.css")))) - (link (@ (rel "stylesheet") (href ,(guix-url "static/base/css/common.css")))) - (link (@ (rel "stylesheet") (href ,(guix-url "static/base/css/messages.css")))) - (link (@ (rel "stylesheet") (href ,(guix-url "static/base/css/navbar.css")))) - (link (@ (rel "stylesheet") (href ,(guix-url "static/base/css/breadcrumbs.css")))) - (link (@ (rel "stylesheet") (href ,(guix-url "static/base/css/buttons.css")))) - (link (@ (rel "stylesheet") (href ,(guix-url "static/base/css/footer.css")))) - - (link (@ (rel "stylesheet") (href ,(guix-url "static/base/css/page.css")))) - (link (@ (rel "stylesheet") (href ,(guix-url "static/base/css/post.css"))))) - (body - (header (@ (class "navbar")) - (h1 (a (@ (class "branding") - (href #$%web-site-url))) - (span (@ (class "a11y-offset")) - "Guix")) - (nav (@ (class "menu")))) - (nav (@ (class "breadcrumbs")) - (a (@ (class "crumb") - (href #$%web-site-url)) - "Home")) - (main - (article - (@ (class "page centered-block limit-width")) - (h2 ,title) - (p (@ (class "post-metadata centered-text")) - #$version " — " - ,(seconds->string #$date language)) - - (div - (ul - (li (a (@ (href "html_node")) - "HTML, with one page per node")) - (li (a (@ (href - ,(string-append - #$manual - (if (string=? language - "en") - "" - (string-append "." - language)) - ".html"))) - "HTML, entirely on one page")) - ,@(if (member language '("ru" "zh_CN")) - '() - `((li (a (@ (href ,(string-append - #$manual - (if (string=? language "en") - "" - (string-append "." - language)) - ".pdf")))) - "PDF"))))))) - (footer)))) - - (define (write-index language file) - (call-with-output-file file - (lambda (port) - (display "<!DOCTYPE html>\n" port) - (sxml->xml (sxml-index language) port)))) - - (setenv "GUIX_LOCPATH" - #+(file-append glibc-utf8-locales "/lib/locale")) - (setenv "LC_ALL" "en_US.utf8") - (setlocale LC_ALL "en_US.utf8") - - (bindtextdomain "guix-manual" - #+(guix-manual-text-domain source languages)) - - (for-each (lambda (language) - (define directory - (string-append #$output "/" - (normalize language))) - - (mkdir-p directory) - (write-index language - (string-append directory - "/index.html"))) - '#$languages)))) + (with-extensions (list guile-json-3) + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (guix build utils) + (json) + (ice-9 match) + (ice-9 popen) + (sxml simple) + (srfi srfi-1) + (srfi srfi-19)) + + (define (normalize language) ;XXX: deduplicate + ;; Normalize LANGUAGE. For instance, "zh_CN" becomes "zh-cn". + (string-map (match-lambda + (#\_ #\-) + (chr chr)) + (string-downcase language))) + + (define-syntax-rule (with-language language exp ...) + (let ((lang (getenv "LANGUAGE"))) + (dynamic-wind + (lambda () + (setenv "LANGUAGE" language) + (setlocale LC_MESSAGES)) + (lambda () exp ...) + (lambda () + (if lang + (setenv "LANGUAGE" lang) + (unsetenv "LANGUAGE")) + (setlocale LC_MESSAGES))))) + + ;; (put 'with-language 'scheme-indent-function 1) + (define* (translate str language + #:key (domain "guix-manual")) + (define exp + `(begin + (bindtextdomain "guix-manual" + #+(guix-manual-text-domain + source + languages)) + (bindtextdomain "iso_639-3" ;language names + #+(file-append iso-codes + "/share/locale")) + (write (gettext ,str ,domain)))) + + (with-language language + ;; Since the 'gettext' function caches msgid translations, + ;; regardless of $LANGUAGE, we have to spawn a new process each + ;; time we want to translate to a different language. Bah! + (let* ((pipe (open-pipe* OPEN_READ + #+(file-append guile-2.2 + "/bin/guile") + "-c" (object->string exp))) + (str (read pipe))) + (close-pipe pipe) + str))) + + (define (seconds->string seconds language) + (let* ((time (make-time time-utc 0 seconds)) + (date (time-utc->date time))) + (with-language language (date->string date "~e ~B ~Y")))) + + (define (guix-url path) + (string-append #$%web-site-url path)) + + (define (sxml-index language title body) + ;; FIXME: Avoid duplicating styling info from guix-artwork.git. + `(html (@ (lang ,language)) + (head + (title ,(string-append title " — GNU Guix")) + (meta (@ (charset "UTF-8"))) + (meta (@ (name "viewport") (content "width=device-width, initial-scale=1.0"))) + ;; Menu prefetch. + (link (@ (rel "prefetch") (href ,(guix-url "menu/index.html")))) + ;; Base CSS. + (link (@ (rel "stylesheet") (href ,(guix-url "static/base/css/elements.css")))) + (link (@ (rel "stylesheet") (href ,(guix-url "static/base/css/common.css")))) + (link (@ (rel "stylesheet") (href ,(guix-url "static/base/css/messages.css")))) + (link (@ (rel "stylesheet") (href ,(guix-url "static/base/css/navbar.css")))) + (link (@ (rel "stylesheet") (href ,(guix-url "static/base/css/breadcrumbs.css")))) + (link (@ (rel "stylesheet") (href ,(guix-url "static/base/css/buttons.css")))) + (link (@ (rel "stylesheet") (href ,(guix-url "static/base/css/footer.css")))) + + (link (@ (rel "stylesheet") (href ,(guix-url "static/base/css/page.css")))) + (link (@ (rel "stylesheet") (href ,(guix-url "static/base/css/post.css"))))) + (body + (header (@ (class "navbar")) + (h1 (a (@ (class "branding") + (href #$%web-site-url))) + (span (@ (class "a11y-offset")) + "Guix")) + (nav (@ (class "menu")))) + (nav (@ (class "breadcrumbs")) + (a (@ (class "crumb") + (href #$%web-site-url)) + "Home")) + ,body + (footer)))) + + (define (language-index language) + (define title + (translate "GNU Guix Reference Manual" language)) + + (sxml-index + language title + `(main + (article + (@ (class "page centered-block limit-width")) + (h2 ,title) + (p (@ (class "post-metadata centered-text")) + #$version " — " + ,(seconds->string #$date language)) + + (div + (ul + (li (a (@ (href "html_node")) + "HTML, with one page per node")) + (li (a (@ (href + ,(string-append + #$manual + (if (string=? language + "en") + "" + (string-append "." + language)) + ".html"))) + "HTML, entirely on one page")) + ,@(if (member language '("ru" "zh_CN")) + '() + `((li (a (@ (href ,(string-append + #$manual + (if (string=? language "en") + "" + (string-append "." + language)) + ".pdf")))) + "PDF"))))))))) + + (define %iso639-languages + (vector->list + (assoc-ref (call-with-input-file + #+(file-append iso-codes + "/share/iso-codes/json/iso_639-3.json") + json->scm) + "639-3"))) + + (define (language-code->name code) + "Return the full name of a language from its ISO-639-3 code." + (let ((code (match (string-index code #\_) + (#f code) + (index (string-take code index))))) + (any (lambda (language) + (and (string=? (or (assoc-ref language "alpha_2") + (assoc-ref language "alpha_3")) + code) + (assoc-ref language "name"))) + %iso639-languages))) + + (define (top-level-index languages) + (define title + "GNU Guix Reference Manual") + (sxml-index + "en" title + `(main + (article + (@ (class "page centered-block limit-width")) + (h2 ,title) + (div + "The GNU Guix Reference Manual is available in the following +languages:\n" + (ul + ,@(map (lambda (language) + `(li (a (@ (href ,(normalize language))) + ,(translate + (language-code->name language) + language + #:domain "iso_639-3")))) + languages))))))) + + (define (write-html file sxml) + (call-with-output-file file + (lambda (port) + (display "<!DOCTYPE html>\n" port) + (sxml->xml sxml port)))) + + (setenv "GUIX_LOCPATH" + #+(file-append glibc-utf8-locales "/lib/locale")) + (setenv "LC_ALL" "en_US.utf8") + (setlocale LC_ALL "en_US.utf8") + + (for-each (lambda (language) + (define directory + (string-append #$output "/" + (normalize language))) + + (mkdir-p directory) + (write-html (string-append directory "/index.html") + (language-index language))) + '#$languages) + + (write-html (string-append #$output "/index.html") + (top-level-index '#$languages)))))) (computed-file "html-indexes" build)) diff --git a/doc/contributing.texi b/doc/contributing.texi index e00634eed4..59917193f1 100644 --- a/doc/contributing.texi +++ b/doc/contributing.texi @@ -38,19 +38,6 @@ version from the Git repository: git clone https://git.savannah.gnu.org/git/guix.git @end example -When building Guix from a checkout, -the following packages are required in addition to those mentioned in -the installation instructions (@pxref{Requirements}). - -@itemize -@item @url{http://gnu.org/software/autoconf/, GNU Autoconf}; -@item @url{http://gnu.org/software/automake/, GNU Automake}; -@item @url{http://gnu.org/software/gettext/, GNU Gettext}; -@item @url{http://gnu.org/software/texinfo/, GNU Texinfo}; -@item @url{http://www.graphviz.org/, Graphviz}; -@item @url{http://www.gnu.org/software/help2man/, GNU Help2man (optional)}. -@end itemize - The easiest way to set up a development environment for Guix is, of course, by using Guix! The following command starts a new shell where all the dependencies and appropriate environment variables are set up to @@ -61,7 +48,22 @@ guix environment guix --pure @end example @xref{Invoking guix environment}, for more information on that command. -Extra dependencies can be added with @option{--ad-hoc}: + +If you are unable to use Guix when building Guix from a checkout, the +following are the required packages in addition to those mentioned in the +installation instructions (@pxref{Requirements}). + +@itemize +@item @url{http://gnu.org/software/autoconf/, GNU Autoconf}; +@item @url{http://gnu.org/software/automake/, GNU Automake}; +@item @url{http://gnu.org/software/gettext/, GNU Gettext}; +@item @url{http://gnu.org/software/texinfo/, GNU Texinfo}; +@item @url{http://www.graphviz.org/, Graphviz}; +@item @url{http://www.gnu.org/software/help2man/, GNU Help2man (optional)}. +@end itemize + +On Guix, extra dependencies can be added by instead running @command{guix +environment} with @option{--ad-hoc}: @example guix environment guix --pure --ad-hoc help2man git strace @@ -113,8 +115,8 @@ run @code{make install}. To do that, you first need to have an environment with all the dependencies available (@pxref{Building from Git}), and then simply prefix each command with @command{./pre-inst-env} (the @file{pre-inst-env} script lives in the -top build tree of Guix; it is generated by @command{./configure}), -as in@footnote{The @option{-E} flag to +top build tree of Guix; it is generated by @command{./configure}). +An example@footnote{The @option{-E} flag to @command{sudo} guarantees that @code{GUILE_LOAD_PATH} is correctly set such that @command{guix-daemon} and the tools it uses can find the Guile modules they need.}: @@ -125,7 +127,7 @@ $ ./pre-inst-env guix build hello @end example @noindent -Similarly, for a Guile session using the Guix modules: +Similarly, an example for a Guile session using the Guix modules: @example $ ./pre-inst-env guile -c '(use-modules (guix utils)) (pk (%current-system))' @@ -982,5 +984,6 @@ first send one message to @email{guix-patches@@gnu.org}, and then send subsequent patches to @email{@var{NNN}@@debbugs.gnu.org} to make sure they are kept together. See @uref{https://debbugs.gnu.org/Advanced.html, the Debbugs documentation} -for more information. +for more information. You can install @command{git send-email} with +@command{guix install git:send-email}. @c Debbugs bug: https://debbugs.gnu.org/db/15/15361.html diff --git a/doc/guix.texi b/doc/guix.texi index cb2cfed637..f988f4a8bd 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -11,7 +11,7 @@ @c Identifier of the OpenPGP key used to sign tarballs and such. @set OPENPGP-SIGNING-KEY-ID 3CE464558A84FDC69DB40CFB090B11993D9AEBB5 -@set KEY-SERVER pool.sks-keyservers.net +@set OPENPGP-SIGNING-KEY-URL https://sv.gnu.org/people/viewgpg.php?user_id=15145 @c Base URL for downloads. @set BASE-URL https://ftp.gnu.org/gnu/guix @@ -558,8 +558,8 @@ If that command fails because you do not have the required public key, then run this command to import it: @example -$ gpg --keyserver @value{KEY-SERVER} \ - --recv-keys @value{OPENPGP-SIGNING-KEY-ID} +$ wget @value{OPENPGP-SIGNING-KEY-URL} \ + -qO - | gpg --import - @end example @noindent @@ -1905,8 +1905,8 @@ If that command fails because you do not have the required public key, then run this command to import it: @example -$ gpg --keyserver @value{KEY-SERVER} \ - --recv-keys @value{OPENPGP-SIGNING-KEY-ID} +$ wget @value{OPENPGP-SIGNING-KEY-URL} \ + -qO - | gpg --import - @end example @noindent @@ -3921,6 +3921,19 @@ For the sake of reliability and maintainability, you should avoid dependencies on channels that you don't control, and you should aim to keep the number of dependencies to a minimum. +@cindex subdirectory, channels +@subsection Package Modules in a Sub-directory + +As a channel author, you may want to keep your channel modules in a +sub-directory. If your modules are in the sub-directory @file{guix}, you must +add a meta-data file @file{.guix-channel} that contains: + +@lisp +(channel + (version 0) + (directory "guix")) +@end lisp + @subsection Replicating Guix @cindex pinning, channels @@ -6333,6 +6346,17 @@ the module (in the "arguments" form of a package using the linux-module-build-system, use the key #:linux to specify it). @end defvr +@defvr {Scheme Variable} node-build-system +This variable is exported by @code{(guix build-system node)}. It +implements the build procedure used by @uref{http://nodejs.org, +Node.js}, which implements an approximation of the @code{npm install} +command, followed by an @code{npm test} command. + +Which Node.js package is used to interpret the @code{npm} commands can +be specified with the @code{#:node} parameter which defaults to +@code{node}. +@end defvr + Lastly, for packages that do not need anything as sophisticated, a ``trivial'' build system is provided. It is trivial in the sense that it provides basically no support: it does not pull any implicit inputs, @@ -25547,7 +25571,7 @@ vm-image} on x86_64 hardware: @example $ qemu-system-x86_64 \ -net user -net nic,model=virtio \ - -enable-kvm -m 512 \ + -enable-kvm -m 1024 \ -device virtio-blk,drive=myhd \ -drive if=none,file=/tmp/qemu-image,id=myhd @end example |