Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / node.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014 Cyrill Schenkel <cyrill.schenkel@gmail.com>
3 ;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
4 ;;;
5 ;;; This file is part of GNU Guix.
6 ;;;
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
11 ;;;
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details.
16 ;;;
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20 (define-module (gnu packages node)
21 #:use-module ((guix licenses)
22 #:select (expat))
23 #:use-module (gnu packages)
24 #:use-module (gnu packages perl)
25 #:use-module (gnu packages python)
26 #:use-module (gnu packages gcc)
27 #:use-module (gnu packages linux)
28 #:use-module (gnu packages base)
29 #:use-module (guix packages)
30 #:use-module (guix derivations)
31 #:use-module (guix download)
32 #:use-module (guix build-system gnu))
33
34 (define-public node
35 (package
36 (name "node")
37 (version "0.12.2")
38 (source (origin
39 (method url-fetch)
40 (uri (string-append "http://nodejs.org/dist/v" version
41 "/node-v" version ".tar.gz"))
42 (sha256
43 (base32
44 "0bbp58p3iwsp35c37brkkh6bmjjhwsw2nlr8srz3wqryx6nphzmc"))))
45 (native-inputs `(("python" ,python-2)
46 ("perl" ,perl)
47 ("gcc" ,gcc-4.9)
48 ("util-linux" ,util-linux)
49 ("which" ,which)))
50 (build-system gnu-build-system)
51 (arguments
52 `(#:phases
53 (alist-replace
54 'configure
55 ;; Node's configure script is actually a python script, so we can't
56 ;; run it with bash.
57 (lambda* (#:key outputs (configure-flags '()) inputs
58 #:allow-other-keys)
59 (let* ((prefix (assoc-ref outputs "out"))
60 (flags `(,(string-append "--prefix=" prefix)
61 ,@configure-flags)))
62 (format #t "build directory: ~s~%" (getcwd))
63 (format #t "configure flags: ~s~%" flags)
64 ;; Node's configure script expects the CC environment variable to
65 ;; be set.
66 (setenv "CC" (string-append (assoc-ref inputs "gcc") "/bin/gcc"))
67 (zero? (apply system*
68 (string-append (assoc-ref inputs "python")
69 "/bin/python")
70 "./configure" flags))))
71 %standard-phases)))
72 (synopsis "Evented I/O for V8 javascript")
73 (description "Node.js is a platform built on Chrome's JavaScript runtime
74 for easily building fast, scalable network applications. Node.js uses an
75 event-driven, non-blocking I/O model that makes it lightweight and efficient,
76 perfect for data-intensive real-time applications that run across distributed
77 devices.")
78 (license expat)
79 (home-page "http://nodejs.org/")))