From c1b4f22b775ca663853bdbeffcaa36f6fbc6331d Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Sat, 1 Jun 2019 14:33:32 +0200 Subject: [PATCH 1/3] ibus: move code changes to a patch --- pkgs/tools/inputmethods/ibus/default.nix | 13 +++++--- pkgs/tools/inputmethods/ibus/fix-paths.patch | 31 ++++++++++++++++++++ 2 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 pkgs/tools/inputmethods/ibus/fix-paths.patch diff --git a/pkgs/tools/inputmethods/ibus/default.nix b/pkgs/tools/inputmethods/ibus/default.nix index 8948f1abbb3..e6385a1b553 100644 --- a/pkgs/tools/inputmethods/ibus/default.nix +++ b/pkgs/tools/inputmethods/ibus/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, runCommand, fetchFromGitHub, autoreconfHook, gettext, makeWrapper, pkgconfig +{ stdenv, substituteAll, fetchurl, runCommand, fetchFromGitHub, autoreconfHook, gettext, makeWrapper, pkgconfig , vala, wrapGAppsHook, dbus, dconf ? null, glib, gdk_pixbuf, gobject-introspection, gtk2 , gtk3, gtk-doc, isocodes, python3, json-glib, libnotify ? null, enablePythonLibrary ? true , enableUI ? true, withWayland ? false, libxkbcommon ? null, wayland ? null @@ -90,10 +90,15 @@ stdenv.mkDerivation rec { sha256 = "1npavb896qrp6qbqayb0va4mpsi68wybcnlbjknzgssqyw2ylh9r"; }; + patches = [ + (substituteAll { + src = ./fix-paths.patch; + pythonInterpreter = python3Runtime.interpreter; + pythonSitePackages = python3.sitePackages; + }) + ]; + postPatch = '' - substituteInPlace setup/ibus-setup.in --subst-var-by PYTHON ${python3Runtime.interpreter} - substituteInPlace data/dconf/Makefile.am --replace "dconf update" true - substituteInPlace configure.ac --replace '$python2dir/ibus' $out/${python3.sitePackages}/ibus echo \#!${runtimeShell} > data/dconf/make-dconf-override-db.sh cp ${buildPackages.gtk-doc}/share/gtk-doc/data/gtk-doc.make . ''; diff --git a/pkgs/tools/inputmethods/ibus/fix-paths.patch b/pkgs/tools/inputmethods/ibus/fix-paths.patch new file mode 100644 index 00000000000..3aa7ca29dc6 --- /dev/null +++ b/pkgs/tools/inputmethods/ibus/fix-paths.patch @@ -0,0 +1,31 @@ +--- a/configure.ac ++++ b/configure.ac +@@ -462,7 +462,7 @@ + PYTHON2_VERSION=`$PYTHON2 -c "import sys; sys.stdout.write(sys.version[[:3]])"` + PYTHON2_LIBDIR="$PYTHON2_PREFIX/lib/python$PYTHON2_VERSION" + python2dir="$PYTHON2_LIBDIR/site-packages" +- pkgpython2dir="$python2dir/ibus" ++ pkgpython2dir="$prefix/@pythonSitePackages@/ibus" + AC_SUBST(pkgpython2dir) + else + enable_python_library="no (disabled, use --enable-python-library to enable)" +--- a/data/dconf/Makefile.am ++++ b/data/dconf/Makefile.am +@@ -50,7 +50,7 @@ + + install-data-hook: + if test -z "$(DESTDIR)"; then \ +- dconf update; \ ++ true; \ + fi + + EXTRA_DIST = \ +--- a/setup/ibus-setup.in ++++ b/setup/ibus-setup.in +@@ -27,5 +27,5 @@ + export IBUS_DATAROOTDIR=@datarootdir@ + export IBUS_LOCALEDIR=@localedir@ + export IBUS_LIBEXECDIR=${libexecdir} +-exec @PYTHON@ @prefix@/share/ibus/setup/main.py $@ ++exec @pythonInterpreter@ @prefix@/share/ibus/setup/main.py $@ + From aefb8fbc692e8e0592dcf6c6f2ec571b9bc31c67 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Sat, 1 Jun 2019 14:59:25 +0200 Subject: [PATCH 2/3] ibus: Build introspection overrides --- pkgs/tools/inputmethods/ibus/default.nix | 1 + pkgs/tools/inputmethods/ibus/fix-paths.patch | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/pkgs/tools/inputmethods/ibus/default.nix b/pkgs/tools/inputmethods/ibus/default.nix index e6385a1b553..f1a364f9096 100644 --- a/pkgs/tools/inputmethods/ibus/default.nix +++ b/pkgs/tools/inputmethods/ibus/default.nix @@ -135,6 +135,7 @@ stdenv.mkDerivation rec { dconf gdk_pixbuf gobject-introspection + python3.pkgs.pygobject3 # for pygobject overrides gtk2 gtk3 isocodes diff --git a/pkgs/tools/inputmethods/ibus/fix-paths.patch b/pkgs/tools/inputmethods/ibus/fix-paths.patch index 3aa7ca29dc6..192aa7d6395 100644 --- a/pkgs/tools/inputmethods/ibus/fix-paths.patch +++ b/pkgs/tools/inputmethods/ibus/fix-paths.patch @@ -1,5 +1,19 @@ --- a/configure.ac +++ b/configure.ac +@@ -429,11 +429,11 @@ + if test "x$enable_pygobject" = "xyes"; then + PKG_CHECK_MODULES(PYTHON, [pygobject-3.0 >= $PYGOBJECT_REQUIRED]) + +- pyoverridesdir=`$PYTHON -c "import gi; print(gi._overridesdir)"` ++ pyoverridesdir="$prefix/@pythonSitePackages@/gi/overrides" + AC_SUBST(pyoverridesdir) + + if test x"$enable_python2" = x"yes"; then +- py2overridesdir=`$PYTHON2 -c "import gi; print(gi._overridesdir)"` ++ py2overridesdir="$prefix/@pythonSitePackages@/gi/overrides" + AC_SUBST(py2overridesdir) + fi + fi @@ -462,7 +462,7 @@ PYTHON2_VERSION=`$PYTHON2 -c "import sys; sys.stdout.write(sys.version[[:3]])"` PYTHON2_LIBDIR="$PYTHON2_PREFIX/lib/python$PYTHON2_VERSION" From f17b65371b7db1c3d0a2b5dac6fab1957883c811 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Sat, 1 Jun 2019 15:03:42 +0200 Subject: [PATCH 3/3] ibus: Disable python library by default It is a Python 2 library that we install to Python 3 prefix. Even if it were used by anything it would not work. --- pkgs/tools/inputmethods/ibus/default.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkgs/tools/inputmethods/ibus/default.nix b/pkgs/tools/inputmethods/ibus/default.nix index f1a364f9096..cb42d959d12 100644 --- a/pkgs/tools/inputmethods/ibus/default.nix +++ b/pkgs/tools/inputmethods/ibus/default.nix @@ -1,6 +1,6 @@ { stdenv, substituteAll, fetchurl, runCommand, fetchFromGitHub, autoreconfHook, gettext, makeWrapper, pkgconfig , vala, wrapGAppsHook, dbus, dconf ? null, glib, gdk_pixbuf, gobject-introspection, gtk2 -, gtk3, gtk-doc, isocodes, python3, json-glib, libnotify ? null, enablePythonLibrary ? true +, gtk3, gtk-doc, isocodes, python3, json-glib, libnotify ? null, enablePython2Library ? false , enableUI ? true, withWayland ? false, libxkbcommon ? null, wayland ? null , buildPackages, runtimeShell }: @@ -110,7 +110,8 @@ stdenv.mkDerivation rec { (enableFeature (dconf != null) "dconf") (enableFeature (libnotify != null) "libnotify") (enableFeature withWayland "wayland") - (enableFeature enablePythonLibrary "python-library") + (enableFeature enablePython2Library "python-library") + (enableFeature enablePython2Library "python2") # XXX: python2 library does not work anyway (enableFeature enableUI "ui") "--with-unicode-emoji-dir=${emojiData}" "--with-emoji-annotation-dir=${cldrEmojiAnnotation}/share/unicode/cldr/common/annotations"