Skip to content

Commit 0f927bd

Browse files
committed
automate patch during build process
1 parent 1ea92b7 commit 0f927bd

File tree

3 files changed

+61
-3
lines changed

3 files changed

+61
-3
lines changed

build

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# !/bin/bash
2-
#emcc -I ./depend/secp256k1 -I ./depend/secp256k1/src secp256k1-bindings.cpp -o http/secp256k1.html -s EXTRA_EXPORTED_RUNTIME_METHODS=["cwrap"] -std=c++11 --bind -s ALLOW_MEMORY_GROWTH=1 -s IMPORTED_MEMORY
32
emcc -I ./depend/secp256k1 -I ./depend/secp256k1/src secp256k1-bindings.cpp -o http/secp256k1.html -s EXTRA_EXPORTED_RUNTIME_METHODS='["cwrap"]' -std=c++11 --bind
3+
patch -b http/secp256k1.js secp256k1-js.patch

build.bat

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
REM emcc -I ./depend/secp256k1 -I ./depend/secp256k1/src secp256k1-bindings.cpp -o http/secp256k1.html -s EXTRA_EXPORTED_RUNTIME_METHODS=["cwrap"] -std=c++11 --bind -s ALLOW_MEMORY_GROWTH=1 -s IMPORTED_MEMORY
21
emcc -I ./depend/secp256k1 -I ./depend/secp256k1/src secp256k1-bindings.cpp -o http/secp256k1.html -s EXTRA_EXPORTED_RUNTIME_METHODS=["cwrap"] -std=c++11 --bind
3-
2+
patch -b http/secp256k1.js secp256k1-js.patch

secp256k1-js.patch

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
- add support for workers in NWJS
2+
- remove global exception handling
3+
- add node-style module export
4+
---
5+
http/secp256k1.js | 27 ++++++++++++++++-----------
6+
1 file changed, 16 insertions(+), 11 deletions(-)
7+
8+
diff --git a/http/secp256k1.js b/http/secp256k1.js
9+
index d54d1be..1ece7eb 100644
10+
--- a/http/secp256k1.js
11+
+++ b/http/secp256k1.js
12+
@@ -75,11 +75,11 @@ var nodeFS;
13+
var nodePath;
14+
15+
if (ENVIRONMENT_IS_NODE) {
16+
- if (ENVIRONMENT_IS_WORKER) {
17+
- scriptDirectory = require('path').dirname(scriptDirectory) + '/';
18+
- } else {
19+
+ //if (ENVIRONMENT_IS_WORKER) {
20+
+ // scriptDirectory = require('path').dirname(scriptDirectory) + '/';
21+
+ //} else {
22+
scriptDirectory = __dirname + '/';
23+
- }
24+
+ //}
25+
26+
// include: node_shell_read.js
27+
28+
@@ -111,14 +111,15 @@ readBinary = function readBinary(filename) {
29+
module['exports'] = Module;
30+
}
31+
32+
- process['on']('uncaughtException', function(ex) {
33+
- // suppress ExitStatus exceptions from showing an error
34+
- if (!(ex instanceof ExitStatus)) {
35+
- throw ex;
36+
- }
37+
- });
38+
+
39+
+ // process['on']('uncaughtException', function(ex) {
40+
+ // // suppress ExitStatus exceptions from showing an error
41+
+ // if (!(ex instanceof ExitStatus)) {
42+
+ // throw ex;
43+
+ // }
44+
+ // });
45+
+ // process['on']('unhandledRejection', abort);
46+
47+
- process['on']('unhandledRejection', abort);
48+
49+
quit_ = function(status) {
50+
process['exit'](status);
51+
@@ -3238,6 +3239,10 @@ noExitRuntime = true;
52+
53+
run();
54+
55+
+if (typeof module !== 'undefined') {
56+
+ module['exports'] = Module;
57+
+}
58+
+
59+

0 commit comments

Comments
 (0)