Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 115 lines 2.6 kB view raw
1{ 2 stdenv, 3 fetchFromGitLab, 4 cmake, 5 ninja, 6 pkg-config, 7 boost, 8 glib, 9 gsl, 10 cairo, 11 double-conversion, 12 gtest, 13 lib, 14 inkscape, 15 pkgsCross, 16}: 17 18stdenv.mkDerivation (finalAttrs: { 19 pname = "lib2geom"; 20 version = "1.4"; 21 22 outputs = [ 23 "out" 24 "dev" 25 ]; 26 27 src = fetchFromGitLab { 28 owner = "inkscape"; 29 repo = "lib2geom"; 30 rev = "refs/tags/${finalAttrs.version}"; 31 hash = "sha256-kbcnefzNhUj/ZKZaB9r19bpI68vxUKOLVAwUXSr/zz0="; 32 }; 33 34 nativeBuildInputs = [ 35 cmake 36 ninja 37 pkg-config 38 ]; 39 40 buildInputs = [ 41 boost 42 glib 43 gsl 44 cairo 45 double-conversion 46 ]; 47 48 nativeCheckInputs = [ 49 gtest 50 ]; 51 52 cmakeFlags = [ 53 "-D2GEOM_BUILD_SHARED=ON" 54 # For cross compilation. 55 (lib.cmakeBool "2GEOM_TESTING" finalAttrs.finalPackage.doCheck) 56 ]; 57 58 doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform; 59 60 # TODO: Update cmake hook to make it simpler to selectively disable cmake tests: #113829 61 checkPhase = 62 let 63 disabledTests = 64 lib.optionals stdenv.hostPlatform.isMusl [ 65 # Fails due to rounding differences 66 # https://gitlab.com/inkscape/lib2geom/-/issues/70 67 "circle-test" 68 ] 69 ++ lib.optionals (stdenv.hostPlatform.system != "x86_64-linux") [ 70 # Broken on all platforms, test just accidentally passes on some. 71 # https://gitlab.com/inkscape/lib2geom/-/issues/63 72 "elliptical-arc-test" 73 74 # https://gitlab.com/inkscape/lib2geom/-/issues/69 75 "polynomial-test" 76 77 # https://gitlab.com/inkscape/lib2geom/-/issues/75 78 "line-test" 79 80 # Failure observed on i686 81 "angle-test" 82 "self-intersections-test" 83 84 # Failure observed on aarch64-darwin 85 "bezier-test" 86 "ellipse-test" 87 ]; 88 in 89 '' 90 runHook preCheck 91 ctest --output-on-failure -E '^${lib.concatStringsSep "|" disabledTests}$' 92 runHook postCheck 93 ''; 94 95 passthru = { 96 tests = { 97 inherit inkscape; 98 } 99 # Make sure x86_64-linux -> aarch64-linux cross compilation works 100 // lib.optionalAttrs (stdenv.buildPlatform.system == "x86_64-linux") { 101 aarch64-cross = pkgsCross.aarch64-multiplatform.lib2geom; 102 }; 103 }; 104 105 meta = with lib; { 106 description = "Easy to use 2D geometry library in C++"; 107 homepage = "https://gitlab.com/inkscape/lib2geom"; 108 license = [ 109 licenses.lgpl21Only 110 licenses.mpl11 111 ]; 112 maintainers = with maintainers; [ jtojnar ]; 113 platforms = platforms.unix; 114 }; 115})