From b10cfdb58f6a1022713d3eec3fdb141d06d6d6d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Hundeb=C3=B8ll?= Date: Thu, 23 Jul 2015 08:20:55 +0200 Subject: [PATCH 1/7] nodejs: new recipe --- ...itialize-arm_version-variable-in-gyp.patch | 24 ++++++ recipes/nodejs/nodejs.inc | 78 +++++++++++++++++++ recipes/nodejs/nodejs_0.11.13.oe | 1 + recipes/nodejs/nodejs_0.11.13.oe.sig | 1 + 4 files changed, 104 insertions(+) create mode 100644 recipes/nodejs/files/0001-initialize-arm_version-variable-in-gyp.patch create mode 100644 recipes/nodejs/nodejs.inc create mode 100644 recipes/nodejs/nodejs_0.11.13.oe create mode 100644 recipes/nodejs/nodejs_0.11.13.oe.sig diff --git a/recipes/nodejs/files/0001-initialize-arm_version-variable-in-gyp.patch b/recipes/nodejs/files/0001-initialize-arm_version-variable-in-gyp.patch new file mode 100644 index 000000000..a725e40e5 --- /dev/null +++ b/recipes/nodejs/files/0001-initialize-arm_version-variable-in-gyp.patch @@ -0,0 +1,24 @@ +From 6500ffdc89fb18355dd49c4e188562c067b96aee Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Martin=20Hundeb=C3=B8ll?= +Date: Wed, 22 Jul 2015 17:22:01 +0200 +Subject: [PATCH] initialize arm_version variable in gyp + +--- + common.gypi | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/common.gypi b/common.gypi +index 42ab572..ab5497b 100644 +--- a/common.gypi ++++ b/common.gypi +@@ -11,6 +11,7 @@ + 'gcc_version%': 'unknown', + 'clang%': 0, + 'python%': 'python', ++ 'arm_version%' : '1', + + # Enable V8's post-mortem debugging only on unix flavors. + 'conditions': [ +-- +2.4.6 + diff --git a/recipes/nodejs/nodejs.inc b/recipes/nodejs/nodejs.inc new file mode 100644 index 000000000..da8580580 --- /dev/null +++ b/recipes/nodejs/nodejs.inc @@ -0,0 +1,78 @@ +DESCRIPTION = "nodeJS Evented I/O for V8 JavaScript" +HOMEPAGE = "http://nodejs.org" +LICENSE = "MIT BSD Artistic-2.0" + +inherit make c c++ + +DEPENDS = "openssl libz librt libm libdl libv8 libv8-dev" +RECIPE_TYPES = "machine native sdk" + +SRC_URI = " \ + http://nodejs.org/dist/v${PV}/node-v${PV}.tar.gz \ + file://0001-initialize-arm_version-variable-in-gyp.patch \ +" +S = "${SRCDIR}/node-v${PV}" + +# Node is way too cool to use proper autotools +NODEJS_CONF_ARCH="" +do_configure[prefuncs] += "do_configure_map_nodejs_arch" +def do_configure_map_nodejs_arch(d): + import re + a = d.getVar('TARGET_ARCH', True) + if re.match('p(pc|owerpc)(|64)', a): a = 'ppc' + elif re.match('i.86$', a): a = 'ia32' + elif re.match('x86_64$', a): a = 'x64' + elif re.match('arm', a): a = 'arm' + d.set('NODEJS_CONF_ARCH', a) + +EXTRA_OECONF += "-DNODE_WANT_INTERNALS=0" +SYSROOT = "${BUILD_SYSROOT}" +SYSROOT:machine = "${MACHINE_SYSROOT}" +do_configure () { + # $TARGET_ARCH settings don't match --dest-cpu settings + ./configure --prefix=${prefix} \ + --without-snapshot \ + --without-npm \ + --shared-openssl \ + --shared-openssl-includes=${SYSROOT}${includedir} \ + --shared-openssl-libpath=${SYSROOT}${libdir} \ + --shared-v8 \ + --shared-v8-includes=${SYSROOT}${includedir} \ + --shared-v8-libpath=${SYSROOT}${libdir} \ + --shared-zlib \ + --shared-zlib-includes=${SYSROOT}${includedir} \ + --shared-zlib-libpath=${SYSROOT}${libdir} \ + --dest-cpu=${NODEJS_CONF_ARCH} \ + --dest-os=linux +} + +do_compile () { + oe_runmake BUILDTYPE=Release +} + +do_install () { + oe_runmake install DESTDIR=${D} PREFIX=${prefix} +} + +DEPENDS_${PN} = "libz libv8 openssl libdl librt libstdc++ libm libgcc libpthread libc" +RDEPENDS_${PN} = "libz libv8 openssl libdl librt libstdc++ libm libgcc libpthread libc" + +PACKAGES_${PN} =+ "${PN}-dev" +FILES_${PN}-dev = "${includedir}/node ${datadir}" + +PACKAGES =+ "${PN}-systemtap" +FILES_${PN}-systemtap = "${datadir}/systemtap" + +PACKAGES =+ "${PN}-source" +FILES_${PN}-source = "${datadir}/src" +do_unpack[postfuncs] += "do_unpack_node_source" +do_unpack_node_source () { + cp -r ${S} ${SRCDIR}/node-source +} + +do_install[postfuncs] += "do_install_node_source" +do_install_node_source () { + install -d ${D}${datadir}/src + cp -r ${SRCDIR}/node-source ${D}${datadir}/src/nodejs-${PV} + ln -s nodejs-${PV} ${D}${datadir}/src/nodejs +} diff --git a/recipes/nodejs/nodejs_0.11.13.oe b/recipes/nodejs/nodejs_0.11.13.oe new file mode 100644 index 000000000..3700486a4 --- /dev/null +++ b/recipes/nodejs/nodejs_0.11.13.oe @@ -0,0 +1 @@ +require nodejs.inc diff --git a/recipes/nodejs/nodejs_0.11.13.oe.sig b/recipes/nodejs/nodejs_0.11.13.oe.sig new file mode 100644 index 000000000..e531a466d --- /dev/null +++ b/recipes/nodejs/nodejs_0.11.13.oe.sig @@ -0,0 +1 @@ +da4a9adb73978710566f643241b2c05fb8a97574 node-v0.11.13.tar.gz From 59442f618cb8afe22f618403fd79e070d8d4f2e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Hundeb=C3=B8ll?= Date: Mon, 7 Sep 2015 14:48:14 +0200 Subject: [PATCH 2/7] nodejs: use bundled libv8 library Using a shared libv8 for nodejs puts a hard requirement on the version of libv8, which conflicts with the version used in mongodb, thus refraining us from updating to a recent nodejs. Enable the bundled libv8 to be able to update nodejs. --- recipes/nodejs/nodejs.inc | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/recipes/nodejs/nodejs.inc b/recipes/nodejs/nodejs.inc index da8580580..8b7f72d88 100644 --- a/recipes/nodejs/nodejs.inc +++ b/recipes/nodejs/nodejs.inc @@ -4,7 +4,7 @@ LICENSE = "MIT BSD Artistic-2.0" inherit make c c++ -DEPENDS = "openssl libz librt libm libdl libv8 libv8-dev" +DEPENDS = "openssl libz librt libm libdl" RECIPE_TYPES = "machine native sdk" SRC_URI = " \ @@ -36,9 +36,6 @@ do_configure () { --shared-openssl \ --shared-openssl-includes=${SYSROOT}${includedir} \ --shared-openssl-libpath=${SYSROOT}${libdir} \ - --shared-v8 \ - --shared-v8-includes=${SYSROOT}${includedir} \ - --shared-v8-libpath=${SYSROOT}${libdir} \ --shared-zlib \ --shared-zlib-includes=${SYSROOT}${includedir} \ --shared-zlib-libpath=${SYSROOT}${libdir} \ @@ -54,8 +51,8 @@ do_install () { oe_runmake install DESTDIR=${D} PREFIX=${prefix} } -DEPENDS_${PN} = "libz libv8 openssl libdl librt libstdc++ libm libgcc libpthread libc" -RDEPENDS_${PN} = "libz libv8 openssl libdl librt libstdc++ libm libgcc libpthread libc" +DEPENDS_${PN} = "libz openssl libdl librt libstdc++ libm libgcc libpthread libc" +RDEPENDS_${PN} = "libz openssl libdl librt libstdc++ libm libgcc libpthread libc" PACKAGES_${PN} =+ "${PN}-dev" FILES_${PN}-dev = "${includedir}/node ${datadir}" From 290e456d9de7df3540899d04d5cec51cb08870db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Hundeb=C3=B8ll?= Date: Mon, 7 Sep 2015 14:49:59 +0200 Subject: [PATCH 3/7] nodejs: add version 0.12.7 --- recipes/nodejs/nodejs_0.12.7.oe | 1 + recipes/nodejs/nodejs_0.12.7.oe.sig | 1 + 2 files changed, 2 insertions(+) create mode 100644 recipes/nodejs/nodejs_0.12.7.oe create mode 100644 recipes/nodejs/nodejs_0.12.7.oe.sig diff --git a/recipes/nodejs/nodejs_0.12.7.oe b/recipes/nodejs/nodejs_0.12.7.oe new file mode 100644 index 000000000..3700486a4 --- /dev/null +++ b/recipes/nodejs/nodejs_0.12.7.oe @@ -0,0 +1 @@ +require nodejs.inc diff --git a/recipes/nodejs/nodejs_0.12.7.oe.sig b/recipes/nodejs/nodejs_0.12.7.oe.sig new file mode 100644 index 000000000..3e8c57420 --- /dev/null +++ b/recipes/nodejs/nodejs_0.12.7.oe.sig @@ -0,0 +1 @@ +6d59007212a964c7a4defc5520aedacdbcb008e1 node-v0.12.7.tar.gz From 416cd72de93752b35c60733d5f9360906849806d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Hundeb=C3=B8ll?= Date: Mon, 7 Sep 2015 14:50:13 +0200 Subject: [PATCH 4/7] nodejs: remove version 0.11.13 --- recipes/nodejs/nodejs_0.11.13.oe | 1 - recipes/nodejs/nodejs_0.11.13.oe.sig | 1 - 2 files changed, 2 deletions(-) delete mode 100644 recipes/nodejs/nodejs_0.11.13.oe delete mode 100644 recipes/nodejs/nodejs_0.11.13.oe.sig diff --git a/recipes/nodejs/nodejs_0.11.13.oe b/recipes/nodejs/nodejs_0.11.13.oe deleted file mode 100644 index 3700486a4..000000000 --- a/recipes/nodejs/nodejs_0.11.13.oe +++ /dev/null @@ -1 +0,0 @@ -require nodejs.inc diff --git a/recipes/nodejs/nodejs_0.11.13.oe.sig b/recipes/nodejs/nodejs_0.11.13.oe.sig deleted file mode 100644 index e531a466d..000000000 --- a/recipes/nodejs/nodejs_0.11.13.oe.sig +++ /dev/null @@ -1 +0,0 @@ -da4a9adb73978710566f643241b2c05fb8a97574 node-v0.11.13.tar.gz From b0d85a6da4d6e9659eb1fb5c3bada57caae6e215 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Hundeb=C3=B8ll?= Date: Tue, 8 Sep 2015 08:23:39 +0200 Subject: [PATCH 5/7] nodejs: fix regex to detect target platform When copying the regex from the OE/Yocto recipe, it expected the match to be at the end of the string. Instead, we want to search the entire string for a match, so remove the remaining $'s. --- recipes/nodejs/nodejs.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes/nodejs/nodejs.inc b/recipes/nodejs/nodejs.inc index 8b7f72d88..69ae6818d 100644 --- a/recipes/nodejs/nodejs.inc +++ b/recipes/nodejs/nodejs.inc @@ -20,8 +20,8 @@ def do_configure_map_nodejs_arch(d): import re a = d.getVar('TARGET_ARCH', True) if re.match('p(pc|owerpc)(|64)', a): a = 'ppc' - elif re.match('i.86$', a): a = 'ia32' - elif re.match('x86_64$', a): a = 'x64' + elif re.match('i.86', a): a = 'ia32' + elif re.match('x86_64', a): a = 'x64' elif re.match('arm', a): a = 'arm' d.set('NODEJS_CONF_ARCH', a) From f798a7ef6f45f9245980ca2c916f996f8b4d9a0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Hundeb=C3=B8ll?= Date: Tue, 13 Oct 2015 15:21:03 +0200 Subject: [PATCH 6/7] modejs: fix building for mingw32 sdk Building hipster software like nodejs for win/mingw on a linux host is like pure magic, but we do the attempt anyways. And we do this because we need the nodejs-source package for the sdk, so the recipe fails if the nodejs binary doesn't build. Fix the build by splitting out a few libraries (c-ares, libuv), disabling some features (perfctr, etw, dtrace), and by patching the source in a few places. (But only patch it when building for mingw). --- .../0001-fix-compilation-for-mingw-sdk.patch | 177 +++++++++++++++ recipes/nodejs/files/nameser.h | 211 ++++++++++++++++++ recipes/nodejs/nodejs.inc | 40 +++- 3 files changed, 424 insertions(+), 4 deletions(-) create mode 100644 recipes/nodejs/files/0001-fix-compilation-for-mingw-sdk.patch create mode 100644 recipes/nodejs/files/nameser.h diff --git a/recipes/nodejs/files/0001-fix-compilation-for-mingw-sdk.patch b/recipes/nodejs/files/0001-fix-compilation-for-mingw-sdk.patch new file mode 100644 index 000000000..4bd387ad1 --- /dev/null +++ b/recipes/nodejs/files/0001-fix-compilation-for-mingw-sdk.patch @@ -0,0 +1,177 @@ +From ed8c9f54598dfe49d02b3a1a9725ceb032f14123 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Martin=20Hundeb=C3=B8ll?= +Date: Tue, 13 Oct 2015 12:40:33 +0200 +Subject: [PATCH] fix compilation for mingw sdk + +redefinitions/reimplementations of snprintf are removed as these are +provided by gcc when building for mingw. + +upstream-status: not appropriate - linux->mingw compilation only +--- + configure | 4 +--- + deps/v8/BUILD.gn | 2 +- + deps/v8/src/base/platform/platform-win32.cc | 1 + + deps/v8/src/ostreams.cc | 4 ---- + deps/v8/tools/gyp/v8.gyp | 2 +- + node.gyp | 2 +- + src/cares_wrap.cc | 8 ++++---- + src/node.cc | 1 - + src/node_internals.h | 15 --------------- + src/node_main.cc | 2 +- + 10 files changed, 10 insertions(+), 31 deletions(-) + +diff --git a/configure b/configure +index 66cb312..9d4b73b 100755 +--- a/configure ++++ b/configure +@@ -1034,10 +1034,8 @@ if options.use_ninja: + gyp_args += ['-f', 'ninja-' + flavor] + elif options.use_xcode: + gyp_args += ['-f', 'xcode'] +-elif flavor == 'win': +- gyp_args += ['-f', 'msvs', '-G', 'msvs_version=auto'] + else: +- gyp_args += ['-f', 'make-' + flavor] ++ gyp_args += ['-f', 'make-' + flavor, '-D', 'OS='+flavor] + + gyp_args += args + +diff --git a/deps/v8/BUILD.gn b/deps/v8/BUILD.gn +index efa4b71..d6ff0c4 100644 +--- a/deps/v8/BUILD.gn ++++ b/deps/v8/BUILD.gn +@@ -1162,7 +1162,7 @@ source_set("v8_libbase") { + + defines += [ "_CRT_RAND_S" ] # for rand_s() + +- libs = [ "winmm.lib", "ws2_32.lib" ] ++ libs = [ "winmm", "ws2_32" ] + } + + # TODO(jochen): Add support for qnx, freebsd, openbsd, netbsd, and solaris. +diff --git a/deps/v8/src/base/platform/platform-win32.cc b/deps/v8/src/base/platform/platform-win32.cc +index f18bb99..aef5b46 100644 +--- a/deps/v8/src/base/platform/platform-win32.cc ++++ b/deps/v8/src/base/platform/platform-win32.cc +@@ -1201,6 +1201,7 @@ double OS::nan_value() { + #ifdef _MSC_VER + return std::numeric_limits::quiet_NaN(); + #else // _MSC_VER ++#define NAN 0./0. + return NAN; + #endif // _MSC_VER + } +diff --git a/deps/v8/src/ostreams.cc b/deps/v8/src/ostreams.cc +index 62304eb..c78d4fc 100644 +--- a/deps/v8/src/ostreams.cc ++++ b/deps/v8/src/ostreams.cc +@@ -9,10 +9,6 @@ + #include "src/base/platform/platform.h" // For isinf/isnan with MSVC + #include "src/ostreams.h" + +-#if V8_OS_WIN +-#define snprintf sprintf_s +-#endif +- + namespace v8 { + namespace internal { + +diff --git a/deps/v8/tools/gyp/v8.gyp b/deps/v8/tools/gyp/v8.gyp +index c703155..8c951e7 100644 +--- a/deps/v8/tools/gyp/v8.gyp ++++ b/deps/v8/tools/gyp/v8.gyp +@@ -1301,7 +1301,7 @@ + ], + 'msvs_disabled_warnings': [4351, 4355, 4800], + 'link_settings': { +- 'libraries': [ '-lwinmm.lib', '-lws2_32.lib' ], ++ 'libraries': [ '-lwinmm', '-lws2_32' ], + }, + }], + ], +diff --git a/node.gyp b/node.gyp +index 46dbf39..2972856 100644 +--- a/node.gyp ++++ b/node.gyp +@@ -334,7 +334,7 @@ + 'PLATFORM="win32"', + '_UNICODE=1', + ], +- 'libraries': [ '-lpsapi.lib' ] ++ 'libraries': [ '-lpsapi' ] + }, { # POSIX + 'defines': [ '__POSIX__' ], + }], +diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc +index 1764374..c456b3b 100644 +--- a/src/cares_wrap.cc ++++ b/src/cares_wrap.cc +@@ -1299,10 +1299,10 @@ static void Initialize(Handle target, + Integer::New(env->isolate(), AF_INET6)); + target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "AF_UNSPEC"), + Integer::New(env->isolate(), AF_UNSPEC)); +- target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "AI_ADDRCONFIG"), +- Integer::New(env->isolate(), AI_ADDRCONFIG)); +- target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "AI_V4MAPPED"), +- Integer::New(env->isolate(), AI_V4MAPPED)); ++ target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "ARES_AI_ADDRCONFIG"), ++ Integer::New(env->isolate(), ARES_AI_ADDRCONFIG)); ++ target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "ARES_AI_V4MAPPED"), ++ Integer::New(env->isolate(), ARES_AI_V4MAPPED)); + + Local aiw = + FunctionTemplate::New(env->isolate(), NewGetAddrInfoReqWrap); +diff --git a/src/node.cc b/src/node.cc +index e669706..54ccaa0 100644 +--- a/src/node.cc ++++ b/src/node.cc +@@ -76,7 +76,6 @@ + #define umask _umask + typedef int mode_t; + #else +-#include // getrlimit, setrlimit + #include // setuid, getuid + #endif + +diff --git a/src/node_internals.h b/src/node_internals.h +index 253bd38..66300ac 100644 +--- a/src/node_internals.h ++++ b/src/node_internals.h +@@ -83,21 +83,6 @@ v8::Local AddressToJS( + const sockaddr* addr, + v8::Local info = v8::Handle()); + +-#ifdef _WIN32 +-// emulate snprintf() on windows, _snprintf() doesn't zero-terminate the buffer +-// on overflow... +-#include +-inline static int snprintf(char* buf, unsigned int len, const char* fmt, ...) { +- va_list ap; +- va_start(ap, fmt); +- int n = _vsprintf_p(buf, len, fmt, ap); +- if (len) +- buf[len - 1] = '\0'; +- va_end(ap); +- return n; +-} +-#endif +- + #if defined(__x86_64__) + # define BITS_PER_LONG 64 + #else +diff --git a/src/node_main.cc b/src/node_main.cc +index 6471551..d3b773b 100644 +--- a/src/node_main.cc ++++ b/src/node_main.cc +@@ -22,7 +22,7 @@ + #include "node.h" + + #ifdef _WIN32 +-int wmain(int argc, wchar_t *wargv[]) { ++int main(int argc, wchar_t *wargv[]) { + // Convert argv to to UTF8 + char** argv = new char*[argc]; + for (int i = 0; i < argc; i++) { +-- +2.6.1 + diff --git a/recipes/nodejs/files/nameser.h b/recipes/nodejs/files/nameser.h new file mode 100644 index 000000000..a0302fd39 --- /dev/null +++ b/recipes/nodejs/files/nameser.h @@ -0,0 +1,211 @@ + +#ifndef ARES_NAMESER_H +#define ARES_NAMESER_H + +/* header file provided by liren@vivisimo.com */ + +#ifndef HAVE_ARPA_NAMESER_H + +#define NS_PACKETSZ 512 /* maximum packet size */ +#define NS_MAXDNAME 256 /* maximum domain name */ +#define NS_MAXCDNAME 255 /* maximum compressed domain name */ +#define NS_MAXLABEL 63 +#define NS_HFIXEDSZ 12 /* #/bytes of fixed data in header */ +#define NS_QFIXEDSZ 4 /* #/bytes of fixed data in query */ +#define NS_RRFIXEDSZ 10 /* #/bytes of fixed data in r record */ +#define NS_INT16SZ 2 +#define NS_INADDRSZ 4 +#define NS_IN6ADDRSZ 16 +#define NS_CMPRSFLGS 0xc0 /* Flag bits indicating name compression. */ +#define NS_DEFAULTPORT 53 /* For both TCP and UDP. */ + +typedef enum __ns_class { + ns_c_invalid = 0, /* Cookie. */ + ns_c_in = 1, /* Internet. */ + ns_c_2 = 2, /* unallocated/unsupported. */ + ns_c_chaos = 3, /* MIT Chaos-net. */ + ns_c_hs = 4, /* MIT Hesiod. */ + /* Query class values which do not appear in resource records */ + ns_c_none = 254, /* for prereq. sections in update requests */ + ns_c_any = 255, /* Wildcard match. */ + ns_c_max = 65536 +} ns_class; + +typedef enum __ns_type { + ns_t_invalid = 0, /* Cookie. */ + ns_t_a = 1, /* Host address. */ + ns_t_ns = 2, /* Authoritative server. */ + ns_t_md = 3, /* Mail destination. */ + ns_t_mf = 4, /* Mail forwarder. */ + ns_t_cname = 5, /* Canonical name. */ + ns_t_soa = 6, /* Start of authority zone. */ + ns_t_mb = 7, /* Mailbox domain name. */ + ns_t_mg = 8, /* Mail group member. */ + ns_t_mr = 9, /* Mail rename name. */ + ns_t_null = 10, /* Null resource record. */ + ns_t_wks = 11, /* Well known service. */ + ns_t_ptr = 12, /* Domain name pointer. */ + ns_t_hinfo = 13, /* Host information. */ + ns_t_minfo = 14, /* Mailbox information. */ + ns_t_mx = 15, /* Mail routing information. */ + ns_t_txt = 16, /* Text strings. */ + ns_t_rp = 17, /* Responsible person. */ + ns_t_afsdb = 18, /* AFS cell database. */ + ns_t_x25 = 19, /* X_25 calling address. */ + ns_t_isdn = 20, /* ISDN calling address. */ + ns_t_rt = 21, /* Router. */ + ns_t_nsap = 22, /* NSAP address. */ + ns_t_nsap_ptr = 23, /* Reverse NSAP lookup (deprecated). */ + ns_t_sig = 24, /* Security signature. */ + ns_t_key = 25, /* Security key. */ + ns_t_px = 26, /* X.400 mail mapping. */ + ns_t_gpos = 27, /* Geographical position (withdrawn). */ + ns_t_aaaa = 28, /* Ip6 Address. */ + ns_t_loc = 29, /* Location Information. */ + ns_t_nxt = 30, /* Next domain (security). */ + ns_t_eid = 31, /* Endpoint identifier. */ + ns_t_nimloc = 32, /* Nimrod Locator. */ + ns_t_srv = 33, /* Server Selection. */ + ns_t_atma = 34, /* ATM Address */ + ns_t_naptr = 35, /* Naming Authority PoinTeR */ + ns_t_kx = 36, /* Key Exchange */ + ns_t_cert = 37, /* Certification record */ + ns_t_a6 = 38, /* IPv6 address (deprecates AAAA) */ + ns_t_dname = 39, /* Non-terminal DNAME (for IPv6) */ + ns_t_sink = 40, /* Kitchen sink (experimentatl) */ + ns_t_opt = 41, /* EDNS0 option (meta-RR) */ + ns_t_apl = 42, /* Address prefix list (RFC3123) */ + ns_t_ds = 43, /* Delegation Signer (RFC4034) */ + ns_t_sshfp = 44, /* SSH Key Fingerprint (RFC4255) */ + ns_t_rrsig = 46, /* Resource Record Signature (RFC4034) */ + ns_t_nsec = 47, /* Next Secure (RFC4034) */ + ns_t_dnskey = 48, /* DNS Public Key (RFC4034) */ + ns_t_tkey = 249, /* Transaction key */ + ns_t_tsig = 250, /* Transaction signature. */ + ns_t_ixfr = 251, /* Incremental zone transfer. */ + ns_t_axfr = 252, /* Transfer zone of authority. */ + ns_t_mailb = 253, /* Transfer mailbox records. */ + ns_t_maila = 254, /* Transfer mail agent records. */ + ns_t_any = 255, /* Wildcard match. */ + ns_t_zxfr = 256, /* BIND-specific, nonstandard. */ + ns_t_max = 65536 +} ns_type; + +typedef enum __ns_opcode { + ns_o_query = 0, /* Standard query. */ + ns_o_iquery = 1, /* Inverse query (deprecated/unsupported). */ + ns_o_status = 2, /* Name server status query (unsupported). */ + /* Opcode 3 is undefined/reserved. */ + ns_o_notify = 4, /* Zone change notification. */ + ns_o_update = 5, /* Zone update message. */ + ns_o_max = 6 +} ns_opcode; + +typedef enum __ns_rcode { + ns_r_noerror = 0, /* No error occurred. */ + ns_r_formerr = 1, /* Format error. */ + ns_r_servfail = 2, /* Server failure. */ + ns_r_nxdomain = 3, /* Name error. */ + ns_r_notimpl = 4, /* Unimplemented. */ + ns_r_refused = 5, /* Operation refused. */ + /* these are for BIND_UPDATE */ + ns_r_yxdomain = 6, /* Name exists */ + ns_r_yxrrset = 7, /* RRset exists */ + ns_r_nxrrset = 8, /* RRset does not exist */ + ns_r_notauth = 9, /* Not authoritative for zone */ + ns_r_notzone = 10, /* Zone of record different from zone section */ + ns_r_max = 11, + /* The following are TSIG extended errors */ + ns_r_badsig = 16, + ns_r_badkey = 17, + ns_r_badtime = 18 +} ns_rcode; + +#endif /* HAVE_ARPA_NAMESER_H */ + +#ifndef HAVE_ARPA_NAMESER_COMPAT_H + +#define PACKETSZ NS_PACKETSZ +#define MAXDNAME NS_MAXDNAME +#define MAXCDNAME NS_MAXCDNAME +#define MAXLABEL NS_MAXLABEL +#define HFIXEDSZ NS_HFIXEDSZ +#define QFIXEDSZ NS_QFIXEDSZ +#define RRFIXEDSZ NS_RRFIXEDSZ +#define INDIR_MASK NS_CMPRSFLGS +#define NAMESERVER_PORT NS_DEFAULTPORT + +#define QUERY ns_o_query + +#define SERVFAIL ns_r_servfail +#define NOTIMP ns_r_notimpl +#define REFUSED ns_r_refused +#undef NOERROR /* it seems this is already defined in winerror.h */ +#define NOERROR ns_r_noerror +#define FORMERR ns_r_formerr +#define NXDOMAIN ns_r_nxdomain + +#define C_IN ns_c_in +#define C_CHAOS ns_c_chaos +#define C_HS ns_c_hs +#define C_NONE ns_c_none +#define C_ANY ns_c_any + +#define T_A ns_t_a +#define T_NS ns_t_ns +#define T_MD ns_t_md +#define T_MF ns_t_mf +#define T_CNAME ns_t_cname +#define T_SOA ns_t_soa +#define T_MB ns_t_mb +#define T_MG ns_t_mg +#define T_MR ns_t_mr +#define T_NULL ns_t_null +#define T_WKS ns_t_wks +#define T_PTR ns_t_ptr +#define T_HINFO ns_t_hinfo +#define T_MINFO ns_t_minfo +#define T_MX ns_t_mx +#define T_TXT ns_t_txt +#define T_RP ns_t_rp +#define T_AFSDB ns_t_afsdb +#define T_X25 ns_t_x25 +#define T_ISDN ns_t_isdn +#define T_RT ns_t_rt +#define T_NSAP ns_t_nsap +#define T_NSAP_PTR ns_t_nsap_ptr +#define T_SIG ns_t_sig +#define T_KEY ns_t_key +#define T_PX ns_t_px +#define T_GPOS ns_t_gpos +#define T_AAAA ns_t_aaaa +#define T_LOC ns_t_loc +#define T_NXT ns_t_nxt +#define T_EID ns_t_eid +#define T_NIMLOC ns_t_nimloc +#define T_SRV ns_t_srv +#define T_ATMA ns_t_atma +#define T_NAPTR ns_t_naptr +#define T_KX ns_t_kx +#define T_CERT ns_t_cert +#define T_A6 ns_t_a6 +#define T_DNAME ns_t_dname +#define T_SINK ns_t_sink +#define T_OPT ns_t_opt +#define T_APL ns_t_apl +#define T_DS ns_t_ds +#define T_SSHFP ns_t_sshfp +#define T_RRSIG ns_t_rrsig +#define T_NSEC ns_t_nsec +#define T_DNSKEY ns_t_dnskey +#define T_TKEY ns_t_tkey +#define T_TSIG ns_t_tsig +#define T_IXFR ns_t_ixfr +#define T_AXFR ns_t_axfr +#define T_MAILB ns_t_mailb +#define T_MAILA ns_t_maila +#define T_ANY ns_t_any + +#endif /* HAVE_ARPA_NAMESER_COMPAT_H */ + +#endif /* ARES_NAMESER_H */ diff --git a/recipes/nodejs/nodejs.inc b/recipes/nodejs/nodejs.inc index 69ae6818d..bdd1cc2fc 100644 --- a/recipes/nodejs/nodejs.inc +++ b/recipes/nodejs/nodejs.inc @@ -4,17 +4,34 @@ LICENSE = "MIT BSD Artistic-2.0" inherit make c c++ -DEPENDS = "openssl libz librt libm libdl" +## +## NOTE: This recipe compiles for mingw32, but is not runtime tested. +## It is only used to provide the nodejs sources in the SDK, so +## that npm can compile modules against those. +## + +DEPENDS_HOST_OS = "libdl librt" +DEPENDS_HOST_OS:HOST_LIBC_mingw = "" +DEPENDS = "openssl libz libm libcares-dev libuv-dev ${DEPENDS_HOST_OS}" RECIPE_TYPES = "machine native sdk" SRC_URI = " \ http://nodejs.org/dist/v${PV}/node-v${PV}.tar.gz \ file://0001-initialize-arm_version-variable-in-gyp.patch \ " +SRC_URI:>HOST_LIBC_mingw = " file://0001-fix-compilation-for-mingw-sdk.patch file://nameser.h" S = "${SRCDIR}/node-v${PV}" +CONFIGURE_NAMESER = "" +CONFIGURE_NAMESER:HOST_LIBC_mingw = "do_configure_nameser" +do_configure[prefuncs] = "${CONFIGURE_NAMESER}" +do_configure_nameser() { + cp ${SRCDIR}/nameser.h ${S}/src/nameser.h +} + # Node is way too cool to use proper autotools NODEJS_CONF_ARCH="" +NODEJS_CONF_OS="" do_configure[prefuncs] += "do_configure_map_nodejs_arch" def do_configure_map_nodejs_arch(d): import re @@ -25,6 +42,12 @@ def do_configure_map_nodejs_arch(d): elif re.match('arm', a): a = 'arm' d.set('NODEJS_CONF_ARCH', a) + a = d.getVar('TARGET_OS', True) + if 'linux' in a: a = 'linux' + elif 'mingw' in a: a = 'win' + elif 'win' in a: a = 'win' + d.set('NODEJS_CONF_OS', a) + EXTRA_OECONF += "-DNODE_WANT_INTERNALS=0" SYSROOT = "${BUILD_SYSROOT}" SYSROOT:machine = "${MACHINE_SYSROOT}" @@ -33,14 +56,23 @@ do_configure () { ./configure --prefix=${prefix} \ --without-snapshot \ --without-npm \ + --without-perfctr \ + --without-etw \ + --without-dtrace \ --shared-openssl \ --shared-openssl-includes=${SYSROOT}${includedir} \ --shared-openssl-libpath=${SYSROOT}${libdir} \ --shared-zlib \ --shared-zlib-includes=${SYSROOT}${includedir} \ --shared-zlib-libpath=${SYSROOT}${libdir} \ + --shared-cares \ + --shared-cares-includes=${SYSROOT}${includedir} \ + --shared-cares-libpath=${SYSROOT}${libdir} \ + --shared-libuv \ + --shared-libuv-includes=${SYSROOT}${includedir} \ + --shared-libuv-libpath=${SYSROOT}${libdir} \ --dest-cpu=${NODEJS_CONF_ARCH} \ - --dest-os=linux + --dest-os=${NODEJS_CONF_OS} } do_compile () { @@ -51,8 +83,8 @@ do_install () { oe_runmake install DESTDIR=${D} PREFIX=${prefix} } -DEPENDS_${PN} = "libz openssl libdl librt libstdc++ libm libgcc libpthread libc" -RDEPENDS_${PN} = "libz openssl libdl librt libstdc++ libm libgcc libpthread libc" +DEPENDS_${PN} = "libz openssl libstdc++ libm libgcc libpthread libc libcares libuv ${DEPENDS_HOST_OS}" +RDEPENDS_${PN} = "libz openssl libstdc++ libm libgcc libpthread libc libcares libuv ${DEPENDS_HOST_OS}" PACKAGES_${PN} =+ "${PN}-dev" FILES_${PN}-dev = "${includedir}/node ${datadir}" From bb70da50808010ed14fec16833844bd29486e056 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Hundeb=C3=B8ll?= Date: Tue, 13 Oct 2015 21:11:37 +0200 Subject: [PATCH 7/7] nodejs: add patch to link libdl on posix targets The final linker step failed when compiling node, which was caused by unresolved symbols from libdl. Fix this by patching gyp to link with libdl on posix systems. --- ...-libdl-to-libraries-on-posix-targets.patch | 28 +++++++++++++++++++ recipes/nodejs/nodejs.inc | 1 + 2 files changed, 29 insertions(+) create mode 100644 recipes/nodejs/files/0001-add-libdl-to-libraries-on-posix-targets.patch diff --git a/recipes/nodejs/files/0001-add-libdl-to-libraries-on-posix-targets.patch b/recipes/nodejs/files/0001-add-libdl-to-libraries-on-posix-targets.patch new file mode 100644 index 000000000..971b108bf --- /dev/null +++ b/recipes/nodejs/files/0001-add-libdl-to-libraries-on-posix-targets.patch @@ -0,0 +1,28 @@ +From ada98d25b1a8017adfba15ee363ec9af1768341f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Martin=20Hundeb=C3=B8ll?= +Date: Tue, 13 Oct 2015 20:49:18 +0200 +Subject: [PATCH] add libdl to libraries on posix targets + +When using external libuv, libdl is required for linking, but isn't +picked up by gyp. Fix this by adding -ldl to libraries in node.gyp. + +Upstream-status: Inappropriate - upstream links statically with libuv +--- + node.gyp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/node.gyp b/node.gyp +index 2972856..ab517ad 100644 +--- a/node.gyp ++++ b/node.gyp +@@ -337,6 +337,7 @@ + 'libraries': [ '-lpsapi' ] + }, { # POSIX + 'defines': [ '__POSIX__' ], ++ 'libraries': [ '-ldl' ], + }], + [ 'OS=="mac"', { + # linking Corefoundation is needed since certain OSX debugging tools +-- +2.6.1 + diff --git a/recipes/nodejs/nodejs.inc b/recipes/nodejs/nodejs.inc index bdd1cc2fc..c5ab1a961 100644 --- a/recipes/nodejs/nodejs.inc +++ b/recipes/nodejs/nodejs.inc @@ -18,6 +18,7 @@ RECIPE_TYPES = "machine native sdk" SRC_URI = " \ http://nodejs.org/dist/v${PV}/node-v${PV}.tar.gz \ file://0001-initialize-arm_version-variable-in-gyp.patch \ + file://0001-add-libdl-to-libraries-on-posix-targets.patch \ " SRC_URI:>HOST_LIBC_mingw = " file://0001-fix-compilation-for-mingw-sdk.patch file://nameser.h" S = "${SRCDIR}/node-v${PV}"