| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 |
|
| 22 | (define-module (gnu packages node)
|
| 23 | #:use-module ((guix licenses) #:select (expat))
|
| 24 | #:use-module (guix packages)
|
| 25 | #:use-module (guix derivations)
|
| 26 | #:use-module (guix download)
|
| 27 | #:use-module (guix build-system gnu)
|
| 28 | #:use-module (gnu packages base)
|
| 29 | #:use-module (gnu packages compression)
|
| 30 | #:use-module (gnu packages gcc)
|
| 31 | #:use-module (gnu packages libevent)
|
| 32 | #:use-module (gnu packages linux)
|
| 33 | #:use-module (gnu packages perl)
|
| 34 | #:use-module (gnu packages python)
|
| 35 | #:use-module (gnu packages tls))
|
| 36 |
|
| 37 | (define-public node
|
| 38 | (package
|
| 39 | (name "node")
|
| 40 | (version "6.0.0")
|
| 41 | (source (origin
|
| 42 | (method url-fetch)
|
| 43 | (uri (string-append "http://nodejs.org/dist/v" version
|
| 44 | "/node-v" version ".tar.gz"))
|
| 45 | (sha256
|
| 46 | (base32
|
| 47 | "0cpw7ng193jgfbw2g1fd0kcglmjjkbj4xb89g00z8zz0lj0nvdbd"))))
|
| 48 | (build-system gnu-build-system)
|
| 49 | (arguments
|
| 50 | |
| 51 | '(#:configure-flags '("--shared-openssl"
|
| 52 | "--shared-zlib"
|
| 53 | "--shared-libuv"
|
| 54 | "--without-snapshot")
|
| 55 | #:phases
|
| 56 | (modify-phases %standard-phases
|
| 57 | (add-before 'configure 'patch-files
|
| 58 | (lambda* (#:key inputs #:allow-other-keys)
|
| 59 | |
| 60 | (substitute* '("lib/child_process.js"
|
| 61 | "lib/internal/v8_prof_polyfill.js"
|
| 62 | "test/parallel/test-stdio-closed.js")
|
| 63 | (("'/bin/sh'")
|
| 64 | (string-append "'" (which "bash") "'")))
|
| 65 |
|
| 66 | |
| 67 | (substitute* '("test/parallel/test-child-process-default-options.js"
|
| 68 | "test/parallel/test-child-process-env.js"
|
| 69 | "test/parallel/test-child-process-exec-env.js")
|
| 70 | (("'/usr/bin/env'")
|
| 71 | (string-append "'" (which "env") "'")))
|
| 72 |
|
| 73 | |
| 74 | (substitute* '("Makefile")
|
| 75 | ((" \\$\\(MAKE\\) jslint") "")
|
| 76 | ((" \\$\\(MAKE\\) cpplint\n") ""))
|
| 77 |
|
| 78 | |
| 79 | |
| 80 | (for-each delete-file
|
| 81 | '("test/parallel/test-cluster-master-error.js"
|
| 82 | "test/parallel/test-cluster-master-kill.js"
|
| 83 | "test/parallel/test-npm-install.js"
|
| 84 | "test/parallel/test-stdout-close-unref.js"
|
| 85 | "test/sequential/test-child-process-emfile.js"))
|
| 86 | #t))
|
| 87 | (replace 'configure
|
| 88 | |
| 89 | |
| 90 | (lambda* (#:key outputs (configure-flags '()) inputs
|
| 91 | #:allow-other-keys)
|
| 92 | (let* ((prefix (assoc-ref outputs "out"))
|
| 93 | (flags (cons (string-append "--prefix=" prefix)
|
| 94 | configure-flags)))
|
| 95 | (format #t "build directory: ~s~%" (getcwd))
|
| 96 | (format #t "configure flags: ~s~%" flags)
|
| 97 | |
| 98 | |
| 99 | (setenv "CC" (string-append (assoc-ref inputs "gcc") "/bin/gcc"))
|
| 100 | (zero? (apply system*
|
| 101 | (string-append (assoc-ref inputs "python")
|
| 102 | "/bin/python")
|
| 103 | "configure" flags)))))
|
| 104 | (replace 'patch-shebangs
|
| 105 | (lambda* (#:key outputs #:allow-other-keys #:rest all)
|
| 106 | |
| 107 | (let* ((patch (assoc-ref %standard-phases 'patch-shebangs))
|
| 108 | (npm (string-append (assoc-ref outputs "out")
|
| 109 | "/bin/npm"))
|
| 110 | (target (readlink npm)))
|
| 111 | (and (apply patch all)
|
| 112 | (with-directory-excursion (dirname npm)
|
| 113 | |
| 114 | |
| 115 | |
| 116 | (delete-file target)
|
| 117 | (rename-file npm target)
|
| 118 | (symlink target npm)
|
| 119 | #t))))))))
|
| 120 | (native-inputs
|
| 121 | `(("python" ,python-2)
|
| 122 | ("perl" ,perl)
|
| 123 | ("procps" ,procps)
|
| 124 | ("util-linux" ,util-linux)
|
| 125 | ("which" ,which)))
|
| 126 | (inputs
|
| 127 | `(("libuv" ,libuv)
|
| 128 | ("openssl" ,openssl)
|
| 129 | ("zlib" ,zlib)))
|
| 130 | (synopsis "Evented I/O for V8 JavaScript")
|
| 131 | (description "Node.js is a platform built on Chrome's JavaScript runtime
|
| 132 | for easily building fast, scalable network applications. Node.js uses an
|
| 133 | event-driven, non-blocking I/O model that makes it lightweight and efficient,
|
| 134 | perfect for data-intensive real-time applications that run across distributed
|
| 135 | devices.")
|
| 136 | (home-page "http://nodejs.org/")
|
| 137 | (license expat)))
|