Skip to content
Permalink
Browse files

refactor(generic): replace process.arch with a function that handles …

…arm arches better
  • Loading branch information
malept authored and MarshallOfSound committed Dec 11, 2016
1 parent 894fd4e commit 81fa0943569abba3f2305e8270109592bf12bf7e
@@ -5,6 +5,7 @@ import program from 'commander';
import ora from 'ora';

import './util/terminate';
import electronHostArch from './util/electron-host-arch';
import getForgeConfig from './util/forge-config';
import packager from './electron-forge-package';
import resolveDir from './util/resolve-dir';
@@ -55,7 +56,7 @@ const main = async () => {

console.info('Making for the following targets:', `${targets.join(', ')}`.cyan);

const declaredArch = program.arch || process.arch;
const declaredArch = program.arch || electronHostArch();
let targetArchs = [declaredArch];
if (declaredArch === 'all') {
switch (process.platform) {
@@ -8,6 +8,7 @@ import ora from 'ora';
import rimraf from 'rimraf';

import './util/terminate';
import electronHostArch from './util/electron-host-arch';
import getForgeConfig from './util/forge-config';
import packagerCompileHook from './util/compile-hook';
import rebuildHook from './util/rebuild';
@@ -34,7 +35,7 @@ const main = async () => {
})
.parse(process.argv);

const arch = program.arch || process.arch;
const arch = program.arch || electronHostArch();
const platform = program.platform || process.platform;

let prepareSpinner = ora.ora(`Preparing to Package Application for arch: ${(arch === 'all' ? 'ia32' : arch).cyan}`).start();
@@ -8,11 +8,8 @@ function debianArch(nodeArch) {
switch (nodeArch) {
case 'ia32': return 'i386';
case 'x64': return 'amd64';
case 'arm':
if (process.config.variables.arm_version === '7') {
return 'armhf';
}
return 'armel';
case 'armv7l': return 'armhf';
case 'arm': return 'armel';
default: return nodeArch;
}
}
@@ -8,6 +8,7 @@ function flatpakArch(nodeArch) {
switch (nodeArch) {
case 'ia32': return 'i386';
case 'x64': return 'x86_64';
case 'armv7l': return 'arm';
// arm => arm
default: return nodeArch;
}
@@ -8,11 +8,8 @@ function rpmArch(nodeArch) {
switch (nodeArch) {
case 'ia32': return 'i386';
case 'x64': return 'x86_64';
case 'arm':
if (process.config.variables.arm_version === '7') {
return 'armv7hl';
}
return 'armv6hl';
case 'armv7l': return 'armv7hl';
case 'arm': return 'armv6hl';
default: return nodeArch;
}
}
@@ -0,0 +1,7 @@
export default () => {
if (process.arch === 'arm' && process.config.variables.arm_version === '7') {
return 'armv7l';
}

return process.arch;
};

0 comments on commit 81fa094

Please sign in to comment.
You can’t perform that action at this time.