2019-09-05 09:48:54 +02:00
|
|
|
{ stdenv, mkDerivation, fetchFromGitHub, cmake, zlib, libusb1
|
|
|
|
, enableGUI ? false, qtbase ? null
|
|
|
|
}:
|
2016-01-16 01:36:34 +01:00
|
|
|
|
2019-09-05 09:48:54 +02:00
|
|
|
let version = "1.4.2"; in
|
|
|
|
|
|
|
|
mkDerivation {
|
2017-06-24 06:49:07 +02:00
|
|
|
name = "heimdall-${if enableGUI then "gui-" else ""}${version}";
|
2011-08-21 02:10:12 +02:00
|
|
|
|
2015-01-20 06:37:44 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "Benjamin-Dobell";
|
|
|
|
repo = "Heimdall";
|
2016-05-07 01:39:48 +02:00
|
|
|
rev = "v${version}";
|
2017-06-24 06:49:07 +02:00
|
|
|
sha256 = "1ygn4snvcmi98rgldgxf5hwm7zzi1zcsihfvm6awf9s6mpcjzbqz";
|
2011-08-21 02:10:12 +02:00
|
|
|
};
|
|
|
|
|
2017-06-24 06:49:07 +02:00
|
|
|
buildInputs = [
|
|
|
|
zlib libusb1
|
|
|
|
] ++ stdenv.lib.optional enableGUI qtbase;
|
|
|
|
nativeBuildInputs = [ cmake ];
|
2017-02-02 15:20:16 +01:00
|
|
|
|
2016-05-07 10:46:52 +02:00
|
|
|
cmakeFlags = [
|
2017-02-02 15:20:16 +01:00
|
|
|
"-DDISABLE_FRONTEND=${if enableGUI then "OFF" else "ON"}"
|
2020-01-04 10:20:00 +01:00
|
|
|
"-DLIBUSB_LIBRARY=${libusb1}"
|
2016-05-07 10:46:52 +02:00
|
|
|
];
|
2013-08-31 16:36:47 +02:00
|
|
|
|
2016-05-07 10:46:52 +02:00
|
|
|
preConfigure = ''
|
|
|
|
# Give ownership of the Galaxy S USB device to the logged in user.
|
|
|
|
substituteInPlace heimdall/60-heimdall.rules --replace 'MODE="0666"' 'TAG+="uaccess"'
|
2020-01-04 10:20:00 +01:00
|
|
|
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
|
|
|
substituteInPlace libpit/CMakeLists.txt --replace "-std=gnu++11" ""
|
2016-05-07 10:46:52 +02:00
|
|
|
'';
|
2011-08-21 02:10:12 +02:00
|
|
|
|
2016-05-07 10:46:52 +02:00
|
|
|
installPhase = ''
|
2017-06-24 06:49:07 +02:00
|
|
|
mkdir -p $out/{bin,share/doc/heimdall,lib/udev/rules.d}
|
|
|
|
install -m755 -t $out/bin bin/*
|
|
|
|
install -m644 -t $out/lib/udev/rules.d ../heimdall/60-heimdall.rules
|
2017-06-24 07:18:01 +02:00
|
|
|
install -m644 ../Linux/README $out/share/doc/heimdall/README.linux
|
|
|
|
install -m644 ../OSX/README.txt $out/share/doc/heimdall/README.osx
|
2016-05-07 10:46:52 +02:00
|
|
|
'';
|
2011-08-21 02:10:12 +02:00
|
|
|
|
2017-02-02 15:20:16 +01:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2017-06-24 06:49:07 +02:00
|
|
|
meta = with stdenv.lib; {
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "http://www.glassechidna.com.au/products/heimdall/";
|
2016-05-07 10:46:52 +02:00
|
|
|
description = "A cross-platform tool suite to flash firmware onto Samsung Galaxy S devices";
|
2017-06-24 06:49:07 +02:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ peterhoeg ];
|
|
|
|
platforms = platforms.unix;
|
2011-08-21 02:10:12 +02:00
|
|
|
};
|
|
|
|
}
|