2021-12-06 16:07:01 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchurl
|
2023-11-16 04:20:00 +00:00
|
|
|
, rdma-core
|
2021-12-06 16:07:01 +00:00
|
|
|
, openssl
|
|
|
|
, zlib
|
2023-11-16 04:20:00 +00:00
|
|
|
, xz
|
|
|
|
, expat
|
|
|
|
, boost
|
|
|
|
, curl
|
|
|
|
, pkg-config
|
|
|
|
, libxml2
|
|
|
|
, pciutils
|
|
|
|
, busybox
|
|
|
|
, python3
|
|
|
|
, automake
|
|
|
|
, autoconf
|
|
|
|
, libtool
|
|
|
|
, git
|
|
|
|
# use this to shrink the package's footprint if necessary (e.g. for hardened appliances)
|
|
|
|
, onlyFirmwareUpdater ? false
|
|
|
|
# contains binary-only libraries
|
|
|
|
, enableDPA ? true
|
2021-12-06 16:07:01 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2020-05-29 06:06:01 +00:00
|
|
|
pname = "mstflint";
|
2023-11-16 04:20:00 +00:00
|
|
|
version = "4.26.0-1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/Mellanox/mstflint/releases/download/v${version}/mstflint-${version}.tar.gz";
|
2023-11-16 04:20:00 +00:00
|
|
|
hash = "sha256-P8XACcz6d8UTOhFFeTijfFOthBqnUghGlDj9K145sZ8=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
autoconf
|
|
|
|
automake
|
|
|
|
libtool
|
|
|
|
pkg-config
|
|
|
|
libxml2
|
|
|
|
git
|
|
|
|
];
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
buildInputs = [
|
2023-11-16 04:20:00 +00:00
|
|
|
rdma-core
|
2021-12-06 16:07:01 +00:00
|
|
|
zlib
|
2023-11-16 04:20:00 +00:00
|
|
|
libxml2
|
|
|
|
openssl
|
|
|
|
] ++ lib.optionals (!onlyFirmwareUpdater) [
|
|
|
|
boost
|
|
|
|
curl
|
|
|
|
expat
|
|
|
|
xz
|
|
|
|
python3
|
|
|
|
];
|
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
export CPPFLAGS="-I$(pwd)/tools_layouts -isystem ${libxml2.dev}/include/libxml2"
|
|
|
|
export INSTALL_BASEDIR=$out
|
|
|
|
./autogen.sh
|
|
|
|
'';
|
|
|
|
|
|
|
|
# Cannot use wrapProgram since the python script's logic depends on the
|
|
|
|
# filename and will get messed up if the executable is named ".xyz-wrapped".
|
|
|
|
# That is why the python executable and runtime dependencies are injected
|
|
|
|
# this way.
|
|
|
|
#
|
|
|
|
# Remove host_cpu replacement again (see https://github.com/Mellanox/mstflint/pull/865),
|
|
|
|
# needs to hit master or a release. master_devel may be rebased.
|
|
|
|
#
|
|
|
|
# Remove patch for regex check, after https://github.com/Mellanox/mstflint/pull/871
|
|
|
|
# got merged.
|
|
|
|
prePatch = [
|
|
|
|
''
|
|
|
|
patchShebangs eval_git_sha.sh
|
|
|
|
substituteInPlace configure.ac \
|
|
|
|
--replace "build_cpu" "host_cpu"
|
|
|
|
substituteInPlace common/compatibility.h \
|
|
|
|
--replace "#define ROOT_PATH \"/\"" "#define ROOT_PATH \"$out/\""
|
|
|
|
substituteInPlace configure.ac \
|
|
|
|
--replace 'Whether to use GNU C regex])' 'Whether to use GNU C regex])],[AC_MSG_RESULT([yes])'
|
|
|
|
''
|
|
|
|
(lib.optionals (!onlyFirmwareUpdater) ''
|
|
|
|
substituteInPlace common/python_wrapper.sh \
|
|
|
|
--replace \
|
|
|
|
'exec $PYTHON_EXEC $SCRIPT_PATH "$@"' \
|
|
|
|
'export PATH=$PATH:${lib.makeBinPath [ (placeholder "out") pciutils busybox]}; exec ${python3}/bin/python3 $SCRIPT_PATH "$@"'
|
|
|
|
'')
|
2021-12-06 16:07:01 +00:00
|
|
|
];
|
2020-05-29 06:06:01 +00:00
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
configureFlags = [
|
|
|
|
"--enable-xml2"
|
|
|
|
"--datarootdir=${placeholder "out"}/share"
|
|
|
|
] ++ lib.optionals (!onlyFirmwareUpdater) [
|
|
|
|
"--enable-adb-generic-tools"
|
|
|
|
"--enable-cs"
|
|
|
|
"--enable-dc"
|
|
|
|
"--enable-fw-mgr"
|
|
|
|
"--enable-inband"
|
|
|
|
"--enable-rdmem"
|
|
|
|
] ++ lib.optionals enableDPA [
|
|
|
|
"--enable-dpa"
|
|
|
|
];
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2020-05-29 06:06:01 +00:00
|
|
|
hardeningDisable = [ "format" ];
|
|
|
|
|
|
|
|
dontDisableStatic = true; # the build fails without this. should probably be reported upstream
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-11-06 00:33:48 +00:00
|
|
|
description = "Open source version of Mellanox Firmware Tools (MFT)";
|
2020-05-29 06:06:01 +00:00
|
|
|
homepage = "https://github.com/Mellanox/mstflint";
|
|
|
|
license = with licenses; [ gpl2 bsd2 ];
|
2023-11-16 04:20:00 +00:00
|
|
|
maintainers = with maintainers; [ thillux ];
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|