diff --git a/pkgs/applications/misc/kiwix/default.nix b/pkgs/applications/misc/kiwix/default.nix index dff50bafaf8..f3406d4159b 100644 --- a/pkgs/applications/misc/kiwix/default.nix +++ b/pkgs/applications/misc/kiwix/default.nix @@ -1,109 +1,48 @@ -{ lib, stdenv, fetchurl, makeWrapper, pkg-config -, zip, python, zlib, which, icu, libmicrohttpd, lzma, aria2, wget, bc -, libuuid, libX11, libXext, libXt, libXrender, glib, dbus, dbus-glib -, gtk2, gdk-pixbuf, pango, cairo, freetype, fontconfig, alsaLib, atk, cmake -, xapian, ctpp2, zimlib +{ lib, mkDerivation, fetchFromGitHub +, callPackage +, pkg-config +, makeWrapper +, qmake +, qtbase +, qtwebengine +, qtsvg +, qtimageformats +, aria2 }: -with lib; - -let - xulrunner64_tar = fetchurl { - url = "http://download.kiwix.org/dev/xulrunner-29.0.en-US.linux-x86_64.tar.bz2"; - sha256 = "0i3m30gm5z7qmas14id6ypvbmnb2k7jhz8aby2wz5vvv49zqmx3s"; - }; - xulrunnersdk64_tar = fetchurl { - url = "http://download.kiwix.org/dev/xulrunner-29.0.en-US.linux-x86_64.sdk.tar.bz2"; - sha256 = "0z90v7c4mq15g5klmsj8vs2r10fbygj3qzynx4952hkv8ihw8n3a"; - }; - xulrunner32_tar = fetchurl { - url = "http://download.kiwix.org/dev/xulrunner-29.0.en-US.linux-i686.tar.bz2"; - sha256 = "0yln6pxz8f6b9wm9124sx049z8mgi17lgd63rcv2hnix825y8gjb"; - }; - xulrunnersdk32_tar = fetchurl { - url = "http://download.kiwix.org/dev/xulrunner-29.0.en-US.linux-i686.sdk.tar.bz2"; - sha256 = "1h9vcbvf8wgds6i2z20y7krpys0mqsqhv1ijyfljanp6vyll9fvi"; - }; - - xulrunner = if stdenv.hostPlatform.system == "x86_64-linux" - then { tar = xulrunner64_tar; sdk = xulrunnersdk64_tar; } - else { tar = xulrunner32_tar; sdk = xulrunnersdk32_tar; }; - - pugixml = stdenv.mkDerivation rec { - version = "1.2"; - pname = "pugixml"; - - src = fetchurl { - url = "http://download.kiwix.org/dev/${pname}-${version}.tar.gz"; - sha256 = "0sqk0vdwjq44jxbbkj1cy8qykrmafs1sickzldb2w2nshsnjshhg"; - }; - - nativeBuildInputs = [ cmake ]; - - unpackPhase = '' - # not a nice src archive: all the files are in the root :( - mkdir ${pname}-${version} - cd ${pname}-${version} - tar -xf ${src} - - # and the build scripts are in there :'( - cd scripts - ''; - }; - -in - -stdenv.mkDerivation rec { +mkDerivation rec { pname = "kiwix"; - version = "0.9"; + version = "2.0.5"; - src = fetchurl { - url = "http://download.kiwix.org/src/kiwix-${version}-src.tar.xz"; - sha256 = "0577phhy2na59cpcqjgldvksp0jwczyg0l6c9ghnr19i375l7yqc"; + src = fetchFromGitHub { + owner = pname; + repo = "${pname}-desktop"; + rev = version; + sha256 = "12v43bcg4g8fcp02y2srsfdvcb7dpl4pxb9z7a235006s0kfv8yn"; }; - nativeBuildInputs = [ pkg-config ]; + nativeBuildInputs = [ + qmake + pkg-config + ]; + buildInputs = [ - zip python zlib xapian which icu libmicrohttpd - lzma zimlib ctpp2 aria2 wget bc libuuid makeWrapper pugixml + qtbase + qtwebengine + qtsvg + qtimageformats + (callPackage ./lib.nix {}) ]; - postUnpack = '' - cd kiwix* - mkdir static - cp Makefile.in static/ - - cd src/dependencies - - tar -xf ${xulrunner.tar} - tar -xf ${xulrunner.sdk} - - cd ../../.. - ''; - - configureFlags = [ - "--disable-staticbins" + qtWrapperArgs = [ + "--prefix PATH : ${lib.makeBinPath [ aria2 ]}" ]; - postInstall = '' - cp -r src/dependencies/xulrunner $out/lib/kiwix - - patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/lib/kiwix/xulrunner/xulrunner - - rm $out/bin/kiwix - makeWrapper $out/lib/kiwix/kiwix-launcher $out/bin/kiwix \ - --suffix LD_LIBRARY_PATH : ${makeLibraryPath [stdenv.cc.cc libX11 libXext libXt libXrender glib dbus dbus-glib gtk2 gdk-pixbuf pango cairo freetype fontconfig alsaLib atk]} \ - --suffix PATH : ${aria2}/bin - ''; - - meta = { + meta = with lib; { description = "An offline reader for Web content"; homepage = "https://kiwix.org"; license = licenses.gpl3; platforms = platforms.linux; - maintainers = with maintainers; [ robbinch ]; - knownVulnerabilities = [ - "CVE-2015-1032" - ]; + maintainers = with maintainers; [ ajs124 ]; }; } diff --git a/pkgs/applications/misc/kiwix/lib.nix b/pkgs/applications/misc/kiwix/lib.nix new file mode 100644 index 00000000000..dcde5c390a4 --- /dev/null +++ b/pkgs/applications/misc/kiwix/lib.nix @@ -0,0 +1,55 @@ +{ stdenv, lib, fetchFromGitHub +, meson, ninja, pkg-config +, python3 +, curl +, icu +, pugixml +, zimlib +, zlib +, libmicrohttpd +, mustache-hpp +, gtest +}: + + +stdenv.mkDerivation rec { + pname = "kiwix-lib"; + version = "9.4.1"; + + src = fetchFromGitHub { + owner = "kiwix"; + repo = pname; + rev = version; + sha256 = "034nk6l623v78clrs2d0k1vg69sbzrd8c0q79qiqmlkinck1nkxw"; + }; + + nativeBuildInputs = [ + meson + ninja + pkg-config + python3 + ]; + + buildInputs = [ + icu + zlib + mustache-hpp + ]; + + propagatedBuildInputs = [ + curl + libmicrohttpd + pugixml + zimlib + ]; + + checkInputs = [ + gtest + ]; + + doCheck = true; + + postPatch = '' + patchShebangs scripts + ''; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index cc888c8e2ae..599f806f13e 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -23683,7 +23683,7 @@ in ffmpeg = ffmpeg_2; }; - kiwix = callPackage ../applications/misc/kiwix { }; + kiwix = libsForQt5.callPackage ../applications/misc/kiwix { }; klayout = libsForQt5.callPackage ../applications/misc/klayout { };