summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/sg/sgfutils/package.nix
blob: 138de47b1987bd1875ff91a883b400f231a25f65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
{
  lib,
  stdenv,
  fetchFromGitHub,
  openssl,
  libiconv,
  makeWrapper,
  imagemagick,
  makeFontsConf,
}:
stdenv.mkDerivation {
  pname = "sgfutils";
  version = "0.25-unstable-2017-11-27";
  src = fetchFromGitHub {
    owner = "yangboz";
    repo = "sgfutils";
    rev = "11ab171c46cc16cc71ac6fc901d38ea88d6532a4";
    hash = "sha256-KWYgTxz32WK3MKouj1WAJtZmleKt5giCpzQPwfWruZQ=";
  };
  patches = [
    # FIx gcc-15 build failure: https://github.com/yangboz/sgfutils/pull/3
    ./gcc-15.patch
  ];
  nativeBuildInputs = [ makeWrapper ];
  buildInputs = [ openssl ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ libiconv ];
  buildPhase = ''
    runHook preBuild
    make all
    runHook postBuild
  '';
  installPhase = ''
    runHook preInstall
    mkdir -p $out/bin
    cp sgf sgfsplit sgfvarsplit sgfstrip sgfinfo sgfmerge sgftf \
      sgfcheck sgfdb sgfdbinfo sgfcharset sgfcmp sgfx \
      ngf2sgf nip2sgf nk2sgf gib2sgf sgftopng ugi2sgf \
      $out/bin
    runHook postInstall
  '';
  postFixup = ''
    wrapProgram $out/bin/sgftopng \
      --prefix PATH : ${lib.makeBinPath [ imagemagick ]} \
      --set-default FONTCONFIG_FILE ${makeFontsConf { fontDirectories = [ ]; }}
  '';
  meta = {
    homepage = "https://homepages.cwi.nl/~aeb/go/sgfutils/html/sgfutils.html";
    description = "Command line utilities that help working with SGF files";
    longDescription = ''
      The package sgfutils is a collection of command line utilities that help working with SGF files,
      especially when they describe go (igo, weiqi, baduk) games.
    '';
    license = lib.licenses.gpl2Plus;
    maintainers = with lib.maintainers; [ ggpeti ];
    platforms = lib.platforms.all; # tested on x86_64-linux and aarch64-darwin
  };
}