about summary refs log tree commit diff
path: root/pkgs/applications/misc/kiwix
diff options
context:
space:
mode:
authorajs124 <git@ajs124.de>2021-03-28 00:30:12 +0100
committerajs124 <git@ajs124.de>2021-03-30 14:58:46 +0200
commitcbac34be889e35db4f4c95c3312064865d8b828c (patch)
tree9cc0272e1e5c9f3c3d328819ca70ac0150644856 /pkgs/applications/misc/kiwix
parent9478a316c2fbb6b8366fb9aa9c61704d2ee8a4fd (diff)
kiwix: 0.9 -> 2.0.5
Diffstat (limited to 'pkgs/applications/misc/kiwix')
-rw-r--r--pkgs/applications/misc/kiwix/default.nix123
-rw-r--r--pkgs/applications/misc/kiwix/lib.nix55
2 files changed, 86 insertions, 92 deletions
diff --git a/pkgs/applications/misc/kiwix/default.nix b/pkgs/applications/misc/kiwix/default.nix
index dff50bafaf807..f3406d4159b8f 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 ];
-  buildInputs = [
-    zip python zlib xapian which icu libmicrohttpd
-    lzma zimlib ctpp2 aria2 wget bc libuuid makeWrapper pugixml
+  nativeBuildInputs = [
+    qmake
+    pkg-config
   ];
 
-  postUnpack = ''
-    cd kiwix*
-    mkdir static
-    cp Makefile.in static/
-
-    cd src/dependencies
-
-    tar -xf ${xulrunner.tar}
-    tar -xf ${xulrunner.sdk}
-
-    cd ../../..
-  '';
-
-  configureFlags = [
-    "--disable-staticbins"
+  buildInputs = [
+    qtbase
+    qtwebengine
+    qtsvg
+    qtimageformats
+    (callPackage ./lib.nix {})
   ];
 
-  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
-  '';
+  qtWrapperArgs = [
+    "--prefix PATH : ${lib.makeBinPath [ aria2 ]}"
+  ];
 
-  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 0000000000000..dcde5c390a473
--- /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
+  '';
+}