at 22.05-pre 146 lines 4.5 kB view raw
1{ lib, stdenv, fetchFromGitHub, shared-mime-info 2, autoconf, automake, intltool, libtool, pkg-config, cmake 3, ruby, librsvg 4, ncurses, m17n_lib, m17n_db, expat 5, withAnthy ? true, anthy ? null 6, withGtk ? true 7, withGtk2 ? withGtk, gtk2 ? null 8, withGtk3 ? withGtk, gtk3 ? null 9, withQt ? true 10, withQt4 ? withQt, qt4 ? null 11, withQt5 ? false, qt5 ? null 12, withLibnotify ? true, libnotify ? null 13, withSqlite ? true, sqlite ? null 14, withNetworking ? true, curl ? null, openssl ? null 15, withFFI ? true, libffi ? null 16 17# Things that are clearly an overkill to be enabled by default 18, withMisc ? false, libeb ? null 19}: 20 21with lib; 22 23assert withGtk2 -> gtk2 != null; 24assert withGtk3 -> gtk3 != 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 28assert withQt4 -> !withQt5 && qt4 != null; 29assert withQt5 -> !withQt4 && qt5 != null; 30 31assert !withQt5; # fails to build with "Makefile.qmake: No such file or directory" 32 33assert withAnthy -> anthy != null; 34assert withLibnotify -> libnotify != null; 35assert withSqlite -> sqlite != null; 36assert withNetworking -> curl != null && openssl != null; 37assert withFFI -> libffi != null; 38assert withMisc -> libeb != null; 39 40stdenv.mkDerivation rec { 41 version = "1.8.8"; 42 pname = "uim"; 43 44 src = fetchFromGitHub { 45 owner = "uim"; 46 repo = "uim"; 47 rev = "2c0958c9c505a87e70e344c2192e2e5123c71ea5"; 48 fetchSubmodules = true; 49 sha256 = "1hkjxi5r49gcna37m3jvykny5hz9ram4y8a3q7lw4qzr52mz9pdp"; 50 }; 51 52 nativeBuildInputs = [ 53 autoconf automake intltool libtool pkg-config 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 59 buildInputs = [ 60 ncurses m17n_lib m17n_db expat 61 ] 62 ++ optional withAnthy anthy 63 ++ optional withGtk2 gtk2 64 ++ optional withGtk3 gtk3 65 ++ optional withQt4 qt4 66 ++ optionals withQt5 [ qt5.qtbase.bin qt5.qtbase.dev ] 67 ++ optional withLibnotify libnotify 68 ++ optional withSqlite sqlite 69 ++ optionals withNetworking [ 70 curl openssl 71 ] 72 ++ optional withFFI libffi 73 ++ optional withMisc libeb; 74 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 89 patches = [ ./data-hook.patch ]; 90 91 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 96 "--enable-pref" 97 "--with-skk" 98 "--with-x" 99 "--with-xft" 100 "--with-expat=${expat.dev}" 101 ] 102 ++ optional withAnthy "--with-anthy-utf8" 103 ++ optional withGtk2 "--with-gtk2" 104 ++ optional withGtk3 "--with-gtk3" 105 ++ optionals withQt4 [ 106 "--with-qt4" 107 "--with-qt4-immodule" 108 ] 109 ++ optionals withQt5 [ 110 "--with-qt5" 111 "--with-qt5-immodule" 112 ] 113 ++ optional withLibnotify "--enable-notify=libnotify" 114 ++ optional withSqlite "--with-sqlite3" 115 ++ optionals withNetworking [ 116 "--with-curl" 117 "--with-openssl-dir=${openssl.dev}" 118 ] 119 ++ optional withFFI "--with-ffi" 120 ++ optional withMisc "--with-eb"; 121 122 # TODO: things in `./configure --help`, but not in nixpkgs 123 #--with-canna Use Canna [default=no] 124 #--with-wnn Build with libwnn [default=no] 125 #--with-mana Build a plugin for Mana [default=yes] 126 #--with-prime Build a plugin for PRIME [default=yes] 127 #--with-sj3 Use SJ3 [default=no] 128 #--with-osx-dcs Build with OS X Dictionary Services [default=no] 129 130 # TODO: fix this in librsvg/glib later 131 # https://github.com/NixOS/nixpkgs/pull/57027#issuecomment-475461733 132 preBuild = '' 133 export XDG_DATA_DIRS="${shared-mime-info}/share" 134 ''; 135 136 dontUseCmakeConfigure = true; 137 138 meta = with lib; { 139 homepage = src.meta.homepage; 140 description = "A multilingual input method framework"; 141 license = licenses.bsd3; 142 platforms = platforms.unix; 143 broken = stdenv.hostPlatform.isAarch64; # fails to build libgcroots (not supported on aarch64) 144 maintainers = with maintainers; [ ericsagnes oxij ]; 145 }; 146}