{ lib
, fetchFromGitHub
, stdenv
, tcl
, tclx
, makeWrapper
, pkg-config
, autoreconfHook
}:

stdenv.mkDerivation rec {
  pname = "tcllauncher";
  version = "1.10";

  src = fetchFromGitHub {
    owner = "flightaware";
    repo = "tcllauncher";
    rev = "v${version}";
    sha256 = "sha256:0zjq6s7ny0a72qmbbigsqp151kb316hvydsl6dl10y6arjhyqnh5";
  };

  buildInputs = [
    tcl
    tclx
  ];

  nativeBuildInputs = [
    autoreconfHook
    pkg-config
    makeWrapper
  ];

  configureFlags = [
    "--with-tcl=${tcl}/lib"
    "--with-tclinclude=${tcl}/include"
    "--exec-prefix=${placeholder "out"}"
  ];
  makeFlags = [ "DESTDIR=/" ];
  enableParallelBuilding = true;

  #postInstall = ''
  #  wrapProgram $out/bin/tcllauncher \
  #    --suffix TCLLIBPATH ' ' "${tclx}/lib ${placeholder "out"}/lib"
  #'';
}