Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at gcc-offload 47 lines 1.2 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 python, 6 ndtypes, 7 libndtypes, 8 libxnd, 9 isPy27, 10}: 11 12buildPythonPackage { 13 pname = "xnd"; 14 format = "setuptools"; 15 disabled = isPy27; 16 inherit (libxnd) version src meta; 17 18 propagatedBuildInputs = [ ndtypes ]; 19 20 buildInputs = [ libndtypes ]; 21 22 postPatch = '' 23 substituteInPlace setup.py \ 24 --replace 'include_dirs = ["libxnd", "ndtypes/python/ndtypes"] + INCLUDES' \ 25 'include_dirs = ["${libndtypes}/include", "${ndtypes}/include", "${libxnd}/include"]' \ 26 --replace 'library_dirs = ["libxnd", "ndtypes/libndtypes"] + LIBS' \ 27 'library_dirs = ["${libndtypes}/lib", "${libxnd}/lib"]' \ 28 --replace 'runtime_library_dirs = ["$ORIGIN"]' \ 29 'runtime_library_dirs = ["${libndtypes}/lib", "${libxnd}/lib"]' \ 30 ''; 31 32 postInstall = 33 '' 34 mkdir $out/include 35 cp python/xnd/*.h $out/include 36 '' 37 + lib.optionalString stdenv.hostPlatform.isDarwin '' 38 install_name_tool -add_rpath ${libxnd}/lib $out/${python.sitePackages}/xnd/_xnd.*.so 39 ''; 40 41 checkPhase = '' 42 pushd python 43 mv xnd _xnd 44 python test_xnd.py 45 popd 46 ''; 47}