From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37525) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGtGp-0005ix-HW for guix-patches@gnu.org; Fri, 02 Jun 2017 16:34:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dGtGm-000124-Cc for guix-patches@gnu.org; Fri, 02 Jun 2017 16:34:07 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:49259) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dGtGm-00011x-9T for guix-patches@gnu.org; Fri, 02 Jun 2017 16:34:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dGtGl-0008AI-5H for guix-patches@gnu.org; Fri, 02 Jun 2017 16:34:04 -0400 Subject: bug#27049: [PATCH 2/2] gnu: Add js-mathjax. Resent-Message-ID: Message-Id: <846e49f4.AEUAKzpfUbYAAAAAAAAAAAPEb_oAAAACwQwAAAAAAAW9WABZMcuW@mailjet.com> MIME-Version: 1.0 From: Arun Isaac Date: Sat, 3 Jun 2017 02:03:08 +0530 In-Reply-To: <20170602203308.7606-1-arunisaac@systemreboot.net> References: <20170602203308.7606-1-arunisaac@systemreboot.net> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 27049@debbugs.gnu.org * gnu/packages/javascript.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. * gnu/packages/javascript.scm (js-mathjax): New variable. --- gnu/local.mk | 1 + gnu/packages/javascript.scm | 90 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 gnu/packages/javascript.scm diff --git a/gnu/local.mk b/gnu/local.mk index e7d5ee2f4..efeb57ab9 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -208,6 +208,7 @@ GNU_SYSTEM_MODULES = \ %D%/packages/irc.scm \ %D%/packages/iso-codes.scm \ %D%/packages/java.scm \ + %D%/packages/javascript.scm \ %D%/packages/jemalloc.scm \ %D%/packages/jrnl.scm \ %D%/packages/julia.scm \ diff --git a/gnu/packages/javascript.scm b/gnu/packages/javascript.scm new file mode 100644 index 000000000..de8567dc4 --- /dev/null +++ b/gnu/packages/javascript.scm @@ -0,0 +1,90 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2017 Arun Isaac +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (gnu packages javascript) + #:use-module ((guix licenses) #:prefix license:) + #:use-module (gnu packages) + #:use-module (gnu packages base) + #:use-module (gnu packages compression) + #:use-module (gnu packages fonts) + #:use-module (gnu packages lisp) + #:use-module (guix packages) + #:use-module (guix download) + #:use-module (guix build-system trivial)) + +(define-public js-mathjax + (package + (name "js-mathjax") + (version "2.7.1") + (source + (origin + (method url-fetch) + (uri (string-append + "https://github.com/mathjax/MathJax/archive/" + version ".tar.gz")) + (file-name (string-append name "-" version ".tar.gz")) + (sha256 + (base32 + "0sbib5lk0jrvbq6s72ag6ss3wjlz5wnk07ddxij1kp96yg3c1d1b")))) + (build-system trivial-build-system) + (arguments + `(#:modules ((guix build utils)) + #:builder + (begin + (use-modules (guix build utils) + (ice-9 match) + (ice-9 regex)) + (setenv "PATH" (string-join (map (match-lambda + ((_ . input-path) + (string-append input-path "/bin"))) + %build-inputs) + ":")) + (let ((install-directory (string-append %output "/share/javascript/mathjax"))) + (system* "tar" "xvf" (assoc-ref %build-inputs "source") + "MathJax-2.7.1/unpacked" "--strip" "2") + (mkdir-p install-directory) + (symlink (string-append (assoc-ref %build-inputs "font-mathjax") + "/share/fonts/mathjax") + (string-append install-directory "/fonts")) + + (for-each + (lambda (file) + (let ((install-path (string-append install-directory + ;; remove prefix "." + (string-drop file 1)))) + (format #t "~a -> ~a~%" file install-path) + (cond + ((string-match "\\.js$" file) + (mkdir-p (dirname install-path)) + (system (format #f "uglify-js ~a > ~a" file install-path))) + (else + (install-file file (dirname install-path)))))) + (find-files ".")))))) + (native-inputs + `(("font-mathjax" ,font-mathjax) + ("gzip" ,gzip) + ("tar" ,tar) + ("uglify-js" ,uglify-js))) + (home-page "https://www.mathjax.org/") + (synopsis "JavaScript display engine for LaTeX, MathML, and AsciiMath") + (description "MathJax is a JavaScript display engine for LaTeX, MathML, +and AsciiMath notation that works in all modern browsers. It requires no +plugins or software to be installed on the browser. So the page author can +write web documents that include mathematics and be confident that readers will +be able to view it naturally and easily.") + (license license:asl2.0))) -- 2.12.2