Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ibus-rime: Init at 1.4.0 #77877

Closed
wants to merge 1 commit into from
Closed

ibus-rime: Init at 1.4.0 #77877

wants to merge 1 commit into from

Conversation

Holi0317
Copy link

Motivation for this change

Add ibus binding for rime input method

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS Not applicable
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/) Not applicable
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@Holi0317 Holi0317 changed the title ibus-rime: Init at 1.4.0 [WIP] ibus-rime: Init at 1.4.0 Jan 19, 2020
@Holi0317
Copy link
Author

Sorry I should have done more testing before opening this ticket.

Currently ibus fails to switch to rime input method due to some path issue. I'm trying to fix it ASAP

};

# FIXME: Replace brise (deprecated) with rime/plum
buildInputs = [ pkgconfig cmake librime ibus libnotify brise ];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
buildInputs = [ pkgconfig cmake librime ibus libnotify brise ];
nativeBuildInputs = [
pkgconfig
cmake
];
buildInputs = [
librime
ibus
libnotify
brise
];

install -m 644 -t $out/share/ibus-rime/icons/ ${src}/icons/*.png
'';

enableParallelBuilding = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CMake builds in parallel by default.

cmakeFlags = [ "-DRIME_DATA_DIR=${brise}/share/rime-data" ];

# Copied from Makefile as cmake will override it
installPhase = ''
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whhy not use the CMake's default install phase?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The repo (ibus-rime) provides install target in the hand-written Makefile instead of defining it in CMake.

So 've got to copy that script out

Maybe I'll make a PR to it later

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then the comment should read CMake build scripts do not provide install target, or something.
Also it should be possible to use something like:

installFlags = [
  "-f" "../Makefile"
  "PREFIX=${placeholder ''out''}"
  "builddir=." # maybe not necessary not sure if make -f works relative to $PWD or the Makefile
];

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've changed the comment. But can't figure out how to use installFlags
I'll just use the installPhase

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like this might work better:

--- a/pkgs/tools/inputmethods/ibus-engines/ibus-rime/default.nix
+++ b/pkgs/tools/inputmethods/ibus-engines/ibus-rime/default.nix
@@ -41,6 +41,10 @@ stdenv.mkDerivation rec {
     "-DRIME_DATA_DIR=${brise}/share/rime-data"
   ];
 
+  installFlags = [
+    "PREFIX=${placeholder ''out''}"
+  ];
+
   # Fix hard-coded paths references on rime-data and icons
   preBuild = ''
     sed -i ../rime_config.h -E \
@@ -48,17 +52,10 @@ stdenv.mkDerivation rec {
       -e "s|(IBUS_RIME_ICONS_DIR).+$|\1 \"$out/share/ibus-rime/icons\"|"
   '';
 
-  # CMake script does not provide install phrase
-  installPhase = ''
-    install -m 755 -d $out/share/ibus/component
-    install -m 644 -t $out/share/ibus/component/ ${src}/rime.xml
-
-    install -m 755 -d $out/lib/ibus-rime
-    install -m 755 -t $out/lib/ibus-rime/ ibus-engine-rime
-
-    install -m 755 -d $out/share/ibus-rime
-    install -m 755 -d $out/share/ibus-rime/icons
-    install -m 644 -t $out/share/ibus-rime/icons/ ${src}/icons/*.png
+  preInstall = ''
+    # CMake script does not provide install phrase,
+    # we need to use the Makefile in the source tree.
+    cd ..
   '';
 
   # The ibus config rime.xml hard-coded binary path for ibus-engine-rime

Of course, it would be best if the install target were added to CMakeLists.txt. I opened an issue about that: rime/ibus-rime#108

@Holi0317 Holi0317 changed the title [WIP] ibus-rime: Init at 1.4.0 ibus-rime: Init at 1.4.0 Jan 19, 2020
@Holi0317
Copy link
Author

The package was tested on my system and ibus could use rime properly
This patch is ready for merge

@stale
Copy link

stale bot commented Jul 17, 2020

Hello, I'm a bot and I thank you in the name of the community for your contributions.

Nixpkgs is a busy repository, and unfortunately sometimes PRs get left behind for too long. Nevertheless, we'd like to help committers reach the PRs that are still important. This PR has had no activity for 180 days, and so I marked it as stale, but you can rest assured it will never be closed by a non-human.

If this is still important to you and you'd like to remove the stale label, we ask that you leave a comment. Your comment can be as simple as "still important to me". But there's a bit more you can do:

If you received an approval by an unprivileged maintainer and you are just waiting for a merge, you can @ mention someone with merge permissions and ask them to help. You might be able to find someone relevant by using Git blame on the relevant files, or via GitHub's web interface. You can see if someone's a member of the nixpkgs-committers team, by hovering with the mouse over their username on the web interface, or by searching them directly on the list.

If your PR wasn't reviewed at all, it might help to find someone who's perhaps a user of the package or module you are changing, or alternatively, ask once more for a review by the maintainer of the package/module this is about. If you don't know any, you can use Git blame on the relevant files, or GitHub's web interface to find someone who touched the relevant files in the past.

If your PR has had reviews and nevertheless got stale, make sure you've responded to all of the reviewer's requests / questions. Usually when PR authors show responsibility and dedication, reviewers (privileged or not) show dedication as well. If you've pushed a change, it's possible the reviewer wasn't notified about your push via email, so you can always officially request them for a review, or just @ mention them and say you've addressed their comments.

Lastly, you can always ask for help at our Discourse Forum, or more specifically, at this thread or at #nixos' IRC channel.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 17, 2020
@LEXUGE
Copy link
Contributor

LEXUGE commented Sep 21, 2020

Any update here?

homepage = https://github.com/rime/ibus-rime;
downloadPage = https://github.com/rime/ibus-rime/releases;
description = "【中州韻】Rime for Linux/IBus";
license = licenses.gpl3;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gpl3 is unclear, use gpl3Plus or gpl3Only. See https://discourse.nixos.org/t/lib-licenses-gpl3-co-are-now-deprecated/8206 for more details.

Opened rime/ibus-rime#107


nativeBuildInputs = [
cmake
pkgconfig
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In new expressions, pkg-config should be used instead of the pkgconfig alias.

@@ -2512,6 +2512,8 @@ in
protobuf = pkgs.protobuf.overrideDerivation (oldAttrs: { stdenv = clangStdenv; });
};

rime = callPackage ../tools/inputmethods/ibus-engines/ibus-rime { };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commit message should match ibus-engines.rime.

cmakeFlags = [ "-DRIME_DATA_DIR=${brise}/share/rime-data" ];

# Copied from Makefile as cmake will override it
installPhase = ''
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like this might work better:

--- a/pkgs/tools/inputmethods/ibus-engines/ibus-rime/default.nix
+++ b/pkgs/tools/inputmethods/ibus-engines/ibus-rime/default.nix
@@ -41,6 +41,10 @@ stdenv.mkDerivation rec {
     "-DRIME_DATA_DIR=${brise}/share/rime-data"
   ];
 
+  installFlags = [
+    "PREFIX=${placeholder ''out''}"
+  ];
+
   # Fix hard-coded paths references on rime-data and icons
   preBuild = ''
     sed -i ../rime_config.h -E \
@@ -48,17 +52,10 @@ stdenv.mkDerivation rec {
       -e "s|(IBUS_RIME_ICONS_DIR).+$|\1 \"$out/share/ibus-rime/icons\"|"
   '';
 
-  # CMake script does not provide install phrase
-  installPhase = ''
-    install -m 755 -d $out/share/ibus/component
-    install -m 644 -t $out/share/ibus/component/ ${src}/rime.xml
-
-    install -m 755 -d $out/lib/ibus-rime
-    install -m 755 -t $out/lib/ibus-rime/ ibus-engine-rime
-
-    install -m 755 -d $out/share/ibus-rime
-    install -m 755 -d $out/share/ibus-rime/icons
-    install -m 644 -t $out/share/ibus-rime/icons/ ${src}/icons/*.png
+  preInstall = ''
+    # CMake script does not provide install phrase,
+    # we need to use the Makefile in the source tree.
+    cd ..
   '';
 
   # The ibus config rime.xml hard-coded binary path for ibus-engine-rime

Of course, it would be best if the install target were added to CMakeLists.txt. I opened an issue about that: rime/ibus-rime#108

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Sep 21, 2020
@jtojnar jtojnar mentioned this pull request Dec 1, 2020
10 tasks
@oxalica
Copy link
Contributor

oxalica commented Mar 24, 2021

Dup of #87735

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants