nixpkgs/pkgs/development/libraries/gjs/default.nix

129 lines
3.1 KiB
Nix
Raw Normal View History

2019-11-04 23:49:38 +00:00
{ fetchurl
, fetchpatch
2019-11-04 23:49:38 +00:00
, stdenv
, meson
, ninja
2019-11-04 23:49:38 +00:00
, pkgconfig
, gnome3
, gtk3
, atk
, gobject-introspection
, spidermonkey_68
2019-11-04 23:49:38 +00:00
, pango
, cairo
2019-11-04 23:49:38 +00:00
, readline
, glib
, libxml2
, dbus
, gdk-pixbuf
, makeWrapper
, xvfb_run
, nixosTests
2019-11-04 23:49:38 +00:00
}:
let
testDeps = [
gobject-introspection # for Gio and cairo typelibs
gtk3 atk pango.out gdk-pixbuf
];
in stdenv.mkDerivation rec {
pname = "gjs";
2020-05-03 14:23:59 +01:00
version = "1.64.2";
src = fetchurl {
url = "mirror://gnome/sources/gjs/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
2020-05-03 14:23:59 +01:00
sha256 = "0ywrsfmkxaw11z83dnmb9yqkn6k3c1mkxw2mv6arbwad6x6q7zqm";
};
outputs = [ "out" "dev" "installedTests" ];
2018-02-14 21:19:56 +00:00
2019-11-04 23:49:38 +00:00
nativeBuildInputs = [
meson
ninja
2019-11-04 23:49:38 +00:00
pkgconfig
makeWrapper
libxml2 # for xml-stripblanks
2019-11-04 23:49:38 +00:00
];
buildInputs = [
gobject-introspection
cairo
2019-11-04 23:49:38 +00:00
readline
spidermonkey_68
dbus # for dbus-run-session
2019-11-04 23:49:38 +00:00
];
checkInputs = [
xvfb_run
] ++ testDeps;
2019-11-04 23:49:38 +00:00
propagatedBuildInputs = [
glib
2019-11-04 23:49:38 +00:00
];
mesonFlags = [
"-Dprofiler=disabled"
"-Dinstalled_test_prefix=${placeholder "installedTests"}"
];
patches = [
# Hard-code various paths
./fix-paths.patch
# Allow installing installed tests to a separate output.
./installed-tests-path.patch
2018-02-14 21:19:56 +00:00
];
# Gio test is failing
# https://github.com/NixOS/nixpkgs/pull/81626#issuecomment-599325843
doCheck = false;
2018-02-14 21:19:56 +00:00
postPatch = ''
substituteInPlace installed-tests/debugger-test.sh --subst-var-by gjsConsole $out/bin/gjs-console
2018-02-14 21:19:56 +00:00
'';
preCheck = ''
# Our gobject-introspection patches make the shared library paths absolute
# in the GIR files. When running tests, the library is not yet installed,
# though, so we need to replace the absolute path with a local one during build.
# We are using a symlink that will be overridden during installation.
mkdir -p $out/lib $installedTests/libexec/gjs/installed-tests
ln -s $PWD/libgjs.so.0 $out/lib/libgjs.so.0
ln -s $PWD/installed-tests/js/libgimarshallingtests.so $installedTests/libexec/gjs/installed-tests/libgimarshallingtests.so
ln -s $PWD/installed-tests/js/libregress.so $installedTests/libexec/gjs/installed-tests/libregress.so
ln -s $PWD/installed-tests/js/libwarnlib.so $installedTests/libexec/gjs/installed-tests/libwarnlib.so
'';
2018-02-14 21:19:56 +00:00
postInstall = ''
2018-02-14 21:19:56 +00:00
wrapProgram "$installedTests/libexec/gjs/installed-tests/minijasmine" \
--prefix GI_TYPELIB_PATH : "${stdenv.lib.makeSearchPath "lib/girepository-1.0" testDeps}"
'';
checkPhase = ''
runHook preCheck
xvfb-run -s '-screen 0 800x600x24' \
meson test --print-errorlogs
runHook postCheck
'';
2019-11-04 23:51:07 +00:00
separateDebugInfo = stdenv.isLinux;
2019-11-04 23:49:38 +00:00
passthru = {
tests = {
installed-tests = nixosTests.installed-tests.gjs;
};
2019-11-04 23:49:38 +00:00
updateScript = gnome3.updateScript {
packageName = "gjs";
};
};
meta = with stdenv.lib; {
2018-02-14 20:28:44 +00:00
description = "JavaScript bindings for GNOME";
2019-11-04 23:49:38 +00:00
homepage = "https://gitlab.gnome.org/GNOME/gjs/blob/master/doc/Home.md";
license = licenses.lgpl2Plus;
maintainers = teams.gnome.members;
platforms = platforms.linux;
};
}