From 49a10f02d88e6cee28af6f60e36ea628b6b607a3 Mon Sep 17 00:00:00 2001 From: LEAN-ESX Date: Mon, 24 Feb 2020 02:54:25 -0800 Subject: [PATCH] node: bump version --- lang/node-arduino-firmata/Makefile | 54 +- .../arduino-firmata/lib/arduino-firmata.js | 507 +++++++++--------- lang/node-cylon/Makefile | 59 +- lang/node-hid/Makefile | 63 ++- lang/node-hid/patches/000-support_musl.patch | 11 + lang/node-homebridge/Makefile | 72 +++ lang/node-homebridge/files/homebridge.init | 18 + lang/node-javascript-obfuscator/Makefile | 104 ++++ lang/node-mozilla-iot-gateway/Makefile | 71 --- .../files/mozilla-iot-gateway.init | 12 - lang/node-serialport-bindings/Makefile | 74 +++ .../patches/000-powerpc_termios_header.patch | 16 + lang/node-serialport/Makefile | 56 +- .../patches/001-turn_off_depends.patch | 10 + lang/node/Makefile | 101 ++-- lang/node/patches/001-hardfloat.patch | 2 +- lang/node/patches/002-addr_info.patch | 4 +- lang/node/patches/003-path.patch | 16 +- lang/node/patches/004-musl_support.patch | 61 +++ .../004-node_crypto_include_cmath.patch | 25 - lang/node/patches/006-mips64_support.patch | 30 ++ .../patches/007-fix_host_build_on_macos.patch | 11 + .../patches/008-deps_v8_fix_big_endian.patch | 11 + ...necessary_libraries_for_host_execute.patch | 78 +++ .../999-fix_missing_llhttp_depends.patch | 14 + ...this_build_method_will_be_deprecated.patch | 37 ++ 26 files changed, 1000 insertions(+), 517 deletions(-) create mode 100644 lang/node-hid/patches/000-support_musl.patch create mode 100644 lang/node-homebridge/Makefile create mode 100644 lang/node-homebridge/files/homebridge.init create mode 100644 lang/node-javascript-obfuscator/Makefile delete mode 100644 lang/node-mozilla-iot-gateway/Makefile delete mode 100644 lang/node-mozilla-iot-gateway/files/mozilla-iot-gateway.init create mode 100644 lang/node-serialport-bindings/Makefile create mode 100644 lang/node-serialport-bindings/patches/000-powerpc_termios_header.patch create mode 100644 lang/node-serialport/patches/001-turn_off_depends.patch create mode 100644 lang/node/patches/004-musl_support.patch delete mode 100644 lang/node/patches/004-node_crypto_include_cmath.patch create mode 100644 lang/node/patches/006-mips64_support.patch create mode 100644 lang/node/patches/007-fix_host_build_on_macos.patch create mode 100644 lang/node/patches/008-deps_v8_fix_big_endian.patch create mode 100644 lang/node/patches/999-delete_unnecessary_libraries_for_host_execute.patch create mode 100644 lang/node/patches/999-fix_missing_llhttp_depends.patch create mode 100644 lang/node/patches/999-v8_this_build_method_will_be_deprecated.patch diff --git a/lang/node-arduino-firmata/Makefile b/lang/node-arduino-firmata/Makefile index d8ce5886..fd2b3f4c 100644 --- a/lang/node-arduino-firmata/Makefile +++ b/lang/node-arduino-firmata/Makefile @@ -10,19 +10,16 @@ include $(TOPDIR)/rules.mk PKG_NPM_NAME:=arduino-firmata PKG_NAME:=node-$(PKG_NPM_NAME) PKG_VERSION:=0.3.4 -PKG_RELEASE:=1 +PKG_RELEASE:=3 -PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL:=https://github.com/shokai/node-arduino-firmata.git -PKG_SOURCE_VERSION:=v0.3.4 -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION) -PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz -#PKG_MIRROR_HASH:=b7a498ccf70e466503e72d38ae5b474e91416b6c9842fd167dff249357b0dc37 +PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz +PKG_SOURCE_URL:=https://registry.npmjs.org/$(PKG_NPM_NAME)/-/ +PKG_HASH:=d7157e02867eae82887cb5e17b90c963fe7489bacd464110bfd20c672b8d5a98 PKG_BUILD_DEPENDS:=node/host -PKG_NODE_VERSION:=8.10.0 +PKG_USE_MIPS16:=0 -PKG_MAINTAINER:=John Crispin +PKG_MAINTAINER:=Hirokazu MORIKAWA PKG_LICENSE:=MIT PKG_LICENSE_FILES:=LICENSE.txt @@ -32,37 +29,44 @@ define Package/node-arduino-firmata SUBMENU:=Node.js SECTION:=lang CATEGORY:=Languages - TITLE:=Node.js package to access serial ports for reading and writing - URL:=https://www.npmjs.org/package/serialport + TITLE:=Arduino Firmata implementation for Node.js + URL:=https://www.npmjs.com/package/arduino-firmata DEPENDS:=+node +node-npm +node-serialport endef define Package/node-arduino-firmata/description - Node.js package to access serial ports for reading and writing OR Welcome your robotic JavaScript overlords. Better yet, program them! + Arduino Firmata protocol (http://firmata.org) implementation on Node.js. endef -define Build/Prepare - /bin/tar xzf $(DL_DIR)/$(PKG_SOURCE) -C $(PKG_BUILD_DIR) --strip-components 1 - $(Build/Patch) -endef +TAR_OPTIONS+= --strip-components 1 +TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS) -EXTRA_LDFLAGS="-L$(TOOLCHAIN_DIR)/lib/ -Wl,-rpath-link $(TOOLCHAIN_DIR)/lib/" \ +NODEJS_CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH))))) define Build/Compile + $(MAKE_VARS) \ $(MAKE_FLAGS) \ - npm_config_arch=$(CONFIG_ARCH) \ - npm_config_nodedir=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/ \ - npm_config_cache=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/npm-cache \ - PREFIX="$(PKG_INSTALL_DIR)/usr/" \ + npm_config_arch=$(NODEJS_CPU) \ + npm_config_target_arch=$(NODEJS_CPU) \ + npm_config_build_from_source=true \ + npm_config_nodedir=$(STAGING_DIR)/usr/ \ + npm_config_prefix=$(PKG_INSTALL_DIR)/usr/ \ + npm_config_cache=$(TMP_DIR)/npm-cache \ + npm_config_tmp=$(TMP_DIR)/npm-tmp \ npm install -g $(PKG_BUILD_DIR) + rm -rf $(TMP_DIR)/npm-tmp + rm -rf $(TMP_DIR)/npm-cache endef define Package/node-arduino-firmata/install - mkdir -p $(1)/usr/lib/node - $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/ $(1)/usr/lib/node - rm -rf $(1)/usr/lib/node/arduino-firmata/node_modules/serialport/ + $(INSTALL_DIR) $(1)/usr/lib/node/$(PKG_NPM_NAME) + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{package.json,README.md} \ + $(1)/usr/lib/node/$(PKG_NPM_NAME)/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{tests,*.txt} \ + $(1)/usr/lib/node/$(PKG_NPM_NAME)/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{node_modules,lib} \ + $(1)/usr/lib/node/$(PKG_NPM_NAME)/ $(CP) ./files/* $(1)/ endef $(eval $(call BuildPackage,node-arduino-firmata)) - diff --git a/lang/node-arduino-firmata/files/usr/lib/node/arduino-firmata/lib/arduino-firmata.js b/lang/node-arduino-firmata/files/usr/lib/node/arduino-firmata/lib/arduino-firmata.js index 578bd402..2f9bcf7c 100644 --- a/lang/node-arduino-firmata/files/usr/lib/node/arduino-firmata/lib/arduino-firmata.js +++ b/lang/node-arduino-firmata/files/usr/lib/node/arduino-firmata/lib/arduino-firmata.js @@ -1,17 +1,249 @@ (function() { 'use strict'; - var ArduinoFirmata, SerialPort, debug, events, exports, serialport, - extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, - hasProp = {}.hasOwnProperty; + var ArduinoFirmata, debug, events, exports, serialport; events = require('eventemitter2'); - SerialPort = (serialport = require('serialport')).SerialPort; + serialport = require('serialport'); debug = require('debug')('arduino-firmata'); - exports = module.exports = ArduinoFirmata = (function(superClass) { - extend(ArduinoFirmata, superClass); + exports = module.exports = ArduinoFirmata = (function() { + class ArduinoFirmata extends events.EventEmitter2 { + static list(callback) { + return serialport.list(function(err, ports) { + var devices, j, len, port; + if (err) { + return callback(err); + } + devices = []; + for (j = 0, len = ports.length; j < len; j++) { + port = ports[j]; + if (/usb|acm|com|ama\d+/i.test(port.comName)) { + devices.push(port.comName); + } + } + return callback(null, devices); + }); + } + + constructor() { + super(); + this.status = ArduinoFirmata.Status.CLOSE; + this.wait_for_data = 0; + this.execute_multi_byte_command = 0; + this.multi_byte_channel = 0; + this.stored_input_data = []; + this.parsing_sysex = false; + this.sysex_bytes_read = 0; + this.digital_output_data = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + this.digital_input_data = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + this.analog_input_data = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + this.boardVersion = null; + } + + isOldArduinoDevice() { + return /usbserial|USB/.test(this.serialport_name); + } + + connect(serialport_name, opts = { + baudRate: 57600 + }) { + this.serialport_name = serialport_name; + opts.parser = serialport.parsers.raw; + if (!this.serialport_name) { + ArduinoFirmata.list((err, devices) => { + return this.connect(devices[0], opts); + }); + return this; + } + this.once('boardReady', function() { + var io_init_wait; + debug('boardReady'); + io_init_wait = this.isOldArduinoDevice() ? (debug(`old arduino device found ${this.serialport_name}`), 3000) : (debug(`new arduino device found ${this.serialport_name}`), 100); + debug(`wait ${io_init_wait}(msec)`); + return setTimeout(() => { + var i, j, k; + for (i = j = 0; j < 6; i = ++j) { + this.write([ArduinoFirmata.REPORT_ANALOG | i, 1]); + } + for (i = k = 0; k < 2; i = ++k) { + this.write([ArduinoFirmata.REPORT_DIGITAL | i, 1]); + } + debug('init IO ports'); + return this.emit('connect'); + }, io_init_wait); + }); + this.serialport = new serialport(this.serialport_name, opts); + this.serialport.once('open', () => { + var cid; + cid = setInterval(() => { + debug('request REPORT_VERSION'); + return this.write([ArduinoFirmata.REPORT_VERSION]); + }, 500); + this.once('boardVersion', (version) => { + clearInterval(cid); + this.status = ArduinoFirmata.Status.OPEN; + return this.emit('boardReady'); + }); + return this.serialport.on('data', (data) => { + var byte, j, len, results; + results = []; + for (j = 0, len = data.length; j < len; j++) { + byte = data[j]; + results.push(this.process_input(byte)); + } + return results; + }); + }); + return this; + } + + isOpen() { + return this.status === ArduinoFirmata.Status.OPEN; + } + + close(callback) { + this.status = ArduinoFirmata.Status.CLOSE; + return this.serialport.close(callback); + } + + reset(callback) { + return this.write([ArduinoFirmata.SYSTEM_RESET], callback); + } + + write(bytes, callback) { + return this.serialport.write(bytes, callback); + } + + sysex(command, data = [], callback) { + var write_data; + //# http://firmata.org/wiki/V2.1ProtocolDetails#Sysex_Message_Format + data = data.map(function(i) { + return i & 0b1111111; // 7bit + }); + write_data = [ArduinoFirmata.START_SYSEX, command].concat(data, [ArduinoFirmata.END_SYSEX]); + return this.write(write_data, callback); + } + + pinMode(pin, mode, callback) { + switch (mode) { + case true: + mode = ArduinoFirmata.OUTPUT; + break; + case false: + mode = ArduinoFirmata.INPUT; + } + return this.write([ArduinoFirmata.SET_PIN_MODE, pin, mode], callback); + } + + digitalWrite(pin, value, callback) { + var port_num; + this.pinMode(pin, ArduinoFirmata.OUTPUT); + port_num = (pin >>> 3) & 0x0F; + if (value === 0 || value === false) { + this.digital_output_data[port_num] &= ~(1 << (pin & 0x07)); + } else { + this.digital_output_data[port_num] |= 1 << (pin & 0x07); + } + return this.write([ArduinoFirmata.DIGITAL_MESSAGE | port_num, this.digital_output_data[port_num] & 0x7F, this.digital_output_data[port_num] >>> 7], callback); + } + + analogWrite(pin, value, callback) { + value = Math.floor(value); + this.pinMode(pin, ArduinoFirmata.PWM); + return this.write([ArduinoFirmata.ANALOG_MESSAGE | (pin & 0x0F), value & 0x7F, value >>> 7], callback); + } + + servoWrite(pin, angle, callback) { + this.pinMode(pin, ArduinoFirmata.SERVO); + return this.write([ArduinoFirmata.ANALOG_MESSAGE | (pin & 0x0F), angle & 0x7F, angle >>> 7], callback); + } + + digitalRead(pin) { + return ((this.digital_input_data[pin >>> 3] >>> (pin & 0x07)) & 0x01) > 0; + } + + analogRead(pin) { + return this.analog_input_data[pin]; + } + + process_input(input_data) { + var analog_value, command, diff, i, j, old_analog_value, results, stat, sysex_command, sysex_data; + if (this.parsing_sysex) { + if (input_data === ArduinoFirmata.END_SYSEX) { + this.parsing_sysex = false; + sysex_command = this.stored_input_data[0]; + sysex_data = this.stored_input_data.slice(1, this.sysex_bytes_read); + return this.emit('sysex', { + command: sysex_command, + data: sysex_data + }); + } else { + this.stored_input_data[this.sysex_bytes_read] = input_data; + return this.sysex_bytes_read += 1; + } + } else if (this.wait_for_data > 0 && input_data < 128) { + this.wait_for_data -= 1; + this.stored_input_data[this.wait_for_data] = input_data; + if (this.execute_multi_byte_command !== 0 && this.wait_for_data === 0) { + switch (this.execute_multi_byte_command) { + case ArduinoFirmata.DIGITAL_MESSAGE: + input_data = (this.stored_input_data[0] << 7) + this.stored_input_data[1]; + diff = this.digital_input_data[this.multi_byte_channel] ^ input_data; + this.digital_input_data[this.multi_byte_channel] = input_data; + if (this.listeners('digitalChange').length > 0) { + results = []; + for (i = j = 0; j <= 13; i = ++j) { + if (((0x01 << i) & diff) > 0) { + stat = (input_data & diff) > 0; + results.push(this.emit('digitalChange', { + pin: i + this.multi_byte_channel * 8, + value: stat, + old_value: !stat + })); + } else { + results.push(void 0); + } + } + return results; + } + break; + case ArduinoFirmata.ANALOG_MESSAGE: + analog_value = (this.stored_input_data[0] << 7) + this.stored_input_data[1]; + old_analog_value = this.analogRead(this.multi_byte_channel); + this.analog_input_data[this.multi_byte_channel] = analog_value; + if (old_analog_value !== analog_value) { + return this.emit('analogChange', { + pin: this.multi_byte_channel, + value: analog_value, + old_value: old_analog_value + }); + } + break; + case ArduinoFirmata.REPORT_VERSION: + this.boardVersion = `${this.stored_input_data[1]}.${this.stored_input_data[0]}`; + return this.emit('boardVersion', this.boardVersion); + } + } + } else { + if (input_data < 0xF0) { + command = input_data & 0xF0; + this.multi_byte_channel = input_data & 0x0F; + } else { + command = input_data; + } + if (command === ArduinoFirmata.START_SYSEX) { + this.parsing_sysex = true; + return this.sysex_bytes_read = 0; + } else if (command === ArduinoFirmata.DIGITAL_MESSAGE || command === ArduinoFirmata.ANALOG_MESSAGE || command === ArduinoFirmata.REPORT_VERSION) { + this.wait_for_data = 2; + return this.execute_multi_byte_command = command; + } + } + } + + }; ArduinoFirmata.Status = { CLOSE: 0, @@ -38,269 +270,26 @@ ArduinoFirmata.MAX_DATA_BYTES = 32; - ArduinoFirmata.DIGITAL_MESSAGE = 0x90; + ArduinoFirmata.DIGITAL_MESSAGE = 0x90; // send data for a digital port - ArduinoFirmata.ANALOG_MESSAGE = 0xE0; + ArduinoFirmata.ANALOG_MESSAGE = 0xE0; // send data for an analog pin (or PWM) - ArduinoFirmata.REPORT_ANALOG = 0xC0; + ArduinoFirmata.REPORT_ANALOG = 0xC0; // enable analog input by pin - ArduinoFirmata.REPORT_DIGITAL = 0xD0; + ArduinoFirmata.REPORT_DIGITAL = 0xD0; // enable digital input by port - ArduinoFirmata.SET_PIN_MODE = 0xF4; + ArduinoFirmata.SET_PIN_MODE = 0xF4; // set a pin to INPUT/OUTPUT/PWM/etc - ArduinoFirmata.REPORT_VERSION = 0xF9; + ArduinoFirmata.REPORT_VERSION = 0xF9; // report firmware version - ArduinoFirmata.SYSTEM_RESET = 0xFF; + ArduinoFirmata.SYSTEM_RESET = 0xFF; // reset from MIDI - ArduinoFirmata.START_SYSEX = 0xF0; + ArduinoFirmata.START_SYSEX = 0xF0; // start a MIDI SysEx message - ArduinoFirmata.END_SYSEX = 0xF7; - - ArduinoFirmata.list = function(callback) { - return serialport.list(function(err, ports) { - var devices, j, len, port; - if (err) { - return callback(err); - } - devices = []; - for (j = 0, len = ports.length; j < len; j++) { - port = ports[j]; - if (/usb|acm|com\d+/i.test(port.comName)) { - devices.push(port.comName); - } - } - return callback(null, devices); - }); - }; - - function ArduinoFirmata() { - this.status = ArduinoFirmata.Status.CLOSE; - this.wait_for_data = 0; - this.execute_multi_byte_command = 0; - this.multi_byte_channel = 0; - this.stored_input_data = []; - this.parsing_sysex = false; - this.sysex_bytes_read = 0; - this.digital_output_data = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; - this.digital_input_data = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; - this.analog_input_data = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; - this.boardVersion = null; - } - - ArduinoFirmata.prototype.isOldArduinoDevice = function() { - return /usbserial|USB/.test(this.serialport_name); - }; - - ArduinoFirmata.prototype.connect = function(serialport_name, opts) { - this.serialport_name = serialport_name; - if (opts == null) { - opts = { - baudrate: 57600 - }; - } - opts.parser = serialport.parsers.raw; - if (!this.serialport_name) { - ArduinoFirmata.list((function(_this) { - return function(err, devices) { - return _this.connect(devices[0], opts); - }; - })(this)); - return this; - } - this.once('boardReady', function() { - var io_init_wait; - debug('boardReady'); - io_init_wait = this.isOldArduinoDevice() ? (debug("old arduino device found " + this.serialport_name), 3000) : (debug("new arduino device found " + this.serialport_name), 100); - debug("wait " + io_init_wait + "(msec)"); - return setTimeout((function(_this) { - return function() { - var i, j, k; - for (i = j = 0; j < 6; i = ++j) { - _this.write([ArduinoFirmata.REPORT_ANALOG | i, 1]); - } - for (i = k = 0; k < 2; i = ++k) { - _this.write([ArduinoFirmata.REPORT_DIGITAL | i, 1]); - } - debug('init IO ports'); - return _this.emit('connect'); - }; - })(this), io_init_wait); - }); - this.serialport = new SerialPort(this.serialport_name, opts); - this.serialport.once('open', (function(_this) { - return function() { - var cid; - cid = setInterval(function() { - debug('request REPORT_VERSION'); - return _this.write([ArduinoFirmata.REPORT_VERSION]); - }, 500); - _this.once('boardVersion', function(version) { - clearInterval(cid); - _this.status = ArduinoFirmata.Status.OPEN; - return _this.emit('boardReady'); - }); - return _this.serialport.on('data', function(data) { - var byte, j, len, results; - results = []; - for (j = 0, len = data.length; j < len; j++) { - byte = data[j]; - results.push(_this.process_input(byte)); - } - return results; - }); - }; - })(this)); - return this; - }; - - ArduinoFirmata.prototype.isOpen = function() { - return this.status === ArduinoFirmata.Status.OPEN; - }; - - ArduinoFirmata.prototype.close = function(callback) { - this.status = ArduinoFirmata.Status.CLOSE; - return this.serialport.close(callback); - }; - - ArduinoFirmata.prototype.reset = function(callback) { - return this.write([ArduinoFirmata.SYSTEM_RESET], callback); - }; - - ArduinoFirmata.prototype.write = function(bytes, callback) { - return this.serialport.write(bytes, callback); - }; - - ArduinoFirmata.prototype.sysex = function(command, data, callback) { - var write_data; - if (data == null) { - data = []; - } - data = data.map(function(i) { - return i & 0x7f; - }); - write_data = [ArduinoFirmata.START_SYSEX, command].concat(data, [ArduinoFirmata.END_SYSEX]); - return this.write(write_data, callback); - }; - - ArduinoFirmata.prototype.pinMode = function(pin, mode, callback) { - switch (mode) { - case true: - mode = ArduinoFirmata.OUTPUT; - break; - case false: - mode = ArduinoFirmata.INPUT; - } - return this.write([ArduinoFirmata.SET_PIN_MODE, pin, mode], callback); - }; - - ArduinoFirmata.prototype.digitalWrite = function(pin, value, callback) { - var port_num; - this.pinMode(pin, ArduinoFirmata.OUTPUT); - port_num = (pin >>> 3) & 0x0F; - if (value === 0 || value === false) { - this.digital_output_data[port_num] &= ~(1 << (pin & 0x07)); - } else { - this.digital_output_data[port_num] |= 1 << (pin & 0x07); - } - return this.write([ArduinoFirmata.DIGITAL_MESSAGE | port_num, this.digital_output_data[port_num] & 0x7F, this.digital_output_data[port_num] >>> 7], callback); - }; - - ArduinoFirmata.prototype.analogWrite = function(pin, value, callback) { - value = Math.floor(value); - this.pinMode(pin, ArduinoFirmata.PWM); - return this.write([ArduinoFirmata.ANALOG_MESSAGE | (pin & 0x0F), value & 0x7F, value >>> 7], callback); - }; - - ArduinoFirmata.prototype.servoWrite = function(pin, angle, callback) { - this.pinMode(pin, ArduinoFirmata.SERVO); - return this.write([ArduinoFirmata.ANALOG_MESSAGE | (pin & 0x0F), angle & 0x7F, angle >>> 7], callback); - }; - - ArduinoFirmata.prototype.digitalRead = function(pin) { - return ((this.digital_input_data[pin >>> 3] >>> (pin & 0x07)) & 0x01) > 0; - }; - - ArduinoFirmata.prototype.analogRead = function(pin) { - return this.analog_input_data[pin]; - }; - - ArduinoFirmata.prototype.process_input = function(input_data) { - var analog_value, command, diff, i, j, old_analog_value, results, stat, sysex_command, sysex_data; - if (this.parsing_sysex) { - if (input_data === ArduinoFirmata.END_SYSEX) { - this.parsing_sysex = false; - sysex_command = this.stored_input_data[0]; - sysex_data = this.stored_input_data.slice(1, this.sysex_bytes_read); - return this.emit('sysex', { - command: sysex_command, - data: sysex_data - }); - } else { - this.stored_input_data[this.sysex_bytes_read] = input_data; - return this.sysex_bytes_read += 1; - } - } else if (this.wait_for_data > 0 && input_data < 128) { - this.wait_for_data -= 1; - this.stored_input_data[this.wait_for_data] = input_data; - if (this.execute_multi_byte_command !== 0 && this.wait_for_data === 0) { - switch (this.execute_multi_byte_command) { - case ArduinoFirmata.DIGITAL_MESSAGE: - input_data = (this.stored_input_data[0] << 7) + this.stored_input_data[1]; - diff = this.digital_input_data[this.multi_byte_channel] ^ input_data; - this.digital_input_data[this.multi_byte_channel] = input_data; - if (this.listeners('digitalChange').length > 0) { - results = []; - for (i = j = 0; j <= 13; i = ++j) { - if (((0x01 << i) & diff) > 0) { - stat = (input_data & diff) > 0; - results.push(this.emit('digitalChange', { - pin: i + this.multi_byte_channel * 8, - value: stat, - old_value: !stat - })); - } else { - results.push(void 0); - } - } - return results; - } - break; - case ArduinoFirmata.ANALOG_MESSAGE: - analog_value = (this.stored_input_data[0] << 7) + this.stored_input_data[1]; - old_analog_value = this.analogRead(this.multi_byte_channel); - this.analog_input_data[this.multi_byte_channel] = analog_value; - if (old_analog_value !== analog_value) { - return this.emit('analogChange', { - pin: this.multi_byte_channel, - value: analog_value, - old_value: old_analog_value - }); - } - break; - case ArduinoFirmata.REPORT_VERSION: - this.boardVersion = this.stored_input_data[1] + "." + this.stored_input_data[0]; - return this.emit('boardVersion', this.boardVersion); - } - } - } else { - if (input_data < 0xF0) { - command = input_data & 0xF0; - this.multi_byte_channel = input_data & 0x0F; - } else { - command = input_data; - } - if (command === ArduinoFirmata.START_SYSEX) { - this.parsing_sysex = true; - return this.sysex_bytes_read = 0; - } else if (command === ArduinoFirmata.DIGITAL_MESSAGE || command === ArduinoFirmata.ANALOG_MESSAGE || command === ArduinoFirmata.REPORT_VERSION) { - this.wait_for_data = 2; - return this.execute_multi_byte_command = command; - } - } - }; + ArduinoFirmata.END_SYSEX = 0xF7; // end a MIDI SysEx message return ArduinoFirmata; - })(events.EventEmitter2); + }).call(this); }).call(this); diff --git a/lang/node-cylon/Makefile b/lang/node-cylon/Makefile index 97916088..2e5da4e3 100644 --- a/lang/node-cylon/Makefile +++ b/lang/node-cylon/Makefile @@ -9,20 +9,19 @@ include $(TOPDIR)/rules.mk PKG_NPM_NAME:=cylon PKG_NAME:=node-$(PKG_NPM_NAME) +PKG_SRC_NAME:=$(PKG_NPM_NAME)-firmata PKG_VERSION:=0.24.0 -PKG_RELEASE:=1 +PKG_RELEASE:=3 -PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL:=https://github.com/hybridgroup/cylon-firmata.git -PKG_SOURCE_VERSION:=a930f8446f23ec2cb28aadeff54b79ab7704e3a0 -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION) -PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz -PKG_MIRROR_HASH:=dceb75539d32f402db0a5f68f2c7e2b52e5547a5ac2dec875d34fd3cc95cce00 +PKG_SOURCE:=$(PKG_SRC_NAME)-$(PKG_VERSION).tgz +PKG_SOURCE_URL:=https://registry.npmjs.org/$(PKG_SRC_NAME)/-/ +PKG_HASH:=06ac7a8e2e6012577d2f4b043af766bf28a1d3e2a0d50e46629dab4f0bb65104 +PKG_SOURCE_SUBDIR:=$(PKG_SRC_NAME)-$(PKG_VERSION) PKG_BUILD_DEPENDS:=node/host -PKG_NODE_VERSION:=8.10.0 +PKG_USE_MIPS16:=0 -PKG_MAINTAINER:=John Crispin +PKG_MAINTAINER:=Hirokazu MORIKAWA PKG_LICENSE:=Apache-2.0 PKG_LICENSE_FILES:=LICENSE @@ -33,7 +32,7 @@ define Package/node-cylon/default SECTION:=lang CATEGORY:=Languages TITLE:=CylonJS - $(1) - URL:=https://www.npmjs.org/package/cylon + URL:=https://www.npmjs.org/package/cylon-firmata DEPENDS:=+node +node-npm $(2) endef @@ -54,47 +53,55 @@ define Package/node-cylon-firmata endef define Package/node-cylon/description - JavaScript Robotics, By Your Command Next generation robotics framework with support for 36 different platforms Get Started + JavaScript Robotics, By Your Command Next generation robotics framework with support for 36 different platforms Get Started endef -define Build/Prepare - /bin/tar xzf $(DL_DIR)/$(PKG_SOURCE) -C $(PKG_BUILD_DIR) --strip-components 1 - $(Build/Patch) -endef +TAR_OPTIONS+= --strip-components 1 +TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS) -EXTRA_LDFLAGS="-L$(TOOLCHAIN_DIR)/lib/ -Wl,-rpath-link $(TOOLCHAIN_DIR)/lib/" \ +NODEJS_CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH))))) define Build/Compile + $(MAKE_VARS) \ $(MAKE_FLAGS) \ - npm_config_arch=$(CONFIG_ARCH) \ - npm_config_nodedir=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/ \ - npm_config_cache=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/npm-cache \ - PREFIX="$(PKG_INSTALL_DIR)/usr/" \ + npm_config_arch=$(NODEJS_CPU) \ + npm_config_target_arch=$(NODEJS_CPU) \ + npm_config_build_from_source=true \ + npm_config_nodedir=$(STAGING_DIR)/usr/ \ + npm_config_prefix=$(PKG_INSTALL_DIR)/usr/ \ + npm_config_cache=$(TMP_DIR)/npm-cache \ + npm_config_tmp=$(TMP_DIR)/npm-tmp \ npm install -g $(PKG_BUILD_DIR) + rm -rf $(TMP_DIR)/npm-tmp + rm -rf $(TMP_DIR)/npm-cache endef define Package/node-cylon/install - mkdir -p $(1)/usr/lib/node/cylon + $(INSTALL_DIR) $(1)/usr/lib/node/cylon $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/cylon-firmata/node_modules/cylon/* $(1)/usr/lib/node/cylon/ endef define Package/node-cylon-i2c/install - mkdir -p $(1)/usr/lib/node/cylon-i2c + $(INSTALL_DIR) $(1)/usr/lib/node/cylon-i2c $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/cylon-firmata/node_modules/cylon-i2c/* $(1)/usr/lib/node/cylon-i2c/ endef define Package/node-cylon-gpio/install - mkdir -p $(1)/usr/lib/node/cylon-gpio + $(INSTALL_DIR) $(1)/usr/lib/node/cylon-gpio $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/cylon-firmata/node_modules/cylon-gpio/* $(1)/usr/lib/node/cylon-gpio/ endef define Package/node-cylon-firmata/install - mkdir -p $(1)/usr/lib/node/cylon-firmata - $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/cylon-firmata/{index.js,lib,LICENSE,package.json,README.md,RELEASES.md,spec} $(1)/usr/lib/node/cylon-firmata/ + $(INSTALL_DIR) $(1)/usr/lib/node/cylon-firmata + $(CP) $(PKG_BUILD_DIR)/{package.json,LICENSE,*.md} \ + $(1)/usr/lib/node/cylon-firmata/ + $(CP) $(PKG_BUILD_DIR)/{docs,examples,*.js} \ + $(1)/usr/lib/node/cylon-firmata/ + $(CP) $(PKG_BUILD_DIR)/{lib,spec} \ + $(1)/usr/lib/node/cylon-firmata/ endef $(eval $(call BuildPackage,node-cylon)) $(eval $(call BuildPackage,node-cylon-i2c)) $(eval $(call BuildPackage,node-cylon-gpio)) $(eval $(call BuildPackage,node-cylon-firmata)) - diff --git a/lang/node-hid/Makefile b/lang/node-hid/Makefile index 390b3d29..c5b24de5 100644 --- a/lang/node-hid/Makefile +++ b/lang/node-hid/Makefile @@ -7,26 +7,24 @@ include $(TOPDIR)/rules.mk -PKG_NPM_NAME:=hid -PKG_NAME:=node-$(PKG_NPM_NAME) -PKG_VERSION:=0.7.2 -PKG_RELEASE:=3 +PKG_NPM_NAME:=node-hid +PKG_NAME:=$(PKG_NPM_NAME) +PKG_VERSION:=1.1.0 +PKG_RELEASE:=1 -PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL:=https://github.com/node-hid/node-hid.git -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE_VERSION:=v0.7.2 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz -PKG_MIRROR_HASH:=ede801a26a23290ab76d64ab636c3c3e2788030bb830af7006d37444c2a7b2c4 +PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz +PKG_SOURCE_URL:=https://registry.npmjs.org/$(PKG_NPM_NAME)/-/ +PKG_HASH:=a128331388b9a0ac443fb55493e37a9b8043f34699c60453f395ad37b7d5f145 -PKG_BUILD_DEPENDS:=node/host libudev-fbsd -PKG_NODE_VERSION:=8.10.0 +PKG_BUILD_DEPENDS:=node/host +PKG_USE_MIPS16:=0 -PKG_MAINTAINER:=John Crispin -PKG_LICENSE:=Custom +PKG_MAINTAINER:=Hirokazu MORIKAWA +PKG_LICENSE:=MIT or X11 PKG_LICENSE_FILES:= include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk define Package/node-hid SUBMENU:=Node.js @@ -34,34 +32,51 @@ define Package/node-hid CATEGORY:=Languages TITLE:=Node.js package to access HID devices URL:=https://github.com/node-hid/node-hid - DEPENDS:=+node +node-npm +libusb-1.0 +hidapi +libstdcpp + DEPENDS:=+node +node-npm +libusb-1.0 +hidapi +libudev-fbsd $(ICONV_DEPENDS) endef define Package/node-hid/description Node.js package to access HID devices endef -CPU:=$(subst x86_64,x64,$(subst i386,ia32,$(ARCH))) +TAR_OPTIONS+= --strip-components 1 +TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS) +NODEJS_CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH))))) TMPNPM:=$(shell mktemp -u XXXXXXXXXX) TARGET_CFLAGS+=$(FPIC) -I$(STAGING_DIR)/usr/include/libusb-1.0 +TARGET_LDFLAGS+=$(if $(ICONV_FULL),-liconv) define Build/Compile git init $(PKG_BUILD_DIR) $(MAKE_VARS) \ $(MAKE_FLAGS) \ - npm_config_arch=$(CONFIG_ARCH) \ - npm_config_nodedir=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/ \ - npm_config_cache=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/npm-cache-$(TMPNPM) \ - PREFIX="$(PKG_INSTALL_DIR)/usr/" \ - npm install --build-from-source --target_arch=$(CPU) -g $(PKG_BUILD_DIR) + npm_config_arch=$(NODEJS_CPU) \ + npm_config_target_arch=$(NODEJS_CPU) \ + npm_config_build_from_source=true \ + npm_config_nodedir=$(STAGING_DIR)/usr/ \ + npm_config_prefix=$(PKG_INSTALL_DIR)/usr/ \ + npm_config_cache=$(TMP_DIR)/npm-cache-$(TMPNPM) \ + npm_config_tmp=$(TMP_DIR)/npm-tmp-$(TMPNPM) \ + npm install -g $(PKG_BUILD_DIR) + rm -rf $(TMP_DIR)/npm-tmp-$(TMPNPM) + rm -rf $(TMP_DIR)/npm-cache-$(TMPNPM) endef define Package/node-hid/install - mkdir -p $(1)/usr/lib/node/node-hid/ - $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/ $(1)/usr/lib/node/ + $(INSTALL_DIR) $(1)/usr/lib/node/$(PKG_NPM_NAME) + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{package.json,*.md} \ + $(1)/usr/lib/node/$(PKG_NPM_NAME)/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{binding.gyp,*.js} \ + $(1)/usr/lib/node/$(PKG_NPM_NAME)/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{node_modules,src} \ + $(1)/usr/lib/node/$(PKG_NPM_NAME)/ + $(INSTALL_DIR) $(1)/usr/lib/node/$(PKG_NPM_NAME)/build/Release + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/build/Release/HID*.node \ + $(1)/usr/lib/node/$(PKG_NPM_NAME)/build/Release/ + $(INSTALL_DIR) $(1)/usr/bin + $(LN) ../lib/node/node-hid/src/show-devices.js $(1)/usr/bin/hid-showdevices endef $(eval $(call BuildPackage,node-hid)) - diff --git a/lang/node-hid/patches/000-support_musl.patch b/lang/node-hid/patches/000-support_musl.patch new file mode 100644 index 00000000..9f1d0449 --- /dev/null +++ b/lang/node-hid/patches/000-support_musl.patch @@ -0,0 +1,11 @@ +diff -urN a/hidapi/linux/hid.c b/hidapi/linux/hid.c +--- a/hidapi/linux/hid.c 1985-10-26 17:15:00.000000000 +0900 ++++ b/hidapi/linux/hid.c 2019-12-12 11:15:11.164454207 +0900 +@@ -24,6 +24,7 @@ + /* C */ + #include + #include ++#include + #include + #include + #include diff --git a/lang/node-homebridge/Makefile b/lang/node-homebridge/Makefile new file mode 100644 index 00000000..683556b9 --- /dev/null +++ b/lang/node-homebridge/Makefile @@ -0,0 +1,72 @@ +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NPM_NAME:=homebridge +PKG_NAME:=node-$(PKG_NPM_NAME) +PKG_VERSION:=0.4.50 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz +PKG_SOURCE_URL:=http://registry.npmjs.org/$(PKG_NPM_NAME)/-/ +PKG_HASH:=85541254b44c0b70e38ed5e49a9c6a68a20467b99fe0ff3703ca9fc422ce879c + +PKG_BUILD_DEPENDS:=node/host +PKG_USE_MIPS16:=0 + +PKG_MAINTAINER:=Hirokazu MORIKAWA +PKG_LICENSE:=ISC Apache-2.0 +PKG_LICENSE_FILES:=LICENSE + +include $(INCLUDE_DIR)/package.mk + +define Package/node-homebridge + SUBMENU:=Node.js + SECTION:=lang + CATEGORY:=Languages + TITLE:=Node.js HomeKit Server + URL:=https://www.npmjs.org/package/homebridge + DEPENDS:=+node +node-npm + USERID:=homebridge:homebridge +endef + +define Package/node-homebridge/description + Homebridge is a lightweight Node.js server you can run on your home network that emulates the iOS HomeKit API +endef + +NODEJS_CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH))))) +TMPNPM:=$(shell mktemp -u XXXXXXXXXX) + +TARGET_CFLAGS+=$(FPIC) + +define Build/Prepare + $(INSTALL_DIR) $(PKG_BUILD_DIR) +endef + +define Build/Compile + $(MAKE_VARS) \ + $(MAKE_FLAGS) \ + npm_config_arch=$(NODEJS_CPU) \ + npm_config_target_arch=$(NODEJS_CPU) \ + npm_config_build_from_source=true \ + npm_config_nodedir=$(STAGING_DIR)/usr/ \ + npm_config_prefix=$(PKG_INSTALL_DIR)/usr/ \ + npm_config_cache=$(TMP_DIR)/npm-cache-$(TMPNPM) \ + npm_config_tmp=$(TMP_DIR)/npm-tmp-$(TMPNPM) \ + npm install -g $(DL_DIR)/$(PKG_SOURCE) + rm -rf $(TMP_DIR)/npm-tmp-$(TMPNPM) + rm -rf $(TMP_DIR)/npm-cache-$(TMPNPM) +endef + +define Package/node-homebridge/install + $(INSTALL_DIR) $(1)/usr/lib/node + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/* $(1)/usr/lib/node/ + $(INSTALL_DIR) $(1)/usr/bin + $(LN) ../lib/node/homebridge/bin/homebridge $(1)/usr/bin/homebridge + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/homebridge.init $(1)/etc/init.d/homebridge +endef + +$(eval $(call BuildPackage,node-homebridge)) diff --git a/lang/node-homebridge/files/homebridge.init b/lang/node-homebridge/files/homebridge.init new file mode 100644 index 00000000..cea6b87a --- /dev/null +++ b/lang/node-homebridge/files/homebridge.init @@ -0,0 +1,18 @@ +#!/bin/sh /etc/rc.common + +START=98 +USE_PROCD=1 + +start_service() { + [ -d /usr/share/homebridge ] || { + mkdir -m 0755 -p /usr/share/homebridge + chmod 0700 /usr/share/homebridge + chown homebridge:homebridge /usr/share/homebridge + } + procd_open_instance + procd_set_param command /usr/bin/homebridge -U /usr/share/homebridge + procd_set_param user homebridge + procd_set_param stdout 1 + procd_set_param stderr 1 + procd_close_instance +} diff --git a/lang/node-javascript-obfuscator/Makefile b/lang/node-javascript-obfuscator/Makefile new file mode 100644 index 00000000..6432f7d0 --- /dev/null +++ b/lang/node-javascript-obfuscator/Makefile @@ -0,0 +1,104 @@ +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NPM_NAME:=javascript-obfuscator +PKG_NAME:=node-$(PKG_NPM_NAME) +PKG_VERSION:=0.24.0 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz +PKG_SOURCE_URL:=https://registry.npmjs.org/$(PKG_NPM_NAME)/-/ +PKG_HASH:=2312220a65b8d03195837bb8e2555115c9c9910eb08d3077297f5b9133570c26 + +PKG_BUILD_DEPENDS:=node/host +HOST_BUILD_PARALLEL:=1 + +HOST_BUILD_DEPENDS:=node/host +PKG_BUILD_PARALLEL:=1 +PKG_USE_MIPS16:=0 + +PKG_MAINTAINER:=Zbynek Kocur +PKG_LICENSE:=BSD-2-Clause +PKG_LICENSE_FILES:=LICENSE.BSD + +include $(INCLUDE_DIR)/host-build.mk +include $(INCLUDE_DIR)/package.mk + +define Package/node-javascript-obfuscator + SUBMENU:=Node.js + SECTION:=lang + CATEGORY:=Languages + TITLE:=JavaScript obfuscator + URL:=https://www.npmjs.org/package/javascript-obfuscator + DEPENDS:=+node +endef + +define Package/node-javascript-obfuscator/description + JavaScript obfuscator is a powerful free obfuscator for JavaScript with a wide number of features which provides protection for your source code. +endef + +TAR_OPTIONS+= --strip-components 1 +TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS) + +NODEJS_CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH))))) +TMPNPM:=$(shell mktemp -u XXXXXXXXXX) +HOSTTMPNPM:=$(shell mktemp -u XXXXXXXXXX) + +TARGET_CFLAGS+=$(FPIC) +TARGET_CPPFLAGS+=$(FPIC) + +define Build/Compile + $(MAKE_VARS) \ + $(MAKE_FLAGS) \ + npm_config_arch=$(NODEJS_CPU) \ + npm_config_target_arch=$(NODEJS_CPU) \ + npm_config_build_from_source=true \ + npm_config_nodedir=$(STAGING_DIR)/usr/ \ + npm_config_prefix=$(PKG_INSTALL_DIR)/usr/ \ + npm_config_cache=$(TMP_DIR)/npm-cache-$(TMPNPM) \ + npm_config_tmp=$(TMP_DIR)/npm-tmp-$(TMPNPM) \ + npm install -g $(PKG_BUILD_DIR) + rm -rf $(TMP_DIR)/npm-tmp-$(TMPNPM) + rm -rf $(TMP_DIR)/npm-cache-$(TMPNPM) +endef + +define Package/node-javascript-obfuscator/install + $(INSTALL_DIR) $(1)/usr/lib/node/$(PKG_NPM_NAME) + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{package.json,LICENSE.BSD} \ + $(1)/usr/lib/node/$(PKG_NPM_NAME)/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/README.md \ + $(1)/usr/lib/node/$(PKG_NPM_NAME)/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{node_modules,bin,dist} \ + $(1)/usr/lib/node/$(PKG_NPM_NAME)/ + $(INSTALL_DIR) $(1)/usr/bin + $(LN) ../lib/node/javascript-obfuscator/bin/javascript-obfuscator $(1)/usr/bin/javascript-obfuscator +endef + +define Host/Compile + $(HOST_MAKE_VARS) \ + npm_config_nodedir=$(STAGING_DIR)/usr/ \ + npm_config_prefix=$(HOST_INSTALL_DIR)/usr/ \ + npm_config_cache=$(TMP_DIR)/npm-cache-$(HOSTTMPNPM) \ + npm_config_tmp=$(TMP_DIR)/npm-tmp-$(HOSTTMPNPM) \ + npm install -g --no-optional $(HOST_BUILD_DIR) + rm -rf $(TMP_DIR)/npm-tmp-$(HOSTTMPNPM) + rm -rf $(TMP_DIR)/npm-cache-$(HOSTTMPNPM) +endef + +define Host/Install + $(INSTALL_DIR) $(1)/lib/node_modules/$(PKG_NPM_NAME) + $(CP) $(HOST_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{package.json,LICENSE.BSD} \ + $(1)/lib/node_modules/$(PKG_NPM_NAME)/ + $(CP) $(HOST_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/README.md \ + $(1)/lib/node_modules/$(PKG_NPM_NAME)/ + $(CP) $(HOST_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{node_modules,bin,dist} \ + $(1)/lib/node_modules/$(PKG_NPM_NAME)/ + $(INSTALL_DIR) $(1)/bin + $(LN) ../lib/node_modules/javascript-obfuscator/bin/javascript-obfuscator $(1)/bin/javascript-obfuscator +endef + +$(eval $(call HostBuild)) +$(eval $(call BuildPackage,node-javascript-obfuscator)) diff --git a/lang/node-mozilla-iot-gateway/Makefile b/lang/node-mozilla-iot-gateway/Makefile deleted file mode 100644 index 5b5e5001..00000000 --- a/lang/node-mozilla-iot-gateway/Makefile +++ /dev/null @@ -1,71 +0,0 @@ -# -# Copyright (C) 2018 Sartura Ltd. -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -include $(TOPDIR)/rules.mk - -PKG_NPM_NAME:=mozilla-iot-gateway -PKG_NAME:=node-$(PKG_NPM_NAME) -PKG_VERSION:=0.3.1 -PKG_RELEASE:=1 - -PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL:=https://github.com/mozilla-iot/gateway.git -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE_VERSION:=v$(PKG_VERSION) -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_MIRROR_HASH:=ba05bc3e93c36768244df922434e7132c2dae85a1ff9e3213beea087a4844d11 - -PKG_BUILD_DEPENDS:=node/host openzwave - -PKG_MAINTAINER:=Marko Ratkaj -PKG_LICENSE:=MPL-2.0 -PKG_LICENSE_FILES:=LICENSE - -include $(INCLUDE_DIR)/package.mk - -define Package/node-mozilla-iot-gateway - SUBMENU:=Node.js - SECTION:=lang - CATEGORY:=Languages - TITLE:=Things Gateway by Mozilla - URL:=https://iot.mozilla.org/gateway/ - DEPENDS:=+node +node-npm +libopenzwave +python +openssl-util -endef - -define Package/node-mozilla-iot-gateway/description - Build Your Own Web of Things Gateway. The "Web of Things" (WoT) is the - idea of taking the lessons learned from the World Wide Web and applying - them to IoT. It's about creating a decentralized Internet of Things by - giving Things URLs on the web to make them linkable and discoverable, - and defining a standard data model and APIs to make them interoperable. -endef - -CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH))))) - -define Build/Compile - $(MAKE_VARS) \ - $(MAKE_FLAGS) \ - npm_config_arch=$(CONFIG_ARCH) \ - npm_config_nodedir=$(STAGING_DIR)/usr/ \ - npm_config_cache=$(TMP_DIR)/npm-cache \ - npm_config_tmp=$(TMP_DIR)/npm-tmp \ - PREFIX="$(PKG_INSTALL_DIR)/usr/" \ - $(STAGING_DIR_HOSTPKG)/bin/npm install --build-from-source --target_arch=$(CPU) -g $(DL_DIR)/$(PKG_SOURCE) -endef - -define Package/node-mozilla-iot-gateway/install - $(INSTALL_DIR) $(1)/opt/mozilla-iot/gateway - $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/things-gateway/* $(1)/opt/mozilla-iot/gateway - $(STAGING_DIR_HOSTPKG)/bin/npm --prefix=$(1)/opt/mozilla-iot/gateway install $(1)/opt/mozilla-iot/gateway - $(LN) ../constants.js $(1)/opt/mozilla-iot/gateway/src/addons/addon-constants.js - $(LN) /tmp/mozilla-iot/gateway/run-app.log $(1)/opt/mozilla-iot/gateway/run-app.log - - $(INSTALL_DIR) $(1)/etc/init.d - $(INSTALL_BIN) ./files/mozilla-iot-gateway.init $(1)/etc/init.d/mozilla-iot-gateway -endef - -$(eval $(call BuildPackage,node-mozilla-iot-gateway)) diff --git a/lang/node-mozilla-iot-gateway/files/mozilla-iot-gateway.init b/lang/node-mozilla-iot-gateway/files/mozilla-iot-gateway.init deleted file mode 100644 index f2663d5a..00000000 --- a/lang/node-mozilla-iot-gateway/files/mozilla-iot-gateway.init +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh /etc/rc.common - -START=99 - -_npm=/usr/bin/npm - -start() -{ - mkdir -p /tmp/mozilla-iot/gateway/ - cd /opt/mozilla-iot/gateway/ - $_npm start &> /tmp/mozilla-iot/gateway/run-app.log & -} diff --git a/lang/node-serialport-bindings/Makefile b/lang/node-serialport-bindings/Makefile new file mode 100644 index 00000000..4a6e7522 --- /dev/null +++ b/lang/node-serialport-bindings/Makefile @@ -0,0 +1,74 @@ +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NPM_SCOPE:=serialport +PKG_NPM_NAME:=bindings +PKG_NAME:=node-$(PKG_NPM_SCOPE)-$(PKG_NPM_NAME) +PKG_VERSION:=8.0.4 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz +PKG_SOURCE_URL:=https://registry.npmjs.org/@$(PKG_NPM_SCOPE)/$(PKG_NPM_NAME)/-/ +PKG_HASH:=fd48dba7fd4de42d9908e33c21cd028345c3d481eff668511966313cfac61695 + +PKG_BUILD_DEPENDS:=node/host +PKG_USE_MIPS16:=0 + +PKG_MAINTAINER:=Hirokazu MORIKAWA +PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=LICENSE + +include $(INCLUDE_DIR)/package.mk + +define Package/node-serialport-bindings + SUBMENU:=Node.js + SECTION:=lang + CATEGORY:=Languages + TITLE:=SerialPort Bindings + URL:=https://www.npmjs.com/package/@serialport/bindings + DEPENDS:=+node +endef + +define Package/node-serialport-bindings/description + The Binding is how Node-SerialPort talks to the underlying system. By default, we auto detect Windows, Linux and OS X, and load the appropriate module for your system. You can assign SerialPort.Binding to any binding you like. +endef + +TAR_OPTIONS+= --strip-components 1 +TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS) + +NODEJS_CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH))))) +TMPNPM:=$(shell mktemp -u XXXXXXXXXX) + +TARGET_CFLAGS+=$(FPIC) +TARGET_CPPFLAGS+=$(FPIC) + +define Build/Compile + $(MAKE_VARS) \ + $(MAKE_FLAGS) \ + npm_config_arch=$(NODEJS_CPU) \ + npm_config_target_arch=$(NODEJS_CPU) \ + npm_config_build_from_source=true \ + npm_config_nodedir=$(STAGING_DIR)/usr/ \ + npm_config_prefix=$(PKG_INSTALL_DIR)/usr/ \ + npm_config_cache=$(TMP_DIR)/npm-cache-$(TMPNPM) \ + npm_config_tmp=$(TMP_DIR)/npm-tmp-$(TMPNPM) \ + npm install -g --build-from-source $(PKG_BUILD_DIR) + rm -rf $(TMP_DIR)/npm-tmp-$(TMPNPM) + rm -rf $(TMP_DIR)/npm-cache-$(TMPNPM) +endef + +define Package/node-serialport-bindings/install + $(INSTALL_DIR) $(1)/usr/lib/node/@$(PKG_NPM_SCOPE)/$(PKG_NPM_NAME) + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/@$(PKG_NPM_SCOPE)/$(PKG_NPM_NAME)/{package.json,LICENSE,*.md} \ + $(1)/usr/lib/node/@$(PKG_NPM_SCOPE)/$(PKG_NPM_NAME) + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/@$(PKG_NPM_SCOPE)/$(PKG_NPM_NAME)/{node_modules,lib} \ + $(1)/usr/lib/node/@$(PKG_NPM_SCOPE)/$(PKG_NPM_NAME) + $(INSTALL_DIR) $(1)/usr/lib/node/@$(PKG_NPM_SCOPE)/$(PKG_NPM_NAME)/build/Release + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/@$(PKG_NPM_SCOPE)/$(PKG_NPM_NAME)/build/Release/bindings.node \ + $(1)/usr/lib/node/@$(PKG_NPM_SCOPE)/$(PKG_NPM_NAME)/build/Release/ +endef + +$(eval $(call BuildPackage,node-serialport-bindings)) diff --git a/lang/node-serialport-bindings/patches/000-powerpc_termios_header.patch b/lang/node-serialport-bindings/patches/000-powerpc_termios_header.patch new file mode 100644 index 00000000..c268f0ef --- /dev/null +++ b/lang/node-serialport-bindings/patches/000-powerpc_termios_header.patch @@ -0,0 +1,16 @@ +--- a/src/serialport_linux.cpp ++++ b/src/serialport_linux.cpp +@@ -1,8 +1,13 @@ + #if defined(__linux__) + + #include ++#if defined(__powerpc__) || defined(__powerpc64__) ++#include ++#include ++#else + #include + #include ++#endif + + // Uses the termios2 interface to set nonstandard baud rates + int linuxSetCustomBaudRate(const int fd, const unsigned int baudrate) { diff --git a/lang/node-serialport/Makefile b/lang/node-serialport/Makefile index 59ba6ed1..7030f3b1 100644 --- a/lang/node-serialport/Makefile +++ b/lang/node-serialport/Makefile @@ -9,18 +9,18 @@ include $(TOPDIR)/rules.mk PKG_NPM_NAME:=serialport PKG_NAME:=node-$(PKG_NPM_NAME) -PKG_VERSION:=6.1.1 -PKG_RELEASE:=3 +PKG_VERSION:=8.0.5 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz -PKG_SOURCE_URL:=http://registry.npmjs.org/$(PKG_NPM_NAME)/-/ -PKG_HASH:=b58c326d217fb0af1639e4ea834d9fca4be16934c486499e2ddac6e52b8dd560 +PKG_SOURCE_URL:=https://registry.npmjs.org/$(PKG_NPM_NAME)/-/ +PKG_HASH:=d06e67edcc2d2c6489d8634b3bcef46325ecee0b9f8d9243af3518505608213e PKG_BUILD_DEPENDS:=node/host -PKG_NODE_VERSION:=8.10.0 +PKG_USE_MIPS16:=0 -PKG_MAINTAINER:=John Crispin -PKG_LICENSE:=Custom +PKG_MAINTAINER:=Hirokazu MORIKAWA +PKG_LICENSE:=MIT PKG_LICENSE_FILES:=LICENSE include $(INCLUDE_DIR)/package.mk @@ -29,40 +29,46 @@ define Package/node-serialport SUBMENU:=Node.js SECTION:=lang CATEGORY:=Languages - TITLE:=Node.js package to access serial ports for reading and writing - URL:=https://www.npmjs.org/package/serialport - DEPENDS:=+node +node-npm + TITLE:=Node.js package to access serial ports + URL:=https://serialport.io/ + DEPENDS:=+node +node-npm +node-serialport-bindings endef define Package/node-serialport/description Node.js package to access serial ports for reading and writing OR Welcome your robotic JavaScript overlords. Better yet, program them! endef -define Build/Prepare - /bin/tar xzf $(DL_DIR)/$(PKG_SOURCE) -C $(PKG_BUILD_DIR) --strip-components 1 - $(Build/Patch) -endef +TAR_OPTIONS+= --strip-components 1 +TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS) -CPU:=$(subst x86_64,x64,$(subst i386,ia32,$(ARCH))) - -EXTRA_LDFLAGS="$(FPIC) -L$(TOOLCHAIN_DIR)/lib/ -Wl,-rpath-link $(TOOLCHAIN_DIR)/lib/" \ +NODEJS_CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH))))) TMPNPM:=$(shell mktemp -u XXXXXXXXXX) TARGET_CFLAGS+=$(FPIC) define Build/Compile + $(MAKE_VARS) \ $(MAKE_FLAGS) \ - npm_config_arch=$(CONFIG_ARCH) \ - npm_config_nodedir=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/ \ - npm_config_cache=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/npm-cache-$(TMPNPM) \ - PREFIX="$(PKG_INSTALL_DIR)/usr/" \ - npm install --build-from-source --target_arch=$(CPU) -g $(PKG_BUILD_DIR) + npm_config_arch=$(NODEJS_CPU) \ + npm_config_target_arch=$(NODEJS_CPU) \ + npm_config_build_from_source=true \ + npm_config_nodedir=$(STAGING_DIR)/usr/ \ + npm_config_prefix=$(PKG_INSTALL_DIR)/usr/ \ + npm_config_cache=$(TMP_DIR)/npm-cache-$(TMPNPM) \ + npm_config_tmp=$(TMP_DIR)/npm-tmp-$(TMPNPM) \ + npm install -g --build-from-source $(PKG_BUILD_DIR) + rm -rf $(TMP_DIR)/npm-tmp-$(TMPNPM) + rm -rf $(TMP_DIR)/npm-cache-$(TMPNPM) endef define Package/node-serialport/install - mkdir -p $(1)/usr/lib/node/ - $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/* $(1)/usr/lib/node/ + $(INSTALL_DIR) $(1)/usr/lib/node/$(PKG_NPM_NAME) + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{package.json,LICENSE,*.md} \ + $(1)/usr/lib/node/$(PKG_NPM_NAME)/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/test.js \ + $(1)/usr/lib/node/$(PKG_NPM_NAME)/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/$(PKG_NPM_NAME)/{node_modules,lib} \ + $(1)/usr/lib/node/$(PKG_NPM_NAME)/ endef $(eval $(call BuildPackage,node-serialport)) - diff --git a/lang/node-serialport/patches/001-turn_off_depends.patch b/lang/node-serialport/patches/001-turn_off_depends.patch new file mode 100644 index 00000000..87a6828d --- /dev/null +++ b/lang/node-serialport/patches/001-turn_off_depends.patch @@ -0,0 +1,10 @@ +--- a/package.json ++++ b/package.json +@@ -46,7 +46,6 @@ + ], + "dependencies": { + "@serialport/binding-mock": "^8.0.4", +- "@serialport/bindings": "^8.0.4", + "@serialport/parser-byte-length": "^8.0.4", + "@serialport/parser-cctalk": "^8.0.4", + "@serialport/parser-delimiter": "^8.0.4", diff --git a/lang/node/Makefile b/lang/node/Makefile index 1274caba..87a22b5d 100644 --- a/lang/node/Makefile +++ b/lang/node/Makefile @@ -8,24 +8,26 @@ include $(TOPDIR)/rules.mk PKG_NAME:=node -PKG_VERSION:=v8.10.0 -PKG_RELEASE:=3 -PKG_SOURCE:=node-$(PKG_VERSION).tar.xz -PKG_SOURCE_URL:=http://nodejs.org/dist/${PKG_VERSION} -PKG_HASH:=b72d4e71618d6bcbd039b487b51fa7543631a4ac3331d7caf69bdf55b5b2901a +PKG_VERSION:=v12.15.0 +PKG_RELEASE:=1 -HOST_BUILD_DEPENDS:=python/host -PKG_BUILD_DEPENDS:=python/host - -PKG_INSTALL:=1 -PKG_USE_MIPS16:=0 - -HOST_BUILD_PARALLEL:=1 -PKG_BUILD_PARALLEL:=1 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=https://nodejs.org/dist/$(PKG_VERSION) +PKG_HASH:=d2fb4fa80ccf321570552b0a6e6b5f2aedeb281a8450207b057cf54c54d5a81b PKG_MAINTAINER:=John Crispin , Adrian Panella PKG_LICENSE:=MIT PKG_LICENSE_FILES:=LICENSE +PKG_CPE_ID:=cpe:/a:nodejs:node.js + +HOST_BUILD_DEPENDS:=python3/host +HOST_BUILD_PARALLEL:=1 + +PKG_BUILD_DEPENDS:=python3/host +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 +PKG_USE_MIPS16:=0 +PKG_ASLR_PIE:=0 include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/package.mk @@ -35,14 +37,17 @@ define Package/node CATEGORY:=Languages SUBMENU:=Node.js TITLE:=Node.js is a platform built on Chrome's JavaScript runtime - URL:=http://nodejs.org/ - DEPENDS:=@(HAS_FPU||KERNEL_MIPS_FPU_EMULATOR) +libstdcpp +libopenssl +zlib +USE_UCLIBC:libpthread +USE_UCLIBC:librt +NODEJS_ICU:icu + URL:=https://nodejs.org/ + DEPENDS:=@(HAS_FPU||KERNEL_MIPS_FPU_EMULATOR) @!arc @!armeb @!powerpc \ + +libstdcpp +libopenssl +zlib +libnghttp2 +libuv +libhttp-parser \ + +libcares +libatomic +NODEJS_ICU_SYSTEM:icu +NODEJS_ICU_SYSTEM:icu-full-data endef define Package/node/description Node.jsĀ® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js' package ecosystem, npm, is the largest ecosystem of open source libraries in the world. + *** Requires GCC/G++ Multilib on host system to build 32-bit target *** endef define Package/node-npm @@ -50,7 +55,7 @@ define Package/node-npm CATEGORY:=Languages SUBMENU:=Node.js TITLE:=NPM stands for Node Package Manager - URL:=http://npmjs.com/ + URL:=https://www.npmjs.com/ DEPENDS:=+node endef @@ -59,33 +64,55 @@ define Package/node-npm/description endef define Package/node/config - menu "Module Selection" + if PACKAGE_node + choice + prompt "i18n features" + default NODEJS_ICU_NONE + help + Select i18n features - config NODEJS_ICU - bool "enable i18n features" - default n + config NODEJS_ICU_NONE + bool "Disable" - endmenu + config NODEJS_ICU_SMALL + depends on !BIG_ENDIAN + bool "small-icu" + + config NODEJS_ICU_SYSTEM + depends on ARCH_64BIT&&!BIG_ENDIAN + bool "system-icu" + endchoice + endif endef NODEJS_CPU:=$(subst powerpc,ppc,$(subst aarch64,arm64,$(subst x86_64,x64,$(subst i386,ia32,$(ARCH))))) +ifneq ($(CONFIG_ARCH_64BIT),y) +FORCE_32BIT:=-m32 +endif + MAKE_VARS+= \ - DESTCPU=$(NODEJS_CPU) + DESTCPU=$(NODEJS_CPU) \ + LD_LIBRARY_PATH=$(STAGING_DIR_HOSTPKG)/share/icu/65.1/lib CONFIGURE_VARS:= \ CC="$(TARGET_CC) $(TARGET_OPTIMIZATION)" \ CXX="$(TARGET_CXX) $(TARGET_OPTIMIZATION)" \ - CC_host="$(HOSTCC)" \ - CXX_host="$(HOSTCXX)" + CC_host="$(HOSTCC) $(FORCE_32BIT)" \ + CXX_host="$(HOSTCXX) $(FORCE_32BIT)" CONFIGURE_ARGS:= \ --dest-cpu=$(NODEJS_CPU) \ --dest-os=linux \ - --without-snapshot \ + --cross-compiling \ --shared-zlib \ --shared-openssl \ - --with-intl=$(if $(CONFIG_NODEJS_ICU),system-icu,none) \ + --shared-nghttp2 \ + --shared-libuv \ + --shared-http-parser \ + --shared-cares \ + $(if $(CONFIG_NODEJS_ICU_SMALL),, \ + --with-intl=$(if $(CONFIG_NODEJS_ICU_SYSTEM),system-icu,none)) \ $(if $(findstring mips,$(NODEJS_CPU)), \ $(if $(CONFIG_SOFT_FLOAT),--with-mips-float-abi=soft)) \ $(if $(findstring +neon,$(CONFIG_CPU_TYPE)),--with-arm-fpu=neon) \ @@ -97,30 +124,26 @@ CONFIGURE_ARGS:= \ HOST_CONFIGURE_VARS:= HOST_CONFIGURE_ARGS:= \ - --dest-os=linux \ - --without-snapshot \ + --dest-os=$(if $(findstring Darwin,$(HOST_OS)),mac,linux) \ + --with-intl=none \ --prefix=$(STAGING_DIR_HOSTPKG) -HOST_CONFIGURE_CMD:=python ./configure - define Build/InstallDev $(INSTALL_DIR) $(1)/usr/include $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/ endef define Package/node/install - mkdir -p $(1)/usr/bin - $(CP) $(PKG_INSTALL_DIR)/usr/bin/node $(1)/usr/bin/ + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/node $(1)/usr/bin/ endef define Package/node-npm/install - mkdir -p $(1)/usr/bin $(1)/usr/lib/node_modules/npm/{bin,lib,node_modules} - $(CP) $(PKG_INSTALL_DIR)/usr/bin/{npm,npx} $(1)/usr/bin/ - $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/{package.json,LICENSE} $(1)/usr/lib/node_modules/npm - $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/bin/npm-cli.js $(1)/usr/lib/node_modules/npm/bin - $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/bin/npx-cli.js $(1)/usr/lib/node_modules/npm/bin - $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/lib/* $(1)/usr/lib/node_modules/npm/lib/ - $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/node_modules/* $(1)/usr/lib/node_modules/npm/node_modules/ + $(INSTALL_DIR) $(1)/usr/lib/node_modules + $(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/* $(1)/usr/lib/node_modules/ + $(INSTALL_DIR) $(1)/usr/bin + $(LN) ../lib/node_modules/npm/bin/npm-cli.js $(1)/usr/bin/npm + $(LN) ../lib/node_modules/npm/bin/npx-cli.js $(1)/usr/bin/npx endef $(eval $(call HostBuild)) diff --git a/lang/node/patches/001-hardfloat.patch b/lang/node/patches/001-hardfloat.patch index 1a573cb5..6c879f77 100644 --- a/lang/node/patches/001-hardfloat.patch +++ b/lang/node/patches/001-hardfloat.patch @@ -1,6 +1,6 @@ --- a/deps/v8/src/base/cpu.cc +++ b/deps/v8/src/base/cpu.cc -@@ -144,6 +144,7 @@ +@@ -143,6 +143,7 @@ ".set push\n\t" ".set noreorder\n\t" ".set oddspreg\n\t" diff --git a/lang/node/patches/002-addr_info.patch b/lang/node/patches/002-addr_info.patch index 3e4e583a..4a0f709e 100644 --- a/lang/node/patches/002-addr_info.patch +++ b/lang/node/patches/002-addr_info.patch @@ -1,10 +1,10 @@ --- a/deps/uv/src/unix/getaddrinfo.c +++ b/deps/uv/src/unix/getaddrinfo.c -@@ -100,6 +100,7 @@ +@@ -103,6 +103,7 @@ int err; req = container_of(w, uv_getaddrinfo_t, work_req); -+ req->hints->ai_flags &= ~AI_V4MAPPED; ++ req->hints->ai_flags &= ~AI_V4MAPPED; err = getaddrinfo(req->hostname, req->service, req->hints, &req->addrinfo); req->retcode = uv__getaddrinfo_translate_error(err); } diff --git a/lang/node/patches/003-path.patch b/lang/node/patches/003-path.patch index d9f0eb7a..987c866f 100644 --- a/lang/node/patches/003-path.patch +++ b/lang/node/patches/003-path.patch @@ -1,11 +1,11 @@ ---- a/lib/module.js -+++ b/lib/module.js -@@ -714,7 +714,8 @@ - } else { - prefixDir = path.resolve(process.execPath, '..', '..'); - } -- var paths = [path.resolve(prefixDir, 'lib', 'node')]; -+ var paths = [path.resolve(prefixDir, 'lib', 'node'), +--- a/lib/internal/modules/cjs/loader.js ++++ b/lib/internal/modules/cjs/loader.js +@@ -1095,7 +1095,8 @@ + path.resolve(process.execPath, '..') : + path.resolve(process.execPath, '..', '..'); + +- let paths = [path.resolve(prefixDir, 'lib', 'node')]; ++ let paths = [path.resolve(prefixDir, 'lib', 'node'), + path.resolve(prefixDir, 'lib', 'node_modules')]; if (homeDir) { diff --git a/lang/node/patches/004-musl_support.patch b/lang/node/patches/004-musl_support.patch new file mode 100644 index 00000000..4d197ff4 --- /dev/null +++ b/lang/node/patches/004-musl_support.patch @@ -0,0 +1,61 @@ +diff -urN a/deps/v8/src/base/platform/condition-variable.cc b/deps/v8/src/base/platform/condition-variable.cc +--- a/deps/v8/src/base/platform/condition-variable.cc 2019-09-05 00:36:23.000000000 +0900 ++++ b/deps/v8/src/base/platform/condition-variable.cc 2019-09-12 15:10:01.063792083 +0900 +@@ -16,7 +16,7 @@ + + ConditionVariable::ConditionVariable() { + #if (V8_OS_FREEBSD || V8_OS_NETBSD || V8_OS_OPENBSD || \ +- (V8_OS_LINUX && V8_LIBC_GLIBC)) ++ V8_OS_LINUX) + // On Free/Net/OpenBSD and Linux with glibc we can change the time + // source for pthread_cond_timedwait() to use the monotonic clock. + pthread_condattr_t attr; +@@ -92,7 +92,7 @@ + &native_handle_, &mutex->native_handle(), &ts); + #else + #if (V8_OS_FREEBSD || V8_OS_NETBSD || V8_OS_OPENBSD || \ +- (V8_OS_LINUX && V8_LIBC_GLIBC)) ++ V8_OS_LINUX) + // On Free/Net/OpenBSD and Linux with glibc we can change the time + // source for pthread_cond_timedwait() to use the monotonic clock. + result = clock_gettime(CLOCK_MONOTONIC, &ts); +diff -urN a/deps/v8/src/base/platform/platform-posix.cc b/deps/v8/src/base/platform/platform-posix.cc +--- a/deps/v8/src/base/platform/platform-posix.cc 2019-09-05 00:36:23.000000000 +0900 ++++ b/deps/v8/src/base/platform/platform-posix.cc 2019-09-12 15:10:01.063792083 +0900 +@@ -773,7 +773,7 @@ + #if V8_OS_MACOSX + // Default on Mac OS X is 512kB -- bump up to 1MB + stack_size = 1 * 1024 * 1024; +-#elif V8_OS_AIX ++#elif V8_OS_AIX || !defined(__GLIBC__) + // Default on AIX is 96kB -- bump up to 2MB + stack_size = 2 * 1024 * 1024; + #endif +diff -urN a/deps/v8/src/codegen/external-reference-table.cc b/deps/v8/src/codegen/external-reference-table.cc +--- a/deps/v8/src/codegen/external-reference-table.cc 2019-09-05 00:36:23.000000000 +0900 ++++ b/deps/v8/src/codegen/external-reference-table.cc 2019-09-12 15:09:41.959828134 +0900 +@@ -9,7 +9,7 @@ + #include "src/ic/stub-cache.h" + #include "src/logging/counters.h" + +-#if defined(DEBUG) && defined(V8_OS_LINUX) && !defined(V8_OS_ANDROID) ++#if defined(DEBUG) && defined(V8_OS_LINUX) && !defined(V8_OS_ANDROID) && defined(V8_LIBC_GLIBC) + #define SYMBOLIZE_FUNCTION + #include + #include +diff -urN a/deps/v8/src/compiler-dispatcher/optimizing-compile-dispatcher.cc b/deps/v8/src/compiler-dispatcher/optimizing-compile-dispatcher.cc +--- a/deps/v8/src/compiler-dispatcher/optimizing-compile-dispatcher.cc 2019-09-05 00:36:23.000000000 +0900 ++++ b/deps/v8/src/compiler-dispatcher/optimizing-compile-dispatcher.cc 2019-09-12 15:10:01.063792083 +0900 +@@ -134,8 +134,10 @@ + // The function may have already been optimized by OSR. Simply continue. + // Use a mutex to make sure that functions marked for install + // are always also queued. +- base::MutexGuard access_output_queue_(&output_queue_mutex_); +- output_queue_.push(job); ++ { ++ base::MutexGuard access_output_queue_(&output_queue_mutex_); ++ output_queue_.push(job); ++ } + } + + isolate_->stack_guard()->RequestInstallCode(); diff --git a/lang/node/patches/004-node_crypto_include_cmath.patch b/lang/node/patches/004-node_crypto_include_cmath.patch deleted file mode 100644 index 77b309f6..00000000 --- a/lang/node/patches/004-node_crypto_include_cmath.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 34825d50db18631a92902af3f51ddd27aa074c90 Mon Sep 17 00:00:00 2001 -From: Jeroen Roovers -Date: Fri, 13 Apr 2018 05:54:42 +0200 -Subject: [PATCH 2/2] Include cmath ... - -... instead of using the C implementations of isnan and isinf ---- - src/node_crypto.cc | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/node_crypto.cc b/src/node_crypto.cc -index 7c0f65a5735..0aa4adbd467 100644 ---- a/src/node_crypto.cc -+++ b/src/node_crypto.cc -@@ -44,9 +44,9 @@ - #include "StartComAndWoSignData.inc" - - #include -+#include - #include - #include // INT_MAX --#include - #include - #include - #include diff --git a/lang/node/patches/006-mips64_support.patch b/lang/node/patches/006-mips64_support.patch new file mode 100644 index 00000000..01fd2ace --- /dev/null +++ b/lang/node/patches/006-mips64_support.patch @@ -0,0 +1,30 @@ +--- a/configure.py ++++ b/configure.py +@@ -48,7 +48,7 @@ + + valid_os = ('win', 'mac', 'solaris', 'freebsd', 'openbsd', 'linux', + 'android', 'aix', 'cloudabi') +-valid_arch = ('arm', 'arm64', 'ia32', 'mips', 'mipsel', 'mips64el', 'ppc', ++valid_arch = ('arm', 'arm64', 'ia32', 'mips', 'mipsel', 'mips64', 'mips64el', 'ppc', + 'ppc64', 'x32','x64', 'x86', 'x86_64', 's390x') + valid_arm_float_abi = ('soft', 'softfp', 'hard') + valid_arm_fpu = ('vfp', 'vfpv3', 'vfpv3-d16', 'neon') +@@ -883,6 +883,9 @@ + if rtn == 'mipsel' and '_LP64' in k: + rtn = 'mips64el' + ++ if rtn == 'mips' and '_LP64' in k: ++ rtn = 'mips64' ++ + return rtn + + +@@ -981,7 +984,7 @@ + + if target_arch == 'arm': + configure_arm(o) +- elif target_arch in ('mips', 'mipsel', 'mips64el'): ++ elif target_arch in ('mips', 'mipsel', 'mips64', 'mips64el'): + configure_mips(o) + + if flavor == 'aix': diff --git a/lang/node/patches/007-fix_host_build_on_macos.patch b/lang/node/patches/007-fix_host_build_on_macos.patch new file mode 100644 index 00000000..486d2ffd --- /dev/null +++ b/lang/node/patches/007-fix_host_build_on_macos.patch @@ -0,0 +1,11 @@ +--- a/tools/gyp/pylib/gyp/generator/make.py ++++ b/tools/gyp/pylib/gyp/generator/make.py +@@ -176,7 +176,7 @@ + + LINK_COMMANDS_MAC = """\ + quiet_cmd_alink = LIBTOOL-STATIC $@ +-cmd_alink = rm -f $@ && ./gyp-mac-tool filter-libtool libtool $(GYP_LIBTOOLFLAGS) -static -o $@ $(filter %.o,$^) ++cmd_alink = rm -f $@ && ./gyp-mac-tool filter-libtool /usr/bin/libtool $(GYP_LIBTOOLFLAGS) -static -o $@ $(filter %.o,$^) + + quiet_cmd_link = LINK($(TOOLSET)) $@ + cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o "$@" $(LD_INPUTS) $(LIBS) diff --git a/lang/node/patches/008-deps_v8_fix_big_endian.patch b/lang/node/patches/008-deps_v8_fix_big_endian.patch new file mode 100644 index 00000000..040e2e66 --- /dev/null +++ b/lang/node/patches/008-deps_v8_fix_big_endian.patch @@ -0,0 +1,11 @@ +--- a/deps/v8/src/runtime/runtime-utils.h ++++ b/deps/v8/src/runtime/runtime-utils.h +@@ -126,7 +126,7 @@ + #if defined(V8_TARGET_LITTLE_ENDIAN) + return x.ptr() | (static_cast(y.ptr()) << 32); + #elif defined(V8_TARGET_BIG_ENDIAN) +- return y->ptr() | (static_cast(x->ptr()) << 32); ++ return y.ptr() | (static_cast(x.ptr()) << 32); + #else + #error Unknown endianness + #endif diff --git a/lang/node/patches/999-delete_unnecessary_libraries_for_host_execute.patch b/lang/node/patches/999-delete_unnecessary_libraries_for_host_execute.patch new file mode 100644 index 00000000..7e87cee8 --- /dev/null +++ b/lang/node/patches/999-delete_unnecessary_libraries_for_host_execute.patch @@ -0,0 +1,78 @@ +--- a/tools/icu/icu-generic.gyp ++++ b/tools/icu/icu-generic.gyp +@@ -517,6 +517,7 @@ + 'target_name': 'genrb', + 'type': 'executable', + 'toolsets': [ 'host' ], ++ 'libraries!':[ '-lcrypto', '-lssl', '-lz', '-lhttp_parser', '-luv', '-lnghttp2', '-lcares' ], + 'dependencies': [ 'icutools' ], + 'sources': [ + '<@(icu_src_genrb)' +@@ -533,6 +534,7 @@ + 'target_name': 'iculslocs', + 'toolsets': [ 'host' ], + 'type': 'executable', ++ 'libraries!':[ '-lcrypto', '-lssl', '-lz', '-lhttp_parser', '-luv', '-lnghttp2', '-lcares' ], + 'dependencies': [ 'icutools' ], + 'sources': [ + 'iculslocs.cc', +@@ -545,6 +547,7 @@ + 'target_name': 'icupkg', + 'toolsets': [ 'host' ], + 'type': 'executable', ++ 'libraries!':[ '-lcrypto', '-lssl', '-lz', '-lhttp_parser', '-luv', '-lnghttp2', '-lcares' ], + 'dependencies': [ 'icutools' ], + 'sources': [ + '<@(icu_src_icupkg)', +@@ -556,6 +559,7 @@ + 'target_name': 'genccode', + 'toolsets': [ 'host' ], + 'type': 'executable', ++ 'libraries!':[ '-lcrypto', '-lssl', '-lz', '-lhttp_parser', '-luv', '-lnghttp2', '-lcares' ], + 'dependencies': [ 'icutools' ], + 'sources': [ + '<@(icu_src_genccode)', +--- a/tools/v8_gypfiles/v8.gyp 2019-06-27 19:12:20.000000000 +0900 ++++ b/tools/v8_gypfiles/v8.gyp 2019-07-01 14:40:48.292020880 +0900 +@@ -1258,6 +1258,7 @@ + { + 'target_name': 'bytecode_builtins_list_generator', + 'type': 'executable', ++ 'libraries!':[ '-licui18n', '-licuuc', '-licudata', '-lcrypto', '-lssl', '-lz', '-lhttp_parser', '-luv', '-lnghttp2', '-lcares' ], + 'conditions': [ + ['want_separate_host_toolset', { + 'toolsets': ['host'], +@@ -1281,6 +1282,8 @@ + { + 'target_name': 'mksnapshot', + 'type': 'executable', ++ 'libraries!':[ '-lcrypto', '-lssl', '-lz', '-lhttp_parser', '-luv', '-lnghttp2', '-lcares' ], ++ 'library_dirs':[ '../../../../staging_dir/hostpkg/share/icu/65.1/lib' ], + 'dependencies': [ + 'v8_base_without_compiler', + 'v8_compiler_for_mksnapshot', +@@ -1303,6 +1306,7 @@ + { + 'target_name': 'torque', + 'type': 'executable', ++ 'libraries!':[ '-licui18n', '-licuuc', '-licudata', '-lcrypto', '-lssl', '-lz', '-lhttp_parser', '-luv', '-lnghttp2', '-lcares' ], + 'dependencies': [ + 'torque_base', + # "build/win:default_exe_manifest", +@@ -1341,6 +1345,7 @@ + { + 'target_name': 'torque-language-server', + 'type': 'executable', ++ 'libraries!':[ '-licui18n', '-licuuc', '-licudata', '-lcrypto', '-lssl', '-lz', '-lhttp_parser', '-luv', '-lnghttp2', '-lcares' ], + 'conditions': [ + ['want_separate_host_toolset', { + 'toolsets': ['host'], +@@ -1368,6 +1373,8 @@ + { + 'target_name': 'gen-regexp-special-case', + 'type': 'executable', ++ 'libraries!':[ '-lcrypto', '-lssl', '-lz', '-lhttp_parser', '-luv', '-lnghttp2', '-lcares' ], ++ 'library_dirs':[ '../../../../staging_dir/hostpkg/share/icu/65.1/lib' ], + 'dependencies': [ + 'v8_libbase', + # "build/win:default_exe_manifest", diff --git a/lang/node/patches/999-fix_missing_llhttp_depends.patch b/lang/node/patches/999-fix_missing_llhttp_depends.patch new file mode 100644 index 00000000..1ef0bd69 --- /dev/null +++ b/lang/node/patches/999-fix_missing_llhttp_depends.patch @@ -0,0 +1,14 @@ +diff -urN a/node.gypi b/node.gypi +--- a/node.gypi 2019-09-05 00:36:25.000000000 +0900 ++++ b/node.gypi 2019-09-13 09:57:54.073191914 +0900 +@@ -142,6 +142,10 @@ + 'deps/http_parser/http_parser.gyp:http_parser', + 'deps/llhttp/llhttp.gyp:llhttp' + ], ++ }, { ++ 'dependencies': [ ++ 'deps/llhttp/llhttp.gyp:llhttp' ++ ], + } ], + + [ 'node_shared_cares=="false"', { diff --git a/lang/node/patches/999-v8_this_build_method_will_be_deprecated.patch b/lang/node/patches/999-v8_this_build_method_will_be_deprecated.patch new file mode 100644 index 00000000..406b3403 --- /dev/null +++ b/lang/node/patches/999-v8_this_build_method_will_be_deprecated.patch @@ -0,0 +1,37 @@ +diff -urN a/configure.py b/configure.py +--- a/configure.py 2019-09-05 00:36:21.000000000 +0900 ++++ b/configure.py 2019-09-27 11:49:55.445800884 +0900 +@@ -1202,6 +1202,25 @@ + options.build_v8_with_gn = FetchDeps(v8_path) + o['variables']['build_v8_with_gn'] = b(options.build_v8_with_gn) + ++def configure_v8_deprecated(o): ++ target_arch = options.dest_cpu ++ if target_arch == 'x86': ++ target_arch = 'ia32' ++ if target_arch == 'x86_64': ++ target_arch = 'x64' ++ ++ if target_arch in ('mips', 'mips64'): ++ o['variables']['v8_use_snapshot'] = 'false' ++ elif target_arch in ('mipsel', 'mips64el'): ++ o['variables']['v8_enable_embedded_builtins'] = 0 ++ elif target_arch == 'x64': ++ if options.with_intl in (None, 'none'): ++ o['variables']['v8_enable_embedded_builtins'] = 0 ++ elif target_arch == 'ia32': ++ if options.with_intl in (None, 'none'): ++ o['variables']['v8_enable_embedded_builtins'] = 1 ++ else: ++ o['variables']['v8_enable_embedded_builtins'] = 0 + + def configure_openssl(o): + variables = o['variables'] +@@ -1632,6 +1651,7 @@ + configure_intl(output) + configure_static(output) + configure_inspector(output) ++configure_v8_deprecated(output) + + # variables should be a root level element, + # move everything else to target_defaults