gnu: batctl: Update to 2020.0.
[jackhill/guix/guix.git] / gnu / packages / javascript.scm
index 6718274..467a7d0 100644 (file)
@@ -2,7 +2,7 @@
 ;;; Copyright © 2017 Arun Isaac <arunisaac@systemreboot.net>
 ;;; Copyright © 2017, 2019 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
-;;; Copyright © 2017, 2018, 2019 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2017, 2018, 2019, 2020 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2018 Nicolas Goaziou <mail@nicolasgoaziou.fr>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -25,7 +25,6 @@
   #:use-module (gnu packages)
   #:use-module (gnu packages base)
   #:use-module (gnu packages compression)
-  #:use-module (gnu packages lisp)
   #:use-module (gnu packages lisp-xyz)
   #:use-module (gnu packages readline)
   #:use-module (guix packages)
     (version "2.7.2")
     (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"))
+       (method git-fetch)
+       (uri (git-reference
+              (url "https://github.com/mathjax/MathJax")
+              (commit version)))
+       (file-name (git-file-name name version))
        (sha256
         (base32
-         "1r72di4pg4i6pfhcskkxqmf1158m81ki6a7lbw6nz4zh7xw23hy4"))))
+         "127j12g7v2hx6k7r00b8cp49s7nkrwhxy6l8p03pw34xpxbgbimm"))))
     (build-system trivial-build-system)
     (arguments
      `(#:modules ((guix build utils))
        (begin
          (use-modules (guix build utils)
                       (ice-9 match))
-         (set-path-environment-variable
-          "PATH" '("bin") (map (match-lambda
-                                 ((_ . input)
-                                  input))
-                               %build-inputs))
          (let ((install-directory (string-append %output "/share/fonts/mathjax")))
            (mkdir-p install-directory)
-           (invoke "tar" "-C" install-directory "-xvf"
-                   (assoc-ref %build-inputs "source")
-                   ,(string-append "MathJax-" version "/fonts")
-                   "--strip" "2")))))
-    (native-inputs
-     `(("gzip" ,gzip)
-       ("tar" ,tar)))
+           (copy-recursively (string-append (assoc-ref %build-inputs "source")
+                                            "/fonts")
+                             install-directory)))))
     (home-page "https://www.mathjax.org/")
     (synopsis "Fonts for MathJax")
     (description "This package contains the fonts required for MathJax.")
           (list (assoc-ref %build-inputs "glibc-utf8-locales")))
          (setenv "LANG" "en_US.UTF-8")
          (let ((install-directory (string-append %output "/share/javascript/mathjax")))
-           (invoke "tar" "xvf" (assoc-ref %build-inputs "source")
-                   ,(string-append "MathJax-" (package-version font-mathjax)
-                                   "/unpacked")
-                   "--strip" "2")
+           (copy-recursively (string-append (assoc-ref %build-inputs "source") "/unpacked")
+                             "MathJax-unpacked")
            (mkdir-p install-directory)
            (symlink (string-append (assoc-ref %build-inputs "font-mathjax")
                                    "/share/fonts/mathjax")
            (for-each
             (lambda (file)
               (let ((installed (string-append install-directory
-                                              ;; remove prefix "."
-                                              (string-drop file 1))))
+                                              ;; remove prefix "./MathJax-unpacked"
+                                              (string-drop file 18))))
                 (format #t "~a -> ~a~%" file installed)
                 (cond
                  ((string-match "\\.js$" file)
@@ -345,7 +333,7 @@ Worker, but it can be used in other JavaScript environments.")
                 "15gichl8wi6yxag2ps723nxrgyan15976dzsnvw9h9py8sbyyzjn"))))
     (build-system minify-build-system)
     (arguments `(#:javascript-files '("src/selectize.js")))
-    (home-page "http://selectize.github.io/selectize.js/")
+    (home-page "https://selectize.github.io/selectize.js/")
     (synopsis "Hybrid widget between a textbox and <select> box")
     (description "Selectize is the hybrid of a textbox and @code{<select>}
 box.  It's jQuery based and it has autocomplete and native-feeling keyboard
@@ -453,50 +441,3 @@ to use, and is very similar to Lua.  There is no need to interact with byzantine
 C++ template mechanisms, or worry about marking and unmarking garbage collection
 roots, or wrestle with obscure build systems.")
     (license license:isc)))
-
-(define-public uglify-js
-  (package
-    (inherit sbcl-cl-uglify-js)
-    (name "uglify-js")
-    (build-system trivial-build-system)
-    (arguments
-     `(#:modules ((guix build utils))
-       #:builder
-       (let* ((bin    (string-append (assoc-ref %outputs "out") "/bin/"))
-              (script (string-append bin "uglify-js")))
-         (use-modules (guix build utils))
-         (mkdir-p bin)
-         (with-output-to-file script
-           (lambda _
-             (format #t "#!~a/bin/sbcl --script
- (require :asdf)
- (push (truename \"~a/lib/sbcl\") asdf:*central-registry*)"
-                     (assoc-ref %build-inputs "sbcl")
-                     (assoc-ref %build-inputs "sbcl-cl-uglify-js"))
-             ;; FIXME: cannot use progn here because otherwise it fails to
-             ;; find cl-uglify-js.
-             (for-each
-              write
-              '(;; Quiet, please!
-                (let ((*standard-output* (make-broadcast-stream))
-                      (*error-output* (make-broadcast-stream)))
-                  (asdf:load-system :cl-uglify-js))
-                (let ((file (cadr *posix-argv*)))
-                  (if file
-                      (format t "~a"
-                              (cl-uglify-js:ast-gen-code
-                               (cl-uglify-js:ast-mangle
-                                (cl-uglify-js:ast-squeeze
-                                 (with-open-file (in file)
-                                                 (parse-js:parse-js in))))
-                               :beautify nil))
-                      (progn
-                       (format *error-output*
-                               "Please provide a JavaScript file.~%")
-                       (sb-ext:exit :code 1))))))))
-         (chmod script #o755)
-         #t)))
-    (inputs
-     `(("sbcl" ,sbcl)
-       ("sbcl-cl-uglify-js" ,sbcl-cl-uglify-js)))
-    (synopsis "JavaScript compressor")))