nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 102 lines 2.3 kB view raw
1{ 2 lib, 3 stdenv, 4 cmake, 5 fetchFromGitHub, 6 pkg-config, 7 python3, 8 freetype, 9 glfw, 10 gtk3, 11 libGL, 12 libpng, 13 lunasvg, 14 nativefiledialog-extended, 15 nlohmann_json, 16 plutovg, 17 xvfb-run, 18 zlib, 19 python3Packages ? null, 20 enableNFD ? true, 21 enablePython ? false, 22 enableTests ? false, 23 enableExamples ? false, 24 enableShared ? !stdenv.hostPlatform.isStatic, 25}: 26 27stdenv.mkDerivation (finalAttrs: { 28 pname = "feather-tk"; 29 version = "0.4.0"; 30 31 src = fetchFromGitHub { 32 owner = "darbyjohnston"; 33 repo = "feather-tk"; 34 tag = finalAttrs.version; 35 hash = "sha256-hcV99y14o3YFUtKDLEKaR7MxBB3pBdd3sferrYvtvYw="; 36 }; 37 38 nativeBuildInputs = [ 39 cmake 40 pkg-config 41 python3 42 ]; 43 44 buildInputs = [ 45 freetype 46 glfw 47 lunasvg 48 plutovg 49 nlohmann_json 50 libpng 51 zlib 52 libGL 53 ] 54 ++ lib.optionals enableNFD [ 55 nativefiledialog-extended 56 ] 57 ++ lib.optionals (enableNFD && stdenv.isLinux) [ 58 gtk3 59 ] 60 ++ lib.optionals enablePython [ 61 python3Packages.pybind11 62 ]; 63 64 cmakeFlags = [ 65 (lib.cmakeFeature "CMAKE_BUILD_TYPE" "Release") 66 (lib.cmakeBool "BUILD_SHARED_LIBS" enableShared) 67 (lib.cmakeBool "feather_tk_UI_LIB" true) 68 (lib.cmakeFeature "feather_tk_API" "GL_4_1") 69 (lib.cmakeBool "feather_tk_nfd" enableNFD) 70 (lib.cmakeBool "feather_tk_PYTHON" enablePython) 71 (lib.cmakeBool "feather_tk_TESTS" enableTests) 72 (lib.cmakeBool "feather_tk_EXAMPLES" enableExamples) 73 (lib.cmakeFeature "feather_tk_BUILD" "default") 74 ]; 75 76 doCheck = enableTests; 77 78 nativeCheckInputs = lib.optionals (enableTests && stdenv.isLinux) [ 79 xvfb-run 80 ]; 81 82 checkPhase = lib.optionalString enableTests '' 83 runHook preCheck 84 85 cd feather-tk/src/feather-tk-build 86 ${if stdenv.isLinux then "xvfb-run" else ""} ctest --verbose -C Release 87 88 runHook postCheck 89 ''; 90 91 meta = { 92 description = "Lightweight toolkit for building cross-platform applications"; 93 homepage = "https://github.com/darbyjohnston/feather-tk"; 94 license = lib.licenses.bsd3; 95 maintainers = with lib.maintainers; [ liberodark ]; 96 platforms = lib.platforms.linux ++ lib.platforms.darwin; 97 badPlatforms = [ 98 # Broken on darwin with latest SDK, see https://github.com/darbyjohnston/feather-tk/issues/1 99 lib.systems.inspect.patterns.isDarwin 100 ]; 101 }; 102})