2020-04-24 23:36:52 +00:00
|
|
|
{ fetchurl
|
2021-05-20 23:08:51 +00:00
|
|
|
, lib
|
|
|
|
, stdenv
|
2020-04-24 23:36:52 +00:00
|
|
|
, meson
|
2022-09-30 11:47:45 +00:00
|
|
|
, mesonEmulatorHook
|
2020-04-24 23:36:52 +00:00
|
|
|
, ninja
|
2021-02-05 17:12:51 +00:00
|
|
|
, pkg-config
|
2021-05-20 23:08:51 +00:00
|
|
|
, gnome
|
2020-04-24 23:36:52 +00:00
|
|
|
, gtk3
|
|
|
|
, atk
|
|
|
|
, gobject-introspection
|
2022-10-21 18:38:19 +00:00
|
|
|
, spidermonkey_102
|
2020-04-24 23:36:52 +00:00
|
|
|
, pango
|
|
|
|
, cairo
|
|
|
|
, readline
|
2022-07-14 12:49:19 +00:00
|
|
|
, libsysprof-capture
|
2020-04-24 23:36:52 +00:00
|
|
|
, glib
|
|
|
|
, libxml2
|
|
|
|
, dbus
|
|
|
|
, gdk-pixbuf
|
2021-05-20 23:08:51 +00:00
|
|
|
, harfbuzz
|
2020-04-24 23:36:52 +00:00
|
|
|
, makeWrapper
|
2020-06-18 07:06:33 +00:00
|
|
|
, which
|
2021-05-20 23:08:51 +00:00
|
|
|
, xvfb-run
|
2020-04-24 23:36:52 +00:00
|
|
|
, nixosTests
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
testDeps = [
|
2021-05-20 23:08:51 +00:00
|
|
|
gtk3 atk pango.out gdk-pixbuf harfbuzz
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
pname = "gjs";
|
2023-04-12 12:48:02 +00:00
|
|
|
version = "1.76.0";
|
2021-05-20 23:08:51 +00:00
|
|
|
|
|
|
|
outputs = [ "out" "dev" "installedTests" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2021-02-05 17:12:51 +00:00
|
|
|
url = "mirror://gnome/sources/gjs/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
|
2023-04-12 12:48:02 +00:00
|
|
|
sha256 = "sha256-pj8VaWSxNgU+q1HqATEU59fBk7dRjSjAQLawLDyTOm0=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
patches = [
|
|
|
|
# Hard-code various paths
|
|
|
|
./fix-paths.patch
|
|
|
|
|
|
|
|
# Allow installing installed tests to a separate output.
|
|
|
|
./installed-tests-path.patch
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
meson
|
|
|
|
ninja
|
2021-02-05 17:12:51 +00:00
|
|
|
pkg-config
|
2020-04-24 23:36:52 +00:00
|
|
|
makeWrapper
|
2020-06-18 07:06:33 +00:00
|
|
|
which # for locale detection
|
2020-04-24 23:36:52 +00:00
|
|
|
libxml2 # for xml-stripblanks
|
2022-09-30 11:47:45 +00:00
|
|
|
dbus # for dbus-run-session
|
|
|
|
gobject-introspection
|
|
|
|
] ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
|
|
|
|
mesonEmulatorHook
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
cairo
|
|
|
|
readline
|
2022-07-14 12:49:19 +00:00
|
|
|
libsysprof-capture
|
2022-10-21 18:38:19 +00:00
|
|
|
spidermonkey_102
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2021-05-20 23:08:51 +00:00
|
|
|
xvfb-run
|
2020-04-24 23:36:52 +00:00
|
|
|
] ++ testDeps;
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
glib
|
|
|
|
];
|
|
|
|
|
|
|
|
mesonFlags = [
|
|
|
|
"-Dinstalled_test_prefix=${placeholder "installedTests"}"
|
2022-12-02 08:20:57 +00:00
|
|
|
] ++ lib.optionals (!stdenv.isLinux || stdenv.hostPlatform.isMusl) [
|
2022-10-21 18:38:19 +00:00
|
|
|
"-Dprofiler=disabled"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
doCheck = !stdenv.isDarwin;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
postPatch = ''
|
2020-06-18 07:06:33 +00:00
|
|
|
patchShebangs build/choose-tests-locale.sh
|
2020-04-24 23:36:52 +00:00
|
|
|
substituteInPlace installed-tests/debugger-test.sh --subst-var-by gjsConsole $out/bin/gjs-console
|
2022-12-02 08:20:57 +00:00
|
|
|
'' + lib.optionalString stdenv.hostPlatform.isMusl ''
|
|
|
|
substituteInPlace installed-tests/js/meson.build \
|
|
|
|
--replace "'Encoding'," "#'Encoding',"
|
2020-04-24 23:36:52 +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.
|
2020-11-12 09:05:59 +00:00
|
|
|
mkdir -p $out/lib $installedTests/libexec/installed-tests/gjs
|
2020-04-24 23:36:52 +00:00
|
|
|
ln -s $PWD/libgjs.so.0 $out/lib/libgjs.so.0
|
2020-11-12 09:05:59 +00:00
|
|
|
ln -s $PWD/installed-tests/js/libgimarshallingtests.so $installedTests/libexec/installed-tests/gjs/libgimarshallingtests.so
|
2021-05-20 23:08:51 +00:00
|
|
|
ln -s $PWD/installed-tests/js/libgjstesttools/libgjstesttools.so $installedTests/libexec/installed-tests/gjs/libgjstesttools.so
|
2020-11-12 09:05:59 +00:00
|
|
|
ln -s $PWD/installed-tests/js/libregress.so $installedTests/libexec/installed-tests/gjs/libregress.so
|
|
|
|
ln -s $PWD/installed-tests/js/libwarnlib.so $installedTests/libexec/installed-tests/gjs/libwarnlib.so
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
2020-11-12 09:05:59 +00:00
|
|
|
# TODO: make the glib setup hook handle moving the schemas in other outputs.
|
2020-06-18 07:06:33 +00:00
|
|
|
installedTestsSchemaDatadir="$installedTests/share/gsettings-schemas/${pname}-${version}"
|
|
|
|
mkdir -p "$installedTestsSchemaDatadir"
|
|
|
|
mv "$installedTests/share/glib-2.0" "$installedTestsSchemaDatadir"
|
|
|
|
'';
|
|
|
|
|
|
|
|
postFixup = ''
|
2020-11-12 09:05:59 +00:00
|
|
|
wrapProgram "$installedTests/libexec/installed-tests/gjs/minijasmine" \
|
2020-06-18 07:06:33 +00:00
|
|
|
--prefix XDG_DATA_DIRS : "$installedTestsSchemaDatadir" \
|
2021-02-05 17:12:51 +00:00
|
|
|
--prefix GI_TYPELIB_PATH : "${lib.makeSearchPath "lib/girepository-1.0" testDeps}"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
|
|
|
xvfb-run -s '-screen 0 800x600x24' \
|
|
|
|
meson test --print-errorlogs
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
|
|
|
|
|
|
|
separateDebugInfo = stdenv.isLinux;
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
tests = {
|
|
|
|
installed-tests = nixosTests.installed-tests.gjs;
|
|
|
|
};
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
updateScript = gnome.updateScript {
|
2020-04-24 23:36:52 +00:00
|
|
|
packageName = "gjs";
|
2021-08-10 14:31:46 +00:00
|
|
|
versionPolicy = "odd-unstable";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "JavaScript bindings for GNOME";
|
|
|
|
homepage = "https://gitlab.gnome.org/GNOME/gjs/blob/master/doc/Home.md";
|
|
|
|
license = licenses.lgpl2Plus;
|
|
|
|
maintainers = teams.gnome.members;
|
2022-10-21 18:38:19 +00:00
|
|
|
platforms = platforms.unix;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|