about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/libpeas
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/libpeas')
-rw-r--r--nixpkgs/pkgs/development/libraries/libpeas/2.x.nix97
-rw-r--r--nixpkgs/pkgs/development/libraries/libpeas/default.nix91
-rw-r--r--nixpkgs/pkgs/development/libraries/libpeas/fix-paths.patch14
3 files changed, 202 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/libpeas/2.x.nix b/nixpkgs/pkgs/development/libraries/libpeas/2.x.nix
new file mode 100644
index 000000000000..38e4fe055085
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libpeas/2.x.nix
@@ -0,0 +1,97 @@
+{ stdenv
+, lib
+, fetchurl
+, substituteAll
+, pkg-config
+, gi-docgen
+, gobject-introspection
+, meson
+, ninja
+, gjs
+, glib
+, lua5_1
+, python3
+, spidermonkey_115
+, gnome
+}:
+
+stdenv.mkDerivation rec {
+  pname = "libpeas";
+  version = "2.0.1";
+
+  outputs = [ "out" "dev" "devdoc" ];
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    hash = "sha256-ndwdUfOGY9pN9SFjBRt7LOo6JCz67p9afhQPB4TIqnc=";
+  };
+
+  patches = [
+    # Make PyGObject’s gi library available.
+    (substituteAll {
+      src = ./fix-paths.patch;
+      pythonPaths = lib.concatMapStringsSep ", " (pkg: "'${pkg}/${python3.sitePackages}'") [
+        python3.pkgs.pygobject3
+      ];
+    })
+  ];
+
+  depsBuildBuild = [
+    pkg-config
+  ];
+
+  nativeBuildInputs = [
+    gi-docgen
+    gobject-introspection
+    meson
+    ninja
+    pkg-config
+  ];
+
+  buildInputs = [
+    gjs
+    glib
+    lua5_1
+    lua5_1.pkgs.lgi
+    python3
+    python3.pkgs.pygobject3
+    spidermonkey_115
+  ];
+
+  propagatedBuildInputs = [
+    # Required by libpeas-2.pc
+    gobject-introspection
+  ];
+
+  mesonFlags = [
+    "-Dgtk_doc=true"
+  ];
+
+  postPatch = ''
+    # Checks lua51 and lua5.1 executable but we have non of them.
+    substituteInPlace meson.build --replace \
+      "find_program('lua51', required: false)" \
+      "find_program('lua', required: false)"
+  '';
+
+  postFixup = ''
+    # Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back.
+    moveToOutput "share/doc" "$devdoc"
+  '';
+
+  passthru = {
+    updateScript = gnome.updateScript {
+      attrPath = "libpeas2";
+      packageName = "libpeas";
+      versionPolicy = "odd-unstable";
+    };
+  };
+
+  meta = with lib; {
+    description = "A GObject-based plugins engine";
+    homepage = "https://wiki.gnome.org/Projects/Libpeas";
+    license = licenses.gpl2Plus;
+    platforms = platforms.unix;
+    maintainers = teams.gnome.members;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libpeas/default.nix b/nixpkgs/pkgs/development/libraries/libpeas/default.nix
new file mode 100644
index 000000000000..f0b6023117d9
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libpeas/default.nix
@@ -0,0 +1,91 @@
+{ stdenv
+, lib
+, fetchurl
+, substituteAll
+, meson
+, ninja
+, pkg-config
+, gettext
+, gi-docgen
+, gnome
+, glib
+, gtk3
+, gobject-introspection
+, python3
+, ncurses
+, wrapGAppsHook
+}:
+
+stdenv.mkDerivation rec {
+  pname = "libpeas";
+  version = "1.36.0";
+
+  outputs = [ "out" "dev" "devdoc" ];
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "KXy5wszNjoYXYj0aPoQVtFMLjlqJPjUnu/0e3RMje0w=";
+  };
+
+  patches = [
+    # Make PyGObject’s gi library available.
+    (substituteAll {
+      src = ./fix-paths.patch;
+      pythonPaths = lib.concatMapStringsSep ", " (pkg: "'${pkg}/${python3.sitePackages}'") [
+        python3.pkgs.pygobject3
+      ];
+    })
+  ];
+
+  depsBuildBuild = [
+    pkg-config
+  ];
+
+  nativeBuildInputs = [
+    pkg-config
+    meson
+    ninja
+    gettext
+    gi-docgen
+    gobject-introspection
+    wrapGAppsHook
+  ];
+
+  buildInputs = [
+    glib
+    gtk3
+    ncurses
+    python3
+    python3.pkgs.pygobject3
+  ];
+
+  propagatedBuildInputs = [
+    # Required by libpeas-1.0.pc
+    gobject-introspection
+  ];
+
+  mesonFlags = [
+    "-Dgtk_doc=true"
+  ];
+
+  postFixup = ''
+    # Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back.
+    moveToOutput "share/doc" "$devdoc"
+  '';
+
+  passthru = {
+    updateScript = gnome.updateScript {
+      packageName = pname;
+      versionPolicy = "odd-unstable";
+      freeze = true;
+    };
+  };
+
+  meta = with lib; {
+    description = "A GObject-based plugins engine";
+    homepage = "https://wiki.gnome.org/Projects/Libpeas";
+    license = licenses.gpl2Plus;
+    platforms = platforms.unix;
+    maintainers = teams.gnome.members;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/libpeas/fix-paths.patch b/nixpkgs/pkgs/development/libraries/libpeas/fix-paths.patch
new file mode 100644
index 000000000000..c54cdd8873f5
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libpeas/fix-paths.patch
@@ -0,0 +1,14 @@
+diff --git a/loaders/python/peas-plugin-loader-python.c b/loaders/python/peas-plugin-loader-python.c
+index 26edbf3..0d65ada 100644
+--- a/loaders/python/peas-plugin-loader-python.c
++++ b/loaders/python/peas-plugin-loader-python.c
+@@ -248,6 +248,9 @@ peas_plugin_loader_python_initialize (PeasPluginLoader *loader)
+       goto python_init_error;
+     }
+ 
++  /* Add PyGObject to path */
++  PyRun_SimpleString("import site; import functools; functools.reduce(lambda k, p: site.addsitedir(p, k), [@pythonPaths@], site._init_pathinfo())");
++
+   /* Initialize PyGObject */
+   pygobject_init (PYGOBJECT_MAJOR_VERSION,
+                   PYGOBJECT_MINOR_VERSION,