👷 Add build script for Windows

This commit is contained in:
C-3PO 2019-07-22 22:29:02 +02:00
parent fd67099a1a
commit 653b761eb6
Signed by: c3po
GPG key ID: 62993C4BB4D86F24
2 changed files with 24 additions and 1 deletions

21
build.js Normal file
View file

@ -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());
}

View file

@ -8,7 +8,9 @@
"url": "https://git.jedipedia.net/swtor/ssn.git" "url": "https://git.jedipedia.net/swtor/ssn.git"
}, },
"scripts": { "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": [ "files": [
"lib/miniz/miniz.h", "lib/miniz/miniz.h",