NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.14k stars 14.17k forks source link

Gnome web (epiphany) on gtk4 from source build fails #169339

Closed Millrocious closed 1 year ago

Millrocious commented 2 years ago

Gnome web (epiphany) on gtk4 from source build fails

output:

this derivation will be built:
  /nix/store/9mbdhad6rafirnmh65fjkp8vjn9z38q5-epiphany-43.drv
building '/nix/store/9mbdhad6rafirnmh65fjkp8vjn9z38q5-epiphany-43.drv'...
unpacking sources
unpacking source archive /nix/store/8vdj6lbkrnw0xakxzjifq2khk8bk066s-epiphany-wip-exalm-gtk4.tar.gz
source root is epiphany-wip-exalm-gtk4
setting SOURCE_DATE_EPOCH to timestamp 1649764684 of file epiphany-wip-exalm-gtk4/third-party/readability/reader.css
patching sources
patching script interpreter paths in post_install.py
post_install.py: interpreter directive changed from "#!/usr/bin/env python3" to "/nix/store/kwp97hvzh4dff613a4vhpbl6yblavshb-python3-3.9.11/bin/python3"
configuring
meson flags: --buildtype=plain         --libdir=/nix/store/b9033231xbmvxx0hz9gkl2ni0fn3aywl-epiphany-43/lib --libexecdir=/nix/store/b9033231xbmvxx0hz9gkl2ni0fn3aywl-epiphany-43/libexec         --bindir=/nix/store/b9033231xbmvxx0hz9gkl2ni0fn3aywl-epiphany-43/bin --sbindir=/nix/store/b9033231xbmvxx0hz9gkl2ni0fn3aywl-epiphany-43/sbin         --includedir=/nix/store/b9033231xbmvxx0hz9gkl2ni0fn3aywl-epiphany-43/include         --mandir=/nix/store/b9033231xbmvxx0hz9gkl2ni0fn3aywl-epiphany-43/share/man --infodir=/nix/store/b9033231xbmvxx0hz9gkl2ni0fn3aywl-epiphany-43/share/info         --localedir=/nix/store/b9033231xbmvxx0hz9gkl2ni0fn3aywl-epiphany-43/share/locale         -Dauto_features=enabled         -Dwrap_mode=nodownload         --prefix=/nix/store/b9033231xbmvxx0hz9gkl2ni0fn3aywl-epiphany-43 -Dunit_tests=disabled 
The Meson build system
Version: 0.57.1
Source dir: /build/epiphany-wip-exalm-gtk4
Build dir: /build/epiphany-wip-exalm-gtk4/build
Build type: native build
Project name: epiphany
Project version: 42.beta
C compiler for the host machine: gcc (gcc 10.3.0 "gcc (GCC) 10.3.0")
C linker for the host machine: gcc ld.bfd 2.35.2
Host machine cpu family: x86_64
Host machine cpu: x86_64
Found pkg-config: /nix/store/00ipmxm9k10lqjklrb2rbsjgkg1bsx7c-pkg-config-wrapper-0.29.2/bin/pkg-config (0.29.2)
Run-time dependency iso-codes found: YES 4.6.0
Run-time dependency cairo found: YES 1.16.0
Found CMake: /nix/store/ilykjpp6m7brss45clmp2dxmlknvb2m4-cmake-3.21.2/bin/cmake (3.21.2)
Run-time dependency gcr-4-gtk4 found: NO (tried pkgconfig and cmake)

meson.build:81:0: ERROR: Dependency "gcr-4-gtk4" not found, tried pkgconfig and cmake

A full log can be found at /build/epiphany-wip-exalm-gtk4/build/meson-logs/meson-log.txt
error: builder for '/nix/store/9mbdhad6rafirnmh65fjkp8vjn9z38q5-epiphany-43.drv' failed with exit code 1;
       last 10 log lines:
       > Host machine cpu: x86_64
       > Found pkg-config: /nix/store/00ipmxm9k10lqjklrb2rbsjgkg1bsx7c-pkg-config-wrapper-0.29.2/bin/pkg-config (0.29.2)
       > Run-time dependency iso-codes found: YES 4.6.0
       > Run-time dependency cairo found: YES 1.16.0
       > Found CMake: /nix/store/ilykjpp6m7brss45clmp2dxmlknvb2m4-cmake-3.21.2/bin/cmake (3.21.2)
       > Run-time dependency gcr-4-gtk4 found: NO (tried pkgconfig and cmake)
       >
       > meson.build:81:0: ERROR: Dependency "gcr-4-gtk4" not found, tried pkgconfig and cmake
       >
       > A full log can be found at /build/epiphany-wip-exalm-gtk4/build/meson-logs/meson-log.txt
       For full logs, run 'nix log /nix/store/9mbdhad6rafirnmh65fjkp8vjn9z38q5-epiphany-43.drv'.

