nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 160 lines 3.8 kB view raw
1{ 2 stdenv, 3 lib, 4 fetchFromGitHub, 5 fetchpatch, 6 nix-update-script, 7 pkg-config, 8 meson, 9 mesonEmulatorHook, 10 ninja, 11 python3, 12 mutest, 13 nixosTests, 14 glib, 15 withDocumentation ? 16 ( 17 stdenv.buildPlatform.canExecute stdenv.hostPlatform 18 || stdenv.hostPlatform.emulatorAvailable buildPackages 19 ) 20 && !stdenv.hostPlatform.isStatic, 21 gtk-doc, 22 docbook_xsl, 23 docbook_xml_dtd_43, 24 buildPackages, 25 gobject-introspection, 26 withIntrospection ? 27 lib.meta.availableOn stdenv.hostPlatform gobject-introspection 28 && stdenv.hostPlatform.emulatorAvailable buildPackages, 29 makeWrapper, 30 testers, 31}: 32 33stdenv.mkDerivation (finalAttrs: { 34 pname = "graphene"; 35 version = "1.10.8"; 36 37 outputs = [ 38 "out" 39 "dev" 40 ] 41 ++ lib.optionals withDocumentation [ "devdoc" ] 42 ++ lib.optionals (stdenv.hostPlatform == stdenv.buildPlatform) [ "installedTests" ]; 43 44 src = fetchFromGitHub { 45 owner = "ebassi"; 46 repo = "graphene"; 47 rev = finalAttrs.version; 48 sha256 = "P6JQhSktzvyMHatP/iojNGXPmcsxsFxdYerXzS23ojI="; 49 }; 50 51 patches = [ 52 # Add option for changing installation path of installed tests. 53 ./0001-meson-add-options-for-tests-installation-dirs.patch 54 55 # Disable flaky simd_operators_reciprocal test 56 # https://github.com/ebassi/graphene/issues/246 57 (fetchpatch { 58 url = "https://github.com/ebassi/graphene/commit/4fbdd07ea3bcd0964cca3966010bf71cb6fa8209.patch"; 59 sha256 = "uFkkH0u4HuQ/ua1mfO7sJZ7MPrQdV/JON7mTYB4DW80="; 60 includes = [ "tests/simd.c" ]; 61 revert = true; 62 }) 63 ]; 64 65 depsBuildBuild = [ 66 pkg-config 67 ]; 68 69 nativeBuildInputs = [ 70 meson 71 ninja 72 pkg-config 73 python3 74 makeWrapper 75 ] 76 ++ lib.optionals withDocumentation [ 77 docbook_xml_dtd_43 78 docbook_xsl 79 gtk-doc 80 ] 81 ++ lib.optionals (withDocumentation && !stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ 82 mesonEmulatorHook 83 ] 84 ++ lib.optionals withIntrospection [ 85 gobject-introspection 86 ]; 87 88 buildInputs = [ 89 glib 90 ]; 91 92 nativeCheckInputs = [ 93 mutest 94 ]; 95 96 mesonFlags = [ 97 (lib.mesonBool "gtk_doc" withDocumentation) 98 (lib.mesonEnable "introspection" withIntrospection) 99 "-Dinstalled_test_datadir=${placeholder "installedTests"}/share" 100 "-Dinstalled_test_bindir=${placeholder "installedTests"}/libexec" 101 ] 102 ++ lib.optionals stdenv.hostPlatform.isAarch32 [ 103 # the box test is failing with SIGBUS on armv7l-linux 104 # https://github.com/ebassi/graphene/issues/215 105 "-Darm_neon=false" 106 ]; 107 108 doCheck = true; 109 110 postPatch = '' 111 patchShebangs tests/gen-installed-test.py 112 '' 113 + lib.optionalString withIntrospection '' 114 PATH=${ 115 python3.withPackages (pp: [ 116 pp.pygobject3 117 pp.tappy 118 ]) 119 }/bin:$PATH patchShebangs tests/introspection.py 120 ''; 121 122 postFixup = 123 let 124 introspectionPy = "${placeholder "installedTests"}/libexec/installed-tests/graphene-1.0/introspection.py"; 125 in 126 lib.optionalString withIntrospection '' 127 if [ -x '${introspectionPy}' ] ; then 128 wrapProgram '${introspectionPy}' \ 129 --prefix GI_TYPELIB_PATH : "${ 130 lib.makeSearchPath "lib/girepository-1.0" [ 131 glib.out 132 (placeholder "out") 133 ] 134 }" 135 fi 136 ''; 137 138 passthru = { 139 tests = { 140 installedTests = nixosTests.installed-tests.graphene; 141 pkg-config = testers.hasPkgConfigModules { 142 package = finalAttrs.finalPackage; 143 }; 144 }; 145 146 updateScript = nix-update-script { }; 147 }; 148 149 meta = with lib; { 150 description = "Thin layer of graphic data types"; 151 homepage = "https://github.com/ebassi/graphene"; 152 license = licenses.mit; 153 teams = [ teams.gnome ]; 154 platforms = platforms.unix; 155 pkgConfigModules = [ 156 "graphene-1.0" 157 "graphene-gobject-1.0" 158 ]; 159 }; 160})