Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenv, fetchFromGitHub, fetchpatch, 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 21assert withGtk2 -> gtk2 != null; 22assert withGtk3 -> gtk3 != null; 23 24# TODO(@oxij): ./configure can't find both qmakes at the same time 25# this can be fixed by adding an alias qmake -> qmaka${version} in qmake derivation 26assert withQt4 -> !withQt5 && qt4 != null; 27assert withQt5 -> !withQt4 && qt5 != null; 28 29assert !withQt5; # fails to build with "Makefile.qmake: No such file or directory" 30 31assert withAnthy -> anthy != null; 32assert withLibnotify -> libnotify != null; 33assert withSqlite -> sqlite != null; 34assert withNetworking -> curl != null && openssl != null; 35assert withFFI -> libffi != null; 36assert withMisc -> libeb != null; 37 38stdenv.mkDerivation rec { 39 version = "1.8.8"; 40 pname = "uim"; 41 42 src = fetchFromGitHub { 43 owner = "uim"; 44 repo = "uim"; 45 rev = "2c0958c9c505a87e70e344c2192e2e5123c71ea5"; 46 fetchSubmodules = true; 47 sha256 = "1hkjxi5r49gcna37m3jvykny5hz9ram4y8a3q7lw4qzr52mz9pdp"; 48 }; 49 50 nativeBuildInputs = [ 51 autoconf automake intltool libtool pkg-config cmake 52 53 ruby # used by sigscheme build to generate function tables 54 librsvg # used by uim build to generate png pixmaps from svg 55 ]; 56 57 buildInputs = [ 58 ncurses m17n_lib m17n_db expat 59 ] 60 ++ lib.optional withAnthy anthy 61 ++ lib.optional withGtk2 gtk2 62 ++ lib.optional withGtk3 gtk3 63 ++ lib.optional withQt4 qt4 64 ++ lib.optionals withQt5 [ qt5.qtbase.bin qt5.qtbase.dev ] 65 ++ lib.optional withLibnotify libnotify 66 ++ lib.optional withSqlite sqlite 67 ++ lib.optionals withNetworking [ 68 curl openssl 69 ] 70 ++ lib.optional withFFI libffi 71 ++ lib.optional withMisc libeb; 72 73 prePatch = '' 74 patchShebangs *.sh */*.sh */*/*.sh 75 76 # configure sigscheme in maintainer mode or else some function tables won't get autogenerated 77 substituteInPlace configure.ac \ 78 --replace "--with-master-pkg=uim --enable-conf=uim" \ 79 "--enable-maintainer-mode --with-master-pkg=uim --enable-conf=uim" 80 81 # generate ./configure files 82 (cd sigscheme/libgcroots; ./autogen.sh) 83 (cd sigscheme; ./autogen.sh) 84 ./autogen.sh 85 ''; 86 87 patches = [ 88 ./data-hook.patch 89 90 # Pull upstream fix for -fno-common toolchains 91 # https://github.com/uim/libgcroots/pull/4 92 (fetchpatch { 93 name = "libgcroots-fno-common.patch"; 94 url = "https://github.com/uim/libgcroots/commit/7e39241344ad0663409e836560ae6b5eb231e1fc.patch"; 95 sha256 = "0iifcl5lk8bvl0cflm47gkymg88aiwzj0gxh2aj3mqlyhvyx78nz"; 96 # Patch comes from git submodule. Relocate as: 97 # a/include/private/gc_priv.h -> a/sigscheme/libgcroots/include/private/gc_priv.h 98 stripLen = 1; 99 extraPrefix = "sigscheme/libgcroots/"; 100 }) 101 ]; 102 103 configureFlags = [ 104 # configure in maintainer mode or else some pixmaps won't get autogenerated 105 # this should imply the above `--enable-maintainer-mode`, but it does not 106 "--enable-maintainer-mode" 107 108 "--enable-pref" 109 "--with-skk" 110 "--with-x" 111 "--with-xft" 112 "--with-expat=${expat.dev}" 113 ] 114 ++ lib.optional withAnthy "--with-anthy-utf8" 115 ++ lib.optional withGtk2 "--with-gtk2" 116 ++ lib.optional withGtk3 "--with-gtk3" 117 ++ lib.optionals withQt4 [ 118 "--with-qt4" 119 "--with-qt4-immodule" 120 ] 121 ++ lib.optionals withQt5 [ 122 "--with-qt5" 123 "--with-qt5-immodule" 124 ] 125 ++ lib.optional withLibnotify "--enable-notify=libnotify" 126 ++ lib.optional withSqlite "--with-sqlite3" 127 ++ lib.optionals withNetworking [ 128 "--with-curl" 129 "--with-openssl-dir=${openssl.dev}" 130 ] 131 ++ lib.optional withFFI "--with-ffi" 132 ++ lib.optional withMisc "--with-eb"; 133 134 # TODO: things in `./configure --help`, but not in nixpkgs 135 #--with-canna Use Canna [default=no] 136 #--with-wnn Build with libwnn [default=no] 137 #--with-mana Build a plugin for Mana [default=yes] 138 #--with-prime Build a plugin for PRIME [default=yes] 139 #--with-sj3 Use SJ3 [default=no] 140 #--with-osx-dcs Build with OS X Dictionary Services [default=no] 141 142 # TODO: fix this in librsvg/glib later 143 # https://github.com/NixOS/nixpkgs/pull/57027#issuecomment-475461733 144 preBuild = '' 145 export XDG_DATA_DIRS="${shared-mime-info}/share" 146 ''; 147 148 dontUseCmakeConfigure = true; 149 150 meta = with lib; { 151 homepage = src.meta.homepage; 152 description = "A multilingual input method framework"; 153 license = licenses.bsd3; 154 platforms = platforms.unix; 155 maintainers = with maintainers; [ ericsagnes oxij ]; 156 }; 157}