From e178cc0dcd5d052d7b8061e673e44dd19bfca28b Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Thu, 10 Oct 2024 12:51:42 +0200 Subject: [PATCH] gsm: fix cross with Clang MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "clang" is not the correct value for CC when cross compiling — it should be the prefixed, wrapped clang for the host platform. Let's force the use of our original CC in all cases. The default flags of -ansi -pedantic don't matter to us — it builds fine without -ansi, and -pedantic doesn't really belong in a package build. This is probably why the author put them in CC to begin with. There's also no need tot modify the Makefile to change = to ?=, as = variables can be overridden on the command line. --- pkgs/development/libraries/gsm/default.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkgs/development/libraries/gsm/default.nix b/pkgs/development/libraries/gsm/default.nix index 5905fdff7e48..a964c4e4bcb6 100644 --- a/pkgs/development/libraries/gsm/default.nix +++ b/pkgs/development/libraries/gsm/default.nix @@ -18,8 +18,6 @@ stdenv.mkDerivation rec { }; patchPhase = '' - substituteInPlace Makefile \ - --replace "= gcc " "?= gcc " # Fix include directory sed -e 's,$(GSM_INSTALL_ROOT)/inc,$(GSM_INSTALL_ROOT)/include/gsm,' -i Makefile '' + optionalString (!staticSupport) ( @@ -37,10 +35,14 @@ stdenv.mkDerivation rec { '' ); + preBuild = '' + makeFlagsArray+=(CC="$CC") + ''; + makeFlags = [ "SHELL=${stdenv.shell}" "INSTALL_ROOT=$(out)" - ] ++ optional stdenv.cc.isClang "CC=clang"; + ]; preInstall = "mkdir -p $out/{bin,lib,man/man1,man/man3,include/gsm}";