Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ If no platform is provided, the build for the host platform is run.

**Note:** Support for cross-platform building is very limited due to the requirement for platform specific build tools. If in doubt, build on the target platform.

You can also use multiple platforms e.g. `yarn gulp <taskname> --osx64 --linux64`. Other platforms like `--win32`, `--linux32` and `--armv7` can be used too, but they are not officially supported, so use them at your own risk.
You can also use multiple platforms e.g. `yarn gulp <taskname> --osx64 --linux64`. Other platforms like `--win32`, `--linux32` and `--armv8` can be used too, but they are not officially supported, so use them at your own risk.

## Support

Expand Down
46 changes: 23 additions & 23 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const nwBuilderOptions = {
zip: false,
};

const nwArmVersion = '0.27.6';
const nwArmVersion = 'nw60-arm64_2022-01-08';

let metadata = {};

Expand Down Expand Up @@ -136,10 +136,10 @@ gulp.task('default', debugBuild);

// Get platform from commandline args
// #
// # gulp <task> [<platform>]+ Run only for platform(s) (with <platform> one of --linux64, --linux32, --armv7, --osx64, --win32, --win64, or --android)
// # gulp <task> [<platform>]+ Run only for platform(s) (with <platform> one of --linux64, --linux32, --armv8, --osx64, --win32, --win64, or --android)
// #
function getInputPlatforms() {
const supportedPlatforms = ['linux64', 'linux32', 'armv7', 'osx64', 'win32', 'win64', 'android'];
const supportedPlatforms = ['linux64', 'linux32', 'armv8', 'osx64', 'win32', 'win64', 'android'];
const platforms = [];
const regEx = /--(\w+)/;

Expand Down Expand Up @@ -229,7 +229,7 @@ function getRunDebugAppCommand(arch) {

case 'linux64':
case 'linux32':
case 'armv7':
case 'armv8':
command = path.join(DEBUG_DIR, metadata.name, arch, metadata.name);

break;
Expand Down Expand Up @@ -454,9 +454,9 @@ function listPostBuildTasks(folder) {
});
}

if (platforms.indexOf('armv7') !== -1) {
postBuildTasks.push(function post_build_armv7(done) {
return post_build('armv7', folder, done);
if (platforms.indexOf('armv8') !== -1) {
postBuildTasks.push(function post_build_armv8(done) {
return post_build('armv8', folder, done);
});
}

Expand All @@ -479,9 +479,9 @@ function post_build(arch, folder, done) {
.pipe(gulp.dest(launcherDir));
}

if (arch === 'armv7') {
console.log('Moving ARMv7 build from "linux32" to "armv7" directory...');
fse.moveSync(path.join(folder, metadata.name, 'linux32'), path.join(folder, metadata.name, 'armv7'));
if (arch === 'armv8') {
console.log('Moving armv8 build from "linux32" to "armv8" directory...');
fse.moveSync(path.join(folder, metadata.name, 'linux32'), path.join(folder, metadata.name, 'armv8'));
}

return done();
Expand All @@ -502,7 +502,7 @@ function injectARMCache(flavor, done) {
if (!fs.existsSync('./cache')) {
fs.mkdirSync('./cache');
}
fs.closeSync(fs.openSync('./cache/_ARMv7_IS_CACHED', 'w'));
fs.closeSync(fs.openSync('./cache/_ARMv8_IS_CACHED', 'w'));
const versionFolder = `./cache/${nwBuilderOptions.version}${flavorPostfix}`;
if (!fs.existsSync(versionFolder)) {
fs.mkdirSync(versionFolder);
Expand All @@ -512,12 +512,12 @@ function injectARMCache(flavor, done) {
fs.mkdirSync(linux32Folder);
}
const downloadedArchivePath = `${versionFolder}/nwjs${flavorPostfix}-v${nwArmVersion}-linux-arm.tar.gz`;
const downloadUrl = `https://github.com/LeonardLaszlo/nw.js-armv7-binaries/releases/download/v${nwArmVersion}/nwjs${flavorDownloadPostfix}-v${nwArmVersion}-linux-arm.tar.gz`;
const downloadUrl = `https://github.com/LeonardLaszlo/nw.js-armv7-binaries/releases/download/${nwArmVersion}/${nwArmVersion}.tar.gz`;
if (fs.existsSync(downloadedArchivePath)) {
console.log('Prebuilt ARMv7 binaries found in /tmp');
console.log('Prebuilt ARMv8 binaries found in /tmp');
downloadDone(flavorDownloadPostfix, downloadedArchivePath, versionFolder);
} else {
console.log(`Downloading prebuilt ARMv7 binaries from "${downloadUrl}"...`);
console.log(`Downloading prebuilt ARMv8 binaries from "${downloadUrl}"...`);
process.stdout.write('> Starting download...\r');
const armBuildBinary = fs.createWriteStream(downloadedArchivePath);
https.get(downloadUrl, function(res) {
Expand All @@ -539,7 +539,7 @@ function injectARMCache(flavor, done) {
});

function downloadDone(flavorDownload, downloadedArchivePath, versionFolder) {
console.log('Injecting prebuilt ARMv7 binaries into Linux32 cache...');
console.log('Injecting prebuilt ARMv8 binaries into Linux32 cache...');
targz.decompress({
src: downloadedArchivePath,
dest: versionFolder,
Expand Down Expand Up @@ -571,16 +571,16 @@ function buildNWAppsWrapper(platforms, flavor, dir, done) {
buildNWApps(platforms, flavor, dir, done);
}

if (platforms.indexOf('armv7') !== -1) {
if (platforms.indexOf('armv8') !== -1) {
if (platforms.indexOf('linux32') !== -1) {
console.log('Cannot build ARMv7 and Linux32 versions at the same time!');
console.log('Cannot build ARMv8 and Linux32 versions at the same time!');
clean_debug();
process.exit(1);
}
removeItem(platforms, 'armv7');
removeItem(platforms, 'armv8');
platforms.push('linux32');

if (!fs.existsSync('./cache/_ARMv7_IS_CACHED', 'w')) {
if (!fs.existsSync('./cache/_ARMv8_IS_CACHED', 'w')) {
console.log('Purging cache because it needs to be overwritten...');
clean_cache().then(() => {
injectARMCache(flavor, buildNWAppsCallback);
Expand All @@ -589,7 +589,7 @@ function buildNWAppsWrapper(platforms, flavor, dir, done) {
buildNWAppsCallback();
}
} else {
if (platforms.indexOf('linux32') !== -1 && fs.existsSync('./cache/_ARMv7_IS_CACHED')) {
if (platforms.indexOf('linux32') !== -1 && fs.existsSync('./cache/_ARMv8_IS_CACHED')) {
console.log('Purging cache because it was previously overwritten...');
clean_cache().then(buildNWAppsCallback);
} else {
Expand Down Expand Up @@ -874,9 +874,9 @@ function listReleaseTasks(isReleaseBuild, appDirectory) {
});
}

if (platforms.indexOf('armv7') !== -1) {
releaseTasks.push(function release_armv7_zip() {
return release_zip('armv7', appDirectory);
if (platforms.indexOf('armv8') !== -1) {
releaseTasks.push(function release_armv8_zip() {
return release_zip('armv8', appDirectory);
});
}

Expand Down