nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 autoPatchelfHook,
4 bzip2,
5 cairo,
6 fetchurl,
7 gdk-pixbuf,
8 glibc,
9 pango,
10 gtk2,
11 kcoreaddons,
12 ki18n,
13 kio,
14 kservice,
15 stdenv,
16 runtimeShell,
17 unzip,
18}:
19
20let
21 pname = "bcompare";
22 version = "4.4.7.28397";
23
24 throwSystem = throw "Unsupported system: ${stdenv.hostPlatform.system}";
25
26 srcs = {
27 x86_64-linux = fetchurl {
28 url = "https://www.scootersoftware.com/${pname}-${version}_amd64.deb";
29 sha256 = "sha256-4AWTSoYpVhGmBBxcwHXdg1CGd/04+8yL9pu+gHrsj6U";
30 };
31
32 x86_64-darwin = fetchurl {
33 url = "https://www.scootersoftware.com/BCompareOSX-${version}.zip";
34 sha256 = "sha256-qbpM6hJbv+APo+ed45k3GXrl1HnZRxD1uT2lvaN3oM4=";
35 };
36
37 aarch64-darwin = srcs.x86_64-darwin;
38 };
39
40 src = srcs.${stdenv.hostPlatform.system} or throwSystem;
41
42 linux = stdenv.mkDerivation {
43 inherit
44 pname
45 version
46 src
47 meta
48 ;
49 unpackPhase = ''
50 ar x $src
51 tar xfz data.tar.gz
52 '';
53
54 installPhase = ''
55 mkdir -p $out/{bin,lib,share}
56
57 cp -R usr/{bin,lib,share} $out/
58
59 # Remove library that refuses to be autoPatchelf'ed
60 rm $out/lib/beyondcompare/ext/bcompare_ext_kde.amd64.so
61
62 substituteInPlace $out/bin/${pname} \
63 --replace "/usr/lib/beyondcompare" "$out/lib/beyondcompare" \
64 --replace "ldd" "${glibc.bin}/bin/ldd" \
65 --replace "/bin/bash" "${runtimeShell}"
66
67 # Create symlink bzip2 library
68 ln -s ${bzip2.out}/lib/libbz2.so.1 $out/lib/beyondcompare/libbz2.so.1.0
69 '';
70
71 nativeBuildInputs = [ autoPatchelfHook ];
72
73 buildInputs = [
74 (lib.getLib stdenv.cc.cc)
75 gtk2
76 pango
77 cairo
78 kio
79 kservice
80 ki18n
81 kcoreaddons
82 gdk-pixbuf
83 bzip2
84 ];
85
86 dontBuild = true;
87 dontConfigure = true;
88 dontWrapQtApps = true;
89 };
90
91 darwin = stdenv.mkDerivation {
92 inherit
93 pname
94 version
95 src
96 meta
97 ;
98 nativeBuildInputs = [ unzip ];
99
100 installPhase = ''
101 mkdir -p $out/Applications/BCompare.app
102 cp -R . $out/Applications/BCompare.app
103 '';
104 };
105
106 meta = with lib; {
107 description = "GUI application that allows to quickly and easily compare files and folders";
108 longDescription = ''
109 Beyond Compare is focused. Beyond Compare allows you to quickly and easily compare your files and folders.
110 By using simple, powerful commands you can focus on the differences you're interested in and ignore those you're not.
111 You can then merge the changes, synchronize your files, and generate reports for your records.
112 '';
113 homepage = "https://www.scootersoftware.com";
114 sourceProvenance = with sourceTypes; [ binaryNativeCode ];
115 license = licenses.unfree;
116 maintainers = with maintainers; [
117 ktor
118 arkivm
119 ];
120 platforms = builtins.attrNames srcs;
121 mainProgram = "bcompare";
122 };
123in
124if stdenv.hostPlatform.isDarwin then darwin else linux