heimdall: clean up the build expression

- Make sure the front-end-less build does not depend on QT.

- Don't override patchPhase because that will lead to unexpected results for
  people who try to defined a "patches = [...]" attribute.
This commit is contained in:
Peter Simons 2017-02-02 15:20:16 +01:00
parent e051e88213
commit 6dca78e1ae

View file

@ -13,20 +13,22 @@ stdenv.mkDerivation {
};
buildInputs = [ zlib libusb1 cmake ];
patchPhase = stdenv.lib.optional (!enableGUI) ''
sed -i '/heimdall-frontend/d' CMakeLists.txt
'';
enableParallelBuilding = true;
cmakeFlags = [
"-DBUILD_TYPE=Release"
"-DDISABLE_FRONTEND=${if enableGUI then "OFF" else "ON"}"
] ++ stdenv.lib.optionals enableGUI [
"-DQt5Widgets_DIR=${qt5.qtbase.dev}/lib/cmake/Qt5Widgets"
"-DQt5Gui_DIR=${qt5.qtbase.dev}/lib/cmake/Qt5Gui"
"-DQt5Core_DIR=${qt5.qtbase.dev}/lib/cmake/Qt5Core"
"-DBUILD_TYPE=Release"
];
preConfigure = ''
# Give ownership of the Galaxy S USB device to the logged in user.
substituteInPlace heimdall/60-heimdall.rules --replace 'MODE="0666"' 'TAG+="uaccess"'
# Fix version string reported by the executable.
sed -i -e 's/version = "v.*"/version = "v${version}"/' heimdall/source/Interface.cpp
'';
installPhase = ''
@ -36,6 +38,8 @@ stdenv.mkDerivation {
cp ../heimdall/60-heimdall.rules $out/lib/udev/rules.d
'';
enableParallelBuilding = true;
meta = {
homepage = "http://www.glassechidna.com.au/products/heimdall/";
description = "A cross-platform tool suite to flash firmware onto Samsung Galaxy S devices";