anchor.diff:  , file
   , legacySupport ? false
   , static ? stdenv.hostPlatform.isStatic
  +# these need to be ran on the host, thus disable when cross-compiling
  +, buildContrib ? stdenv.hostPlatform == stdenv.buildPlatform
  +, doCheck ? stdenv.hostPlatform == stdenv.buildPlatform
   }:
   
   stdenv.mkDerivation rec {
  
positive.code: 
    preInstall = ''
      mkdir -p $bin/bin
      cp contrib/pzstd/pzstd $bin/bin/pzstd
      substituteInPlace ../programs/zstdgrep \
        --replace ":-grep" ":-${gnugrep}/bin/grep" \
        --replace ":-zstdcat" ":-$bin/bin/zstdcat"
  
negative.code:     (name: value: "-DZSTD_${name}:BOOL=${if value then "ON" else "OFF"}") {
        BUILD_SHARED = !static;
        BUILD_STATIC = static;
        BUILD_CONTRIB = buildContrib;
        PROGRAMS_LINK_SHARED = !static;
        LEGACY_SUPPORT = legacySupport;
        BUILD_TESTS = doCheck;
  