1{ lib, fetchFromGitHub, buildPythonPackage
2, cmake
3, fetchurl
4, isPy3k
5, libxml2
6, libxslt
7, pkg-config
8, pysideApiextractor
9, pysideGeneratorrunner
10, python
11, pythonAtLeast
12, qt4
13, sphinx
14}:
15
16buildPythonPackage rec {
17 pname = "pyside-shiboken";
18 version = "1.2.4";
19 format = "other";
20
21 src = fetchFromGitHub {
22 owner = "PySide";
23 repo = "Shiboken";
24 rev = version;
25 sha256 = "0x2lyg52m6a0vn0665pgd1z1qrydglyfxxcggw6xzngpnngb6v5v";
26 };
27
28 nativeBuildInputs = [ cmake pkg-config pysideApiextractor pysideGeneratorrunner sphinx qt4 ];
29
30 buildInputs = [ python libxml2 libxslt ];
31
32 outputs = [ "out" "dev" ];
33
34 preConfigure = ''
35 cmakeFlagsArray=("-DCMAKE_INSTALL_PREFIX=$dev")
36 echo "preConfigure: Fixing shiboken_generator install target."
37 substituteInPlace generator/CMakeLists.txt --replace \
38 \"$\{GENERATORRUNNER_PLUGIN_DIR}\" lib/generatorrunner/
39 '';
40
41 patches = [
42 # gcc6 patch was also sent upstream: https://github.com/pyside/Shiboken/pull/86
43 ./gcc6.patch
44 (lib.optional (pythonAtLeast "3.5") ./shiboken_py35.patch)
45 (fetchurl {
46 # https://github.com/pyside/Shiboken/pull/90
47 name = "fix-build-with-python-3.9.patch";
48 url = "https://github.com/pyside/Shiboken/commit/d1c901d4c0af581003553865360ba964cda041e8.patch";
49 sha256 = "1f7slz8n8rps5r67hz3hi4rr82igc3l166shfy6647ivsb2fnxwy";
50 })
51 ];
52
53 cmakeFlags = lib.optionals isPy3k [
54 "-DUSE_PYTHON3=TRUE"
55 "-DPYTHON3_INCLUDE_DIR=${lib.getDev python}/include/${python.libPrefix}"
56 "-DPYTHON3_LIBRARY=${lib.getLib python}/lib"
57 ];
58
59 meta = with lib; {
60 description = "Plugin (front-end) for pyside-generatorrunner, that generates bindings for C++ libraries using CPython source code";
61 license = licenses.gpl2;
62 homepage = "http://www.pyside.org/";
63 maintainers = [ ];
64 platforms = platforms.all;
65 };
66}