summary refs log tree commit diff
diff options
context:
space:
mode:
authorJörg Thalheim <Mic92@users.noreply.github.com>2017-12-21 10:33:33 +0100
committerGitHub <noreply@github.com>2017-12-21 10:33:33 +0100
commit362244787fc1d629fe9500f440affd263c142903 (patch)
treeeacadb4a194d4407c8c2bbbc2924307bcd97710b
parentf962f335935d5d6e946eaae3bc375069744fca48 (diff)
parent4d778886da14121ba0e76423254ad297a3169ef3 (diff)
downloadnixlib-362244787fc1d629fe9500f440affd263c142903.tar
nixlib-362244787fc1d629fe9500f440affd263c142903.tar.gz
nixlib-362244787fc1d629fe9500f440affd263c142903.tar.bz2
nixlib-362244787fc1d629fe9500f440affd263c142903.tar.lz
nixlib-362244787fc1d629fe9500f440affd263c142903.tar.xz
nixlib-362244787fc1d629fe9500f440affd263c142903.tar.zst
nixlib-362244787fc1d629fe9500f440affd263c142903.zip
Merge pull request #32920 from mrVanDalo/feature/pencil3
pencil: 2.0.21 -> 3.0.4
-rw-r--r--pkgs/applications/graphics/pencil/default.nix108
1 files changed, 88 insertions, 20 deletions
diff --git a/pkgs/applications/graphics/pencil/default.nix b/pkgs/applications/graphics/pencil/default.nix
index f7175f9d2b87..a4e73d2f5b5a 100644
--- a/pkgs/applications/graphics/pencil/default.nix
+++ b/pkgs/applications/graphics/pencil/default.nix
@@ -1,36 +1,104 @@
-{ stdenv, fetchurl, makeWrapper, xulrunner }:
+{ stdenv, fetchurl, lib, makeWrapper,
+  # build dependencies
+  alsaLib, atk, cairo, cups, dbus, expat, fontconfig,
+  freetype, gdk_pixbuf, glib, gnome2, nspr, nss, xlibs,
+  glibc, udev
+}:
 
 stdenv.mkDerivation rec {
-  version = "2.0.21";
+  version = "3.0.4";
   name = "pencil-${version}";
 
   src = fetchurl {
-    url = "https://github.com/prikhi/pencil/releases/download/v${version}/Pencil-${version}-linux-pkg.tar.gz";
-    sha256 = "0xq3gczqy7gzf1997qxdql5z7qqk1vabr0rzgakmsi4dq2q4d3kq";
+    url    = "http://pencil.evolus.vn/dl/V${version}/Pencil_${version}_amd64.deb";
+    sha256 = "58e2b794c615ea8715d8374f177e19c87f7071e359826ec34a59836d537a62fd";
   };
 
-  buildPhase = "";
+  sourceRoot = ".";
 
-  buildInputs = [ makeWrapper ];
+  unpackCmd = ''
+    ar p "$src" data.tar.xz | tar xJ
+  '';
+
+  buildPhase = ":";
+
+  nativeBuildInputs = [ makeWrapper ];
 
   installPhase = ''
-    mkdir -p "$out"
-    cp -r usr/* "$out"
-    sed -e "s|/usr/share/evolus-pencil|$out/share/evolus-pencil|" \
-        -i "$out/bin/pencil"
-    sed -e "s|/usr/bin/pencil|$out/bin/pencil|" \
-        -e "s|Icon=.*|Icon=$out/share/evolus-pencil/skin/classic/icon.svg|" \
-        -i "$out/share/applications/pencil.desktop"
-
-    wrapProgram $out/bin/pencil \
-      --prefix PATH ":" ${xulrunner}/bin
+    mkdir -p $out/bin
+    cp -R usr/share opt $out/
+
+    # fix the path in the desktop file
+    substituteInPlace \
+      $out/share/applications/pencil.desktop \
+      --replace /opt/ $out/opt/
+
+    # symlink the binary to bin/
+    ln -s $out/opt/Pencil/pencil $out/bin/pencil
+  '';
+
+
+  preFixup = let
+    packages = [
+      alsaLib
+      atk
+      cairo
+      cups
+      dbus
+      expat
+      fontconfig
+      freetype
+      gdk_pixbuf
+      glib
+      gnome2.GConf
+      gnome2.gtk
+      gnome2.pango
+      nspr
+      nss
+      xlibs.libX11
+      xlibs.libXScrnSaver
+      xlibs.libXcomposite
+      xlibs.libXcursor
+      xlibs.libXdamage
+      xlibs.libXext
+      xlibs.libXfixes
+      xlibs.libXi
+      xlibs.libXrandr
+      xlibs.libXrender
+      xlibs.libXtst
+      stdenv.cc.cc.lib
+      stdenv.cc.cc
+      glibc
+    ];
+    libPathNative = lib.makeLibraryPath packages;
+    libPath64 = lib.makeSearchPathOutput "lib" "lib64" packages;
+    libPath = "${libPathNative}:${libPath64}";
+  in ''
+    # patch executable
+    patchelf \
+      --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
+      --set-rpath "${libPath}:$out/opt/Pencil" \
+      $out/opt/Pencil/pencil
+
+    # patch libnode
+    patchelf \
+      --set-rpath "${libPath}" \
+      $out/opt/Pencil/libnode.so
+
+    # libffmpeg is for some reason  not executable
+    chmod a+x $out/opt/Pencil/libffmpeg.so
+
+    # fix missing libudev
+    ln -s ${udev}/lib/systemd/libsystemd-shared.so $out/opt/Pencil/libudev.so.1
+    wrapProgram $out/opt/Pencil/pencil \
+      --prefix LD_LIBRARY_PATH : $out/opt/Pencil
   '';
 
   meta = with stdenv.lib; {
     description = "GUI prototyping/mockup tool";
-    homepage = https://github.com/prikhi/pencil;
-    license = licenses.gpl2; # Commercial license is also available
-    maintainers = with maintainers; [ bjornfor prikhi ];
-    platforms = platforms.linux;
+    homepage    = "https://pencil.evolus.vn/";
+    license     = licenses.gpl2; # Commercial license is also available
+    maintainers = with maintainers; [ bjornfor prikhi mrVanDalo ];
+    platforms   = platforms.linux;
   };
 }