Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 stdenv,
4 fetchurl,
5 fetchpatch,
6 pkg-config,
7 wrapGAppsHook3,
8 libxml2,
9 gtk2,
10 libSM,
11 shared-mime-info,
12}:
13
14stdenv.mkDerivation rec {
15 pname = "rox-filer";
16 version = "2.11";
17
18 src = fetchurl {
19 url = "mirror://sourceforge/rox/rox-filer-${version}.tar.bz2";
20 sha256 = "a929bd32ee18ef7a2ed48b971574574592c42e34ae09f36604bf663d7c101ba8";
21 };
22
23 nativeBuildInputs = [
24 pkg-config
25 wrapGAppsHook3
26 ];
27 buildInputs = [
28 libxml2
29 gtk2
30 shared-mime-info
31 libSM
32 ];
33 NIX_LDFLAGS = "-lm";
34 NIX_CFLAGS_COMPILE = " -fpermissive";
35
36 patches = [
37 ./rox-filer-2.11-in-source-build.patch
38 # Pull upstream fix for -fno-common toolchains like upstream gcc-10:
39 # https://github.com/rox-desktop/rox-filer/pull/15
40 (fetchpatch {
41 name = "fno-common.patch";
42 url = "https://github.com/rox-desktop/rox-filer/commit/86b0bb9144186d51ea9b898905111bd8b143b552.patch";
43 sha256 = "1csyx229i09p00lbdlkdqdhn3x2lb5zby1h9rkjgzlr2qz74gc69";
44 })
45 ];
46
47 # go to the source directory after unpacking the sources
48 sourceRoot = "rox-filer-${version}/ROX-Filer";
49
50 # account for 'setSourceRoot' offset
51 patchFlags = [ "-p2" ];
52
53 # patch the main.c to disable the lookup of the APP_DIR environment variable,
54 # which is used to lookup the location for certain images when rox-filer
55 # starts; rather override the location with an absolute path to the directory
56 # where images are stored to prevent having to use a wrapper, which sets the
57 # APP_DIR environment variable prior to starting rox-filer
58 preConfigure = ''
59 sed -i -e "s:g_strdup(getenv(\"APP_DIR\")):\"$out\":" src/main.c
60 mkdir build
61 cd build
62 '';
63
64 configureScript = "../src/configure";
65
66 installPhase = ''
67 mkdir -p "$out"
68 cd ..
69 cp -av Help Messages Options.xml ROX images style.css .DirIcon "$out"
70
71 # create the man/ directory, which will be moved from $out to share/ in the fixup phase
72 mkdir "$out/man/"
73 cp -av ../rox.1 "$out/man/"
74
75 # the main executable
76 mkdir "$out/bin/"
77 cp -v ROX-Filer "$out/bin/rox"
78
79 # mime types
80 mkdir -p "$out/ROX/MIME"
81 cd "$out/ROX/MIME"
82 ln -sv text-x-{diff,patch}.png
83 ln -sv application-x-font-{afm,type1}.png
84 ln -sv application-xml{,-dtd}.png
85 ln -sv application-xml{,-external-parsed-entity}.png
86 ln -sv application-{,rdf+}xml.png
87 ln -sv application-x{ml,-xbel}.png
88 ln -sv application-{x-shell,java}script.png
89 ln -sv application-x-{bzip,xz}-compressed-tar.png
90 ln -sv application-x-{bzip,lzma}-compressed-tar.png
91 ln -sv application-x-{bzip-compressed-tar,lzo}.png
92 ln -sv application-x-{bzip,xz}.png
93 ln -sv application-x-{gzip,lzma}.png
94 ln -sv application-{msword,rtf}.png
95 '';
96
97 meta = with lib; {
98 description = "Fast, lightweight, gtk2 file manager";
99 mainProgram = "rox";
100 homepage = "http://rox.sourceforge.net/desktop";
101 license = with licenses; [
102 gpl2
103 lgpl2
104 ];
105 platforms = platforms.linux;
106 maintainers = [ maintainers.eleanor ];
107 };
108}