about summary refs log tree commit diff
path: root/gn/packages/javascript.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gn/packages/javascript.scm')
-rw-r--r--gn/packages/javascript.scm29
1 files changed, 19 insertions, 10 deletions
diff --git a/gn/packages/javascript.scm b/gn/packages/javascript.scm
index 6ba75ca..77ad6b4 100644
--- a/gn/packages/javascript.scm
+++ b/gn/packages/javascript.scm
@@ -1,5 +1,6 @@
 (define-module (gn packages javascript)
   #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (gnu packages base)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages javascript)
   #:use-module (gn packages web)
@@ -894,10 +895,14 @@ visualization components and a data-driven approach to DOM manipulation.")
     (source
       (origin
        (method url-fetch)
-       ;; note that D3 no longer provides a prebuilt JS file - except through CDS
-       (uri (string-append "https://files.genenetwork.org/software/d3.v" version ".min.js.gz"))
+       ;; D3 ships no prebuilt d3.min.js in its GitHub release, and the
+       ;; gzipped copy that used to be mirrored on
+       ;; files.genenetwork.org/software is gone (404), so take the
+       ;; npm tarball instead.
+       (uri (string-append "https://registry.npmjs.org/d3/-/d3-"
+                           version ".tgz"))
        (sha256
-        (base32 "0k7g40zb65s12z1zchvimj5xibkrqff5sylbrhcwmwpcplpigid7"))))
+        (base32 "0pim4jwa0j9aqdyjalxf2nr424wii3ccdj4pcy259fm221bn0dky"))))
     (build-system trivial-build-system)
     (arguments
      `(#:modules ((guix build utils))
@@ -906,17 +911,21 @@ visualization components and a data-driven approach to DOM manipulation.")
          (use-modules (guix build utils))
          (let* ((out (assoc-ref %outputs "out"))
                 (module-name "d3js-7")
-                (gzip (string-append (assoc-ref %build-inputs "gzip")
-                                      "/bin/gzip"))
-                (targetdir (string-append out "/share/genenetwork2/javascript/" module-name))
-                (jsname (string-append "d3.v" "7.9.0" ".min.js"))
-                (gzname (string-append jsname ".gz"))
+                (tar (string-append (assoc-ref %build-inputs "tar") "/bin/tar"))
+                (gzip (string-append (assoc-ref %build-inputs "gzip") "/bin/gzip"))
+                (targetdir (string-append out
+                                          "/share/genenetwork2/javascript/"
+                                          module-name))
                 (source (assoc-ref %build-inputs "source")))
+           (invoke tar (string-append "--use-compress-program=" gzip)
+                   "--extract" "--file" source)
            (mkdir-p targetdir)
-           (copy-file (pk source) (pk (string-append targetdir "/" gzname)))
-           (invoke gzip "-fd" (string-append targetdir "/" gzname))))))
+           (copy-file "package/dist/d3.min.js"
+                      (string-append targetdir "/d3.v7.9.0.min.js"))))))
     (native-inputs
      `(("source" ,source)
+       ("tar" ,tar)
+       ;; tar shells out to gzip to decompress the npm tarball.
        ("gzip" ,gzip)))
     (home-page "https://d3js.org/")
     (synopsis "JavaScript library for visualizing data")