about summary refs log tree commit diff
path: root/pkgs/development/libraries/gts/default.nix
blob: 5aa8aca6ffb3d3062500368d950c1e536ec5e32c (plain) (blame)
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
{ fetchurl, lib, stdenv, pkg-config, autoreconfHook, gettext, glib, buildPackages }:


stdenv.mkDerivation rec {
  pname = "gts";
  version = "0.7.6";

  outputs = [ "bin" "dev" "out" ];

  src = fetchurl {
    url = "mirror://sourceforge/gts/${pname}-${version}.tar.gz";
    sha256 = "07mqx09jxh8cv9753y2d2jsv7wp8vjmrd7zcfpbrddz3wc9kx705";
  };

  nativeBuildInputs = [
    pkg-config
    autoreconfHook
    glib  # required to satisfy AM_PATH_GLIB_2_0
  ];
  buildInputs = [ gettext ];
  propagatedBuildInputs = [ glib ];

  doCheck = false; # fails with "permission denied"

  preBuild = lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
    pushd src
    make CC=${buildPackages.stdenv.cc}/bin/cc predicates_init
    mv predicates_init predicates_init_build
    make clean
    popd

    substituteInPlace src/Makefile --replace "./predicates_init" "./predicates_init_build"
  '';

  meta = {
    homepage = "https://gts.sourceforge.net/";
    license = lib.licenses.lgpl2Plus;
    description = "GNU Triangulated Surface Library";

    longDescription = ''
      Library intended to provide a set of useful functions to deal with
      3D surfaces meshed with interconnected triangles.
    '';

    maintainers = [ lib.maintainers.viric ];
    platforms = lib.platforms.linux ++ lib.platforms.darwin;
  };
}