Merge pull request #295650 from madsmtm/fix-flutter-macos

Fix Flutter's reference to the `arch` binary on macOS
This commit is contained in:
Weijia Wang 2024-03-21 13:26:47 +01:00 committed by GitHub
commit 863764bb98
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 9 deletions

View File

@ -1,14 +1,12 @@
{ darwin }: {}:
{ { buildInputs ? [ ]
buildInputs ? [ ], , ...
...
}: }:
{ {
postPatch = '' postPatch = ''
if [ "$pname" == "flutter-tools" ]; then if [ "$pname" == "flutter-tools" ]; then
# Remove impure references to `arch` and use arm64 instead of arm64e. # Use arm64 instead of arm64e.
substituteInPlace lib/src/ios/xcodeproj.dart \ substituteInPlace lib/src/ios/xcodeproj.dart \
--replace-fail /usr/bin/arch '${darwin.adv_cmds}/bin/arch' \
--replace-fail arm64e arm64 --replace-fail arm64e arm64
fi fi
''; '';

View File

@ -9,7 +9,6 @@
, flutterSrc , flutterSrc
, patches ? [ ] , patches ? [ ]
, pubspecLock , pubspecLock
, darwin
}: }:
buildDartApplication.override { inherit dart; } rec { buildDartApplication.override { inherit dart; } rec {
@ -27,10 +26,9 @@ buildDartApplication.override { inherit dart; } rec {
postPatch = '' postPatch = ''
popd popd
'' ''
# Remove impure references to `arch` and use arm64 instead of arm64e. # Use arm64 instead of arm64e.
+ lib.optionalString stdenv.isDarwin '' + lib.optionalString stdenv.isDarwin ''
substituteInPlace lib/src/ios/xcodeproj.dart \ substituteInPlace lib/src/ios/xcodeproj.dart \
--replace-fail /usr/bin/arch '${darwin.adv_cmds}/bin/arch' \
--replace-fail arm64e arm64 --replace-fail arm64e arm64
''; '';