about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/gjs
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2020-04-27 21:04:56 +0000
committerAlyssa Ross <hi@alyssa.is>2020-04-27 21:04:56 +0000
commita4e6c7d26af697f4346cacb7ab18dcd7fcfc056e (patch)
tree47950e79183035018882419c4eff5047d1537b99 /nixpkgs/pkgs/development/libraries/gjs
parent5b00523fb58512232b819a301c4309f579c7f09c (diff)
parent22a3bf9fb9edad917fb6cd1066d58b5e426ee975 (diff)
downloadnixlib-a4e6c7d26af697f4346cacb7ab18dcd7fcfc056e.tar
nixlib-a4e6c7d26af697f4346cacb7ab18dcd7fcfc056e.tar.gz
nixlib-a4e6c7d26af697f4346cacb7ab18dcd7fcfc056e.tar.bz2
nixlib-a4e6c7d26af697f4346cacb7ab18dcd7fcfc056e.tar.lz
nixlib-a4e6c7d26af697f4346cacb7ab18dcd7fcfc056e.tar.xz
nixlib-a4e6c7d26af697f4346cacb7ab18dcd7fcfc056e.tar.zst
nixlib-a4e6c7d26af697f4346cacb7ab18dcd7fcfc056e.zip
Merge commit '22a3bf9fb9edad917fb6cd1066d58b5e426ee975'
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/gjs')
-rw-r--r--nixpkgs/pkgs/development/libraries/gjs/default.nix72
-rw-r--r--nixpkgs/pkgs/development/libraries/gjs/fix-paths.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/gjs/installed-tests-path.patch24
3 files changed, 94 insertions, 15 deletions
diff --git a/nixpkgs/pkgs/development/libraries/gjs/default.nix b/nixpkgs/pkgs/development/libraries/gjs/default.nix
index d63c06981273..1f25abd2cf38 100644
--- a/nixpkgs/pkgs/development/libraries/gjs/default.nix
+++ b/nixpkgs/pkgs/development/libraries/gjs/default.nix
@@ -1,11 +1,14 @@
 { fetchurl
+, fetchpatch
 , stdenv
+, meson
+, ninja
 , pkgconfig
 , gnome3
 , gtk3
 , atk
 , gobject-introspection
-, spidermonkey_60
+, spidermonkey_68
 , pango
 , cairo
 , readline
@@ -14,21 +17,29 @@
 , dbus
 , gdk-pixbuf
 , makeWrapper
+, xvfb_run
 , nixosTests
 }:
 
