2022-06-08 13:46:08 +00:00
|
|
|
{ lib
|
|
|
|
, buildEnv
|
|
|
|
, makeWrapper
|
|
|
|
, dconf
|
|
|
|
, hicolor-icon-theme
|
|
|
|
, ibus
|
|
|
|
, librsvg
|
|
|
|
, plugins ? [ ]
|
2016-02-27 12:30:04 +00:00
|
|
|
}:
|
2016-02-10 06:57:05 +00:00
|
|
|
|
2022-06-08 13:46:08 +00:00
|
|
|
buildEnv {
|
2021-01-15 09:19:50 +00:00
|
|
|
name = "ibus-with-plugins-" + lib.getVersion ibus;
|
2016-02-10 06:57:05 +00:00
|
|
|
|
2022-06-08 13:46:08 +00:00
|
|
|
paths = [ ibus ] ++ plugins;
|
|
|
|
|
|
|
|
pathsToLink = [
|
|
|
|
"/bin"
|
|
|
|
"/etc"
|
|
|
|
"/lib"
|
|
|
|
"/libexec"
|
|
|
|
"/share"
|
2022-06-08 14:09:32 +00:00
|
|
|
# Need to link contents so that the directories are writeable.
|
|
|
|
"/lib/systemd"
|
|
|
|
"/share/dbus-1/services"
|
|
|
|
"/share/systemd/user"
|
|
|
|
"/share/systemd/user/gnome-session.target.wants"
|
2022-06-08 13:46:08 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
makeWrapper
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [ ibus ] ++ plugins;
|
|
|
|
|
|
|
|
postBuild = ''
|
2017-09-27 18:27:15 +00:00
|
|
|
for prog in ibus; do
|
2016-02-26 23:30:20 +00:00
|
|
|
wrapProgram "$out/bin/$prog" \
|
2016-06-21 14:36:21 +00:00
|
|
|
--set GDK_PIXBUF_MODULE_FILE ${librsvg.out}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache \
|
2016-02-27 12:30:04 +00:00
|
|
|
--prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH:$out/lib/girepository-1.0" \
|
2021-01-15 09:19:50 +00:00
|
|
|
--prefix GIO_EXTRA_MODULES : "${lib.getLib dconf}/lib/gio/modules" \
|
2016-02-26 23:30:20 +00:00
|
|
|
--set IBUS_COMPONENT_PATH "$out/share/ibus/component/" \
|
|
|
|
--set IBUS_DATAROOTDIR "$out/share" \
|
|
|
|
--set IBUS_LIBEXECDIR "$out/libexec" \
|
|
|
|
--set IBUS_LOCALEDIR "$out/share/locale" \
|
|
|
|
--set IBUS_PREFIX "$out" \
|
|
|
|
--set IBUS_TABLE_BIN_PATH "$out/bin" \
|
|
|
|
--set IBUS_TABLE_DATA_DIR "$out/share" \
|
|
|
|
--set IBUS_TABLE_LIB_LOCATION "$out/libexec" \
|
|
|
|
--set IBUS_TABLE_LOCATION "$out/share/ibus-table" \
|
2016-02-27 12:30:04 +00:00
|
|
|
--prefix PYTHONPATH : "$PYTHONPATH" \
|
|
|
|
--prefix XDG_DATA_DIRS : "$out/share:$GSETTINGS_SCHEMAS_PATH" \
|
2018-02-25 02:23:58 +00:00
|
|
|
--suffix XDG_DATA_DIRS : "${hicolor-icon-theme}/share"
|
2016-02-26 23:30:20 +00:00
|
|
|
done
|
2016-10-03 10:24:33 +00:00
|
|
|
|
|
|
|
for prog in ibus-daemon; do
|
|
|
|
wrapProgram "$out/bin/$prog" \
|
|
|
|
--set GDK_PIXBUF_MODULE_FILE ${librsvg.out}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache \
|
|
|
|
--prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH:$out/lib/girepository-1.0" \
|
2021-01-15 09:19:50 +00:00
|
|
|
--prefix GIO_EXTRA_MODULES : "${lib.getLib dconf}/lib/gio/modules" \
|
2016-10-03 10:24:33 +00:00
|
|
|
--set IBUS_COMPONENT_PATH "$out/share/ibus/component/" \
|
|
|
|
--set IBUS_DATAROOTDIR "$out/share" \
|
|
|
|
--set IBUS_LIBEXECDIR "$out/libexec" \
|
|
|
|
--set IBUS_LOCALEDIR "$out/share/locale" \
|
|
|
|
--set IBUS_PREFIX "$out" \
|
|
|
|
--set IBUS_TABLE_BIN_PATH "$out/bin" \
|
|
|
|
--set IBUS_TABLE_DATA_DIR "$out/share" \
|
|
|
|
--set IBUS_TABLE_LIB_LOCATION "$out/libexec" \
|
|
|
|
--set IBUS_TABLE_LOCATION "$out/share/ibus-table" \
|
|
|
|
--prefix PYTHONPATH : "$PYTHONPATH" \
|
|
|
|
--prefix XDG_DATA_DIRS : "$out/share:$GSETTINGS_SCHEMAS_PATH" \
|
2018-02-25 02:23:58 +00:00
|
|
|
--suffix XDG_DATA_DIRS : "${hicolor-icon-theme}/share" \
|
2016-10-03 10:24:33 +00:00
|
|
|
--add-flags "--cache=refresh"
|
|
|
|
done
|
2022-06-08 14:09:32 +00:00
|
|
|
|
|
|
|
ibusPackage="${ibus}"
|
|
|
|
|
|
|
|
# Update services.
|
|
|
|
for service in \
|
|
|
|
"share/dbus-1/services/org.freedesktop.IBus.service" \
|
|
|
|
"share/systemd/user/org.freedesktop.IBus.session.generic.service" \
|
|
|
|
"share/systemd/user/org.freedesktop.IBus.session.GNOME.service"
|
|
|
|
do
|
|
|
|
unlink "$out/$service"
|
|
|
|
substitute "$ibusPackage/$service" "$out/$service" --replace "$ibusPackage/bin" "$out/bin"
|
|
|
|
done
|
|
|
|
|
|
|
|
# Re-create relative symbolic links.
|
|
|
|
for link in \
|
|
|
|
"$out/share/systemd/user/gnome-session.target.wants/"*
|
|
|
|
do
|
|
|
|
target="$link"
|
|
|
|
until [[ "''${target:0:1}" != "/" ]]; do
|
|
|
|
target="$(readlink "$target")"
|
|
|
|
done
|
|
|
|
unlink "$link"
|
|
|
|
ln -s "$target" "$link"
|
|
|
|
done
|
|
|
|
|
|
|
|
# Update absolute symbolic links.
|
|
|
|
for link in \
|
|
|
|
"$out/lib/systemd/user"
|
|
|
|
do
|
|
|
|
target="$(readlink -f "$link")"
|
|
|
|
relativeTarget="''${target#$ibusPackage/}"
|
|
|
|
if [[ "$ibusPackage/$relativeTarget" != "$target" ]]; then
|
|
|
|
>&2 echo "File $link does not point to to a file in $ibusPackage"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
unlink "$link"
|
|
|
|
ln -s "$out/$relativeTarget" "$link"
|
|
|
|
done
|
2016-02-10 06:57:05 +00:00
|
|
|
'';
|
2022-06-08 13:46:08 +00:00
|
|
|
|
|
|
|
inherit (ibus) meta;
|
|
|
|
}
|