Skip to content

Commit

Permalink
Try fix nexe build again
Browse files Browse the repository at this point in the history
  • Loading branch information
animetosho committed Jan 23, 2024
1 parent e7828f2 commit 175124c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions nexe/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,17 @@ nexe.compile({
var data = await compiler.readFileAsync('deps/yencode/src/yencode.cc');
data = data.contents.toString();
data = data.replace(/#if NODE_VERSION_AT_LEAST\(10, 7, 0\).+?NODE_MODULE_INIT.+?#endif/s,
`#include "../../../src/node_internals.h"
`#define NODE_WANT_INTERNALS 1
#include "../../../src/node_internals.h"
#include <uv.h>
static uv_once_t init_once = UV_ONCE_INIT;
void yencode_init(Local<Object> exports, Local<Value> module, Local<Context> context, void* priv)`
);
data = data.replace(/(\nNODE_BUILTIN_MODULE_CONTEXT_AWARE\(yencode, yencode_init\))?$/, "\nNODE_BUILTIN_MODULE_CONTEXT_AWARE(yencode, yencode_init)");
if(parseFloat(nodeVer) >= 12) {
data = data.replace(/(\nNODE_MODULE_CONTEXT_AWARE_INTERNAL\(yencode, yencode_init\))?$/, "\nNODE_MODULE_CONTEXT_AWARE_INTERNAL(yencode, yencode_init)");
} else {
data = data.replace(/(\nNODE_BUILTIN_MODULE_CONTEXT_AWARE\(yencode, yencode_init\))?$/, "\nNODE_BUILTIN_MODULE_CONTEXT_AWARE(yencode, yencode_init)");
}
await compiler.setFileContentsAsync('deps/yencode/src/yencode.cc', data);

data = await compiler.readFileAsync('deps/yencode/index.js');
Expand Down

0 comments on commit 175124c

Please sign in to comment.