-stdenv.mkDerivation rec {
+let
+  testDeps = [
+    gobject-introspection # for Gio and cairo typelibs
+    gtk3 atk pango.out gdk-pixbuf
+  ];
+in stdenv.mkDerivation rec {
   pname = "gjs";
-  version = "1.58.5";
+  version = "1.64.1";
 
   src = fetchurl {
     url = "mirror://gnome/sources/gjs/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
-    sha256 = "0fm1szmhdawvgbf9fh6vvkv1fdvbn888fciyi2wkhx48kz09jvg7";
+    sha256 = "0z4qx4s3174b1w5b0slnn6jwpy2c18s4fvx4xii2kflr7s4q7bsm";
   };
 
   outputs = [ "out" "dev" "installedTests" ];
 
   nativeBuildInputs = [
+    meson
+    ninja
     pkgconfig
     makeWrapper
     libxml2 # for xml-stripblanks
@@ -38,30 +49,61 @@ stdenv.mkDerivation rec {
     gobject-introspection
     cairo
     readline
-    spidermonkey_60
+    spidermonkey_68
     dbus # for dbus-run-session
   ];
 
+  checkInputs = [
+    xvfb_run
+  ] ++ testDeps;
+
   propagatedBuildInputs = [
     glib
   ];
 
-  configureFlags = [
-    "--enable-installed-tests"
+  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
   ];
 
+  # Gio test is failing
+  # https://github.com/NixOS/nixpkgs/pull/81626#issuecomment-599325843
+  doCheck = false;
+
   postPatch = ''
-    for f in installed-tests/*.test.in; do
-      substituteInPlace "$f" --subst-var-by pkglibexecdir "$installedTests/libexec/gjs"
-    done
+    substituteInPlace installed-tests/debugger-test.sh --subst-var-by gjsConsole $out/bin/gjs-console
   '';
 
-  postInstall = ''
-    moveToOutput "share/installed-tests" "$installedTests"
-    moveToOutput "libexec/gjs/installed-tests" "$installedTests"
+  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
+  '';
 
+  postInstall = ''
     wrapProgram "$installedTests/libexec/gjs/installed-tests/minijasmine" \
-      --prefix GI_TYPELIB_PATH : "${stdenv.lib.makeSearchPath "lib/girepository-1.0" [ gtk3 atk pango.out gdk-pixbuf ]}:$installedTests/libexec/gjs/installed-tests"
+      --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
   '';
 
   separateDebugInfo = stdenv.isLinux;
@@ -80,7 +122,7 @@ stdenv.mkDerivation rec {
     description = "JavaScript bindings for GNOME";
     homepage = "https://gitlab.gnome.org/GNOME/gjs/blob/master/doc/Home.md";
     license = licenses.lgpl2Plus;
-    maintainers = gnome3.maintainers;
+    maintainers = teams.gnome.members;
     platforms = platforms.linux;
   };
 }
diff --git a/nixpkgs/pkgs/development/libraries/gjs/fix-paths.patch b/nixpkgs/pkgs/development/libraries/gjs/fix-paths.patch
new file mode 100644
index 000000000000..5ca5372ea947
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gjs/fix-paths.patch
@@ -0,0 +1,13 @@
+diff --git a/installed-tests/debugger-test.sh b/installed-tests/debugger-test.sh
+index 0d118490..54c5507e 100755
+--- a/installed-tests/debugger-test.sh
++++ b/installed-tests/debugger-test.sh
+@@ -3,7 +3,7 @@
+ if test "$GJS_USE_UNINSTALLED_FILES" = "1"; then
+     gjs="$TOP_BUILDDIR/gjs-console"
+ else
+-    gjs=gjs-console
++    gjs=@gjsConsole@
+ fi
+ 
+ echo 1..1
diff --git a/nixpkgs/pkgs/development/libraries/gjs/installed-tests-path.patch b/nixpkgs/pkgs/development/libraries/gjs/installed-tests-path.patch
new file mode 100644
index 000000000000..11a39b2dd9a5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/gjs/installed-tests-path.patch
@@ -0,0 +1,24 @@
+diff --git a/installed-tests/meson.build b/installed-tests/meson.build
+index 294d20c6..1e5029e0 100644
+--- a/installed-tests/meson.build
++++ b/installed-tests/meson.build
+@@ -1,7 +1,7 @@
+ ### Installed tests ############################################################
+ 
+-installed_tests_execdir = get_option('prefix') / pkglibexecdir / 'installed-tests'
+-installed_tests_metadir = abs_datadir / 'installed-tests' / meson.project_name()
++installed_tests_execdir = get_option('installed_test_prefix') / 'libexec' / meson.project_name() / 'installed-tests'
++installed_tests_metadir = get_option('installed_test_prefix') / 'share' / 'installed-tests' / meson.project_name()
+ 
+ # Simple shell script tests #
+ 
+diff --git a/meson_options.txt b/meson_options.txt
+index 66f66024..008687cb 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -25,3 +25,5 @@ option('skip_gtk_tests', type: 'boolean', value: false,
+     description: 'Skip tests that need a display connection')
+ option('verbose_logs', type: 'boolean', value: false,
+     description: 'Enable extra log messages that may decrease performance (not allowed in release builds)')
++option('installed_test_prefix', type: 'string', value: '',
++    description: 'Prefix for installed tests')