about summary refs log tree commit diff
path: root/pkgs/applications/graphics/xfig
diff options
context:
space:
mode:
authorFederico Beffa <beffa@fbengineering.ch>2022-03-22 17:13:41 +0100
committerFederico Beffa <beffa@fbengineering.ch>2022-03-23 09:25:40 +0100
commit974ede575bbe1dc35cfe641c3959969017d1311f (patch)
tree5ccf40c939aac0d6f81a7fc30b9346342514d75a /pkgs/applications/graphics/xfig
parent9858da4185cd83b6a00bbf737d6dd8ad8ac84a76 (diff)
xfig: Install icons and fix desktop file
Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
Diffstat (limited to 'pkgs/applications/graphics/xfig')
-rw-r--r--pkgs/applications/graphics/xfig/default.nix15
1 files changed, 13 insertions, 2 deletions
diff --git a/pkgs/applications/graphics/xfig/default.nix b/pkgs/applications/graphics/xfig/default.nix
index dc98d761bf083..23d56c8ec727f 100644
--- a/pkgs/applications/graphics/xfig/default.nix
+++ b/pkgs/applications/graphics/xfig/default.nix
@@ -3,6 +3,7 @@
 , fetchurl
 , xlibsWrapper
 , makeWrapper
+, imagemagick
 , libXpm
 , libXmu
 , libXi
@@ -21,7 +22,7 @@ stdenv.mkDerivation rec {
     sha256 = "0fndgbm1mkqb1sn2v2kj3nx9mxj70jbp31y2bjvzcmmkry0q3k5j";
   };
 
-  nativeBuildInputs = [ makeWrapper ];
+  nativeBuildInputs = [ imagemagick makeWrapper ];
 
   buildInputs = [
     xlibsWrapper
@@ -34,7 +35,8 @@ stdenv.mkDerivation rec {
   ];
 
   postPatch = ''
-    sed -i 's:"fig2dev":"${fig2dev}/bin/fig2dev":' src/main.c
+    substituteInPlace src/main.c --replace '"fig2dev"' '"${fig2dev}/bin/fig2dev"'
+    substituteInPlace xfig.desktop --replace "/usr/bin/" "$out/bin/"
   '';
 
   postInstall = ''
@@ -43,6 +45,15 @@ stdenv.mkDerivation rec {
 
     wrapProgram $out/bin/xfig \
       --set XAPPLRESDIR $out/share/X11/app-defaults
+
+    mkdir -p $out/share/icons/hicolor/{16x16,22x22,48x48,64x64}/apps
+
+    for dimension in 16x16 22x22 48x48; do
+      convert doc/html/images/xfig-logo.png -geometry $dimension\
+        $out/share/icons/hicolor/16x16/apps/xfig.png
+    done
+    install doc/html/images/xfig-logo.png \
+      $out/share/icons/hicolor/64x64/apps/xfig.png
   '';
 
   enableParallelBuilding = true;