<commit_before>{ lib, stdenv, fetchurl
, # Compile statically (support for packages that look for the static object)
  staticSupport ? stdenv.hostPlatform.isStatic
}:

let
  inherit (stdenv) isDarwin;
  inherit (lib) optional optionalString;
in

stdenv.mkDerivation rec {
  pname = "gsm";
  version = "1.0.19";

  src = fetchurl {
    url = "http://www.quut.com/gsm/${pname}-${version}.tar.gz";
    sha256 = "1xkha9ss5g5qnfaybi8il0mcvp8knwg9plgh8404vh58d0pna0s9";
  };

  patchPhase = ''
    # Fix include directory
    sed -e 's,$(GSM_INSTALL_ROOT)/inc,$(GSM_INSTALL_ROOT)/include/gsm,' -i Makefile
  '' + optionalString (!staticSupport) (
    (if isDarwin then  ''
      # Build dylib on Darwin<commit_msg>gsm: support for cross-compilation<commit_after>{ lib, stdenv, fetchurl
, # Compile statically (support for packages that look for the static object)
  staticSupport ? stdenv.hostPlatform.isStatic
}:

let
  inherit (stdenv) isDarwin;
  inherit (lib) optional optionalString;
in

stdenv.mkDerivation rec {
  pname = "gsm";
  version = "1.0.19";

  src = fetchurl {
    url = "http://www.quut.com/gsm/${pname}-${version}.tar.gz";
    sha256 = "1xkha9ss5g5qnfaybi8il0mcvp8knwg9plgh8404vh58d0pna0s9";
  };

  patchPhase = ''
    substituteInPlace Makefile \
      --replace "= gcc " "?= gcc "
    # Fix include directory
    sed -e 's,$(GSM_INSTALL_ROOT)/inc,$(GSM_INSTALL_ROOT)/include/gsm,' -i Makefile
  '' + optionalString (!staticSupport) (
    (if isDarwin then  ''
      # Build dylib on Darwin
{'fraction_non_alphanumeric': 0.13023255813953488, 'fraction_numerical': 0.03189368770764119, 'mean_word_length': 3.7961783439490446, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2355457', 'n_tokens_mistral': 592, 'n_tokens_neox': 562, 'n_words': 119}