From f2619dde702d145ec64c77a2064080ccfedff570 Mon Sep 17 00:00:00 2001 From: Raghav Gururajan Date: Fri, 12 Jun 2020 08:58:06 -0400 Subject: [PATCH 19/58] gnu: Add asciidoctor. * gnu/packages/documentation.scm (asciidoctor): New variable. --- gnu/packages/documentation.scm | 177 +++++++++++++++++++++------------ 1 file changed, 114 insertions(+), 63 deletions(-) diff --git a/gnu/packages/documentation.scm b/gnu/packages/documentation.scm index dcacdb456f..bc9f5838dc 100644 --- a/gnu/packages/documentation.scm +++ b/gnu/packages/documentation.scm @@ -27,11 +27,13 @@ (define-module (gnu packages documentation) #:use-module (guix licenses) + #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) #:use-module (guix download) #:use-module (guix git-download) #:use-module (guix build-system gnu) #:use-module (guix build-system cmake) + #:use-module (guix build-system ruby) #:use-module (gnu packages) #:use-module (gnu packages autotools) #:use-module (gnu packages base) @@ -43,9 +45,58 @@ #:use-module (gnu packages graphviz) #:use-module (gnu packages gettext) #:use-module (gnu packages glib) + #:use-module (gnu packages maths) #:use-module (gnu packages perl) + #:use-module (gnu packages ruby) #:use-module (gnu packages xml)) +(define-public asciidoctor + (package + (name "asciidoctor") + (version "2.0.10") + (source + (origin + (method git-fetch) + (uri + (git-reference + (url "https://github.com/asciidoctor/asciidoctor.git") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 "0jaxpnsdnx3qyjw5p2lsx1swny12q1i2vxw2kgdp4vlsyjv95z95")))) + (build-system ruby-build-system) + (arguments + `(#:phases + (modify-phases %standard-phases + (add-after 'unpack 'remove-failing-tests + (lambda _ + (with-directory-excursion "test" + ;; These tests require network access. + (for-each delete-file + (list + "blocks_test.rb" + "substitutions_test.rb"))) + #t))))) + (inputs + `(("asciimath" ,ruby-asciimath) + ("coderay" ,ruby-coderay) + ("concurrent" ,ruby-concurrent) + ("cucumber" ,ruby-cucumber) + ("erubis" ,ruby-erubis) + ("haml" ,ruby-haml) + ("minitest" ,ruby-minitest) + ("nokogiri" ,ruby-nokogiri) + ("rake" ,ruby-rake) + ("rouge" ,ruby-rouge) + ("rspec-expectations" ,ruby-rspec-expectations) + ("slim" ,ruby-slim) + ("tilt" ,ruby-tilt))) + (synopsis "Text processor and publishing toolchain") + (description "Asciidoctor is a fast text processor and publishing toolchain +for converting AsciiDoc content to HTML5, DocBook, PDF, and other formats.") + (home-page "https://asciidoctor.org/") + (license license:expat))) + (define-public asciidoc (package (name "asciidoc") @@ -72,38 +123,38 @@ ;; "--no-xmllint" option, a missing "xsltproc" binary. ;; The following phase enables asciidoc to find some of them. (add-before 'configure 'set-xml-binary-paths - (lambda* (#:key inputs #:allow-other-keys) - (let* ((libxml2 (assoc-ref inputs "libxml2")) - (xmllint (string-append libxml2 "/bin/xmllint")) - (libxslt (assoc-ref inputs "libxslt")) - (xsltproc (string-append libxslt "/bin/xsltproc"))) - (substitute* "a2x.py" - (("XMLLINT = 'xmllint'") - (string-append "XMLLINT = '" xmllint "'")) - (("XSLTPROC = 'xsltproc'") - (string-append "XSLTPROC = '" xsltproc "'"))) - #t))) + (lambda* (#:key inputs #:allow-other-keys) + (let* ((libxml2 (assoc-ref inputs "libxml2")) + (xmllint (string-append libxml2 "/bin/xmllint")) + (libxslt (assoc-ref inputs "libxslt")) + (xsltproc (string-append libxslt "/bin/xsltproc"))) + (substitute* "a2x.py" + (("XMLLINT = 'xmllint'") + (string-append "XMLLINT = '" xmllint "'")) + (("XSLTPROC = 'xsltproc'") + (string-append "XSLTPROC = '" xsltproc "'"))) + #t))) ;; Make asciidoc use the local docbook-xsl package instead of fetching ;; it from the internet at run-time. (add-before 'install 'make-local-docbook-xsl - (lambda* (#:key inputs #:allow-other-keys) - (substitute* (find-files "docbook-xsl" ".*\\.xsl$") - (("xsl:import href=\"http://docbook.sourceforge.net/\ + (lambda* (#:key inputs #:allow-other-keys) + (substitute* (find-files "docbook-xsl" ".*\\.xsl$") + (("xsl:import href=\"http://docbook.sourceforge.net/\ release/xsl/current") - (string-append - "xsl:import href=\"" - (string-append (assoc-ref inputs "docbook-xsl") - "/xml/xsl/docbook-xsl-" - ,(package-version docbook-xsl))))) - #t)) + (string-append + "xsl:import href=\"" + (string-append (assoc-ref inputs "docbook-xsl") + "/xml/xsl/docbook-xsl-" + ,(package-version docbook-xsl))))) + #t)) ;; Do the same for docbook-xml. (add-before 'install 'make-local-docbook-xml - (lambda* (#:key inputs #:allow-other-keys) - (substitute* "docbook45.conf" - (("http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd") - (string-append (assoc-ref inputs "docbook-xml") - "/xml/dtd/docbook/docbookx.dtd"))) - #t))))) + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "docbook45.conf" + (("http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd") + (string-append (assoc-ref inputs "docbook-xml") + "/xml/dtd/docbook/docbookx.dtd"))) + #t))))) (native-inputs `(("autoconf" ,autoconf))) (inputs `(("python" ,python-2) @@ -126,26 +177,26 @@ markup) can be customized and extended by the user.") (define-public asciidoc-py3 (package (inherit asciidoc) - (name "asciidoc-py3") - (version "9.0.0rc1") - (source (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/asciidoc/asciidoc-py3/") - (commit version))) - (file-name (git-file-name name version)) - (sha256 - (base32 - "1v815dgab62970m9cr2crwbh4kvlzk6pv3hk4bzv6gfa4lbwfkfl")))) - (build-system gnu-build-system) - (native-inputs - `(("autoconf" ,autoconf))) - (inputs - `(("python" ,python) - ("docbook-xml" ,docbook-xml) - ("docbook-xsl" ,docbook-xsl) - ("libxml2" ,libxml2) - ("libxslt" ,libxslt))))) + (name "asciidoc-py3") + (version "9.0.0rc1") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/asciidoc/asciidoc-py3/") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1v815dgab62970m9cr2crwbh4kvlzk6pv3hk4bzv6gfa4lbwfkfl")))) + (build-system gnu-build-system) + (native-inputs + `(("autoconf" ,autoconf))) + (inputs + `(("python" ,python) + ("docbook-xml" ,docbook-xml) + ("docbook-xsl" ,docbook-xsl) + ("libxml2" ,libxml2) + ("libxslt" ,libxslt))))) (define-public doxygen (package @@ -153,17 +204,17 @@ markup) can be customized and extended by the user.") (version "1.8.17") (home-page "http://www.doxygen.nl/") (source (origin - (method url-fetch) - (uri (list (string-append home-page "files/doxygen-" - version ".src.tar.gz") - (string-append "mirror://sourceforge/doxygen/rel-" - version "/doxygen-" version - ".src.tar.gz"))) - (sha256 - (base32 - "16dmv0gm1x8rvbm82fmjvi213q8fxqxinm75pcf595flya59ific")) - (patches (search-patches "doxygen-test.patch" - "doxygen-1.8.17-runtests.patch")))) + (method url-fetch) + (uri (list (string-append home-page "files/doxygen-" + version ".src.tar.gz") + (string-append "mirror://sourceforge/doxygen/rel-" + version "/doxygen-" version + ".src.tar.gz"))) + (sha256 + (base32 + "16dmv0gm1x8rvbm82fmjvi213q8fxqxinm75pcf595flya59ific")) + (patches (search-patches "doxygen-test.patch" + "doxygen-1.8.17-runtests.patch")))) (build-system cmake-build-system) (native-inputs `(("bison" ,bison) @@ -184,12 +235,12 @@ markup) can be customized and extended by the user.") #:test-target "tests" #:phases (modify-phases %standard-phases (add-before 'configure 'patch-sh - (lambda* (#:key inputs #:allow-other-keys) - (substitute* "src/portable.cpp" - (("/bin/sh") - (string-append - (assoc-ref inputs "bash") "/bin/sh"))) - #t))))) + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "src/portable.cpp" + (("/bin/sh") + (string-append + (assoc-ref inputs "bash") "/bin/sh"))) + #t))))) (synopsis "Generate documentation from annotated sources") (description "Doxygen is the de facto standard tool for generating documentation from annotated C++ sources, but it also supports other popular -- 2.26.2