nodejs_10.17.0.bb 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. DESCRIPTION = "nodeJS Evented I/O for V8 JavaScript"
  2. HOMEPAGE = "http://nodejs.org"
  3. LICENSE = "MIT & BSD & Artistic-2.0"
  4. LIC_FILES_CHKSUM = "file://LICENSE;md5=be980eb7ccafe287cb438076a65e888c"
  5. DEPENDS = "openssl"
  6. DEPENDS_append_class-target = " nodejs-native"
  7. inherit pkgconfig ${@bb.utils.contains("BBFILE_COLLECTIONS", "meta-python2", "pythonnative", "", d)}
  8. COMPATIBLE_MACHINE_armv4 = "(!.*armv4).*"
  9. COMPATIBLE_MACHINE_armv5 = "(!.*armv5).*"
  10. COMPATIBLE_MACHINE_mips64 = "(!.*mips64).*"
  11. COMPATIBLE_HOST_riscv64 = "null"
  12. COMPATIBLE_HOST_riscv32 = "null"
  13. SRC_URI = "http://nodejs.org/dist/v${PV}/node-v${PV}.tar.xz \
  14. file://0001-Disable-running-gyp-files-for-bundled-deps.patch \
  15. file://0003-Install-both-binaries-and-use-libdir.patch \
  16. file://0004-Make-compatibility-with-gcc-4.8.patch \
  17. file://0007-v8-don-t-override-ARM-CFLAGS.patch \
  18. "
  19. SRC_URI_append_class-target = " \
  20. file://0002-Using-native-torque.patch \
  21. file://0005-Link-atomic-library.patch \
  22. "
  23. SRC_URI[md5sum] = "d5a56d0abf764a91f627f0690cd4b9f3"
  24. SRC_URI[sha256sum] = "412667d76bd5273c07cb69c215998109fd5bb35c874654f93e6a0132d666c58e"
  25. S = "${WORKDIR}/node-v${PV}"
  26. # v8 errors out if you have set CCACHE
  27. CCACHE = ""
  28. def map_nodejs_arch(a, d):
  29. import re
  30. if re.match('i.86$', a): return 'ia32'
  31. elif re.match('x86_64$', a): return 'x64'
  32. elif re.match('aarch64$', a): return 'arm64'
  33. elif re.match('(powerpc64|ppc64le)$', a): return 'ppc64'
  34. elif re.match('powerpc$', a): return 'ppc'
  35. return a
  36. ARCHFLAGS_arm = "${@bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', '--with-arm-float-abi=hard', '--with-arm-float-abi=softfp', d)} \
  37. ${@bb.utils.contains('TUNE_FEATURES', 'neon', '--with-arm-fpu=neon', \
  38. bb.utils.contains('TUNE_FEATURES', 'vfpv3d16', '--with-arm-fpu=vfpv3-d16', \
  39. bb.utils.contains('TUNE_FEATURES', 'vfpv3', '--with-arm-fpu=vfpv3', \
  40. '--with-arm-fpu=vfp', d), d), d)}"
  41. GYP_DEFINES_append_mipsel = " mips_arch_variant='r1' "
  42. ARCHFLAGS ?= ""
  43. PACKAGECONFIG ??= "ares icu libuv zlib"
  44. PACKAGECONFIG[ares] = "--shared-cares,,c-ares"
  45. PACKAGECONFIG[gyp] = ",,gyp-py2-native"
  46. PACKAGECONFIG[icu] = "--with-intl=system-icu,--without-intl,icu"
  47. PACKAGECONFIG[libuv] = "--shared-libuv,,libuv"
  48. PACKAGECONFIG[nghttp2] = "--shared-nghttp2,,nghttp2"
  49. PACKAGECONFIG[shared] = "--shared"
  50. PACKAGECONFIG[zlib] = "--shared-zlib,,zlib"
  51. # We don't want to cross-compile during target compile,
  52. # and we need to use the right flags during host compile,
  53. # too.
  54. EXTRA_OEMAKE = "\
  55. CC.host='${CC}' \
  56. CFLAGS.host='${CPPFLAGS} ${CFLAGS}' \
  57. CXX.host='${CXX}' \
  58. CXXFLAGS.host='${CPPFLAGS} ${CXXFLAGS}' \
  59. LDFLAGS.host='${LDFLAGS}' \
  60. AR.host='${AR}' \
  61. \
  62. builddir_name=./ \
  63. "
  64. python do_unpack() {
  65. import shutil
  66. bb.build.exec_func('base_do_unpack', d)
  67. shutil.rmtree(d.getVar('S') + '/deps/openssl', True)
  68. if 'ares' in d.getVar('PACKAGECONFIG'):
  69. shutil.rmtree(d.getVar('S') + '/deps/cares', True)
  70. if 'gyp' in d.getVar('PACKAGECONFIG'):
  71. shutil.rmtree(d.getVar('S') + '/tools/gyp', True)
  72. if 'libuv' in d.getVar('PACKAGECONFIG'):
  73. shutil.rmtree(d.getVar('S') + '/deps/uv', True)
  74. if 'nghttp2' in d.getVar('PACKAGECONFIG'):
  75. shutil.rmtree(d.getVar('S') + '/deps/nghttp2', True)
  76. if 'zlib' in d.getVar('PACKAGECONFIG'):
  77. shutil.rmtree(d.getVar('S') + '/deps/zlib', True)
  78. }
  79. # Node is way too cool to use proper autotools, so we install two wrappers to forcefully inject proper arch cflags to workaround gypi
  80. do_configure () {
  81. export LD="${CXX}"
  82. GYP_DEFINES="${GYP_DEFINES}" export GYP_DEFINES
  83. # $TARGET_ARCH settings don't match --dest-cpu settings
  84. ./configure --prefix=${prefix} --without-snapshot --shared-openssl \
  85. --dest-cpu="${@map_nodejs_arch(d.getVar('TARGET_ARCH'), d)}" \
  86. --dest-os=linux \
  87. --libdir=${D}${libdir} \
  88. ${ARCHFLAGS} \
  89. ${PACKAGECONFIG_CONFARGS}
  90. }
  91. do_compile () {
  92. export LD="${CXX}"
  93. oe_runmake BUILDTYPE=Release
  94. }
  95. do_install () {
  96. oe_runmake install DESTDIR=${D}
  97. }
  98. do_install_append_class-native() {
  99. # use node from PATH instead of absolute path to sysroot
  100. # node-v0.10.25/tools/install.py is using:
  101. # shebang = os.path.join(node_prefix, 'bin/node')
  102. # update_shebang(link_path, shebang)
  103. # and node_prefix can be very long path to bindir in native sysroot and
  104. # when it exceeds 128 character shebang limit it's stripped to incorrect path
  105. # and npm fails to execute like in this case with 133 characters show in log.do_install:
  106. # updating shebang of /home/jenkins/workspace/build-webos-nightly/device/qemux86/label/open-webos-builder/BUILD-qemux86/work/x86_64-linux/nodejs-native/0.10.15-r0/image/home/jenkins/workspace/build-webos-nightly/device/qemux86/label/open-webos-builder/BUILD-qemux86/sysroots/x86_64-linux/usr/bin/npm to /home/jenkins/workspace/build-webos-nightly/device/qemux86/label/open-webos-builder/BUILD-qemux86/sysroots/x86_64-linux/usr/bin/node
  107. # /usr/bin/npm is symlink to /usr/lib/node_modules/npm/bin/npm-cli.js
  108. # use sed on npm-cli.js because otherwise symlink is replaced with normal file and
  109. # npm-cli.js continues to use old shebang
  110. sed "1s^.*^#\!/usr/bin/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js
  111. # Install the native torque to provide it within sysroot for the target compilation
  112. install -d ${D}${bindir}
  113. install -m 0755 ${S}/out/Release/torque ${D}${bindir}/torque
  114. }
  115. do_install_append_class-target() {
  116. sed "1s^.*^#\!${bindir}/env node^g" -i ${D}${exec_prefix}/lib/node_modules/npm/bin/npm-cli.js
  117. }
  118. PACKAGES =+ "${PN}-npm"
  119. FILES_${PN}-npm = "${exec_prefix}/lib/node_modules ${bindir}/npm ${bindir}/npx"
  120. RDEPENDS_${PN}-npm = "bash python-core python-shell python-datetime python-subprocess python-textutils \
  121. python-compiler python-misc python-multiprocessing"
  122. PACKAGES =+ "${PN}-systemtap"
  123. FILES_${PN}-systemtap = "${datadir}/systemtap"
  124. BBCLASSEXTEND = "native"
  125. python() {
  126. if 'meta-python2' not in d.getVar('BBFILE_COLLECTIONS').split():
  127. raise bb.parse.SkipRecipe('Requires meta-python2 to be present.')
  128. }