From 653b761eb682f6493c3bdb9a4f6c3cfc09219d26 Mon Sep 17 00:00:00 2001 From: C-3PO Date: Mon, 22 Jul 2019 22:29:02 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7=20Add=20build=20script=20for=20Win?= =?UTF-8?q?dows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.js | 21 +++++++++++++++++++++ package.json | 4 +++- 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 build.js diff --git a/build.js b/build.js new file mode 100644 index 0000000..e43bea7 --- /dev/null +++ b/build.js @@ -0,0 +1,21 @@ +const childProcess = require("child_process"); +const os = require("os"); + +function puts(error, stdout, stderr) { + if (error) { + throw error; + } + console.log(stdout); + console.error(stderr); +} + +switch (os.type()) { + case "Linux": + childProcess.exec("npm run build-linux", puts); + break; + case "Windows_NT": + childProcess.exec("npm run build-windows", puts); + break; + default: + throw new Error("Unsupported OS found: " + os.type()); +} diff --git a/package.json b/package.json index 570acac..1f08e1f 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,9 @@ "url": "https://git.jedipedia.net/swtor/ssn.git" }, "scripts": { - "preinstall": "gcc -Wall -m64 -o ssn-installer lib/miniz/miniz.c src/*.c src/*/*.c && chmod +x ssn-installer" + "preinstall": "npm run build-linux", + "build-linux": "gcc -Wall -m64 -o ssn-installer lib/miniz/miniz.c src/*.c src/*/*.c && chmod +x ssn-installer", + "build-windows": "gcc -Wall -m64 -std=c99 -o ssn-installer.exe lib/miniz/miniz.c src/*.c src/utils/decryptUtilities.c src/utils/fileUtilities.c" }, "files": [ "lib/miniz/miniz.h",