<commit_before>{ lib }:

self: super: {
  haskell = super.haskell // {
    compiler = super.haskell.compiler // lib.mapAttrs (n: v: v.overrideAttrs (drv: {
      patches = (drv.patches or []) ++ lib.optionals self.stdenv.targetPlatform.useAndroidPrebuilt [
        ./8.6.y/android-patches/force-relocation.patch
      ];
    })) { inherit (super.haskell.compiler) ghc865 ghcSplices; };
  };
  libffi = if self.stdenv.targetPlatform.useAndroidPrebuilt
    then
      # Use libffi-3.3-rc0 because the regular libffi is not compatible with android-ndk.
      # Google has its own forked libffi (https://android.googlesource.com/platform/external/libffi/)
      # but upstream also has a release candidate that fixes the same issues. We're using upstream here:
      super.libffi.overrideAttrs (drv: {
        name = "libffi-3.3-rc0";
        patches = [];
        src = builtins.fetchurl {
          url = "https://github.com/libffi/libffi/releases/download/v3.3-rc0/libffi-3.3-rc0.tar.gz";
          sha256 = "1kqfyar1xaxrylrw7j1nclqvcgr6a2cisazaamw1a18wpym6fga0";
        };
        # The new version of libffi doesn't require the same post-fixup hacks that 3.2.1 required. Also,
        # the postFixup script in nixpkgs-channel 19.03 hardcoded some paths to include "3.2.1" specifically,
        # which is no longer valid.
        postFixup = "";
      })
    else
      super.libffi;
}<commit_msg>Use vendored libffi on android<commit_after>{ lib }:

let # Setting libffi to null causes GHC to use its own vendored libffi, which seems to be
    # necessary on android. See discussion here:
    # https://github.com/reflex-frp/reflex-platform/pull/506#issuecomment-511978967
    overrideLibffiOnAndroid = self: v: if self.stdenv.targetPlatform.useAndroidPrebuilt
      then v.override { libffi = null; }
      else v;
in self: super: {
  haskell = super.haskell // {
    compiler = super.haskell.compiler // lib.mapAttrs (n: v: (overrideLibffiOnAndroid self v).overrideAttrs (drv: {
      patches = (drv.patches or []) ++ lib.optionals self.stdenv.targetPlatform.useAndroidPrebuilt [
        ./8.6.y/android-patches/force-relocation.patch
      ];
    })) { inherit (super.haskell.compiler) ghc865 ghcSplices; };
  };
}
{'fraction_non_alphanumeric': 0.11661413777577667, 'fraction_numerical': 0.026114362899594776, 'mean_word_length': 2.9119718309859155, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6632386', 'n_tokens_mistral': 787, 'n_tokens_neox': 749, 'n_words': 173}