The package.nix:

{ lib
, stdenv
, meson
, ninja
, gettext
, fetchurl
, fetchpatch
, pkg-config
, gtk4
, glib
, icu
, cmake
, wrapGAppsHook
, gnome
, libxml2
, libxslt
, itstool
, webkitgtk
, libsoup
, glib-networking
, libsecret
, libnotify
, libarchive
, p11-kit
, sqlite
, gcr
, isocodes
, desktop-file-utils
, python3
, nettle
, gdk-pixbuf
, gst_all_1
, json-glib
, libdazzle
, libhandy
, buildPackages
, withPantheon ? false
}:

stdenv.mkDerivation rec {
  pname = "epiphany";
  version = "43";

  src = fetchurl {
    url = "https://gitlab.gnome.org/GNOME/epiphany/-/archive/wip/exalm/gtk4/epiphany-wip-exalm-gtk4.tar.gz";
    sha256 = "sha256-VFj/G6f91HWJl2vLSKsJX5hS1ukXPLrTVID94q1WBbM=";
  };

  patches = lib.optionals withPantheon [
    # Pantheon specific patches for epiphany
    # https://github.com/elementary/browser
    #
    # Patch to unlink nav buttons
    # https://github.com/elementary/browser/pull/18
    (fetchpatch {
      url = "https://raw.githubusercontent.com/elementary/browser/cc17559a7ac6effe593712b4f3d0bbefde6e3b62/navigation-buttons.patch";
      sha256 = "sha256-G1/JUjn/8DyO9sgL/5Kq205KbTOs4EMi4Vf3cJ8FHXU=";
    })
  ];

  nativeBuildInputs = [
    desktop-file-utils
    gettext
    itstool
    libxslt
    gcr
    meson
    cmake
    ninja
    pkg-config
    python3
    wrapGAppsHook
    buildPackages.glib
    buildPackages.gtk3
  ];

  buildInputs = [
    gdk-pixbuf
    glib
    gst_all_1.gst-libav
    gst_all_1.gst-plugins-bad
    gst_all_1.gst-plugins-base
    gst_all_1.gst-plugins-good
    gst_all_1.gst-plugins-ugly
    gst_all_1.gstreamer
    gtk4
    icu
    isocodes
    json-glib
    libdazzle
    libhandy
    libnotify
    libarchive
    libsecret
    libsoup
    libxml2
    nettle
    p11-kit
    sqlite
    webkitgtk
  ];

  # Tests need an X display
  mesonFlags = [
    "-Dunit_tests=disabled"
  ];

  postPatch = ''
    chmod +x post_install.py # patchShebangs requires executable file
    patchShebangs post_install.py
  '';

  passthru = {
    updateScript = gnome.updateScript {
      packageName = pname;
    };
  };

  meta = with lib; {
    homepage = "https://wiki.gnome.org/Apps/Epiphany";
    description = "WebKit based web browser for GNOME";
    maintainers = teams.gnome.members ++ teams.pantheon.members;
    license = licenses.gpl3Plus;
    platforms = platforms.linux;
  };
}

Technical details

ReplayCoding commented 2 years ago

It looks like this is depending on an unreleased version of https://gitlab.gnome.org/GNOME/gcr. You could try changing the gcr package to point to master instead of the release.

Millrocious commented 2 years ago

so i have this package for gcr

{ lib, stdenv
, fetchurl
, fetchpatch
, pkg-config
, meson
, ninja
, gettext
, gnupg
, p11-kit
, glib
, libgcrypt
, libtasn1
, gtk4
, pango
, libsecret
, openssh
, systemd
, gobject-introspection
, wrapGAppsHook
, libxslt
, vala
, gnome
, python3
, shared-mime-info
}:

