Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 stdenv, 3 lib, 4 buildPackages, 5 fetchurl, 6 pkgsCross, 7 replaceVars, 8 pkg-config, 9 gi-docgen, 10 gobject-introspection, 11 meson, 12 ninja, 13 vala, 14 gjs, 15 glib, 16 lua5_1, 17 python3, 18 spidermonkey_128, 19 gnome, 20}: 21 22let 23 luaEnv = lua5_1.withPackages (ps: with ps; [ lgi ]); 24in 25stdenv.mkDerivation rec { 26 pname = "libpeas"; 27 version = "2.0.7"; 28 29 outputs = [ 30 "out" 31 "dev" 32 "devdoc" 33 ]; 34 35 src = fetchurl { 36 url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz"; 37 hash = "sha256-HpqdaXYdIQnv9bfBHYyWtIZ8z6yiuSHt7UlAEZJ2nsk="; 38 }; 39 40 patches = [ 41 # Make PyGObject’s gi library available. 42 (replaceVars ./fix-paths.patch { 43 pythonPaths = lib.concatMapStringsSep ", " (pkg: "'${pkg}/${python3.sitePackages}'") [ 44 python3.pkgs.pygobject3 45 ]; 46 }) 47 ]; 48 49 depsBuildBuild = [ 50 pkg-config 51 ]; 52 53 nativeBuildInputs = [ 54 gi-docgen 55 gobject-introspection 56 meson 57 ninja 58 pkg-config 59 vala 60 ]; 61 62 buildInputs = [ 63 gjs 64 glib 65 luaEnv 66 python3 67 python3.pkgs.pygobject3 68 spidermonkey_128 69 ]; 70 71 propagatedBuildInputs = [ 72 # Required by libpeas-2.pc 73 gobject-introspection 74 ]; 75 76 mesonFlags = [ 77 "-Dgtk_doc=true" 78 "-Dvapi=true" 79 ]; 80 81 # required for locating lua dependencies at build time (when cross compiling): 82 env.LUA_CPATH = "${luaEnv}/lib/lua/${luaEnv.luaversion}/?.so"; 83 env.LUA_PATH = "${luaEnv}/share/lua/${luaEnv.luaversion}/?.lua"; 84 85 strictDeps = true; 86 87 postPatch = '' 88 # Checks lua51 and lua5.1 executable but we have none of them. 89 # Then it tries to invoke lua to check for LGI, which requires emulation for cross. 90 substituteInPlace meson.build \ 91 --replace-fail \ 92 "find_program('lua51', required: false)" \ 93 "find_program('${lib.getExe' lua5_1 "lua"}', required: false)" \ 94 --replace-fail \ 95 "run_command(lua_prg, [" \ 96 "run_command('${stdenv.hostPlatform.emulator buildPackages}', [lua_prg, " 97 ''; 98 99 postFixup = '' 100 # Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back. 101 moveToOutput "share/doc" "$devdoc" 102 ''; 103 104 passthru = { 105 updateScript = gnome.updateScript { 106 attrPath = "libpeas2"; 107 packageName = "libpeas"; 108 versionPolicy = "odd-unstable"; 109 }; 110 111 tests.cross = pkgsCross.aarch64-multiplatform.libpeas2; 112 }; 113 114 meta = with lib; { 115 description = "GObject-based plugins engine"; 116 homepage = "https://gitlab.gnome.org/GNOME/libpeas"; 117 license = licenses.gpl2Plus; 118 platforms = platforms.unix; 119 teams = [ teams.gnome ]; 120 }; 121}