From 4e427c9df0f1d021a8d7dc0437f73d9582b21c67 Mon Sep 17 00:00:00 2001 From: 06kellyjac Date: Wed, 31 Aug 2022 12:35:42 +0100 Subject: [PATCH] tinycc: avoid replacing VERSION when it would cause errors Still doesn't fix the general build of tinycc on darwin --- pkgs/development/compilers/tinycc/default.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pkgs/development/compilers/tinycc/default.nix b/pkgs/development/compilers/tinycc/default.nix index 97a86a3fa783..21eb497a116a 100644 --- a/pkgs/development/compilers/tinycc/default.nix +++ b/pkgs/development/compilers/tinycc/default.nix @@ -8,6 +8,10 @@ , which }: +let + # avoid "malformed 32-bit x.y.z" error on mac when using clang + isCleanVer = version: builtins.match "^[0-9]\\.+[0-9]+\\.[0-9]+" version != null; +in stdenv.mkDerivation rec { pname = "tcc"; version = "unstable-2022-07-15"; @@ -62,7 +66,11 @@ stdenv.mkDerivation rec { ]; preConfigure = '' - echo ${version} > VERSION + ${ + if stdenv.isDarwin && ! isCleanVer version + then "echo 'not overwriting VERSION since it would upset ld'" + else "echo ${version} > VERSION" + } configureFlagsArray+=("--elfinterp=$(< $NIX_CC/nix-support/dynamic-linker)") '';