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-kkc engine support #34416

Merged
merged 4 commits into from Mar 10, 2018
Merged

ibus-kkc engine support #34416

merged 4 commits into from Mar 10, 2018

Conversation

vanzef
Copy link
Contributor

@vanzef vanzef commented Jan 30, 2018

Motivation for this change

This PR adds support for ibus-kkc IME, based on libkkc.

Things done

Added packages pythonPackages.marisa (python bindings, generated by swig), libkkc, libkkc-data and ibus-kkc.

  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • 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 nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@vanzef vanzef requested a review from FRidh as a code owner January 30, 2018 12:19
version = "1.3.40";
name = "${pname}-${version}";

src = fetchgit {
Copy link
Member

Choose a reason for hiding this comment

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

Better use fetchFromGitHub. This will download a tarball instead of cloning the repo.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

buildPythonPackage rec {
pname = "marisa-python";
version = "1.3.40";
name = "${pname}-${version}";
Copy link
Member

Choose a reason for hiding this comment

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

No name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, I don't get it. Why don't you like 6th line where name is defined?

Copy link
Member

Choose a reason for hiding this comment

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

There's no need for name. It is generated from pname and version by buildPythonPackage.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it. Thanks for advice.

buildinputs = [ marisa ];

preBuild = ''
cd bindings/python
Copy link
Member

Choose a reason for hiding this comment

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

Better use sourceRoot.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

{ stdenv, buildPythonPackage, fetchgit, marisa, swig }:

buildPythonPackage rec {
pname = "marisa-python";
Copy link
Member

Choose a reason for hiding this comment

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

Is there another package repo that calls this marisa-python or why did you choose that name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At first I thought that it's a good idea since there is a project named marisa-tie which is a handwritten(?) python bindings to C++ marisa library. And this one is the bindings generated by swig.

Now I think that you are right and it's better to rename it to marisa especially since the same package called python2-marisa in Arch Linux repos and we have pythonPackages namespace.

pname = "libkkc-data";
version = "0.2.7";
name = "${pname}-${version}";
libkkc_version = "0.3.5";
Copy link
Member

Choose a reason for hiding this comment

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

This attribute can go in a let ... in expression

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean only libkkc_version? If so -- fixed.

sourceRoot = "${src.name}/bindings/python";

meta = with stdenv.lib; {
description = "Python binding for marisa package (do not confuse with marisa-trie python bindings)";
Copy link
Member

Choose a reason for hiding this comment

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

yet the homepage does point to marisa-trie ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, as I mentioned it previously (#34416 (comment)) there are two different bindings for marisa-trie C++ library: one are generated by swig (this package), so the homepage of bindings is the homepage of C++ library, other bindings (also called marisa-trie) are from the different package (you can find them here https://github.com/pytries/marisa-trie/). However, they are incompatible.

At first I packaged the bindings by pytries and called the package marisa-trie, but then I'd found out that I need bindings from s-yata's repo, so I'd decided to give latter the name as for the C++ package.

I agree that the description is pretty misleading, do you have any suggestions for improvement?

@@ -0,0 +1,40 @@
{ stdenv, fetchurl
, vala, gobjectIntrospection, intltool, pythonPackages, python, glib
Copy link
Member

Choose a reason for hiding this comment

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

either pythonPackages or python

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@vanzef
Copy link
Contributor Author

vanzef commented Feb 20, 2018

Should I fix something else?

cc @FRidh


configureFlags = [ "--disable-static" ];

buildInputs = [ libkkc ibus skk-dicts gnome3.gtk3 ];
Copy link
Member

Choose a reason for hiding this comment

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

Don't use gnome3 as an argument; instead just use gtk3.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

{ stdenv, fetchurl, pythonPackages }:

let
libkkc_version = "0.3.5";
Copy link
Member

Choose a reason for hiding this comment

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

Given that you need to keep those versions synchronized with libkkc and it's the only user why not move this directly into libkkc instead?

Copy link
Member

Choose a reason for hiding this comment

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

On another hand you could just use libkkc as an argument and use libkkc.version. Don't worry about circular dependencies -- libkkc.version can be used without instantiating libkkc derivation itself.

vala intltool pkgconfig
];

configureFlags = [ "--disable-static" ];
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't be needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed


propagatedBuildInputs = [ gnome3.libgee json_glib ];

configureFlags = [ "--disable-static --disable-silent-rules" ];
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't be needed too; static libraries are not built by default (tested by removing those and building).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed


buildInputs = [ marisa libkkc-data ];

propagatedBuildInputs = [ gnome3.libgee json_glib ];
Copy link
Member

Choose a reason for hiding this comment

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

Just use libgee and inherit (gnome3) libgee; in all-packages.nix instead; we try to avoid using whole (sub-)package sets as arguments.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Copy link
Member

@abbradar abbradar left a comment

Choose a reason for hiding this comment

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

Built this locally but didn't verify that it works; ready to merge as soon as remaining issues are addressed. Sorry you had to wait for a long time; we are a bit short on manpower ^_^".

@@ -0,0 +1,26 @@
{ stdenv, fetchurl, pythonPackages }:
Copy link
Member

Choose a reason for hiding this comment

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

Don't use pythonPackages; as with libgee use inherit instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@vanzef vanzef force-pushed the kkc branch 2 times, most recently from 717cab5 to e9fdd35 Compare March 10, 2018 13:12
@abbradar
Copy link
Member

@GrahamcOfBorg build ibus-engines.kkc

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Partial log (click to expand)

glibPreFixupPhase
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/b7phz9kx42spwbwm0lsasymhnan0bzp6-ibus-kkc-1.5.22
shrinking /nix/store/b7phz9kx42spwbwm0lsasymhnan0bzp6-ibus-kkc-1.5.22/libexec/ibus-engine-kkc
shrinking /nix/store/b7phz9kx42spwbwm0lsasymhnan0bzp6-ibus-kkc-1.5.22/libexec/ibus-setup-kkc
strip is /nix/store/b0zlxla7dmy1iwc3g459rjznx59797xy-binutils-2.28.1/bin/strip
stripping (with command strip and flags -S) in /nix/store/b7phz9kx42spwbwm0lsasymhnan0bzp6-ibus-kkc-1.5.22/libexec 
patching script interpreter paths in /nix/store/b7phz9kx42spwbwm0lsasymhnan0bzp6-ibus-kkc-1.5.22
checking for references to /tmp/nix-build-ibus-kkc-1.5.22.drv-0 in /nix/store/b7phz9kx42spwbwm0lsasymhnan0bzp6-ibus-kkc-1.5.22...
/nix/store/b7phz9kx42spwbwm0lsasymhnan0bzp6-ibus-kkc-1.5.22

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Partial log (click to expand)

glibPreFixupPhase
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/bgzda7ihx8zpb02gaygxy86fic85k7wa-ibus-kkc-1.5.22
shrinking /nix/store/bgzda7ihx8zpb02gaygxy86fic85k7wa-ibus-kkc-1.5.22/libexec/ibus-setup-kkc
shrinking /nix/store/bgzda7ihx8zpb02gaygxy86fic85k7wa-ibus-kkc-1.5.22/libexec/ibus-engine-kkc
strip is /nix/store/lvx1acn1ig1j2km8jds5x3ggh3f2wa8v-binutils-2.28.1/bin/strip
stripping (with command strip and flags -S) in /nix/store/bgzda7ihx8zpb02gaygxy86fic85k7wa-ibus-kkc-1.5.22/libexec
patching script interpreter paths in /nix/store/bgzda7ihx8zpb02gaygxy86fic85k7wa-ibus-kkc-1.5.22
checking for references to /build in /nix/store/bgzda7ihx8zpb02gaygxy86fic85k7wa-ibus-kkc-1.5.22...
/nix/store/bgzda7ihx8zpb02gaygxy86fic85k7wa-ibus-kkc-1.5.22

@abbradar abbradar merged commit 504b911 into NixOS:master Mar 10, 2018
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

5 participants