1 { lib, stdenv, fetchFromGitHub, pkg-config
2 , libXtst, libvorbis, hunspell, lzo, xz, bzip2, libiconv
3 , qtbase, qtsvg, qtwebkit, qtx11extras, qttools, qmake
6 , withCC ? true, opencc
7 , withEpwing ? true, libeb
8 , withExtraTiff ? true, libtiff
9 , withFFmpeg ? true, libao, ffmpeg
10 , withMultimedia ? true
11 , withZim ? true, zstd }:
13 stdenv.mkDerivation rec {
17 src = fetchFromGitHub {
21 hash = "sha256-80o8y+mbzpyMQYUGHYs/zgQT23nLVCs7Jcr8FbbXn8M=";
25 ./0001-dont-check-for-updates.patch
26 ./0001-dont-use-maclibs.patch
30 substituteInPlace goldendict.pro \
31 --replace "hunspell-1.6.1" "hunspell-${lib.versions.majorMinor hunspell.version}" \
32 --replace "opencc.2" "opencc"
35 nativeBuildInputs = [ pkg-config qmake wrapQtAppsHook wrapGAppsHook ];
37 qtbase qtsvg qtwebkit qttools
38 libvorbis hunspell xz lzo
39 ] ++ lib.optionals stdenv.isLinux [ qtx11extras libXtst ]
40 ++ lib.optionals stdenv.isDarwin [ bzip2 libiconv ]
41 ++ lib.optional withCC opencc
42 ++ lib.optional withEpwing libeb
43 ++ lib.optional withExtraTiff libtiff
44 ++ lib.optionals withFFmpeg [ libao ffmpeg ]
45 ++ lib.optional withZim zstd;
47 qmakeFlags = with lib; [
49 (optional withCC "CONFIG+=chinese_conversion_support")
50 (optional (!withCC) "CONFIG+=no_chinese_conversion_support")
51 (optional (!withEpwing) "CONFIG+=no_epwing_support")
52 (optional (!withExtraTiff) "CONFIG+=no_extra_tiff_handler")
53 (optional (!withFFmpeg) "CONFIG+=no_ffmpeg_player")
54 (optional (!withMultimedia)"CONFIG+=no_qtmultimedia_player")
55 (optional withZim "CONFIG+=zim_support")
58 postInstall = lib.optionalString stdenv.isDarwin ''
59 mkdir -p $out/Applications
60 mv GoldenDict.app $out/Applications
64 homepage = "http://goldendict.org/";
65 description = "A feature-rich dictionary lookup program";
66 platforms = with platforms; linux ++ darwin;
67 mainProgram = "goldendict";
68 maintainers = with maintainers; [ gebner astsmtl sikmir ];
69 license = licenses.gpl3Plus;