From 5c9438359a4c402df7e1edf79574b396b6e5e771 Mon Sep 17 00:00:00 2001 From: Nick Cao Date: Mon, 28 Oct 2024 10:25:47 -0400 Subject: [PATCH] stm8flash: fix cross compilation --- pkgs/development/embedded/stm8/stm8flash/default.nix | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pkgs/development/embedded/stm8/stm8flash/default.nix b/pkgs/development/embedded/stm8/stm8flash/default.nix index a34be169816d7..ee049d3758a20 100644 --- a/pkgs/development/embedded/stm8/stm8flash/default.nix +++ b/pkgs/development/embedded/stm8/stm8flash/default.nix @@ -1,6 +1,6 @@ { lib, stdenv, fetchFromGitHub, libusb1, pkg-config }: -stdenv.mkDerivation rec { +stdenv.mkDerivation { pname = "stm8flash"; version = "2022-03-27"; @@ -17,8 +17,13 @@ stdenv.mkDerivation rec { # NOTE: _FORTIFY_SOURCE requires compiling with optimization (-O) env.NIX_CFLAGS_COMPILE = "-O"; - preBuild = '' - export DESTDIR=$out; + makeFlags = [ + "DESTDIR=${placeholder "out"}" + ]; + + postPatch = '' + substituteInPlace Makefile \ + --replace 'pkg-config' '$(PKG_CONFIG)' ''; nativeBuildInputs = [ pkg-config ];