diff --git a/packages/flutter_app_packager/lib/src/makers/rpm/make_rpm_config.dart b/packages/flutter_app_packager/lib/src/makers/rpm/make_rpm_config.dart index c78157ee..87a8381c 100644 --- a/packages/flutter_app_packager/lib/src/makers/rpm/make_rpm_config.dart +++ b/packages/flutter_app_packager/lib/src/makers/rpm/make_rpm_config.dart @@ -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?)?.cast(), buildRequires: (json['build_requires'] as List?)?.cast(), description: json['description'] as String?, @@ -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, @@ -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'; + } +}