anchor.diff:      libexif
       libogg
       libopus
  -    libselinux
  -    libsepol
       libsndfile
       libthai
       libunarr
  
positive.code: , libxkbcommon
  , lsb-release
  , lz4
  , pcre
  , pkg-config
  , portaudio
  
negative.code:     portaudio
      sqlite
      tinyxml
      wxGTK32
    ] ++ lib.optionals stdenv.isLinux [
      alsa-utils
      libselinux
      libsepol
      udev
      util-linux
      xorg.libXdmcp
      xorg.libXtst
    ];
  
    cmakeFlags = [ "-DOCPN_BUNDLE_DOCS=true" ];
  
    NIX_CFLAGS_COMPILE = lib.optionals (!stdenv.hostPlatform.isx86) [
      "-DSQUISH_USE_SSE=0"
    ];
  
    postInstall = lib.optionals stdenv.isDarwin ''
      mkdir -p $out/Applications
      mv $out/bin/OpenCPN.app $out/Applications
      makeWrapper $out/Applications/OpenCPN.app/Contents/MacOS/OpenCPN $out/bin/opencpn
    '';
  
    doCheck = true;
  
    meta = with lib; {
      description = "A concise ChartPlotter/Navigator";
      maintainers = with maintainers; [ kragniz lovesegfault ];
      platforms = platforms.unix;
      license = licenses.gpl2Plus;
      homepage = "https://opencpn.org/";
    };
  }
  