1
1
# Building Autobahn|JS
2
2
3
- To build ** Autobahn|JS** for use in browsers, you will need
3
+ The following describes how to build and publish ** Autobahn|JS** for browser and Node.
4
4
5
- - [ Node.js] ( http://nodejs.org/ )
6
- - [ Google Closure Compiler] ( http://dl.google.com/closure-compiler/compiler-latest.zip )
7
- - [ SCons] ( http://www.scons.org/ )
8
- - [ Taschenmesser] ( https://github.com/oberstet/taschenmesser )
9
- - [ browserify] ( http://browserify.org/ )
10
- - [ ws] ( http://websockets.github.io/ws/ )
11
- - [ crypto-js] ( https://www.npmjs.org/package/crypto-js )
12
5
13
-
14
- ## Installing build requirements
6
+ ## Build environment (browser build)
15
7
16
8
Install [ Node.js] ( http://nodejs.org/ )
17
9
18
10
sudo apt-get install -y nodejs nodejs-legacy npm
19
11
20
- Install browserify
12
+ Install [ browserify] ( http://browserify.org/ )
21
13
22
14
sudo npm install -g browserify
23
15
@@ -29,7 +21,7 @@ Install Java JDK
29
21
30
22
sudo apt install -y openjdk-8-jdk
31
23
32
- Install
24
+ Install [ Google Closure Compiler ] ( https://developers.google.com/closure/compiler/ )
33
25
34
26
cd ~
35
27
rm -f compiler-latest.zip
@@ -49,35 +41,65 @@ Set environment variables (add that to `$HOME/.profile`):
49
41
export NODE_PATH=/usr/local/lib/node_modules/
50
42
51
43
44
+ ## Building for browsers
52
45
53
-
54
-
55
-
56
-
57
-
58
- ** Clone the Autobahn|JS repo**
59
-
60
- git clone [email protected] :tavendo/AutobahnJS.git
61
- cd autobahnjs
62
-
63
- ** Install JavaScript dependencies in NodeJS**
64
-
65
- npm install ws when crypto-js msgpack-lite utf-8-validate
66
-
67
- ** Start the build** :
46
+ To start the build:
68
47
69
48
scons
70
49
71
- > ** note**
72
- >
73
- > When using a bash shell under Windows (e.g. git shell), use 'scons.py'.
74
-
75
- ** You get 3 files inside the** ` build ` ** directory**
76
-
77
- build/autobahn.js
78
- build/autobahn.min.js
79
- build/autobahn.min.jgz
80
-
81
- To ** clean up your build** (i.e. remove previously created files):
50
+ To clean up your build:
82
51
83
52
scons -uc
53
+
54
+ Here is a typical build output (* some* warnings are "ok" - they come from dependencies we don't control):
55
+
56
+
57
+ ``` console
58
+ (cpy2712_1) oberstet@office-corei7:~/scm/crossbario/autobahn-js $ scons
59
+ scons: Reading SConscript files ...
60
+ Building AutobahnJS 0.11.0
61
+ scons: done reading SConscript files.
62
+ scons: Building targets ...
63
+ browserify lib/autobahn.js --standalone autobahn -o build/autobahn.js
64
+ js_builder(["build/autobahn.min.js"], ["build/autobahn.js"])
65
+ java -jar /home/oberstet/closure-compiler-v20161024.jar --compilation_level SIMPLE_OPTIMIZATIONS --js build/autobahn.js --js_output_file build/autobahn.min.js
66
+ build/autobahn.js:772: WARNING - Suspicious negated left operand of in operator.
67
+ while ( k < len && ! k in t ) k++;
68
+ ^
69
+
70
+ build/autobahn.js:866: WARNING - Suspicious negated left operand of in operator.
71
+ while ( k >= 0 && ! k in t ) k--;
72
+ ^
73
+
74
+ build/autobahn.js:6098: WARNING - Suspicious code. The result of the 'getprop' operator is not being used.
75
+ array.byteLength // this throws if `array` is not a valid ArrayBuffer
76
+ ^
77
+
78
+ build/autobahn.js:15857: WARNING - Suspicious code. The result of the 'not' operator is not being used.
79
+ !function(exports) {
80
+ ^
81
+
82
+ 0 error(s), 4 warning(s)
83
+ gzipper(["build/autobahn.min.jgz"], ["build/autobahn.min.js"])
84
+ checksumsMD5(["build/CHECKSUM.MD5"], ["build/autobahn.js", "build/autobahn.min.js", "build/autobahn.min.jgz"])
85
+ checksumsSHA1(["build/CHECKSUM.SHA1"], ["build/autobahn.js", "build/autobahn.min.js", "build/autobahn.min.jgz"])
86
+ checksumsSHA256(["build/CHECKSUM.SHA256"], ["build/autobahn.js", "build/autobahn.min.js", "build/autobahn.min.jgz"])
87
+ Copy("build/LICENSE", "LICENSE")
88
+ scons: done building targets.
89
+ ```
90
+
91
+ This should produce the following build artifacts:
92
+
93
+ ``` console
94
+ (cpy2712_1) oberstet@office-corei7:~/scm/crossbario/autobahn-js $ ls -la build/
95
+ insgesamt 896
96
+ drwxrwxr-x 2 oberstet oberstet 4096 Nov 15 10:51 .
97
+ drwxrwxr-x 7 oberstet oberstet 4096 Nov 15 10:51 ..
98
+ -rw-rw-r-- 1 oberstet oberstet 573208 Nov 15 10:51 autobahn.js
99
+ -rw-rw-r-- 1 oberstet oberstet 58009 Nov 15 10:51 autobahn.min.jgz
100
+ -rw-rw-r-- 1 oberstet oberstet 198906 Nov 15 10:51 autobahn.min.js
101
+ -rw-rw-r-- 1 oberstet oberstet 168 Nov 15 10:51 CHECKSUM.MD5
102
+ -rw-rw-r-- 1 oberstet oberstet 195 Nov 15 10:51 CHECKSUM.SHA1
103
+ -rw-rw-r-- 1 oberstet oberstet 273 Nov 15 10:51 CHECKSUM.SHA256
104
+ -rw-rw-r-- 1 oberstet oberstet 1086 Nov 15 10:46 LICENSE
105
+ ```
0 commit comments