mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Fix building LOOT as a native Linux application.
Not all Windows-specific code has equivalent Linux code, file path to URL conversion is hacky, and only that LOOT launches correctly with no game detected has been tested.
This commit is contained in:
+59
-50
@@ -6,12 +6,9 @@
|
||||
var child_process = require('child_process');
|
||||
var path = require('path');
|
||||
var fs = require('fs-extra');
|
||||
var os = require('os');
|
||||
var helpers = require('./helpers');
|
||||
|
||||
function isApi64Bit(root_path) {
|
||||
return helpers.fileExists(path.join(root_path, 'build', 'Release', 'loot64.dll'));
|
||||
}
|
||||
|
||||
function vulcanize() {
|
||||
return child_process.execFileSync('node', [
|
||||
'scripts/vulcanize.js',
|
||||
@@ -28,7 +25,12 @@ function getGitDescription() {
|
||||
}
|
||||
|
||||
function compress(source_path, dest_path) {
|
||||
var sevenzip_path = path.join('C:\\', 'Program Files', '7-Zip', '7z.exe');
|
||||
var sevenzip_path = '';
|
||||
if (os.platform() == 'win32') {
|
||||
sevenzip_path = path.join('C:\\', 'Program Files', '7-Zip', '7z.exe');
|
||||
} else {
|
||||
sevenzip_path = '/usr/bin/7z';
|
||||
}
|
||||
|
||||
// First remove any existing archive.
|
||||
fs.removeSync(dest_path);
|
||||
@@ -43,32 +45,43 @@ function compress(source_path, dest_path) {
|
||||
]);
|
||||
}
|
||||
|
||||
function createAppArchive(dest_path) {
|
||||
function createAppArchive(release_path, dest_path) {
|
||||
// Ensure that the output directory is empty.
|
||||
fs.emptyDirSync(temp_path);
|
||||
|
||||
if (helpers.isMultiArch(root_path)) {
|
||||
var release_path = path.join(root_path, 'build', '32', 'Release');
|
||||
} else {
|
||||
var release_path = path.join(root_path, 'build', 'Release');
|
||||
}
|
||||
|
||||
// Copy LOOT exectuable and CEF files.
|
||||
[
|
||||
'LOOT.exe',
|
||||
'd3dcompiler_47.dll',
|
||||
'libEGL.dll',
|
||||
'libGLESv2.dll',
|
||||
'libcef.dll',
|
||||
'wow_helper.exe',
|
||||
'natives_blob.bin',
|
||||
'snapshot_blob.bin',
|
||||
'cef.pak',
|
||||
'cef_100_percent.pak',
|
||||
'cef_200_percent.pak',
|
||||
'devtools_resources.pak',
|
||||
'icudtl.dat'
|
||||
].forEach(function(file){
|
||||
var binaries = [];
|
||||
if (os.platform() == 'win32') {
|
||||
binaries = [
|
||||
'LOOT.exe',
|
||||
'd3dcompiler_47.dll',
|
||||
'libEGL.dll',
|
||||
'libGLESv2.dll',
|
||||
'libcef.dll',
|
||||
'wow_helper.exe',
|
||||
'natives_blob.bin',
|
||||
'snapshot_blob.bin',
|
||||
'cef.pak',
|
||||
'cef_100_percent.pak',
|
||||
'cef_200_percent.pak',
|
||||
'devtools_resources.pak',
|
||||
'icudtl.dat'
|
||||
];
|
||||
} else {
|
||||
binaries = [
|
||||
'LOOT',
|
||||
'chrome-sandbox',
|
||||
'libcef.so',
|
||||
'natives_blob.bin',
|
||||
'snapshot_blob.bin',
|
||||
'cef.pak',
|
||||
'cef_100_percent.pak',
|
||||
'cef_200_percent.pak',
|
||||
'devtools_resources.pak',
|
||||
'icudtl.dat'
|
||||
];
|
||||
}
|
||||
binaries.forEach(function(file){
|
||||
fs.copySync(
|
||||
path.join(release_path, file),
|
||||
path.join(temp_path, file)
|
||||
@@ -130,31 +143,15 @@ function createAppArchive(dest_path) {
|
||||
fs.removeSync(temp_path);
|
||||
}
|
||||
|
||||
function createApiArchive(dest_path) {
|
||||
function createApiArchive(binary_path, dest_path) {
|
||||
// Ensure that the output directory is empty.
|
||||
fs.emptyDirSync(temp_path);
|
||||
|
||||
// API binary/binaries.
|
||||
if (helpers.isMultiArch(root_path)) {
|
||||
fs.copySync(
|
||||
path.join(root_path, 'build', '32', 'Release', 'loot32.dll'),
|
||||
path.join(temp_path, 'loot32.dll')
|
||||
);
|
||||
fs.copySync(
|
||||
path.join(root_path, 'build', '64', 'Release', 'loot64.dll'),
|
||||
path.join(temp_path, 'loot64.dll')
|
||||
);
|
||||
} else if (isApi64Bit(root_path)) {
|
||||
fs.copySync(
|
||||
path.join(root_path, 'build', 'Release', 'loot64.dll'),
|
||||
path.join(temp_path, 'loot64.dll')
|
||||
);
|
||||
} else {
|
||||
fs.copySync(
|
||||
path.join(root_path, 'build', 'Release', 'loot32.dll'),
|
||||
path.join(temp_path, 'loot32.dll')
|
||||
);
|
||||
}
|
||||
fs.copySync(
|
||||
binary_path,
|
||||
path.join(temp_path, path.basename(binary_path))
|
||||
);
|
||||
|
||||
// API header file.
|
||||
fs.mkdirsSync(path.join(temp_path, 'include', 'loot'));
|
||||
@@ -191,5 +188,17 @@ var temp_path = path.join(root_path, 'build', 'archive.tmp');
|
||||
|
||||
var git_desc = getGitDescription();
|
||||
vulcanize();
|
||||
createAppArchive(path.join(root_path, 'build', 'LOOT ' + git_desc + '.7z'));
|
||||
createApiArchive(path.join(root_path, 'build', 'LOOT API ' + git_desc + '.7z'));
|
||||
|
||||
var release_paths = helpers.getAppReleasePaths(root_path);
|
||||
for (var i = 0; i < release_paths.length; ++i) {
|
||||
if (release_paths[i].label) {
|
||||
createAppArchive(release_paths[i].path, path.join(root_path, 'build', 'LOOT ' + git_desc + ' (' + release_paths[i].label + ').7z'));
|
||||
} else {
|
||||
createAppArchive(release_paths[i].path, path.join(root_path, 'build', 'LOOT ' + git_desc + '.7z'));
|
||||
}
|
||||
}
|
||||
|
||||
var binary_paths = helpers.getApiBinaryPaths(root_path);
|
||||
for (var i = 0; i < binary_paths.length; ++i) {
|
||||
createApiArchive(binary_paths[i].path, path.join(root_path, 'build', 'LOOT API ' + git_desc + ' (' + binary_paths[i].label + ').7z'));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user