summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/pyftgl/default.nix
blob: 8cb6330d5e92f2d0818dc91cbf57eaedaeeb945a (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
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  stdenv,
  setuptools,
  boost,
  freetype,
  ftgl,
  libGLU,
  libGL,
  python,
}:

let
  pythonVersion = with lib.versions; "${major python.version}${minor python.version}";
in
buildPythonPackage rec {
  pname = "pyftgl";
  version = "0.4b";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "umlaeute";
    repo = "pyftgl";
    tag = version;
    sha256 = "sha256-mbzXpIPMNe6wfwaAAw/Ri8xaW6Z6kuNUhFFyzsiW7Is=";
  };

  build-system = [ setuptools ];

  postPatch = ''
    substituteInPlace setup.py \
      --replace-fail boost_python boost_python${pythonVersion}
  ''
  + lib.optionalString stdenv.hostPlatform.isDarwin ''
    export NIX_CFLAGS_COMPILE+=" -L$SDKROOT/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries"
  '';

  buildInputs = [
    boost
    freetype
    ftgl
    libGLU
    libGL
  ];

  meta = {
    description = "Python bindings for FTGL (FreeType for OpenGL)";
    license = lib.licenses.gpl2Plus;
  };
}