unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] gnu: Add node.
@ 2014-06-30 22:20 Cyrill Schenkel
  2014-06-30 22:36 ` Eric Bavier
  2014-06-30 22:37 ` David Thompson
  0 siblings, 2 replies; 5+ messages in thread
From: Cyrill Schenkel @ 2014-06-30 22:20 UTC (permalink / raw)
  To: Guix-devel

From 3ac30b57db1e57e1c80077df7ee645838deb04fd Mon Sep 17 00:00:00 2001
From: Cyrill Schenkel <cyrill.schenkel@gmail.com>
Date: Tue, 1 Jul 2014 00:18:41 +0200
Subject: [PATCH] gnu: Add node.

* gnu-system.am (GNU_SYSTEM_MODULES, dist_patch_DATA): Add new patch and package.
* gnu/packages/patches/node-configure.patch: New file.
* gnu/packages/node.scm: New file.
---
 gnu-system.am                             |  2 ++
 gnu/packages/node.scm                     | 56 +++++++++++++++++++++++++++++++
 gnu/packages/patches/node-configure.patch | 34 +++++++++++++++++++
 3 files changed, 92 insertions(+)
 create mode 100644 gnu/packages/node.scm
 create mode 100644 gnu/packages/patches/node-configure.patch

diff --git a/gnu-system.am b/gnu-system.am
index 793ee4c..c38896b 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -171,6 +171,7 @@ GNU_SYSTEM_MODULES =				\
   gnu/packages/ncurses.scm			\
   gnu/packages/netpbm.scm			\
   gnu/packages/nettle.scm			\
+  gnu/packages/node.scm				\
   gnu/packages/noweb.scm			\
   gnu/packages/ocaml.scm			\
   gnu/packages/ocrad.scm			\
@@ -339,6 +340,7 @@ dist_patch_DATA =						\
   gnu/packages/patches/mit-krb5-init-fix.patch			\
   gnu/packages/patches/mpc123-initialize-ao.patch		\
   gnu/packages/patches/module-init-tools-moduledir.patch	\
+  gnu/packages/patches/node-configure.patch			\
   gnu/packages/patches/patchelf-page-size.patch			\
   gnu/packages/patches/patchutils-xfail-gendiff-tests.patch	\
   gnu/packages/patches/perl-no-sys-dirs.patch			\
diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
new file mode 100644
index 0000000..be7afa6
--- /dev/null
+++ b/gnu/packages/node.scm
@@ -0,0 +1,56 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2014 Cyrill Schenkel <cyrill.schenkel@gmail.com>
+;;;
+;;; 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 <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages node)
+  #:use-module ((guix licenses)
+                #:select (expat))
+  #:use-module (gnu packages)
+  #:use-module (gnu packages perl)
+  #:use-module (gnu packages python)
+  #:use-module (gnu packages gcc)
+  #:use-module (gnu packages linux)
+  #:use-module (guix packages)
+  #:use-module (guix download)
+  #:use-module (guix build gnu-build-system)
+  #:use-module (guix build-system gnu))
+
+(define-public node
+  (package
+    (name "node")
+    (version "0.10.29")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "http://nodejs.org/dist/v" version
+                                  "/node-v" version ".tar.gz"))
+              (sha256
+               (base32
+                "0pdib215ldypc149ad03wlfj0i8fwdfydd4q2hd7ry35yw0rsds7"))
+              (patches (list (search-patch "node-configure.patch")))))
+    (native-inputs `(("python" ,python-2)
+                     ("perl" ,perl)
+                     ("gcc" ,gcc-4.9)
+                     ("util-linux" ,util-linux)))
+    (build-system gnu-build-system)
+    (synopsis "Evented I/O for V8 javascript.")
+    (description "Node.js is a platform built on Chrome's JavaScript runtime
+for easily building fast, scalable network applications. Node.js uses an
+event-driven, non-blocking I/O model that makes it lightweight and efficient,
+perfect for data-intensive real-time applications that run across distributed
+devices.")
+    (license expat)
+    (home-page "http://nodejs.org/")))
diff --git a/gnu/packages/patches/node-configure.patch b/gnu/packages/patches/node-configure.patch
new file mode 100644
index 0000000..6351766
--- /dev/null
+++ b/gnu/packages/patches/node-configure.patch
@@ -0,0 +1,34 @@
+By default the `gnu-build-system' tries to run the configure script with
+bash. This doesn't work because the node configure script is written in
+python.
+
+This patch is a small hack which redirects the original content of the
+configure script to python in a bash compatible manner.
+
+--- node-v0.10.29/configure.orig	2014-06-09 19:04:36.000000000 +0200
++++ node-v0.10.29/configure	2014-06-30 21:56:40.044559261 +0200
+@@ -1,4 +1,18 @@
+-#!/usr/bin/env python
++#!/bin/bash
++
++ARGS=""
++
++for i in $@
++do
++    if echo $i | grep "\\-\\-prefix.*" > /dev/null
++    then
++	ARGS="$ARGS $i"
++    fi
++done
++
++export CC=gcc
++
++python <<EOF - $ARGS
+ import optparse
+ import os
+ import pprint
+@@ -714,3 +728,4 @@
+ gyp_args += args
+ 
+ subprocess.call(gyp_args)
++EOF
-- 
2.0.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] gnu: Add node.
  2014-06-30 22:20 [PATCH] gnu: Add node Cyrill Schenkel
