at 24.11-pre 106 lines 2.7 kB view raw
1{ lib 2, stdenv 3, fetchurl 4, glib 5, meson 6, ninja 7, nixosTests 8, pkg-config 9, gettext 10, withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && stdenv.hostPlatform.emulatorAvailable buildPackages 11, buildPackages 12, gobject-introspection 13, gi-docgen 14, libxslt 15, fixDarwinDylibNames 16, gnome 17}: 18 19stdenv.mkDerivation rec { 20 pname = "json-glib"; 21 version = "1.8.0"; 22 23 outputs = [ "out" "dev" "installedTests" ] 24 ++ lib.optional withIntrospection "devdoc"; 25 26 src = fetchurl { 27 url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz"; 28 sha256 = "l+9euSyoEQOa1Qpl8GYz8armR5J4kwe+cXB5XYsxlFQ="; 29 }; 30 31 patches = [ 32 # Add option for changing installation path of installed tests. 33 ./meson-add-installed-tests-prefix-option.patch 34 ]; 35 36 strictDeps = true; 37 38 depsBuildBuild = [ 39 pkg-config 40 ]; 41 42 nativeBuildInputs = [ 43 meson 44 ninja 45 pkg-config 46 gettext 47 glib 48 libxslt 49 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ 50 fixDarwinDylibNames 51 ] ++ lib.optionals withIntrospection [ 52 gobject-introspection 53 gi-docgen 54 ]; 55 56 propagatedBuildInputs = [ 57 glib 58 ]; 59 60 mesonFlags = [ 61 "-Dinstalled_test_prefix=${placeholder "installedTests"}" 62 (lib.mesonEnable "introspection" withIntrospection) 63 (lib.mesonEnable "gtk_doc" withIntrospection) 64 ]; 65 66 # Run-time dependency gi-docgen found: NO (tried pkgconfig and cmake) 67 # it should be a build-time dep for build 68 # TODO: send upstream 69 postPatch = '' 70 substituteInPlace doc/meson.build \ 71 --replace "'gi-docgen', ver" "'gi-docgen', native:true, ver" \ 72 --replace "'gi-docgen', req" "'gi-docgen', native:true, req" 73 ''; 74 75 doCheck = true; 76 77 postFixup = '' 78 # Move developer documentation to devdoc output. 79 # Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back. 80 if [[ -d "$out/share/doc" ]]; then 81 find -L "$out/share/doc" -type f -regex '.*\.devhelp2?' -print0 \ 82 | while IFS= read -r -d ''' file; do 83 moveToOutput "$(dirname "''${file/"$out/"/}")" "$devdoc" 84 done 85 fi 86 ''; 87 88 passthru = { 89 tests = { 90 installedTests = nixosTests.installed-tests.json-glib; 91 }; 92 93 updateScript = gnome.updateScript { 94 packageName = pname; 95 versionPolicy = "odd-unstable"; 96 }; 97 }; 98 99 meta = with lib; { 100 description = "A library providing (de)serialization support for the JavaScript Object Notation (JSON) format"; 101 homepage = "https://gitlab.gnome.org/GNOME/json-glib"; 102 license = licenses.lgpl21Plus; 103 maintainers = teams.gnome.members; 104 platforms = with platforms; unix; 105 }; 106}