2024-02-29 20:09:43 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-04-24 23:36:52 +00:00
|
|
|
, substituteAll
|
|
|
|
, fetchFromGitHub
|
|
|
|
, autoreconfHook
|
|
|
|
, gettext
|
|
|
|
, makeWrapper
|
2021-02-05 17:12:51 +00:00
|
|
|
, pkg-config
|
2020-04-24 23:36:52 +00:00
|
|
|
, vala
|
2024-05-15 15:35:15 +00:00
|
|
|
, wrapGAppsHook3
|
2020-04-24 23:36:52 +00:00
|
|
|
, dbus
|
2022-03-30 09:31:56 +00:00
|
|
|
, systemd
|
2020-04-24 23:36:52 +00:00
|
|
|
, dconf ? null
|
|
|
|
, glib
|
|
|
|
, gdk-pixbuf
|
|
|
|
, gobject-introspection
|
|
|
|
, gtk3
|
2022-03-30 09:31:56 +00:00
|
|
|
, gtk4
|
2020-04-24 23:36:52 +00:00
|
|
|
, gtk-doc
|
2024-02-29 20:09:43 +00:00
|
|
|
, libdbusmenu-gtk3
|
2020-07-18 16:06:22 +00:00
|
|
|
, runCommand
|
2020-04-24 23:36:52 +00:00
|
|
|
, isocodes
|
2022-04-15 01:41:22 +00:00
|
|
|
, cldr-annotations
|
2020-04-24 23:36:52 +00:00
|
|
|
, unicode-character-database
|
|
|
|
, unicode-emoji
|
|
|
|
, python3
|
|
|
|
, json-glib
|
|
|
|
, libnotify ? null
|
|
|
|
, enableUI ? true
|
2024-02-29 20:09:43 +00:00
|
|
|
, withWayland ? true
|
2022-08-21 13:32:41 +00:00
|
|
|
, libxkbcommon
|
|
|
|
, wayland
|
2020-04-24 23:36:52 +00:00
|
|
|
, buildPackages
|
|
|
|
, runtimeShell
|
|
|
|
, nixosTests
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
python3Runtime = python3.withPackages (ps: with ps; [ pygobject3 ]);
|
|
|
|
python3BuildEnv = python3.buildEnv.override {
|
|
|
|
# ImportError: No module named site
|
|
|
|
postBuild = ''
|
|
|
|
makeWrapper ${glib.dev}/bin/gdbus-codegen $out/bin/gdbus-codegen --unset PYTHONPATH
|
|
|
|
makeWrapper ${glib.dev}/bin/glib-genmarshal $out/bin/glib-genmarshal --unset PYTHONPATH
|
|
|
|
makeWrapper ${glib.dev}/bin/glib-mkenums $out/bin/glib-mkenums --unset PYTHONPATH
|
|
|
|
'';
|
|
|
|
};
|
2020-07-18 16:06:22 +00:00
|
|
|
# make-dconf-override-db.sh needs to execute dbus-launch in the sandbox,
|
|
|
|
# it will fail to read /etc/dbus-1/session.conf unless we add this flag
|
2024-02-29 20:09:43 +00:00
|
|
|
dbus-launch = runCommand "sandbox-dbus-launch"
|
|
|
|
{
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
} ''
|
|
|
|
makeWrapper ${dbus}/bin/dbus-launch $out/bin/dbus-launch \
|
|
|
|
--add-flags --config-file=${dbus}/share/dbus-1/session.conf
|
2020-07-18 16:06:22 +00:00
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "ibus";
|
2024-06-05 15:53:02 +00:00
|
|
|
version = "1.5.30";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ibus";
|
|
|
|
repo = "ibus";
|
|
|
|
rev = version;
|
2024-06-05 15:53:02 +00:00
|
|
|
sha256 = "sha256-VgSjeKF9DCkDfE9lHEaWpgZb6ibdgoDf/I6qeJf8Ah4=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
(substituteAll {
|
|
|
|
src = ./fix-paths.patch;
|
|
|
|
pythonInterpreter = python3Runtime.interpreter;
|
|
|
|
pythonSitePackages = python3.sitePackages;
|
|
|
|
})
|
2023-03-04 12:14:45 +00:00
|
|
|
./build-without-dbus-launch.patch
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
outputs = [ "out" "dev" "installedTests" ];
|
|
|
|
|
|
|
|
postPatch = ''
|
2024-02-29 20:09:43 +00:00
|
|
|
# Maintainer does not want to create separate tarballs for final release candidate and release versions,
|
|
|
|
# so we need to set `ibus_released` to `1` in `configure.ac`. Otherwise, anyone running `ibus version` gets
|
|
|
|
# a version with an inaccurate `-rcX` suffix.
|
|
|
|
# https://github.com/ibus/ibus/issues/2584
|
|
|
|
substituteInPlace configure.ac --replace "m4_define([ibus_released], [0])" "m4_define([ibus_released], [1])"
|
|
|
|
|
2020-07-18 16:06:22 +00:00
|
|
|
patchShebangs --build data/dconf/make-dconf-override-db.sh
|
2020-04-24 23:36:52 +00:00
|
|
|
cp ${buildPackages.gtk-doc}/share/gtk-doc/data/gtk-doc.make .
|
2022-06-16 17:23:12 +00:00
|
|
|
substituteInPlace bus/services/org.freedesktop.IBus.session.GNOME.service.in --replace "ExecStart=sh" "ExecStart=${runtimeShell}"
|
|
|
|
substituteInPlace bus/services/org.freedesktop.IBus.session.generic.service.in --replace "ExecStart=sh" "ExecStart=${runtimeShell}"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
preAutoreconf = "touch ChangeLog";
|
|
|
|
|
|
|
|
configureFlags = [
|
2024-02-29 20:09:43 +00:00
|
|
|
# The `AX_PROG_{CC,CXX}_FOR_BUILD` autoconf macros can pick up unwrapped GCC binaries,
|
|
|
|
# so we set `{CC,CXX}_FOR_BUILD` to override that behavior.
|
|
|
|
# https://github.com/NixOS/nixpkgs/issues/21751
|
|
|
|
"CC_FOR_BUILD=${stdenv.cc}/bin/cc"
|
|
|
|
"CXX_FOR_BUILD=${stdenv.cc}/bin/c++"
|
2020-04-24 23:36:52 +00:00
|
|
|
"--disable-memconf"
|
2023-02-02 18:25:31 +00:00
|
|
|
(lib.enableFeature (dconf != null) "dconf")
|
|
|
|
(lib.enableFeature (libnotify != null) "libnotify")
|
|
|
|
(lib.enableFeature withWayland "wayland")
|
|
|
|
(lib.enableFeature enableUI "ui")
|
2024-01-02 11:29:13 +00:00
|
|
|
"--disable-gtk2"
|
2022-03-30 09:31:56 +00:00
|
|
|
"--enable-gtk4"
|
2020-04-24 23:36:52 +00:00
|
|
|
"--enable-install-tests"
|
|
|
|
"--with-unicode-emoji-dir=${unicode-emoji}/share/unicode/emoji"
|
2022-04-15 01:41:22 +00:00
|
|
|
"--with-emoji-annotation-dir=${cldr-annotations}/share/unicode/cldr/common/annotations"
|
2020-04-24 23:36:52 +00:00
|
|
|
"--with-ucd-dir=${unicode-character-database}/share/unicode"
|
|
|
|
];
|
|
|
|
|
|
|
|
makeFlags = [
|
2021-02-05 17:12:51 +00:00
|
|
|
"test_execsdir=${placeholder "installedTests"}/libexec/installed-tests/ibus"
|
|
|
|
"test_sourcesdir=${placeholder "installedTests"}/share/installed-tests/ibus"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
autoreconfHook
|
|
|
|
gtk-doc
|
|
|
|
gettext
|
|
|
|
makeWrapper
|
2021-02-05 17:12:51 +00:00
|
|
|
pkg-config
|
2020-04-24 23:36:52 +00:00
|
|
|
python3BuildEnv
|
|
|
|
vala
|
2024-05-15 15:35:15 +00:00
|
|
|
wrapGAppsHook3
|
2020-07-18 16:06:22 +00:00
|
|
|
dbus-launch
|
2023-08-10 07:59:29 +00:00
|
|
|
gobject-introspection
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
glib
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
dbus
|
2022-03-30 09:31:56 +00:00
|
|
|
systemd
|
2020-04-24 23:36:52 +00:00
|
|
|
dconf
|
|
|
|
gdk-pixbuf
|
|
|
|
python3.pkgs.pygobject3 # for pygobject overrides
|
|
|
|
gtk3
|
2022-03-30 09:31:56 +00:00
|
|
|
gtk4
|
2020-04-24 23:36:52 +00:00
|
|
|
isocodes
|
|
|
|
json-glib
|
|
|
|
libnotify
|
2024-02-29 20:09:43 +00:00
|
|
|
libdbusmenu-gtk3
|
2023-02-02 18:25:31 +00:00
|
|
|
] ++ lib.optionals withWayland [
|
2020-04-24 23:36:52 +00:00
|
|
|
libxkbcommon
|
|
|
|
wayland
|
|
|
|
];
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
doCheck = false; # requires X11 daemon
|
|
|
|
doInstallCheck = true;
|
|
|
|
installCheckPhase = ''
|
|
|
|
$out/bin/ibus version
|
|
|
|
'';
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
# It has some hardcoded FHS paths and also we do not use it
|
|
|
|
# since we set up the environment in NixOS tests anyway.
|
|
|
|
moveToOutput "bin/ibus-desktop-testing-runner" "$installedTests"
|
|
|
|
'';
|
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
# set necessary environment also for tests
|
|
|
|
for f in $installedTests/libexec/installed-tests/ibus/*; do
|
|
|
|
wrapGApp $f
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
tests = {
|
|
|
|
installed-tests = nixosTests.installed-tests.ibus;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/ibus/ibus";
|
|
|
|
description = "Intelligent Input Bus, input method framework";
|
|
|
|
license = licenses.lgpl21Plus;
|
|
|
|
platforms = platforms.linux;
|
2024-07-27 06:49:29 +00:00
|
|
|
maintainers = with maintainers; [ ttuegel ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|