nodejs-4.3.1移植
1.下载源码包 v4.3.1 共21.5M 下载地址https://nodejs.org/download/release/v4.3.1/node-v4.3.1.tar.gz
2.解压包,按下面的要求安装软件
* `gcc` and `g++` 4.8 or newer, or
* `clang` and `clang++` 3.4 or newer
* Python 2.6 or 2.7
* GNU Make 3.81 or newer
3.修改./configure文件的585和676行
585行
'__MIPSEL__' : 'mipsel',
改为
'__MIPSEL__' : 'mips64el',
676行添加mips64el
elif target_arch in ('mips', 'mipsel','mips64el'):
4.执行下面的命令编译
$ export PYTHON=/path/to/python
$ $PYTHON ./configure
$ make -j 8
$ [sudo] make install
简单验证 make install 默认安装在/usr/local/bin下
执行
$ /usr/local/bin/node -v
v4.4.3
编写一个小的js程序,假定为web.js
var http = require("http");
http.createServer( function(req, res) {
res.writeHead(200, {"Content-Type": "text/html"});
res.write("<h1>Node.js OK</h1>");
res.end("<p>Hello Loongson 3A2000!</p>");
}).listen(3000);
console.log("HTTP server is running at port 3000.");
执行
$/usr/local/bin/node web.js
HTTP server is running at port 3000.
浏览器测试http://localhost:3000 显示正常