@ 2014-06-30 22:36 ` Eric Bavier
  2014-06-30 22:37 ` David Thompson
  1 sibling, 0 replies; 5+ messages in thread
From: Eric Bavier @ 2014-06-30 22:36 UTC (permalink / raw)
  To: Cyrill Schenkel; +Cc: Guix-devel


Cyrill Schenkel writes:

> +By default the `gnu-build-system' tries to run the configure script with
> +bash. This doesn't work because the node configure script is written in
> +python.
> +
> +This patch is a small hack which redirects the original content of the
> +configure script to python in a bash compatible manner.

Instead of patching the configure script, why not replace the default
configure step with one that calls python instead?  This is done e.g.
in the "petsc" package.

-- 
Eric Bavier

Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] gnu: Add node.
  2014-06-30 22:20 [PATCH] gnu: Add node Cyrill Schenkel
  2014-06-30 22:36 ` Eric Bavier
@ 2014-06-30 22:37 ` David Thompson
  2014-07-01  6:59   ` Cyrill Schenkel
  1 sibling, 1 reply; 5+ messages in thread
From: David Thompson @ 2014-06-30 22:37 UTC (permalink / raw)
  To: Cyrill Schenkel, Guix-devel

Cyrill Schenkel <cyrill.schenkel@gmail.com> writes:

> From 3ac30b57db1e57e1c80077df7ee645838deb04fd Mon Sep 17 00:00:00 2001
> From: Cyrill Schenkel <cyrill.schenkel@gmail.com>
> Date: Tue, 1 Jul 2014 00:18:41 +0200
> Subject: [PATCH] gnu: Add node.
>

Awesome!

Thinking out loud: I would like to learn how to use Guix as a tool for
web application packaging and deployment automation.

