<commit_before>{ stdenv, fetchurl, SDL, mesa, SDL_ttf, gettext, zlib, SDL_mixer, SDL_image, guile
, debug ? false }:

with stdenv.lib;

stdenv.mkDerivation rec {
  name = "trackballs-1.1.4";
  
  src = fetchurl {
    url = mirror://sourceforge/trackballs/trackballs-1.1.4.tar.gz;
    sha256 = "19ilnif59sxa8xmfisk90wngrd11pj8s86ixzypv8krm4znbm7a5";
  };

  buildInputs = [ zlib mesa SDL SDL_ttf SDL_mixer SDL_image guile gettext ];

  CFLAGS = optionalString debug "-g -O0";
  CXXFLAGS = CFLAGS;
  dontStrip = debug;
  postUnpack = optionalString debug
    "mkdir -p $out/src; cp -R * $out/src ; cd $out/src";

  NIX_CFLAGS_COMPILE = "-iquote ${SDL.dev}/include/SDL";
  configureFlags = optionalString debug "--enable-debug";

  patchPhase = ''<commit_msg>trackballs: disable format hardening<commit_after>{ stdenv, fetchurl, SDL, mesa, SDL_ttf, gettext, zlib, SDL_mixer, SDL_image, guile
, debug ? false }:

with stdenv.lib;

stdenv.mkDerivation rec {
  name = "trackballs-1.1.4";
  
  src = fetchurl {
    url = mirror://sourceforge/trackballs/trackballs-1.1.4.tar.gz;
    sha256 = "19ilnif59sxa8xmfisk90wngrd11pj8s86ixzypv8krm4znbm7a5";
  };

  buildInputs = [ zlib mesa SDL SDL_ttf SDL_mixer SDL_image guile gettext ];

  hardeningDisable = [ "format" ];

  CFLAGS = optionalString debug "-g -O0";
  CXXFLAGS = CFLAGS;
  dontStrip = debug;
  postUnpack = optionalString debug
    "mkdir -p $out/src; cp -R * $out/src ; cd $out/src";

  NIX_CFLAGS_COMPILE = "-iquote ${SDL.dev}/include/SDL";
  configureFlags = optionalString debug "--enable-debug";

  patchPhase = ''
{'fraction_non_alphanumeric': 0.12921705919796309, 'fraction_numerical': 0.033099936346276254, 'mean_word_length': 3.8819875776397517, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '5429409', 'n_tokens_mistral': 660, 'n_tokens_neox': 615, 'n_words': 129}