Unverified Commit 6cecfa12 authored by Maciej Krüger's avatar Maciej Krüger Committed by GitHub
Browse files

Merge pull request #239570 from hacker1024/feature/flutter-wrapper-gapps

flutter: Use wrapGAppsHook
parents a1004f62 84347c21
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -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 −20
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@
, makeWrapper
, runCommandLocal
, writeShellScript
, wrapGAppsHook
, git
, which
, pkg-config
@@ -166,20 +167,26 @@ 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;
} ''
  dontUnpack = true;
  dontWrapGApps = true;

  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
@@ -192,5 +199,11 @@ in
      --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)}'
'')
      --prefix LDFLAGS "''\t" '${builtins.concatStringsSep " " (map (flag: "-Wl,${flag}") linkerFlags)}' \
      ''${gappsWrapperArgs[@]}

    runHook postInstall
  '';

  inherit (flutter) meta;
})