Skip to content

Commit

Permalink
Add prebuilds for Windows and C Client v3.8.2 (#15)
Browse files Browse the repository at this point in the history
* fix(windows): build with extra CMAKE flags

* fix(windows): apply patches is still needed

* feat(windows): add prebuild for node 18
  • Loading branch information
davidvujic-win-dev authored Aug 7, 2023
1 parent 14e47df commit 193d592
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
Binary file added prebuilds/win32-x64/node.abi108.node
Binary file not shown.
2 changes: 1 addition & 1 deletion scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ shell.cd(`${env.sourceFolder}`);

if (env.isWindows) {
const output = env.isVerbose ? '' : ' > NUL';
exec(`cmake -DWANT_SYNCAPI=OFF -DCMAKE_GENERATOR_PLATFORM=${process.arch} .${output}`);
exec(`cmake -DWANT_SYNCAPI=OFF -DCMAKE_GENERATOR_PLATFORM=${process.arch} .${output} -DWITH_OPENSSL=OFF -DWITH_CYRUS_SASL=OFF`);
exec(`cmake --build .${output}`);
} else {
const flags = '-w';
Expand Down
10 changes: 10 additions & 0 deletions scripts/prepublish.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ function clearPath() {
shell.rm('-rf', env.sourceFolder);
}

function applyPatches() {
if (env.isWindows) {
const destination = `${env.sourceFolder}/src`;
shell.sed('-i', '#include "zookeeper_log.h"', '#include "zookeeper_log.h"\n#include "winport.h"\n', `${destination}/zk_log.c`);
shell.sed('-i', '#include "zookeeper.h"', '#include "winport.h"\n#include "zookeeper.h"\n', `${destination}/zk_adaptor.h`);
shell.sed('-i', '#include "zk_adaptor.h"', '#include "zk_adaptor.h"\n#include "winport.h"\n', `${destination}/zookeeper.c`);
}
}

if (env.isAlreadyBuilt) {
shell.echo('Zookeeper has already been built');
shell.exit(0);
Expand All @@ -31,6 +40,7 @@ decompress(env.downloadedFileName, './', {
],
}).then(() => {
shell.echo('Decompressed file');
applyPatches();
}).catch((e) => {
shell.echo(`Error: ${e.message}`);
shell.exit(1);
Expand Down

0 comments on commit 193d592

Please sign in to comment.