about summary refs log tree commit diff
path: root/pkgs/tools/system/awstats/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/tools/system/awstats/default.nix')
-rw-r--r--pkgs/tools/system/awstats/default.nix58
1 files changed, 58 insertions, 0 deletions
diff --git a/pkgs/tools/system/awstats/default.nix b/pkgs/tools/system/awstats/default.nix
new file mode 100644
index 000000000000..f4a14155d689
--- /dev/null
+++ b/pkgs/tools/system/awstats/default.nix
@@ -0,0 +1,58 @@
+{ stdenv, fetchurl, perlPackages, jdk }:
+
+perlPackages.buildPerlPackage rec {
+  name = "awstats-${version}";
+  version = "7.4";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/awstats/${name}.tar.gz";
+    sha256 = "0mdbilsl8g9a84qgyws4pakhqr3mfhs5g5dqbgsn9gn285rzxas3";
+  };
+
+  postPatch = ''
+    substituteInPlace wwwroot/cgi-bin/awstats.pl \
+      --replace /usr/share/awstats/ "$out/wwwroot/cgi-bin/"
+  '';
+
+  outputs = [ "out" "bin" "doc" ];
+
+  buildInputs = with perlPackages; [ ]; # plugins will need some
+
+  preConfigure = ''
+    touch Makefile.PL
+    patchShebangs .
+  '';
+
+  # build our own JAR
+  preBuild = ''
+    (
+      cd wwwroot/classes/src
+      rm ../*.jar
+      PATH="${jdk}/bin" "$(type -P perl)" Makefile.pl
+      test -f ../*.jar
+    )
+  '';
+
+  doCheck = false;
+
+  installPhase = ''
+    mkdir "$out"
+    mv wwwroot "$out/wwwroot"
+    rm -r "$out/wwwroot/classes/src/"
+
+    mkdir -p "$bin/bin"
+    ln -s "$out/wwwroot/cgi-bin/awstats.pl" "$bin/bin/awstats"
+
+    mkdir -p "$doc/share/"
+    mv README.md docs/
+    mv docs "$doc/share/awstats"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Real-time logfile analyzer to get advanced statistics";
+    homepage = http://awstats.org;
+    license = licenses.gpl3Plus;
+    platforms = platforms.linux;
+  };
+}
+