> * gnu-system.am (GNU_SYSTEM_MODULES, dist_patch_DATA): Add new patch and package.
> * gnu/packages/patches/node-configure.patch: New file.
> * gnu/packages/node.scm: New file.
> ---
>  gnu-system.am                             |  2 ++
>  gnu/packages/node.scm                     | 56 +++++++++++++++++++++++++++++++
>  gnu/packages/patches/node-configure.patch | 34 +++++++++++++++++++
>  3 files changed, 92 insertions(+)
>  create mode 100644 gnu/packages/node.scm
>  create mode 100644 gnu/packages/patches/node-configure.patch
>
> diff --git a/gnu-system.am b/gnu-system.am
> index 793ee4c..c38896b 100644
> --- a/gnu-system.am
> +++ b/gnu-system.am
> @@ -171,6 +171,7 @@ GNU_SYSTEM_MODULES =				\
>    gnu/packages/ncurses.scm			\
>    gnu/packages/netpbm.scm			\
>    gnu/packages/nettle.scm			\
> +  gnu/packages/node.scm				\
>    gnu/packages/noweb.scm			\
>    gnu/packages/ocaml.scm			\
>    gnu/packages/ocrad.scm			\
> @@ -339,6 +340,7 @@ dist_patch_DATA =						\
>    gnu/packages/patches/mit-krb5-init-fix.patch			\
>    gnu/packages/patches/mpc123-initialize-ao.patch		\
>    gnu/packages/patches/module-init-tools-moduledir.patch	\
> +  gnu/packages/patches/node-configure.patch			\
>    gnu/packages/patches/patchelf-page-size.patch			\
>    gnu/packages/patches/patchutils-xfail-gendiff-tests.patch	\
>    gnu/packages/patches/perl-no-sys-dirs.patch			\
> diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
> new file mode 100644
> index 0000000..be7afa6
> --- /dev/null
> +++ b/gnu/packages/node.scm
> @@ -0,0 +1,56 @@
> +;;; GNU Guix --- Functional package management for GNU
> +;;; Copyright © 2014 Cyrill Schenkel <cyrill.schenkel@gmail.com>
> +;;;
> +;;; 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 <http://www.gnu.org/licenses/>.
> +
> +(define-module (gnu packages node)
> +  #:use-module ((guix licenses)
> +                #:select (expat))
> +  #:use-module (gnu packages)
> +  #:use-module (gnu packages perl)
> +  #:use-module (gnu packages python)
> +  #:use-module (gnu packages gcc)
> +  #:use-module (gnu packages linux)
> +  #:use-module (guix packages)
> +  #:use-module (guix download)
> +  #:use-module (guix build gnu-build-system)
> +  #:use-module (guix build-system gnu))
> +
> +(define-public node
> +  (package
> +    (name "node")
> +    (version "0.10.29")
> +    (source (origin
> +              (method url-fetch)
> +              (uri (string-append "http://nodejs.org/dist/v" version
> +                                  "/node-v" version ".tar.gz"))
> +              (sha256
> +               (base32
> +                "0pdib215ldypc149ad03wlfj0i8fwdfydd4q2hd7ry35yw0rsds7"))
> +              (patches (list (search-patch "node-configure.patch")))))
> +    (native-inputs `(("python" ,python-2)
> +                     ("perl" ,perl)
> +                     ("gcc" ,gcc-4.9)
> +                     ("util-linux" ,util-linux)))
> +    (build-system gnu-build-system)
> +    (synopsis "Evented I/O for V8 javascript.")

No period at the end.

> +    (description "Node.js is a platform built on Chrome's JavaScript runtime
> +for easily building fast, scalable network applications. Node.js uses an
> +event-driven, non-blocking I/O model that makes it lightweight and efficient,
> +perfect for data-intensive real-time applications that run across distributed
> +devices.")

Two spaces after a period.

> +    (license expat)
> +    (home-page "http://nodejs.org/")))
> diff --git a/gnu/packages/patches/node-configure.patch b/gnu/packages/patches/node-configure.patch
> new file mode 100644
> index 0000000..6351766
> --- /dev/null
> +++ b/gnu/packages/patches/node-configure.patch
> @@ -0,0 +1,34 @@
> +By default the `gnu-build-system' tries to run the configure script with
> +bash. This doesn't work because the node configure script is written in
> +python.
> +
> +This patch is a small hack which redirects the original content of the
> +configure script to python in a bash compatible manner.
> +
> +--- node-v0.10.29/configure.orig	2014-06-09 19:04:36.000000000 +0200
> ++++ node-v0.10.29/configure	2014-06-30 21:56:40.044559261 +0200
> +@@ -1,4 +1,18 @@
> +-#!/usr/bin/env python
> ++#!/bin/bash
> ++
> ++ARGS=""
> ++
> ++for i in $@
> ++do
> ++    if echo $i | grep "\\-\\-prefix.*" > /dev/null
> ++    then
> ++	ARGS="$ARGS $i"
> ++    fi
> ++done
> ++
> ++export CC=gcc
> ++
> ++python <<EOF - $ARGS
> + import optparse
> + import os
> + import pprint
> +@@ -714,3 +728,4 @@
> + gyp_args += args
> + 
> + subprocess.call(gyp_args)
> ++EOF
> -- 
> 2.0.0
>
>

Looks good to me!  Let's see what Ludovic thinks.

-- 
David Thompson
Web Developer - Free Software Foundation - http://fsf.org
GPG Key: 0FF1D807
Support the FSF: https://fsf.org/donate

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] gnu: Add node.
  2014-06-30 22:37 ` David Thompson
@ 2014-07-01  6:59   ` Cyrill Schenkel
  2014-07-01  8:34     ` Ludovic Courtès
  0 siblings, 1 reply; 5+ messages in thread
From: Cyrill Schenkel @ 2014-07-01  6:59 UTC (permalink / raw)
  To: Guix-devel

[-- Attachment #1: Type: text/plain, Size: 801 bytes --]

Hi

Eric Bavier <ericbavier@gmail.com> writes:

> Instead of patching the configure script, why not replace the default
> configure step with one that calls python instead?  This is done e.g.
> in the "petsc" package.

Thanks for the hint.

David Thompson <dthompson2@worcester.edu> writes:

>> +    (synopsis "Evented I/O for V8 javascript.")
>
> No period at the end.

Done.

>> +    (description "Node.js is a platform built on Chrome's JavaScript runtime
>> +for easily building fast, scalable network applications. Node.js uses an
>> +event-driven, non-blocking I/O model that makes it lightweight and efficient,
>> +perfect for data-intensive real-time applications that run across distributed
>> +devices.")
>
> Two spaces after a period.

Done.

An updated Patch is attached.

Regards
Cyrill


[-- Attachment #2: 0001-gnu-Add-node.patch --]
[-- Type: text/x-diff, Size: 4448 bytes --]

From 57788c6cbb3989b5ff997b7c37b8c02979786c4b Mon Sep 17 00:00:00 2001
From: Cyrill Schenkel <cyrill.schenkel@gmail.com>
Date: Tue, 1 Jul 2014 08:47:31 +0200
Subject: [PATCH] gnu: Add node.

* gnu-system.am (GNU_SYSTEM_MODULES): Add new package.
* gnu/packages/node.scm: New file.
---
 gnu-system.am         |  1 +
 gnu/packages/node.scm | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 78 insertions(+)
 create mode 100644 gnu/packages/node.scm

diff --git a/gnu-system.am b/gnu-system.am
index 793ee4c..d59f204 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -171,6 +171,7 @@ GNU_SYSTEM_MODULES =				\
   gnu/packages/ncurses.scm			\
   gnu/packages/netpbm.scm			\
   gnu/packages/nettle.scm			\
+  gnu/packages/node.scm				\
   gnu/packages/noweb.scm			\
   gnu/packages/ocaml.scm			\
   gnu/packages/ocrad.scm			\
diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
new file mode 100644
index 0000000..5af96eb
--- /dev/null
+++ b/gnu/packages/node.scm
@@ -0,0 +1,77 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2014 Cyrill Schenkel <cyrill.schenkel@gmail.com>
+;;;
+;;; 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 <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages node)
+  #:use-module ((guix licenses)
+                #:select (expat))
+  #:use-module (gnu packages)
+  #:use-module (gnu packages perl)
+  #:use-module (gnu packages python)
+  #:use-module (gnu packages gcc)
+  #:use-module (gnu packages linux)
+  #:use-module (guix packages)
+  #:use-module (guix derivations)
+  #:use-module (guix download)
+  #:use-module (guix build gnu-build-system)
+  #:use-module (guix build-system gnu))
+
+(define-public node
+  (package
+    (name "node")
+    (version "0.10.29")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "http://nodejs.org/dist/v" version
+                                  "/node-v" version ".tar.gz"))
+              (sha256
+               (base32
+                "0pdib215ldypc149ad03wlfj0i8fwdfydd4q2hd7ry35yw0rsds7"))))
+    (native-inputs `(("python" ,python-2)
+                     ("perl" ,perl)
+                     ("gcc" ,gcc-4.9)
+                     ("util-linux" ,util-linux)))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:phases
+       (alist-replace
+        'configure
+        ;; Node's configure script is actually a python script, so we can't
+        ;; run it with bash.
+        (lambda* (#:key outputs (configure-flags '()) inputs
+                        #:allow-other-keys)
+          (let* ((prefix (assoc-ref outputs "out"))
+                 (flags `(,(string-append "--prefix=" prefix)
+                          ,@configure-flags)))
+            (format #t "build directory: ~s~%" (getcwd))
+            (format #t "configure flags: ~s~%" flags)
+            ;; Node's configure script expects the CC environment variable to
+            ;; be set.
+            (setenv "CC" (string-append (assoc-ref inputs "gcc") "/bin/gcc"))
+            (zero? (apply system*
+                          (string-append (assoc-ref inputs "python")
+                                         "/bin/python")
+                          "./configure" flags))))
+        %standard-phases)))
+    (synopsis "Evented I/O for V8 javascript")
+    (description "Node.js is a platform built on Chrome's JavaScript runtime
+for easily building fast, scalable network applications.  Node.js uses an
+event-driven, non-blocking I/O model that makes it lightweight and efficient,
+perfect for data-intensive real-time applications that run across distributed
+devices.")
+    (license expat)
+    (home-page "http://nodejs.org/")))
-- 
2.0.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] gnu: Add node.
  2014-07-01  6:59   ` Cyrill Schenkel
@ 2014-07-01  8:34     ` Ludovic Courtès
  0 siblings, 0 replies; 5+ messages in thread
From: Ludovic Courtès @ 2014-07-01  8:34 UTC (permalink / raw)
  To: Cyrill Schenkel; +Cc: Guix-devel

Cyrill Schenkel <cyrill.schenkel@gmail.com> skribis:

> From 57788c6cbb3989b5ff997b7c37b8c02979786c4b Mon Sep 17 00:00:00 2001
> From: Cyrill Schenkel <cyrill.schenkel@gmail.com>
> Date: Tue, 1 Jul 2014 08:47:31 +0200
> Subject: [PATCH] gnu: Add node.
>
> * gnu-system.am (GNU_SYSTEM_MODULES): Add new package.
> * gnu/packages/node.scm: New file.

LGTM, pushed.  Thank you!

Thanks David and Eric for the review.  Feel free to apply patches when
you’re confident, you’re both well qualified for that.

Ludo’.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-07-01  8:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-30 22:20 [PATCH] gnu: Add node Cyrill Schenkel
2014-06-30 22:36 ` Eric Bavier
2014-06-30 22:37 ` David Thompson
2014-07-01  6:59   ` Cyrill Schenkel
2014-07-01  8:34     ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).