From ea7533164cc98ad176e7ec8bf4f797f515a1a9e0 Mon Sep 17 00:00:00 2001 From: Emily Trau Date: Wed, 24 May 2023 11:58:37 +1000 Subject: [PATCH] minimal-bootstrap.tinycc-*: static link by default --- pkgs/os-specific/linux/minimal-bootstrap/bzip2/default.nix | 2 +- pkgs/os-specific/linux/minimal-bootstrap/gawk/default.nix | 2 +- .../os-specific/linux/minimal-bootstrap/gnugrep/default.nix | 2 +- .../os-specific/linux/minimal-bootstrap/gnumake/default.nix | 4 ++-- .../linux/minimal-bootstrap/gnupatch/default.nix | 2 +- pkgs/os-specific/linux/minimal-bootstrap/gnutar/default.nix | 2 +- pkgs/os-specific/linux/minimal-bootstrap/gzip/default.nix | 2 +- .../linux/minimal-bootstrap/tinycc/bootstrappable.nix | 5 +++++ pkgs/os-specific/linux/minimal-bootstrap/tinycc/common.nix | 1 - pkgs/os-specific/linux/minimal-bootstrap/tinycc/mes.nix | 6 +++++- 10 files changed, 18 insertions(+), 10 deletions(-) diff --git a/pkgs/os-specific/linux/minimal-bootstrap/bzip2/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/bzip2/default.nix index cce36a229501..84fb7a0a1b73 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/bzip2/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/bzip2/default.nix @@ -61,7 +61,7 @@ bash.runCommand "${pname}-${version}" { # Build make \ - CC="tcc -static -B ${tinycc.libs}/lib -I ." \ + CC="tcc -B ${tinycc.libs}/lib -I ." \ AR="tcc -ar" \ bzip2 bzip2recover diff --git a/pkgs/os-specific/linux/minimal-bootstrap/gawk/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/gawk/default.nix index a395fe4b2a6c..d840a204416d 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/gawk/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/gawk/default.nix @@ -59,7 +59,7 @@ bash.runCommand "${pname}-${version}" { ${lib.concatMapStringsSep "\n" (f: "patch -Np0 -i ${f}") patches} # Configure - export CC="tcc -static -B ${tinycc.libs}/lib" + export CC="tcc -B ${tinycc.libs}/lib" export ac_cv_func_getpgrp_void=yes export ac_cv_func_tzset=yes bash ./configure \ diff --git a/pkgs/os-specific/linux/minimal-bootstrap/gnugrep/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/gnugrep/default.nix index 434b92fafe6f..b2899961dfa2 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/gnugrep/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/gnugrep/default.nix @@ -53,7 +53,7 @@ bash.runCommand "${pname}-${version}" { cp ${makefile} Makefile # Build - make CC="tcc -static -B ${tinycc.libs}/lib" + make CC="tcc -B ${tinycc.libs}/lib" # Install make install PREFIX=$out diff --git a/pkgs/os-specific/linux/minimal-bootstrap/gnumake/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/gnumake/default.nix index 862c3cb12714..823d314f2802 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/gnumake/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/gnumake/default.nix @@ -45,7 +45,7 @@ let ./configure \ --build i686-pc-linux-gnu \ --host i686-pc-linux-gnu \ - CC="${tinycc.compiler}/bin/tcc -B ${tinycc.libs}/lib -static" \ + CC="${tinycc.compiler}/bin/tcc -B ${tinycc.libs}/lib" \ ac_cv_func_dup=no - `ac_cv_func_dup` disabled as mes-libc doesn't implement tmpfile() @@ -178,7 +178,7 @@ kaem.runCommand "${pname}-${version}" { ${lib.concatMapStringsSep "\n" (f: "CC -c ${f}") sources} # Link - CC -static -o make ${lib.concatStringsSep " " objects} + CC -o make ${lib.concatStringsSep " " objects} # Check ./make --version diff --git a/pkgs/os-specific/linux/minimal-bootstrap/gnupatch/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/gnupatch/default.nix index e698d170b90e..8e6f6696c68c 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/gnupatch/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/gnupatch/default.nix @@ -95,7 +95,7 @@ kaem.runCommand "${pname}-${version}" { ${lib.concatMapStringsSep "\n" (f: "CC -c ${f}") sources} # Link - CC -static -o patch ${lib.concatStringsSep " " objects} + CC -o patch ${lib.concatStringsSep " " objects} # Check ./patch --version diff --git a/pkgs/os-specific/linux/minimal-bootstrap/gnutar/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/gnutar/default.nix index 446f7109eda3..e07561b3e7e5 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/gnutar/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/gnutar/default.nix @@ -50,7 +50,7 @@ bash.runCommand "${pname}-${version}" { cd tar-${version} # Configure - export CC="tcc -static -B ${tinycc.libs}/lib" + export CC="tcc -B ${tinycc.libs}/lib" bash ./configure \ --build=${buildPlatform.config} \ --host=${hostPlatform.config} \ diff --git a/pkgs/os-specific/linux/minimal-bootstrap/gzip/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/gzip/default.nix index b02486b4d1e1..39353bf2b48b 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/gzip/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/gzip/default.nix @@ -46,7 +46,7 @@ bash.runCommand "${pname}-${version}" { cd gzip-${version} # Configure - export CC="tcc -static -B ${tinycc.libs}/lib -Dstrlwr=unused" + export CC="tcc -B ${tinycc.libs}/lib -Dstrlwr=unused" bash ./configure --prefix=$out # Build diff --git a/pkgs/os-specific/linux/minimal-bootstrap/tinycc/bootstrappable.nix b/pkgs/os-specific/linux/minimal-bootstrap/tinycc/bootstrappable.nix index 6d366776a66b..83d89012b0fc 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/tinycc/bootstrappable.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/tinycc/bootstrappable.nix @@ -29,6 +29,11 @@ let mkdir -p ''${out} cd ''${out} untar --file ''${NIX_BUILD_TOP}/tinycc.tar + + # Patch + cd tinycc-${rev} + # Static link by default + replace --file libtcc.c --output libtcc.c --match-on "s->ms_extensions = 1;" --replace-with "s->ms_extensions = 1; s->static_link = 1;" '') + "/tinycc-${rev}"; meta = with lib; { diff --git a/pkgs/os-specific/linux/minimal-bootstrap/tinycc/common.nix b/pkgs/os-specific/linux/minimal-bootstrap/tinycc/common.nix index 68fa84fd7ad1..28dde3298767 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/tinycc/common.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/tinycc/common.nix @@ -74,7 +74,6 @@ rec { -B ${prev.libs}/lib \ -g \ -v \ - -static \ -o ''${out}/bin/tcc \ -D BOOTSTRAP=1 \ ${options} \ diff --git a/pkgs/os-specific/linux/minimal-bootstrap/tinycc/mes.nix b/pkgs/os-specific/linux/minimal-bootstrap/tinycc/mes.nix index 980e7d2fa71c..55f6321412db 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/tinycc/mes.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/tinycc/mes.nix @@ -25,6 +25,11 @@ let mkdir -p ''${out} cd ''${out} untar --file ''${NIX_BUILD_TOP}/tinycc.tar + + # Patch + cd tinycc-${builtins.substring 0 7 rev} + # Static link by default + replace --file libtcc.c --output libtcc.c --match-on "s->ms_extensions = 1;" --replace-with "s->ms_extensions = 1; s->static_link = 1;" '') + "/tinycc-${builtins.substring 0 7 rev}"; meta = with lib; { @@ -39,7 +44,6 @@ let mkdir ''${out} ${tinycc-bootstrappable.compiler}/bin/tcc \ -B ${tinycc-bootstrappable.libs}/lib \ - -static \ -DC2STR \ -o c2str \ ${src}/conftest.c