@@ -1,4 +1,6 @@
1−{ stdenv, fetchurl, intltool, pkgconfig, cmake
1+{ stdenv, fetchFromGitHub
2+, autoconf, automake, intltool, libtool, pkgconfig, cmake
3+, ruby, librsvg
24, ncurses, m17n_lib, m17n_db, expat
35, withAnthy ? true, anthy ? null
46, withGtk ? true
@@ -6,6 +8,7 @@
68, withGtk3 ? withGtk, gtk3 ? null
79, withQt ? true
810, withQt4 ? withQt, qt4 ? null
11+, withQt5 ? false, qt5 ? null
912, withLibnotify ? true, libnotify ? null
1013, withSqlite ? true, sqlite ? null
1114, withNetworking ? true, curl ? null, openssl ? null
@@ -17,10 +20,17 @@
1720
1821with stdenv.lib;
1922
20−assert withAnthy -> anthy != null;
2123assert withGtk2 -> gtk2 != null;
2224assert withGtk3 -> gtk3 != null;
23−assert withQt4 -> qt4 != null;
25+
26+# TODO(@oxij): ./configure can't find both qmakes at the same time
27+# this can be fixed by adding an alias qmake -> qmaka${version} in qmake derivation
28+assert withQt4 -> !withQt5 && qt4 != null;
29+assert withQt5 -> !withQt4 && qt5 != null;
30+
31+assert !withQt5; # fails to build with "Makefile.qmake: No such file or directory"
32+
33+assert withAnthy -> anthy != null;
2434assert withLibnotify -> libnotify != null;
2535assert withSqlite -> sqlite != null;
2636assert withNetworking -> curl != null && openssl != null;
@@ -28,22 +38,32 @@ assert withFFI -> libffi != null;
2838assert withMisc -> libeb != null;
2939
3040stdenv.mkDerivation rec {
31− version = "1.8.6";
41+ version = "1.8.6-20180501-git";
3242 name = "uim-${version}";
3343
44+ src = fetchFromGitHub {
45+ owner = "uim";
46+ repo = "uim";
47+ rev = "c79432cb5aba3a67fb7e7557f4817c749865cc8a";
48+ fetchSubmodules = true;
49+ sha256 = "12rznfwq1mh750i18bl1743c51akyyvy6la5rgrxmrnp0mha9ba5";
50+ };
51+
52+ nativeBuildInputs = [
53+ autoconf automake intltool libtool pkgconfig cmake
54+
55+ ruby # used by sigscheme build to generate function tables
56+ librsvg # used by uim build to generate png pixmaps from svg
57+ ];
58+
3459 buildInputs = [
35− intltool
36− pkgconfig
37− ncurses
38− cmake
39− m17n_lib
40− m17n_db
41− expat
60+ ncurses m17n_lib m17n_db expat
4261 ]
4362 ++ optional withAnthy anthy
4463 ++ optional withGtk2 gtk2
4564 ++ optional withGtk3 gtk3
4665 ++ optional withQt4 qt4
66+ ++ optionals withQt5 [ qt5.qtbase.bin qt5.qtbase.dev ]
4767 ++ optional withLibnotify libnotify
4868 ++ optional withSqlite sqlite
4969 ++ optionals withNetworking [
@@ -52,9 +72,27 @@ stdenv.mkDerivation rec {
5272 ++ optional withFFI libffi
5373 ++ optional withMisc libeb;
5474
75+ prePatch = ''
76+ patchShebangs *.sh */*.sh */*/*.sh
77+
78+ # configure sigscheme in maintainer mode or else some function tables won't get autogenerated
79+ substituteInPlace configure.ac \
80+ --replace "--with-master-pkg=uim --enable-conf=uim" \
81+ "--enable-maintainer-mode --with-master-pkg=uim --enable-conf=uim"
82+
83+ # generate ./configure files
84+ (cd sigscheme/libgcroots; ./autogen.sh)
85+ (cd sigscheme; ./autogen.sh)
86+ ./autogen.sh
87+ '';
88+
5589 patches = [ ./data-hook.patch ];
5690
5791 configureFlags = [
92+ # configure in maintainer mode or else some pixmaps won't get autogenerated
93+ # this should imply the above `--enable-maintainer-mode`, but it does not
94+ "--enable-maintainer-mode"
95+
5896 "--enable-pref"
5997 "--with-skk"
6098 "--with-x"
@@ -68,6 +106,10 @@ stdenv.mkDerivation rec {
68106 "--with-qt4"
69107 "--with-qt4-immodule"
70108 ]
109+ ++ optionals withQt5 [
110+ "--with-qt5"
111+ "--with-qt5-immodule"
112+ ]
71113 ++ optional withLibnotify "--enable-notify=libnotify"
72114 ++ optional withSqlite "--with-sqlite3"
73115 ++ optionals withNetworking [
@@ -87,16 +129,12 @@ stdenv.mkDerivation rec {
87129
88130 dontUseCmakeConfigure = true;
89131
90− src = fetchurl {
91− url = "https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/uim/uim-${version}.tar.bz2";
92− sha1 = "43b9dbdead6797880e6cfc9c032ecb2d37d42777";
93− };
94−
95132 meta = with stdenv.lib; {
96− homepage = "https://github.com/uim/uim";
133+ homepage = src.meta.homepage;
97134 description = "A multilingual input method framework";
98135 license = licenses.bsd3;
99− platforms = platforms.linux;
136+ platforms = platforms.unix;
137+ broken = stdenv.hostPlatform.isAarch64; # fails to build libgcroots (not supported on aarch64)
100138 maintainers = with maintainers; [ ericsagnes oxij ];
101139 };
102140}