guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] gnu: Add node.


From: David Thompson
Subject: Re: [PATCH] gnu: Add node.
Date: Mon, 30 Jun 2014 18:37:41 -0400
User-agent: Notmuch/0.18 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-pc-linux-gnu)

Cyrill Schenkel <address@hidden> writes:

> From 3ac30b57db1e57e1c80077df7ee645838deb04fd Mon Sep 17 00:00:00 2001
> From: Cyrill Schenkel <address@hidden>
> 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 <address@hidden>
> +;;;
> +;;; 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]