DESCRIPTION = "nodeJS Evented I/O for V8 JavaScript"
HOMEPAGE = "http://nodejs.org"
LICENSE = "MIT"

DEPENDS = "openssl"

SRC_URI = " \
  http://nodejs.org/dist/node-v${PV}.tar.gz \
  file://libev-cross-cc_${PV}.patch \
"

SRC_URI[md5sum] = "9e9e791e125f6a601ebc663dc99c72a8"
SRC_URI[sha256sum] = "09b1100ca6828eedbe52418fbeb3352d71c0b1ff3344c44a5af3efb80c5b908c"

S = "${WORKDIR}/node-v${PV}"

# v8 errors out if you have set CCACHE
CCACHE = ""

do_configure () {
  ./configure --prefix=${prefix} --without-snapshot
}

do_compile () {
  make
}

do_install () {
  DESTDIR=${D} oe_runmake install
}

BBCLASSEXTEND = "native"

DESCRIPTION = "nodeJS Evented I/O for V8 JavaScript"
HOMEPAGE = "http://nodejs.org"
LICENSE = "MIT"

DEPENDS = "openssl"

SRC_URI = " \
  http://nodejs.org/dist/node-v${PV}.tar.gz \
  file://libev-cross-cc_${PV}.patch \
"

SRC_URI[md5sum] = "9e9e791e125f6a601ebc663dc99c72a8"
SRC_URI[sha256sum] = "09b1100ca6828eedbe52418fbeb3352d71c0b1ff3344c44a5af3efb80c5b908c"

S = "${WORKDIR}/node-v${PV}"

# v8 errors out if you have set CCACHE
CCACHE = ""

do_configure () {
  sed -i -e 's:/usr/lib:${STAGING_LIBDIR}:g' wscript
  sed -i -e 's:/usr/local/lib:${STAGING_LIBDIR}:g' wscript
  ./configure --prefix=${prefix} --without-snapshot
}

do_compile () {
  make
}

do_install () {
  DESTDIR=${D} oe_runmake install
}

BBCLASSEXTEND = "native"

Make configure script not use host libutil
nodejs: Make configure script not use host libutil

Without this patch the configure script of nodejs-0.4.2 will use host libs for libutil. Excerpt from build/config.log:

Checking for library util
==>

int main() {
        return 0;
}

<==
[1/2] cxx: build/.conf_check_0/test.cpp -> build/.conf_check_0/testbuild/default/test_1.o
['arm-angstrom-linux-gnueabi-g++', '-march=armv7-a', '-mtune=cortex-a8', '-mfpu=neon', '-mfloat-abi=softfp', '-mthumb-interwork', '-mno-thumb', '--sysroot=/home/bitbake/build/tmp_beagleboard/sysroots/armv7a-angstrom-linux-gnueabi', '-fexpensive-optimizations', '-fomit-frame-pointer', '-frename-registers', '-O2', '-ggdb2', '-fpermissive', '-fvisibility-inlines-hidden', '-DHAVE_OPENSSL=1', '../test.cpp', '-c', '-o', 'default/test_1.o']
[2/2] cxx_link: build/.conf_check_0/testbuild/default/test_1.o -> build/.conf_check_0/testbuild/default/testprog
/usr/lib/libutil.so: file not recognized: File format not recognized
collect2: ld returned 1 exit status
['arm-angstrom-linux-gnueabi-g++', '-march=armv7-a', '-mtune=cortex-a8', '-mfpu=neon', '-mfloat-abi=softfp', '-mthumb-interwork', '-mno-thumb', '--sysroot=/home/bitbake/build/tmp_beagleboard/sysroots/armv7a-angstrom-linux-gnueabi', 'default/test_1.o', '-o', '/home/bitbake/build/tmp_beagleboard/work/armv7a-angstrom-linux-gnueabi/nodejs-0.4.2-r0/node-v0.4.2/build/.conf_check_0/testbuild/default/testprog', '-Wl,-O1', '-Wl,--hash-style=gnu', '-L/usr/lib', '-L/usr/local/lib', '-Wl,-Bdynamic', '-lutil']
command returned 'Build failed:  -> task failed (err #1): \n\t{task: cxx_link test_1.o -> testprog}'not found

It is strange how the configure script still continues even though it didn't find some of its dependencies.
Eventually the build will fail with:

default/src/node_stdio_4.o: In function `node::OpenPTY(v8::Arguments const&)':
/home/bitbake/build/tmp_beagleboard/work/armv7a-angstrom-linux-gnueabi/nodejs-0.4.2-r0/node-v0.4.2/build/../src/node_stdio.cc:241: undefined reference to `openpty'
collect2: ld returned 1 exit status

Signed-off-by: Patrik Dahlström <b0caa17214d0c6c1dcf4cdf146ce9a317c8f9ea2@student.liu.se>
Acked-by: Koen Kooi <42e3d96910f922bdd7dd1805fe3f8aff634f391d@dominion.thruhere.net>
Signed-off-by: Eric Bénard <96f164ad4d9b2b0dacf8ebee2bb1eeb3aa69adf1@eukrea.com>
