anchor.diff:  { stdenv, lib, fetchurl, fetchpatch, texlive, bison, flex, lapack, blas
  -, gmp, mpfr, pari, ntl, gsl, mpfi, ecm, glpk, nauty
  -, readline, gettext, libpng, libao, gfortran, perl
  +, autoreconfHook, gmp, mpfr, pari, ntl, gsl, mpfi, ecm, glpk, nauty
  +, buildPackages, readline, gettext, libpng, libao, gfortran, perl
   , enableGUI ? false, libGL, libGLU, xorg, fltk
   , enableMicroPy ? false, python3
   }:
  
positive.code: 
  stdenv.mkDerivation rec {
    pname = "giac${lib.optionalString enableGUI "-with-xcas"}";
    version = "1.6.0-47"; # TODO try to remove preCheck phase on upgrade
  
    src = fetchurl {
      url = "https://www-fourier.ujf-grenoble.fr/~parisse/debian/dists/stable/main/source/giac_${version}.tar.gz";
      sha256 = "sha256-c5A9/I6L/o3Y3dxEPoTKpw/fJqYMr6euLldaQ1HWT5c=";
    };
  
    patches = [
  
negative.code:     })
    ];
  
    # 1.9.0-5's tarball contains a binary (src/mkjs) which is executed
    # at build time. we will delete and rebuild it.
    depsBuildBuild = [ buildPackages.stdenv.cc ];
  
    postPatch = ''
      for i in doc/*/Makefile* micropython*/xcas/Makefile*; do
        substituteInPlace "$i" --replace "/bin/cp" "cp";
      done;
      rm src/mkjs
      substituteInPlace src/Makefile.am --replace "g++ mkjs.cc" \
        "${buildPackages.stdenv.cc.targetPrefix}c++ mkjs.cc"
    '';
  
    nativeBuildInputs = [
      autoreconfHook texlive.combined.scheme-small bison flex
    ];
  
    # perl is only needed for patchShebangs fixup.
  