stdenv.mkDerivation rec {
  pname = "gcr-4-gtk4";

  src = fetchurl {
    url = "https://gitlab.gnome.org/GNOME/gcr/-/archive/master/gcr-master.tar.gz";
    sha256 = lib.fakeSha256;
  };

  patches = [
# Pull upstream fix for meson-0.60:
    #  https://gitlab.gnome.org/GNOME/gcr/-/merge_requests/81
    (fetchpatch {
      name = "meson-0.60.patch";
      url = "https://gitlab.gnome.org/GNOME/gcr/-/commit/b3ca1d02bb0148ca787ac4aead164d7c8ce2c4d8.patch";
      sha256 = "15gwxkcm5q5p87p5lrqwgykpzx5gmk179xd3481yak93yhbvy165";
    })
  ];

  nativeBuildInputs = [
    pkg-config
    meson
    python3
    ninja
    gettext
    gobject-introspection
    libxslt
    wrapGAppsHook
    vala
    shared-mime-info
  ];

  buildInputs = [
    gnupg
    libgcrypt
    libtasn1
    pango
    libsecret
    openssh
    systemd
  ];

  propagatedBuildInputs = [
    glib
    gtk4
    p11-kit
  ];

  checkInputs = [
    python3
  ];

  mesonFlags = [
    "-Dgtk_doc=false"
    # We are still using ssh-agent from gnome-keyring.
    # https://github.com/NixOS/nixpkgs/issues/140824
    "-Dssh_agent=false"
  ];

  doCheck = false; # fails 21 out of 603 tests, needs dbus daemon

  PKG_CONFIG_SYSTEMD_SYSTEMDUSERUNITDIR = "${placeholder "out"}/lib/systemd/user";

  postPatch = ''
    patchShebangs build/ gcr/fixtures/
    chmod +x meson_post_install.py
    patchShebangs meson_post_install.py
  '';

  passthru = {
    updateScript = gnome.updateScript {
      packageName = pname;
    };
  };

  meta = with lib; {
    platforms = platforms.unix;
    maintainers = teams.gnome.members;
    description = "GNOME crypto services (daemon and tools)";
    homepage = "https://gitlab.gnome.org/GNOME/gcr";
    license = licenses.lgpl2Plus;

    longDescription = ''
      GCR is a library for displaying certificates, and crypto UI, accessing
      key stores. It also provides the viewer for crypto files on the GNOME
      desktop.
      GCK is a library for accessing PKCS#11 modules like smart cards, in a
      (G)object oriented way.
    '';
  };
}

But when i type nix-build -E 'with import <nixos-unstable> {}; callPackage ./gcr4.nix {}' command, i have this issue: error: derivation name missing

if i simply use nix-build command i have this:

error: cannot evaluate a function that has an argument without a value ('wrapGAppsHook')

       Nix attempted to evaluate a function as a top level expression; in
       this case it must have its arguments supplied either by default
       values, or passed explicitly with '--arg' or '--argstr'. See
       https://nixos.org/manual/nix/stable/#ss-functions.

       at /home/eog/tmp/gnome-epiphany/gcr/gcr4.nix:19:3:

           18| , gobject-introspection
           19| , wrapGAppsHook
             |   ^
           20| , libxslt
ReplayCoding commented 2 years ago

You need to set the version (below the pname): version = "whatever";. You probably also want to use a commit hash in fetchurl: src = "https://gitlab.gnome.org/GNOME/gcr/-/archive/5924eced679b3a2caea2fd4637e52b85c85f6f0c/gcr-5924eced679b3a2caea2fd4637e52b85c85f6f0c.tar";

Millrocious commented 2 years ago

After i put a version package successfully builds. But how to use this package like as dependency to build epiphany?

ReplayCoding commented 2 years ago

I have created a git repo with some work on this, just clone it and run nix-build (you will have to build webkitgtk, which will probably take quite a while).

jtojnar commented 1 year ago

The repo mentioned above: https://github.com/ReplayCoding/epiphany-gtk4

By the way, webkitgtk_5_0 is packaged in Nixpkgs now but Epiphany moved to WebKitGTK 2.39.3 development release.