about summary refs log tree commit diff
path: root/pkgs/development
diff options
context:
space:
mode:
authorMaciej Krüger <mkg20001@gmail.com>2023-08-11 19:01:38 +0200
committerGitHub <noreply@github.com>2023-08-11 19:01:38 +0200
commit3332ba38623280ab7753e876973af4db09dbb96b (patch)
tree0c0991592f4cb7c6f4a33af36d0fcc66152bad16 /pkgs/development
parent666b3d0e06eeaac378a894221ba555097791802f (diff)
parentc34385b52cdd48aa4aa50b95f12f61fe71fc7d0e (diff)
Merge pull request #247919 from gilice/flutter-notices
flutter: link notices to all of the artifact directories.
Diffstat (limited to 'pkgs/development')
-rw-r--r--pkgs/development/compilers/flutter/engine-artifacts/default.nix41
-rw-r--r--pkgs/development/compilers/flutter/engine-artifacts/hashes.nix4
-rw-r--r--pkgs/development/compilers/flutter/wrapper.nix5
3 files changed, 49 insertions, 1 deletions
diff --git a/pkgs/development/compilers/flutter/engine-artifacts/default.nix b/pkgs/development/compilers/flutter/engine-artifacts/default.nix
index 249e9217325ba..41201bdb94e52 100644
--- a/pkgs/development/compilers/flutter/engine-artifacts/default.nix
+++ b/pkgs/development/compilers/flutter/engine-artifacts/default.nix
@@ -6,13 +6,43 @@
 , fetchzip
 , autoPatchelfHook
 , gtk3
+, flutterVersion
 , unzip
+, stdenvNoCC
 }:
 
 let
   hashes = (import ./hashes.nix).${engineVersion} or
     (throw "There are no known artifact hashes for Flutter engine version ${engineVersion}.");
+  noticeText = stdenvNoCC.mkDerivation (finalAttrs: {
+    pname = "flutter-notice";
+    version = engineVersion;
+    dontUnpack = true;
+    src = fetchurl {
+      url = "https://raw.githubusercontent.com/flutter/engine/${engineVersion}/sky/packages/sky_engine/LICENSE";
+      sha256 = hashes.skyNotice;
+    };
+    flutterNotice = fetchurl {
+      url = "https://raw.githubusercontent.com/flutter/flutter/${flutterVersion}/LICENSE";
+      sha256 = hashes.flutterNotice;
+    };
+    installPhase =
+      ''
+        SRC_TEXT="$(cat $src)"
+        FLUTTER_NOTICE_TEXT="$(cat $flutterNotice)"
+        cat << EOF > $out
+        This artifact is from the Flutter SDK's engine.
+        This file carries third-party notices for its dependencies.
+        See also other files, that have LICENSE in the name, in the artifact directory.
+
+        Appendix 1/2: merged sky_engine LICENSE file (also found at ${finalAttrs.src.url})
+        $SRC_TEXT
 
+        Appendix 2/2: Flutter license (also found at ${finalAttrs.flutterNotice.url})
+        $FLUTTER_NOTICE_TEXT
+        EOF
+      '';
+  });
   artifacts =
     {
       common = {
@@ -165,6 +195,17 @@ let
           destination = "$out/${if subdirectory == true then archiveBasename else if subdirectory != null then subdirectory else "."}";
         in
         ''
+          # ship the notice near all artifacts. if the artifact directory is / multiple directories are nested in $src, link it there. If there isn't a directory, link it in root
+          # this *isn't the same as the subdirectory variable above*
+          DIR_CNT="$(echo */ | wc -w)"
+          if [[ "$DIR_CNT" == 0 ]]; then
+            ln -s ${noticeText} LICENSE.README
+          else
+            for dir in */
+            do
+              ln -s ${noticeText} "$dir/LICENSE.README"
+            done
+          fi
           mkdir -p "${destination}"
           cp -r . "${destination}"
         '';
diff --git a/pkgs/development/compilers/flutter/engine-artifacts/hashes.nix b/pkgs/development/compilers/flutter/engine-artifacts/hashes.nix
index fb5134739f76b..f51e43b2474fa 100644
--- a/pkgs/development/compilers/flutter/engine-artifacts/hashes.nix
+++ b/pkgs/development/compilers/flutter/engine-artifacts/hashes.nix
@@ -1,5 +1,7 @@
 {
   "1a65d409c7a1438a34d21b60bf30a6fd5db59314" = {
+    skyNotice = "sha256-n9B26rLlfUqdR6s+2+PNK4H/fN95UE0T7/Vic19W6yo=";
+    flutterNotice = "sha256-pZjblLYpD/vhC17PkRBXtqlDNRxyf92p5fKJHWhwCiA=";
     android-arm = {
       "artifacts.zip" = "sha256-KDMiI6SQoZHfFV5LJJZ7VOGyEKC4UxzRc777j4BbXgM=";
     };
@@ -113,6 +115,8 @@
     };
   };
   "45f6e009110df4f34ec2cf99f63cf73b71b7a420" = {
+    skyNotice = "sha256-n9B26rLlfUqdR6s+2+PNK4H/fN95UE0T7/Vic19W6yo=";
+    flutterNotice = "sha256-pZjblLYpD/vhC17PkRBXtqlDNRxyf92p5fKJHWhwCiA=";
     android-arm = {
       "artifacts.zip" = "sha256-NOpUM+iFSPVzr99Dz0DBdDUQnMC0ad1eZnVhtqu9HnU=";
     };
diff --git a/pkgs/development/compilers/flutter/wrapper.nix b/pkgs/development/compilers/flutter/wrapper.nix
index 5685ddebd7813..a650b1853fd4d 100644
--- a/pkgs/development/compilers/flutter/wrapper.nix
+++ b/pkgs/development/compilers/flutter/wrapper.nix
@@ -56,7 +56,10 @@
 }:
 
 let
-  engineArtifacts = callPackage ./engine-artifacts { inherit (flutter) engineVersion; };
+  engineArtifacts = callPackage ./engine-artifacts {
+    inherit (flutter) engineVersion;
+    flutterVersion = flutter.version;
+  };
   mkCommonArtifactLinkCommand = { artifact }:
     ''
       mkdir -p $out/artifacts/engine/common