mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-04-13 21:37:38 +00:00
Merge pull request #239570 from hacker1024/feature/flutter-wrapper-gapps
flutter: Use wrapGAppsHook
This commit is contained in:
commit
6cecfa12b5
@ -3,8 +3,10 @@
|
||||
, stdenvNoCC
|
||||
, runCommand
|
||||
, makeWrapper
|
||||
, wrapGAppsHook
|
||||
, llvmPackages_13
|
||||
, cacert
|
||||
, glib
|
||||
, flutter
|
||||
, jq
|
||||
}:
|
||||
@ -68,8 +70,12 @@ let
|
||||
deps
|
||||
flutter
|
||||
jq
|
||||
glib
|
||||
wrapGAppsHook
|
||||
] ++ nativeBuildInputs;
|
||||
|
||||
dontWrapGApps = true;
|
||||
|
||||
preUnpack = ''
|
||||
${lib.optionalString (!autoDepsList) ''
|
||||
if ! { [ '${lib.boolToString (depsListFile != null)}' = 'true' ] ${lib.optionalString (depsListFile != null) "&& cmp -s <(jq -Sc . '${depsListFile}') <(jq -Sc . '${finalAttrs.passthru.depsListFile}')"}; }; then
|
||||
@ -144,6 +150,7 @@ let
|
||||
for f in "$out"/bin/*; do
|
||||
wrapProgram "$f" \
|
||||
--suffix LD_LIBRARY_PATH : '${lib.makeLibraryPath finalAttrs.runtimeDependencies}' \
|
||||
''${gappsWrapperArgs[@]} \
|
||||
${extraWrapProgramArgs}
|
||||
done
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
, makeWrapper
|
||||
, runCommandLocal
|
||||
, writeShellScript
|
||||
, wrapGAppsHook
|
||||
, git
|
||||
, which
|
||||
, pkg-config
|
||||
@ -166,31 +167,43 @@ let
|
||||
includeFlags = map (pkg: "-isystem ${lib.getOutput "dev" pkg}/include") (appStaticBuildDeps ++ extraIncludes);
|
||||
linkerFlags = (map (pkg: "-rpath,${lib.getOutput "lib" pkg}/lib") appRuntimeDeps) ++ extraLinkerFlags;
|
||||
in
|
||||
(callPackage ./sdk-symlink.nix { }) (runCommandLocal "flutter-wrapped"
|
||||
(callPackage ./sdk-symlink.nix { }) (stdenv.mkDerivation
|
||||
{
|
||||
nativeBuildInputs = [
|
||||
makeWrapper
|
||||
] ++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.DarwinTools ];
|
||||
pname = "flutter-wrapped";
|
||||
inherit (flutter) version;
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ]
|
||||
++ lib.optionals stdenv.hostPlatform.isDarwin [ darwin.DarwinTools ]
|
||||
++ lib.optionals supportsLinuxDesktop [ glib wrapGAppsHook ];
|
||||
|
||||
passthru = flutter.passthru // {
|
||||
inherit (flutter) version;
|
||||
unwrapped = flutter;
|
||||
inherit engineArtifacts;
|
||||
};
|
||||
|
||||
inherit (flutter) meta;
|
||||
} ''
|
||||
for path in ${builtins.concatStringsSep " " (builtins.foldl' (paths: pkg: paths ++ (map (directory: "'${pkg}/${directory}/pkgconfig'") ["lib" "share"])) [ ] pkgConfigPackages)}; do
|
||||
addToSearchPath FLUTTER_PKG_CONFIG_PATH "$path"
|
||||
done
|
||||
dontUnpack = true;
|
||||
dontWrapGApps = true;
|
||||
|
||||
mkdir -p $out/bin
|
||||
makeWrapper '${immutableFlutter}' $out/bin/flutter \
|
||||
--set-default ANDROID_EMULATOR_USE_SYSTEM_LIBS 1 \
|
||||
--suffix PATH : '${lib.makeBinPath (tools ++ buildTools)}' \
|
||||
--suffix PKG_CONFIG_PATH : "$FLUTTER_PKG_CONFIG_PATH" \
|
||||
--suffix LIBRARY_PATH : '${lib.makeLibraryPath appStaticBuildDeps}' \
|
||||
--prefix CXXFLAGS "''\t" '${builtins.concatStringsSep " " (includeFlags ++ extraCxxFlags)}' \
|
||||
--prefix CFLAGS "''\t" '${builtins.concatStringsSep " " (includeFlags ++ extraCFlags)}' \
|
||||
--prefix LDFLAGS "''\t" '${builtins.concatStringsSep " " (map (flag: "-Wl,${flag}") linkerFlags)}'
|
||||
'')
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
for path in ${builtins.concatStringsSep " " (builtins.foldl' (paths: pkg: paths ++ (map (directory: "'${pkg}/${directory}/pkgconfig'") ["lib" "share"])) [ ] pkgConfigPackages)}; do
|
||||
addToSearchPath FLUTTER_PKG_CONFIG_PATH "$path"
|
||||
done
|
||||
|
||||
mkdir -p $out/bin
|
||||
makeWrapper '${immutableFlutter}' $out/bin/flutter \
|
||||
--set-default ANDROID_EMULATOR_USE_SYSTEM_LIBS 1 \
|
||||
--suffix PATH : '${lib.makeBinPath (tools ++ buildTools)}' \
|
||||
--suffix PKG_CONFIG_PATH : "$FLUTTER_PKG_CONFIG_PATH" \
|
||||
--suffix LIBRARY_PATH : '${lib.makeLibraryPath appStaticBuildDeps}' \
|
||||
--prefix CXXFLAGS "''\t" '${builtins.concatStringsSep " " (includeFlags ++ extraCxxFlags)}' \
|
||||
--prefix CFLAGS "''\t" '${builtins.concatStringsSep " " (includeFlags ++ extraCFlags)}' \
|
||||
--prefix LDFLAGS "''\t" '${builtins.concatStringsSep " " (map (flag: "-Wl,${flag}") linkerFlags)}' \
|
||||
''${gappsWrapperArgs[@]}
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
inherit (flutter) meta;
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user