1{
2 lib,
3 stdenv,
4 fetchurl,
5 perl,
6 libX11,
7 libXinerama,
8 libjpeg,
9 libpng,
10 libtiff,
11 libwebp,
12 pkg-config,
13 librsvg,
14 glib,
15 gtk2,
16 libXext,
17 libXxf86vm,
18 poppler,
19 vlc,
20 ghostscript,
21 makeWrapper,
22 tzdata,
23 makeDesktopItem,
24 copyDesktopItems,
25 directoryListingUpdater,
26 htmldoc,
27 binutils,
28 gzip,
29 p7zip,
30 xz,
31 zip,
32 extraRuntimeDeps ? [ ],
33}:
34
35stdenv.mkDerivation rec {
36 pname = "eaglemode";
37 version = "0.96.2";
38
39 src = fetchurl {
40 url = "mirror://sourceforge/eaglemode/${pname}-${version}.tar.bz2";
41 hash = "sha256:1al5n2mcjp0hmsvi4hsdmzd7i0id5i3255xplk0il1nmzydh312a";
42 };
43
44 # Fixes "Error: No time zones found." on the clock
45 postPatch = ''
46 substituteInPlace src/emClock/emTimeZonesModel.cpp --replace "/usr/share/zoneinfo" "${tzdata}/share/zoneinfo"
47 '';
48
49 nativeBuildInputs = [
50 pkg-config
51 makeWrapper
52 copyDesktopItems
53 ];
54 buildInputs = [
55 perl
56 libX11
57 libXinerama
58 libjpeg
59 libpng
60 libtiff
61 libwebp
62 librsvg
63 glib
64 gtk2
65 libXxf86vm
66 libXext
67 poppler
68 vlc
69 ghostscript
70 ];
71
72 # The program tries to dlopen Xxf86vm, Xext and Xinerama, so we use the
73 # trick on NIX_LDFLAGS and dontPatchELF to make it find them.
74 buildPhase = ''
75 runHook preBuild
76 export NIX_LDFLAGS="$NIX_LDFLAGS -lXxf86vm -lXext -lXinerama"
77 perl make.pl build
78 runHook postBuild
79 '';
80
81 dontPatchELF = true;
82 # eaglemode expects doc to be in the root directory
83 forceShare = [
84 "man"
85 "info"
86 ];
87
88 installPhase =
89 let
90 runtimeDeps = lib.makeBinPath (
91 [
92 ghostscript # renders the manual
93 htmldoc # renders HTML files in file browser
94 perl # various display scripts use Perl
95
96 # archive formats in the file browser:
97 binutils
98 gzip
99 p7zip
100 xz
101 zip
102 ]
103 ++ extraRuntimeDeps
104 );
105 in
106 ''
107 runHook preInstall
108 perl make.pl install dir=$out
109 wrapProgram $out/bin/eaglemode --set EM_DIR "$out" --prefix LD_LIBRARY_PATH : "$out/lib" --prefix PATH : "${runtimeDeps}"
110 for i in 32 48 96; do
111 mkdir -p $out/share/icons/hicolor/''${i}x''${i}/apps
112 ln -s $out/res/icons/${pname}$i.png $out/share/icons/hicolor/''${i}x''${i}/apps/${pname}.png
113 done
114 runHook postInstall
115 '';
116
117 desktopItems = [
118 (makeDesktopItem {
119 name = pname;
120 exec = pname;
121 icon = pname;
122 desktopName = "Eagle Mode";
123 genericName = meta.description;
124 categories = [
125 "Game"
126 "Graphics"
127 "System"
128 "Utility"
129 ];
130 })
131 ];
132
133 passthru.updateScript = directoryListingUpdater {
134 url = "https://eaglemode.sourceforge.net/download.html";
135 extraRegex = "(?!.*(x86_64|setup64|livecd)).*";
136 };
137
138 meta = with lib; {
139 homepage = "https://eaglemode.sourceforge.net";
140 description = "Zoomable User Interface";
141 changelog = "https://eaglemode.sourceforge.net/ChangeLog.html";
142 license = licenses.gpl3;
143 maintainers = with maintainers; [
144 chuangzhu
145 ehmry
146 ];
147 platforms = platforms.linux;
148 };
149}