Skip to content

Commit

Permalink
fix(flutter_app_packager): fix build rpm on linux arm64 error (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
lijy91 authored Jun 23, 2024
1 parent b1dc1e6 commit f68dfc9
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class MakeRPMConfig extends MakeConfig {
packagerEmail: json['packagerEmail'] as String?,
license: json['license'] as String?,
url: json['url'] as String?,
buildArch: json['build_arch'] as String?,
buildArch: json['build_arch'] as String? ?? _getArchitecture(),
requires: (json['requires'] as List<dynamic>?)?.cast<String>(),
buildRequires: (json['build_requires'] as List<dynamic>?)?.cast<String>(),
description: json['description'] as String?,
Expand Down Expand Up @@ -121,7 +121,7 @@ class MakeRPMConfig extends MakeConfig {
'URL': url,
'Requires': requires?.join(', '),
'BuildRequires': buildRequires?.join(', '),
'BuildArch': buildArch ?? 'x86_64',
'BuildArch': buildArch ?? _getArchitecture(),
}..removeWhere((key, value) => value == null),
'body': {
'%description': description ?? pubspec.description,
Expand Down Expand Up @@ -228,3 +228,12 @@ class MakeRpmConfigLoader extends DefaultMakeConfigLoader {
return MakeRPMConfig.fromJson(map).copyWith(baseMakeConfig);
}
}

String _getArchitecture() {
final result = Process.runSync('uname', ['-m']);
if ('${result.stdout}'.trim() == 'aarch64') {
return 'aarch64';
} else {
return 'x86_64';
}
}

0 comments on commit f68dfc9

Please sign in to comment.