Procházet zdrojové kódy

nodejs: add 0.12 version of node

add node-js 0.12 and a few gyp bindings

Signed-off-by: John Crispin <blogic@openwrt.org>
John Crispin před 9 roky
rodič
revize
1fd7b5d1e6

+ 63
- 0
lang/node-arduino-firmata/Makefile Zobrazit soubor

@@ -0,0 +1,63 @@
1
+#
2
+# Copyright (C) 2014 Arduino LLC
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+include $(TOPDIR)/rules.mk
9
+
10
+PKG_NPM_NAME:=arduino-firmata
11
+PKG_NAME:=node-$(PKG_NPM_NAME)
12
+PKG_VERSION:=0.3.3
13
+PKG_RELEASE:=1
14
+
15
+PKG_SOURCE:=v$(PKG_VERSION).tar.gz
16
+PKG_SOURCE_URL:=https://github.com/shokai/node-arduino-firmata/archive/
17
+
18
+PKG_BUILD_DEPENDS:=node
19
+PKG_NODE_VERSION:=0.12.7
20
+
21
+PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>
22
+PKG_LICENSE:=
23
+
24
+include $(INCLUDE_DIR)/package.mk
25
+
26
+define Package/node-arduino-firmata
27
+  DEPENDS:=+node
28
+  SUBMENU:=Node.js
29
+  SECTION:=lang
30
+  CATEGORY:=Languages
31
+  DEPENDS:=+node +node-serialport
32
+  TITLE:=Node.js package to access serial ports for reading and writing
33
+  URL:=https://www.npmjs.org/package/serialport
34
+endef
35
+
36
+define Package/node-arduino-firmata/description
37
+ Node.js package to access serial ports for reading and writing OR Welcome your robotic JavaScript overlords. Better yet, program them!
38
+endef
39
+
40
+define Build/Prepare
41
+	/bin/tar xzf $(DL_DIR)/$(PKG_SOURCE) -C $(PKG_BUILD_DIR) --strip-components 1
42
+	$(Build/Patch)
43
+endef
44
+
45
+EXTRA_LDFLAGS="-L$(TOOLCHAIN_DIR)/lib/ -Wl,-rpath-link $(TOOLCHAIN_DIR)/lib/" \
46
+
47
+define Build/Compile
48
+	$(MAKE_FLAGS) \
49
+	npm_config_arch=$(CONFIG_ARCH) \
50
+	npm_config_nodedir=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/ \
51
+	PREFIX="$(PKG_INSTALL_DIR)/usr/" \
52
+	$(STAGING_DIR_HOST)/bin/npm install -g $(PKG_BUILD_DIR)
53
+endef
54
+
55
+define Package/node-arduino-firmata/install
56
+	mkdir -p $(1)/usr/lib/node
57
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/* $(1)/usr/lib/node
58
+	rm -rf $(1)/usr/lib/node/arduino-firmata/node_modules/serialport/ 
59
+	$(CP) -r ./files/* $(1)/
60
+endef
61
+
62
+$(eval $(call BuildPackage,node-arduino-firmata))
63
+

+ 306
- 0
lang/node-arduino-firmata/files/usr/lib/node/arduino-firmata/lib/arduino-firmata.js Zobrazit soubor

@@ -0,0 +1,306 @@
1
+(function() {
2
+  'use strict';
3
+  var ArduinoFirmata, SerialPort, debug, events, exports, serialport,
4
+    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; },
5
+    hasProp = {}.hasOwnProperty;
6
+
7
+  events = require('eventemitter2');
8
+
9
+  SerialPort = (serialport = require('serialport')).SerialPort;
10
+
11
+  debug = require('debug')('arduino-firmata');
12
+
13
+  exports = module.exports = ArduinoFirmata = (function(superClass) {
14
+    extend(ArduinoFirmata, superClass);
15
+
16
+    ArduinoFirmata.Status = {
17
+      CLOSE: 0,
18
+      OPEN: 1
19
+    };
20
+
21
+    ArduinoFirmata.INPUT = 0;
22
+
23
+    ArduinoFirmata.OUTPUT = 1;
24
+
25
+    ArduinoFirmata.ANALOG = 2;
26
+
27
+    ArduinoFirmata.PWM = 3;
28
+
29
+    ArduinoFirmata.SERVO = 4;
30
+
31
+    ArduinoFirmata.SHIFT = 5;
32
+
33
+    ArduinoFirmata.I2C = 6;
34
+
35
+    ArduinoFirmata.LOW = 0;
36
+
37
+    ArduinoFirmata.HIGH = 1;
38
+
39
+    ArduinoFirmata.MAX_DATA_BYTES = 32;
40
+
41
+    ArduinoFirmata.DIGITAL_MESSAGE = 0x90;
42
+
43
+    ArduinoFirmata.ANALOG_MESSAGE = 0xE0;
44
+
45
+    ArduinoFirmata.REPORT_ANALOG = 0xC0;
46
+
47
+    ArduinoFirmata.REPORT_DIGITAL = 0xD0;
48
+
49
+    ArduinoFirmata.SET_PIN_MODE = 0xF4;
50
+
51
+    ArduinoFirmata.REPORT_VERSION = 0xF9;
52
+
53
+    ArduinoFirmata.SYSTEM_RESET = 0xFF;
54
+
55
+    ArduinoFirmata.START_SYSEX = 0xF0;
56
+
57
+    ArduinoFirmata.END_SYSEX = 0xF7;
58
+
59
+    ArduinoFirmata.list = function(callback) {
60
+      return serialport.list(function(err, ports) {
61
+        var devices, j, len, port;
62
+        if (err) {
63
+          return callback(err);
64
+        }
65
+        devices = [];
66
+        for (j = 0, len = ports.length; j < len; j++) {
67
+          port = ports[j];
68
+          if (/usb|acm|com\d+/i.test(port.comName)) {
69
+            devices.push(port.comName);
70
+          }
71
+        }
72
+        return callback(null, devices);
73
+      });
74
+    };
75
+
76
+    function ArduinoFirmata() {
77
+      this.status = ArduinoFirmata.Status.CLOSE;
78
+      this.wait_for_data = 0;
79
+      this.execute_multi_byte_command = 0;
80
+      this.multi_byte_channel = 0;
81
+      this.stored_input_data = [];
82
+      this.parsing_sysex = false;
83
+      this.sysex_bytes_read = 0;
84
+      this.digital_output_data = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
85
+      this.digital_input_data = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
86
+      this.analog_input_data = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
87
+      this.boardVersion = null;
88
+    }
89
+
90
+    ArduinoFirmata.prototype.isOldArduinoDevice = function() {
91
+      return /usbserial|USB/.test(this.serialport_name);
92
+    };
93
+
94
+    ArduinoFirmata.prototype.connect = function(serialport_name, opts) {
95
+      this.serialport_name = serialport_name;
96
+      if (opts == null) {
97
+        opts = {
98
+          baudrate: 57600
99
+        };
100
+      }
101
+      opts.parser = serialport.parsers.raw;
102
+      if (!this.serialport_name) {
103
+        ArduinoFirmata.list((function(_this) {
104
+          return function(err, devices) {
105
+            return _this.connect(devices[0], opts);
106
+          };
107
+        })(this));
108
+        return this;
109
+      }
110
+      this.once('boardReady', function() {
111
+        var io_init_wait;
112
+        debug('boardReady');
113
+        io_init_wait = this.isOldArduinoDevice() ? (debug("old arduino device found " + this.serialport_name), 3000) : (debug("new arduino device found " + this.serialport_name), 100);
114
+        debug("wait " + io_init_wait + "(msec)");
115
+        return setTimeout((function(_this) {
116
+          return function() {
117
+            var i, j, k;
118
+            for (i = j = 0; j < 6; i = ++j) {
119
+              _this.write([ArduinoFirmata.REPORT_ANALOG | i, 1]);
120
+            }
121
+            for (i = k = 0; k < 2; i = ++k) {
122
+              _this.write([ArduinoFirmata.REPORT_DIGITAL | i, 1]);
123
+            }
124
+            debug('init IO ports');
125
+            return _this.emit('connect');
126
+          };
127
+        })(this), io_init_wait);
128
+      });
129
+      this.serialport = new SerialPort(this.serialport_name, opts);
130
+      this.serialport.once('open', (function(_this) {
131
+        return function() {
132
+          var cid;
133
+          cid = setInterval(function() {
134
+            debug('request REPORT_VERSION');
135
+            return _this.write([ArduinoFirmata.REPORT_VERSION]);
136
+          }, 500);
137
+          _this.once('boardVersion', function(version) {
138
+            clearInterval(cid);
139
+            _this.status = ArduinoFirmata.Status.OPEN;
140
+            return _this.emit('boardReady');
141
+          });
142
+          return _this.serialport.on('data', function(data) {
143
+            var byte, j, len, results;
144
+            results = [];
145
+            for (j = 0, len = data.length; j < len; j++) {
146
+              byte = data[j];
147
+              results.push(_this.process_input(byte));
148
+            }
149
+            return results;
150
+          });
151
+        };
152
+      })(this));
153
+      return this;
154
+    };
155
+
156
+    ArduinoFirmata.prototype.isOpen = function() {
157
+      return this.status === ArduinoFirmata.Status.OPEN;
158
+    };
159
+
160
+    ArduinoFirmata.prototype.close = function(callback) {
161
+      this.status = ArduinoFirmata.Status.CLOSE;
162
+      return this.serialport.close(callback);
163
+    };
164
+
165
+    ArduinoFirmata.prototype.reset = function(callback) {
166
+      return this.write([ArduinoFirmata.SYSTEM_RESET], callback);
167
+    };
168
+
169
+    ArduinoFirmata.prototype.write = function(bytes, callback) {
170
+      return this.serialport.write(bytes, callback);
171
+    };
172
+
173
+    ArduinoFirmata.prototype.sysex = function(command, data, callback) {
174
+      var write_data;
175
+      if (data == null) {
176
+        data = [];
177
+      }
178
+      data = data.map(function(i) {
179
+        return i & 0x7f;
180
+      });
181
+      write_data = [ArduinoFirmata.START_SYSEX, command].concat(data, [ArduinoFirmata.END_SYSEX]);
182
+      return this.write(write_data, callback);
183
+    };
184
+
185
+    ArduinoFirmata.prototype.pinMode = function(pin, mode, callback) {
186
+      switch (mode) {
187
+        case true:
188
+          mode = ArduinoFirmata.OUTPUT;
189
+          break;
190
+        case false:
191
+          mode = ArduinoFirmata.INPUT;
192
+      }
193
+      return this.write([ArduinoFirmata.SET_PIN_MODE, pin, mode], callback);
194
+    };
195
+
196
+    ArduinoFirmata.prototype.digitalWrite = function(pin, value, callback) {
197
+      var port_num;
198
+      this.pinMode(pin, ArduinoFirmata.OUTPUT);
199
+      port_num = (pin >>> 3) & 0x0F;
200
+      if (value === 0 || value === false) {
201
+        this.digital_output_data[port_num] &= ~(1 << (pin & 0x07));
202
+      } else {
203
+        this.digital_output_data[port_num] |= 1 << (pin & 0x07);
204
+      }
205
+      return this.write([ArduinoFirmata.DIGITAL_MESSAGE | port_num, this.digital_output_data[port_num] & 0x7F, this.digital_output_data[port_num] >>> 7], callback);
206
+    };
207
+
208
+    ArduinoFirmata.prototype.analogWrite = function(pin, value, callback) {
209
+      value = Math.floor(value);
210
+      this.pinMode(pin, ArduinoFirmata.PWM);
211
+      return this.write([ArduinoFirmata.ANALOG_MESSAGE | (pin & 0x0F), value & 0x7F, value >>> 7], callback);
212
+    };
213
+
214
+    ArduinoFirmata.prototype.servoWrite = function(pin, angle, callback) {
215
+      this.pinMode(pin, ArduinoFirmata.SERVO);
216
+      return this.write([ArduinoFirmata.ANALOG_MESSAGE | (pin & 0x0F), angle & 0x7F, angle >>> 7], callback);
217
+    };
218
+
219
+    ArduinoFirmata.prototype.digitalRead = function(pin) {
220
+      return ((this.digital_input_data[pin >>> 3] >>> (pin & 0x07)) & 0x01) > 0;
221
+    };
222
+
223
+    ArduinoFirmata.prototype.analogRead = function(pin) {
224
+      return this.analog_input_data[pin];
225
+    };
226
+
227
+    ArduinoFirmata.prototype.process_input = function(input_data) {
228
+      var analog_value, command, diff, i, j, old_analog_value, results, stat, sysex_command, sysex_data;
229
+      if (this.parsing_sysex) {
230
+        if (input_data === ArduinoFirmata.END_SYSEX) {
231
+          this.parsing_sysex = false;
232
+          sysex_command = this.stored_input_data[0];
233
+          sysex_data = this.stored_input_data.slice(1, this.sysex_bytes_read);
234
+          return this.emit('sysex', {
235
+            command: sysex_command,
236
+            data: sysex_data
237
+          });
238
+        } else {
239
+          this.stored_input_data[this.sysex_bytes_read] = input_data;
240
+          return this.sysex_bytes_read += 1;
241
+        }
242
+      } else if (this.wait_for_data > 0 && input_data < 128) {
243
+        this.wait_for_data -= 1;
244
+        this.stored_input_data[this.wait_for_data] = input_data;
245
+        if (this.execute_multi_byte_command !== 0 && this.wait_for_data === 0) {
246
+          switch (this.execute_multi_byte_command) {
247
+            case ArduinoFirmata.DIGITAL_MESSAGE:
248
+              input_data = (this.stored_input_data[0] << 7) + this.stored_input_data[1];
249
+              diff = this.digital_input_data[this.multi_byte_channel] ^ input_data;
250
+              this.digital_input_data[this.multi_byte_channel] = input_data;
251
+              if (this.listeners('digitalChange').length > 0) {
252
+                results = [];
253
+                for (i = j = 0; j <= 13; i = ++j) {
254
+                  if (((0x01 << i) & diff) > 0) {
255
+                    stat = (input_data & diff) > 0;
256
+                    results.push(this.emit('digitalChange', {
257
+                      pin: i + this.multi_byte_channel * 8,
258
+                      value: stat,
259
+                      old_value: !stat
260
+                    }));
261
+                  } else {
262
+                    results.push(void 0);
263
+                  }
264
+                }
265
+                return results;
266
+              }
267
+              break;
268
+            case ArduinoFirmata.ANALOG_MESSAGE:
269
+              analog_value = (this.stored_input_data[0] << 7) + this.stored_input_data[1];
270
+              old_analog_value = this.analogRead(this.multi_byte_channel);
271
+              this.analog_input_data[this.multi_byte_channel] = analog_value;
272
+              if (old_analog_value !== analog_value) {
273
+                return this.emit('analogChange', {
274
+                  pin: this.multi_byte_channel,
275
+                  value: analog_value,
276
+                  old_value: old_analog_value
277
+                });
278
+              }
279
+              break;
280
+            case ArduinoFirmata.REPORT_VERSION:
281
+              this.boardVersion = this.stored_input_data[1] + "." + this.stored_input_data[0];
282
+              return this.emit('boardVersion', this.boardVersion);
283
+          }
284
+        }
285
+      } else {
286
+        if (input_data < 0xF0) {
287
+          command = input_data & 0xF0;
288
+          this.multi_byte_channel = input_data & 0x0F;
289
+        } else {
290
+          command = input_data;
291
+        }
292
+        if (command === ArduinoFirmata.START_SYSEX) {
293
+          this.parsing_sysex = true;
294
+          return this.sysex_bytes_read = 0;
295
+        } else if (command === ArduinoFirmata.DIGITAL_MESSAGE || command === ArduinoFirmata.ANALOG_MESSAGE || command === ArduinoFirmata.REPORT_VERSION) {
296
+          this.wait_for_data = 2;
297
+          return this.execute_multi_byte_command = command;
298
+        }
299
+      }
300
+    };
301
+
302
+    return ArduinoFirmata;
303
+
304
+  })(events.EventEmitter2);
305
+
306
+}).call(this);

+ 10
- 0
lang/node-arduino-firmata/patches/000-new-serialport.patch Zobrazit soubor

@@ -0,0 +1,10 @@
1
+--- a/package.json
2
++++ b/package.json
3
+@@ -30,7 +30,6 @@
4
+   "author": "Sho Hashimoto <hashimoto@shokai.org>",
5
+   "license": "MIT",
6
+   "dependencies": {
7
+-    "serialport": "*",
8
+     "eventemitter2": "*",
9
+     "debug": "*"
10
+   },

+ 94
- 0
lang/node-cylon/Makefile Zobrazit soubor

@@ -0,0 +1,94 @@
1
+#
2
+# Copyright (C) 2014 Arduino LLC
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+include $(TOPDIR)/rules.mk
9
+
10
+PKG_NPM_NAME:=cylon
11
+PKG_NAME:=node-$(PKG_NPM_NAME)
12
+PKG_VERSION:=1.1.0
13
+PKG_RELEASE:=1
14
+
15
+PKG_SOURCE:=v0.22.0.tar.gz
16
+PKG_SOURCE_URL:=https://github.com/hybridgroup/cylon-firmata/archive/
17
+
18
+PKG_BUILD_DEPENDS:=node
19
+PKG_NODE_VERSION:=0.12.7
20
+
21
+PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>
22
+PKG_LICENSE:=Apache-2.0
23
+
24
+include $(INCLUDE_DIR)/package.mk
25
+
26
+define Package/node-cylon/default
27
+  DEPENDS:=+node $(2)
28
+  SUBMENU:=Node.js
29
+  SECTION:=lang
30
+  CATEGORY:=Languages
31
+  TITLE:=CylonJS - $(1)
32
+  URL:=https://www.npmjs.org/package/cylon
33
+endef
34
+
35
+define Package/node-cylon
36
+  $(call Package/node-cylon/default,Core)
37
+endef
38
+
39
+define Package/node-cylon-i2c
40
+  $(call Package/node-cylon/default,I2C,+node-cylon)
41
+endef
42
+
43
+define Package/node-cylon-gpio
44
+  $(call Package/node-cylon/default,GPIO,+node-cylon)
45
+endef
46
+
47
+define Package/node-cylon-firmata
48
+  $(call Package/node-cylon/default,Firmata,+node-cylon-gpio +node-cylon-i2c +node-arduino-firmata)
49
+endef
50
+
51
+define Package/node-cylon/description
52
+	JavaScript Robotics, By Your Command Next generation robotics framework with support for 36 different platforms Get Started
53
+endef
54
+
55
+define Build/Prepare
56
+	/bin/tar xzf $(DL_DIR)/$(PKG_SOURCE) -C $(PKG_BUILD_DIR) --strip-components 1
57
+	$(Build/Patch)
58
+endef
59
+
60
+EXTRA_LDFLAGS="-L$(TOOLCHAIN_DIR)/lib/ -Wl,-rpath-link $(TOOLCHAIN_DIR)/lib/" \
61
+
62
+define Build/Compile
63
+	$(MAKE_FLAGS) \
64
+	npm_config_arch=$(CONFIG_ARCH) \
65
+	npm_config_nodedir=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/ \
66
+	PREFIX="$(PKG_INSTALL_DIR)/usr/" \
67
+	$(STAGING_DIR_HOST)/bin/npm install -g $(PKG_BUILD_DIR)
68
+endef
69
+
70
+define Package/node-cylon/install
71
+	mkdir -p $(1)/usr/lib/node/cylon
72
+	$(CP) -r $(PKG_INSTALL_DIR)/usr/lib/node_modules/cylon-firmata/node_modules/cylon/* $(1)/usr/lib/node/cylon/
73
+endef
74
+
75
+define Package/node-cylon-i2c/install
76
+	mkdir -p $(1)/usr/lib/node/cylon-i2c
77
+	$(CP) -r $(PKG_INSTALL_DIR)/usr/lib/node_modules/cylon-firmata/node_modules/cylon-i2c/* $(1)/usr/lib/node/cylon-i2c/
78
+endef
79
+
80
+define Package/node-cylon-gpio/install
81
+	mkdir -p $(1)/usr/lib/node/cylon-gpio
82
+	$(CP) -r $(PKG_INSTALL_DIR)/usr/lib/node_modules/cylon-firmata/node_modules/cylon-gpio/* $(1)/usr/lib/node/cylon-gpio/
83
+endef
84
+
85
+define Package/node-cylon-firmata/install
86
+	mkdir -p $(1)/usr/lib/node/cylon-firmata
87
+	$(CP) -r $(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/
88
+endef
89
+
90
+$(eval $(call BuildPackage,node-cylon))
91
+$(eval $(call BuildPackage,node-cylon-i2c))
92
+$(eval $(call BuildPackage,node-cylon-gpio))
93
+$(eval $(call BuildPackage,node-cylon-firmata))
94
+

+ 62
- 0
lang/node-hid/Makefile Zobrazit soubor

@@ -0,0 +1,62 @@
1
+#
2
+# Copyright (C) 2015 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+include $(TOPDIR)/rules.mk
9
+
10
+PKG_NPM_NAME:=hid
11
+PKG_NAME:=node-$(PKG_NPM_NAME)
12
+PKG_VERSION:=0.4.0
13
+
14
+PKG_RELEASE=$(PKG_SOURCE_VERSION)
15
+
16
+PKG_SOURCE_PROTO:=git
17
+PKG_SOURCE_URL:=https://github.com/node-hid/node-hid.git
18
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
19
+PKG_SOURCE_VERSION:=c56c8aa5d113c6f2574d1f7e64d41745702965bb
20
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
21
+
22
+PKG_BUILD_DEPENDS:=node
23
+PKG_NODE_VERSION:=0.12.7
24
+
25
+PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>
26
+PKG_LICENSE:=MIT
27
+
28
+include $(INCLUDE_DIR)/package.mk
29
+
30
+define Package/node-hid
31
+  DEPENDS:=+node
32
+  SUBMENU:=Node.js
33
+  SECTION:=lang
34
+  CATEGORY:=Languages
35
+  DEPENDS:=+libusb-1.0 +hidapi +libstdcpp
36
+  TITLE:=Node.js package to access HID devices
37
+  URL:=https://github.com/node-hid/node-hid
38
+endef
39
+
40
+define Package/node-hid/description
41
+ Node.js package to access HID devices
42
+endef
43
+
44
+EXTRA_LDFLAGS+="-lhidapi-libusb"
45
+EXTRA_CFLAGS+="-I$(STAGING_DIR)/usr/include/hidapi/"
46
+
47
+define Build/Compile
48
+	$(MAKE_VARS) \
49
+	$(MAKE_FLAGS) \
50
+	npm_config_arch=$(CONFIG_ARCH) \
51
+	npm_config_nodedir=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/ \
52
+	PREFIX="$(PKG_INSTALL_DIR)/usr/" \
53
+	$(STAGING_DIR_HOST)/bin/npm install -g $(PKG_BUILD_DIR)
54
+endef
55
+
56
+define Package/node-hid/install
57
+	mkdir -p $(1)/usr/lib/node/node-hid/
58
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/node-hid/{index.js,package.json,build,node_modules} $(1)/usr/lib/node/node-hid/
59
+endef
60
+
61
+$(eval $(call BuildPackage,node-hid))
62
+

+ 2457
- 0
lang/node-hid/patches/000-compile.patch
Diff nebyl zobrazen, protože je příliš veliký
Zobrazit soubor


+ 60
- 0
lang/node-serialport/Makefile Zobrazit soubor

@@ -0,0 +1,60 @@
1
+#
2
+# Copyright (C) 2014 Arduino LLC
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+include $(TOPDIR)/rules.mk
9
+
10
+PKG_NPM_NAME:=serialport
11
+PKG_NAME:=node-$(PKG_NPM_NAME)
12
+PKG_VERSION:=1.4.6
13
+PKG_RELEASE:=2
14
+
15
+PKG_SOURCE:=$(PKG_NPM_NAME)-$(PKG_VERSION).tgz
16
+PKG_SOURCE_URL:=http://registry.npmjs.org/$(PKG_NPM_NAME)/-/
17
+PKG_MD5SUM:=1eb21082e0aa676b8350182a60230808
18
+
19
+PKG_BUILD_DEPENDS:=node
20
+PKG_NODE_VERSION:=0.12.7
21
+
22
+PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>
23
+
24
+include $(INCLUDE_DIR)/package.mk
25
+
26
+define Package/node-serialport
27
+  DEPENDS:=+node
28
+  SUBMENU:=Node.js
29
+  SECTION:=lang
30
+  CATEGORY:=Languages
31
+  TITLE:=Node.js package to access serial ports for reading and writing
32
+  URL:=https://www.npmjs.org/package/serialport
33
+endef
34
+
35
+define Package/node-serialport/description
36
+ Node.js package to access serial ports for reading and writing OR Welcome your robotic JavaScript overlords. Better yet, program them!
37
+endef
38
+
39
+define Build/Prepare
40
+	/bin/tar xzf $(DL_DIR)/$(PKG_SOURCE) -C $(PKG_BUILD_DIR) --strip-components 1
41
+	$(Build/Patch)
42
+endef
43
+
44
+EXTRA_LDFLAGS="-L$(TOOLCHAIN_DIR)/lib/ -Wl,-rpath-link $(TOOLCHAIN_DIR)/lib/" \
45
+
46
+define Build/Compile
47
+	$(MAKE_FLAGS) \
48
+	npm_config_arch=$(CONFIG_ARCH) \
49
+	npm_config_nodedir=$(BUILD_DIR)/node-v$(PKG_NODE_VERSION)/ \
50
+	PREFIX="$(PKG_INSTALL_DIR)/usr/" \
51
+	$(STAGING_DIR_HOST)/bin/npm install -g $(PKG_BUILD_DIR)
52
+endef
53
+
54
+define Package/node-serialport/install
55
+	mkdir -p $(1)/usr/lib/node/
56
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/* $(1)/usr/lib/node/
57
+endef
58
+
59
+$(eval $(call BuildPackage,node-serialport))
60
+

+ 11
- 0
lang/node-serialport/patches/package.json.patch Zobrazit soubor

@@ -0,0 +1,11 @@
1
+--- a/package.json	2014-05-02 12:02:02.940515727 +0200
2
++++ b/package.json	2014-05-02 12:03:08.488512762 +0200
3
+@@ -69,7 +71,7 @@
4
+     "serialportterm": "./bin/serialportTerminal.js"
5
+   },
6
+   "scripts": {
7
+-    "install": "node-pre-gyp install --fallback-to-build",
8
++    "install": "node-pre-gyp reinstall --build-from-source --target_arch=${npm_config_arch}",
9
+     "test": "grunt --verbose"
10
+   }
11
+ }

+ 71
- 0
lang/node/Makefile Zobrazit soubor

@@ -0,0 +1,71 @@
1
+#
2
+# Copyright (C) 2006-2011 OpenWrt.org
3
+#
4
+# This is free software, licensed under the GNU General Public License v2.
5
+# See /LICENSE for more information.
6
+#
7
+
8
+include $(TOPDIR)/rules.mk
9
+
10
+PKG_NAME:=node
11
+PKG_VERSION:=v0.12.7
12
+PKG_RELEASE:=1
13
+
14
+PKG_SOURCE:=node-$(PKG_VERSION).tar.gz
15
+PKG_SOURCE_URL:=http://nodejs.org/dist/${PKG_VERSION}
16
+
17
+PKG_INSTALL:=1
18
+
19
+PKG_MAINTAINER:=John Crispin <blogic@openwrt.org>
20
+PKG_LICENSE:=
21
+
22
+include $(INCLUDE_DIR)/host-build.mk
23
+include $(INCLUDE_DIR)/package.mk
24
+
25
+define Package/node
26
+  SECTION:=lang
27
+  CATEGORY:=Languages
28
+  SUBMENU:=Node.js
29
+  TITLE:=Node.js is a platform built on Chrome's JavaScript runtime
30
+  URL:=http://nodejs.org/
31
+  DEPENDS:=+libpthread +librt +libstdcpp +libopenssl +libuv
32
+endef
33
+
34
+define Package/node/description
35
+  Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses
36
+  an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js'
37
+   package ecosystem, npm, is the largest ecosystem of open source libraries in the world.
38
+endef
39
+
40
+CONFIGURE_ARGS= \
41
+	--dest-cpu=$(CONFIG_ARCH) \
42
+	--dest-os=linux \
43
+	--without-snapshot \
44
+	--shared-zlib \
45
+	--shared-openssl \
46
+	--prefix=/usr
47
+
48
+HOST_CONFIGURE_VARS:=
49
+HOST_CONFIGURE_ARGS:= \
50
+	--dest-os=linux \
51
+	--without-snapshot \
52
+	--prefix=$(STAGING_DIR_HOST)/
53
+
54
+HOST_CONFIGURE_CMD:=python ./configure
55
+
56
+define Build/InstallDev
57
+	$(INSTALL_DIR) $(1)/usr/include
58
+	$(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
59
+endef
60
+
61
+define Package/node/install
62
+	mkdir -p $(1)/usr/bin $(1)/usr/lib/node_modules/npm/{bin,lib,node_modules}
63
+	$(CP) $(PKG_INSTALL_DIR)/usr/bin/{node,npm} $(1)/usr/bin/
64
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/{package.json,LICENSE,cli.js} $(1)/usr/lib/node_modules/npm
65
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/bin/npm-cli.js $(1)/usr/lib/node_modules/npm/bin
66
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/lib/* $(1)/usr/lib/node_modules/npm/lib/
67
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/node_modules/npm/node_modules/* $(1)/usr/lib/node_modules/npm/node_modules/
68
+endef
69
+
70
+$(eval $(call HostBuild))
71
+$(eval $(call BuildPackage,node))

+ 15
- 0
lang/node/patches/001-mips-no-fpu.patch Zobrazit soubor

@@ -0,0 +1,15 @@
1
+--- a/deps/v8/build/toolchain.gypi
2
++++ b/deps/v8/build/toolchain.gypi
3
+@@ -50,10 +50,10 @@
4
+     'arm_test_noprobe%': 'off',
5
+ 
6
+     # Similar to vfp but on MIPS.
7
+-    'v8_can_use_fpu_instructions%': 'true',
8
++    'v8_can_use_fpu_instructions%': 'false',
9
+ 
10
+     # Similar to the ARM hard float ABI but on MIPS.
11
+-    'v8_use_mips_abi_hardfloat%': 'true',
12
++    'v8_use_mips_abi_hardfloat%': 'false',
13
+ 
14
+     # Default arch variant for MIPS.
15
+     'mips_arch_variant%': 'r2',

+ 10
- 0
lang/node/patches/002-addr_info.patch Zobrazit soubor

@@ -0,0 +1,10 @@
1
+--- a/deps/uv/src/unix/getaddrinfo.c
2
++++ b/deps/uv/src/unix/getaddrinfo.c
3
+@@ -99,6 +99,7 @@
4
+   int err;
5
+ 
6
+   req = container_of(w, uv_getaddrinfo_t, work_req);
7
++   req->hints->ai_flags &= ~AI_V4MAPPED;
8
+   err = getaddrinfo(req->hostname, req->service, req->hints, &req->addrinfo);
9
+   req->retcode = uv__getaddrinfo_translate_error(err);
10
+ }

+ 12
- 0
lang/node/patches/003-path.patch Zobrazit soubor

@@ -0,0 +1,12 @@
1
+--- a/lib/module.js
2
++++ b/lib/module.js
3
+@@ -512,7 +512,8 @@
4
+     var homeDir = process.env.HOME;
5
+   }
6
+ 
7
+-  var paths = [path.resolve(process.execPath, '..', '..', 'lib', 'node')];
8
++  var paths = [path.resolve(process.execPath, '..', '..', 'lib', 'node'),
9
++    path.resolve(process.execPath, '..', '..', 'lib', 'node_modules')];
10
+ 
11
+   if (homeDir) {
12
+     paths.unshift(path.resolve(homeDir, '.node_libraries'));