mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-19 02:44:17 +03:00
bcompare: add darwin support (#141413)
Co-authored-by: Paweł Kruszewski <kruszewsky@gmail.com>
This commit is contained in:
parent
64cd57dd4f
commit
18e1ae0d99
@ -1,54 +1,82 @@
|
||||
{ autoPatchelfHook, bzip2, cairo, coreutils, fetchurl, gdk-pixbuf, pango, gtk2, kcoreaddons, ki18n, kio, kservice, lib, qt4, qtbase, stdenv, runtimeShell }:
|
||||
{ lib, autoPatchelfHook, bzip2, cairo, coreutils, fetchurl, gdk-pixbuf, glibc, pango, gtk2, kcoreaddons, ki18n, kio, kservice
|
||||
, stdenv, runtimeShell, unzip
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
let
|
||||
pname = "bcompare";
|
||||
version = "4.4.0.25886";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://www.scootersoftware.com/${pname}-${version}_amd64.deb";
|
||||
sha256 = "sha256-zQZrCjXzoOZ5o5M4t1n5/HhGoGTcZSj5rlf9Uz9UZko=";
|
||||
throwSystem = throw "Unsupported system: ${stdenv.hostPlatform.system}";
|
||||
|
||||
srcs = {
|
||||
x86_64-linux = fetchurl {
|
||||
url = "https://www.scootersoftware.com/${pname}-${version}_amd64.deb";
|
||||
sha256 = "sha256-zQZrCjXzoOZ5o5M4t1n5/HhGoGTcZSj5rlf9Uz9UZko=";
|
||||
};
|
||||
|
||||
x86_64-darwin = fetchurl {
|
||||
url = "https://www.scootersoftware.com/BCompareOSX-${version}.zip";
|
||||
sha256 = "sha256-dez30a1sp+4XuBBYhu07Vpn1+AUmX0Ni7aad7hy2ajQ=";
|
||||
};
|
||||
|
||||
aarch64-darwin = srcs.x86_64-darwin;
|
||||
};
|
||||
|
||||
unpackPhase = ''
|
||||
ar x $src
|
||||
tar xfz data.tar.gz
|
||||
'';
|
||||
src = srcs.${stdenv.hostPlatform.system} or throwSystem;
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin $out/lib $out/share
|
||||
cp -R usr/share $out/
|
||||
cp -R usr/lib $out/
|
||||
cp -R usr/bin $out/
|
||||
linux = stdenv.mkDerivation {
|
||||
inherit pname version src meta;
|
||||
unpackPhase = ''
|
||||
ar x $src
|
||||
tar xfz data.tar.gz
|
||||
'';
|
||||
|
||||
# Remove library that refuses to be autoPatchelf'ed
|
||||
rm $out/lib/beyondcompare/ext/bcompare_ext_kde.amd64.so
|
||||
installPhase = ''
|
||||
mkdir -p $out/{bin,lib,share}
|
||||
|
||||
substituteInPlace $out/bin/bcompare \
|
||||
--replace "/usr/lib/beyondcompare" "$out/lib/beyondcompare" \
|
||||
--replace "/bin/bash" "${runtimeShell}"
|
||||
cp -R usr/{bin,lib,share} $out/
|
||||
|
||||
# Create symlink bzip2 library
|
||||
ln -s ${bzip2.out}/lib/libbz2.so.1 $out/lib/beyondcompare/libbz2.so.1.0
|
||||
'';
|
||||
# Remove library that refuses to be autoPatchelf'ed
|
||||
rm $out/lib/beyondcompare/ext/bcompare_ext_kde.amd64.so
|
||||
|
||||
nativeBuildInputs = [ autoPatchelfHook ];
|
||||
substituteInPlace $out/bin/${pname} \
|
||||
--replace "/usr/lib/beyondcompare" "$out/lib/beyondcompare" \
|
||||
--replace "ldd" "${glibc.out}/bin/ldd" \
|
||||
--replace "/bin/bash" "${runtimeShell}"
|
||||
|
||||
buildInputs = [
|
||||
stdenv.cc.cc.lib
|
||||
gtk2
|
||||
pango
|
||||
cairo
|
||||
kio
|
||||
kservice
|
||||
ki18n
|
||||
kcoreaddons
|
||||
gdk-pixbuf
|
||||
bzip2
|
||||
];
|
||||
# Create symlink bzip2 library
|
||||
ln -s ${bzip2.out}/lib/libbz2.so.1 $out/lib/beyondcompare/libbz2.so.1.0
|
||||
'';
|
||||
|
||||
dontBuild = true;
|
||||
dontConfigure = true;
|
||||
dontWrapQtApps = true;
|
||||
nativeBuildInputs = [ autoPatchelfHook ];
|
||||
|
||||
buildInputs = [
|
||||
stdenv.cc.cc.lib
|
||||
gtk2
|
||||
pango
|
||||
cairo
|
||||
kio
|
||||
kservice
|
||||
ki18n
|
||||
kcoreaddons
|
||||
gdk-pixbuf
|
||||
bzip2
|
||||
];
|
||||
|
||||
dontBuild = true;
|
||||
dontConfigure = true;
|
||||
dontWrapQtApps = true;
|
||||
};
|
||||
|
||||
darwin = stdenv.mkDerivation {
|
||||
inherit pname version src meta;
|
||||
nativeBuildInputs = [ unzip ];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/Applications/BCompare.app
|
||||
cp -R . $out/Applications/BCompare.app
|
||||
'';
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "GUI application that allows to quickly and easily compare files and folders";
|
||||
@ -59,8 +87,10 @@ stdenv.mkDerivation rec {
|
||||
'';
|
||||
homepage = "https://www.scootersoftware.com";
|
||||
license = licenses.unfree;
|
||||
maintainers = [ maintainers.ktor ];
|
||||
platforms = [ "x86_64-linux" ];
|
||||
maintainers = with maintainers; [ ktor arkivm ];
|
||||
platforms = builtins.attrNames srcs;
|
||||
};
|
||||
|
||||
}
|
||||
in
|
||||
if stdenv.isDarwin
|
||||
then darwin
|
||||
else linux
|
||||
|
Loading…
Reference in New Issue
Block a user