Skip to content

Commit

Permalink
refactor(generic): replace process.arch with a function that handles …
Browse files Browse the repository at this point in the history
…arm arches better
  • Loading branch information
malept authored and MarshallOfSound committed Dec 11, 2016
1 parent 894fd4e commit 81fa094
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 12 deletions.
3 changes: 2 additions & 1 deletion src/electron-forge-make.js
Expand Up @@ -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';
Expand Down Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion src/electron-forge-package.js
Expand Up @@ -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';
Expand All @@ -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();
Expand Down
7 changes: 2 additions & 5 deletions src/makers/linux/deb.js
Expand Up @@ -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;
}
}
Expand Down
1 change: 1 addition & 0 deletions src/makers/linux/flatpak.js
Expand Up @@ -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;
}
Expand Down
7 changes: 2 additions & 5 deletions src/makers/linux/rpm.js
Expand Up @@ -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;
}
}
Expand Down
7 changes: 7 additions & 0 deletions src/util/electron-host-arch.js
@@ -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.