20 # use this to shrink the package's footprint if necessary (e.g. for hardened appliances)
21 , onlyFirmwareUpdater ? false
22 # contains binary-only libraries
26 stdenv.mkDerivation rec {
29 # if you update the version of this package, also update the input hash in mstflint_access!
33 url = "https://github.com/Mellanox/mstflint/releases/download/v${version}/mstflint-${version}.tar.gz";
34 hash = "sha256-G9BIFG8f4Ek9R3CyRLAuMpgbScrtBo/ZaiJwAQMiBlQ=";
51 ] ++ lib.optionals (!onlyFirmwareUpdater) [
60 export CPPFLAGS="-I$(pwd)/tools_layouts -isystem ${libxml2.dev}/include/libxml2"
61 export INSTALL_BASEDIR=$out
65 # Cannot use wrapProgram since the python script's logic depends on the
66 # filename and will get messed up if the executable is named ".xyz-wrapped".
67 # That is why the python executable and runtime dependencies are injected
70 # Remove host_cpu replacement again (see https://github.com/Mellanox/mstflint/pull/865),
71 # needs to hit master or a release. master_devel may be rebased.
73 # Remove patch for regex check, after https://github.com/Mellanox/mstflint/pull/871
77 patchShebangs eval_git_sha.sh
78 substituteInPlace configure.ac \
79 --replace "build_cpu" "host_cpu"
80 substituteInPlace common/compatibility.h \
81 --replace "#define ROOT_PATH \"/\"" "#define ROOT_PATH \"$out/\""
82 substituteInPlace configure.ac \
83 --replace 'Whether to use GNU C regex])' 'Whether to use GNU C regex])],[AC_MSG_RESULT([yes])'
85 (lib.optionals (!onlyFirmwareUpdater) ''
86 substituteInPlace common/python_wrapper.sh \
88 'exec $PYTHON_EXEC $SCRIPT_PATH "$@"' \
89 'export PATH=$PATH:${lib.makeBinPath [ (placeholder "out") pciutils busybox]}; exec ${python3}/bin/python3 $SCRIPT_PATH "$@"'
95 "--datarootdir=${placeholder "out"}/share"
96 ] ++ lib.optionals (!onlyFirmwareUpdater) [
97 "--enable-adb-generic-tools"
103 ] ++ lib.optionals enableDPA [
107 enableParallelBuilding = true;
109 hardeningDisable = [ "format" ];
111 dontDisableStatic = true; # the build fails without this. should probably be reported upstream
114 description = "Open source version of Mellanox Firmware Tools (MFT)";
115 homepage = "https://github.com/Mellanox/mstflint";
116 license = with licenses; [ gpl2Only bsd2 ];
117 maintainers = with maintainers; [ thillux ];
118 platforms = platforms.linux;