minimal-bootstrap: remove glibc and gcc2

These components aren't needed in the dependency chain anymore but take significant time to build in `minimal-bootstrap.test`
This commit is contained in:
Emily Trau 2023-10-08 16:50:10 -07:00
parent cc51aa2b0f
commit 6eb660c22f
3 changed files with 0 additions and 278 deletions

View File

@ -73,17 +73,6 @@ lib.makeScope
bootGawk = gawk-mes;
};
gcc2 = callPackage ./gcc/2.nix {
bash = bash_2_05;
gcc = gcc2-mes;
glibc = glibc22;
};
gcc2-mes = callPackage ./gcc/2.nix {
bash = bash_2_05;
tinycc = tinycc-mes;
mesBootstrap = true;
};
gcc46 = callPackage ./gcc/4.6.nix {
tinycc = tinycc-musl;
gnumake = gnumake-musl;
@ -115,11 +104,6 @@ lib.makeScope
gawk = gawk-mes;
};
inherit (callPackage ./glibc {
bash = bash_2_05;
gnused = gnused-mes;
}) glibc22;
gnugrep = callPackage ./gnugrep {
bash = bash_2_05;
tinycc = tinycc-mes;
@ -226,8 +210,6 @@ lib.makeScope
echo ${findutils.tests.get-version}
echo ${gawk-mes.tests.get-version}
echo ${gawk.tests.get-version}
echo ${gcc2.tests.get-version}
echo ${gcc2-mes.tests.get-version}
echo ${gcc46.tests.get-version}
echo ${gcc46-cxx.tests.hello-world}
echo ${gcc8.tests.hello-world}

View File

@ -1,140 +0,0 @@
{ lib
, buildPlatform
, hostPlatform
, fetchurl
, bash
, gnumake
, gnupatch
, gnugrep
, gnutar
, gzip
, heirloom
, binutils
, mesBootstrap ? false, tinycc ? null, mes-libc
, gcc ? null, glibc ? null, linux-headers
}:
assert mesBootstrap -> tinycc != null;
assert !mesBootstrap -> gcc != null && glibc != null;
let
# Gcc-2.95.3 is the most recent GCC that is supported by what the Mes C
# Library v0.16 offers. Gcc-3.x (and 4.x) place higher demands on a C
# library, such as dir.h/struct DIR/readdir, locales, signals... Also,
# with gcc-2.95.3, binutils (2.14.0, 2.20.1a) and glibc-2.2.5 we found a
# GNU toolchain triplet "that works".
# - from guix/gnu/packages/commencement.scm
pname = "gcc" + lib.optionalString mesBootstrap "-mes";
version = "2.95.3";
src = fetchurl {
url = "mirror://gnu/gcc/gcc-${version}/gcc-core-${version}.tar.gz";
sha256 = "1xvfy4pqhrd5v2cv8lzf63iqg92k09g6z9n2ah6ndd4h17k1x0an";
};
patches = [
# This patch enables building gcc-2.95.3 using TCC and Mes C Library.
# * Disable building DOC
# * Avoid running `fixproto'.
# * Force running `fixinc'.
# * Replace Makefile trickery of creating an libgcc1.a archive, then
# extracting the .o files later to create a new libgcc2.a archive.
# Instead, keep temporary .o files.
(fetchurl {
url = "https://git.savannah.gnu.org/cgit/guix.git/plain/gnu/packages/patches/gcc-boot-2.95.3.patch?id=50249cab3a98839ade2433456fe618acc6f804a5";
sha256 = "03l3jaxch6d76mx4zkn6ky64paj58jk0biddck01qd4bnw9z8hiw";
})
];
makeFlags = [
"LANGUAGES=c"
] ++ lib.optionals mesBootstrap [
"LIBGCC2_INCLUDES=\"-I ${mes-libc}/include\""
"BOOT_LDFLAGS=\" -B ${tinycc.libs}/lib\""
] ++ lib.optionals (!mesBootstrap) [
"LIBGCC2_INCLUDES=\"-I ${glibc}/include -I ${linux-headers}/include\""
];
in
bash.runCommand "${pname}-${version}" {
inherit pname version;
nativeBuildInputs = [
(if mesBootstrap then tinycc.compiler else gcc)
gnumake
gnupatch
gnugrep
gnutar
gzip
heirloom.sed
binutils
];
passthru.tests.get-version = result:
bash.runCommand "${pname}-get-version-${version}" {} ''
${result}/bin/gcc --version
mkdir $out
'';
meta = with lib; {
description = "GNU Compiler Collection, version ${version}";
homepage = "https://gcc.gnu.org";
license = licenses.gpl3Plus;
maintainers = teams.minimal-bootstrap.members;
platforms = platforms.unix;
};
} ''
# Unpack
tar xzf ${src}
cd gcc-${version}
# Patch
${lib.concatMapStringsSep "\n" (f: "patch -Np1 -i ${f}") patches}
# /build/glibc-2.2.5/intl/loadmsgcat.c:334: multiple definition of `_nl_load_domain'
# ../intl/libintl.a(loadmsgcat.o):/build/gcc-2.95.3/texinfo/intl/loadmsgcat.c:66: first defined here
rm -R texinfo
mkdir -p texinfo
echo 'all:'>texinfo/Makefile.in
echo 'install:'>>texinfo/Makefile.in
# Configure
${if mesBootstrap then ''
export CC="tcc -B ${tinycc.libs}/lib -D __GLIBC_MINOR__=6"
export CPP="tcc -E"
export ac_cv_func_setlocale=no
'' else ''
export CC="gcc -I${glibc}/include -I${linux-headers}/include -I${gcc}/lib/gcc-lib/${hostPlatform.config}/${version}/include"
export CPP="gcc -E -I${glibc}/include -I${linux-headers}/include -I${gcc}/lib/gcc-lib/${hostPlatform.config}/${version}/include"
export LIBRARY_PATH="${glibc}/lib"
export LIBS="-lc -lnss_files -lnss_dns -lresolv"
''}
export OLDCC="$CC"
export CC_FOR_BUILD="$CC"
export AR=ar
export RANLIB=ranlib
export ac_cv_c_float_format='IEEE (little-endian)'
bash ./configure \
--build=${buildPlatform.config} \
--host=${hostPlatform.config} \
--enable-static \
--disable-shared \
--disable-werror \
--prefix=$out
# no info at this stage
touch gcc/cpp.info gcc/gcc.info
# Build
make ${lib.concatStringsSep " " makeFlags}
# Install
make install
mkdir tmp
cd tmp
ar x ../gcc/libgcc2.a
${lib.optionalString mesBootstrap "ar x ${tinycc.libs}/lib/libtcc1.a"}
ar r $out/lib/gcc-lib/${hostPlatform.config}/${version}/libgcc.a *.o
cd ..
cp gcc/libgcc2.a $out/lib/libgcc2.a
${lib.optionalString mesBootstrap ''
ar x ${tinycc.libs}/lib/libtcc1.a
ar x ${tinycc.libs}/lib/libc.a
ar r $out/lib/gcc-lib/${hostPlatform.config}/${version}/libc.a libc.o libtcc1.o
''}
''

View File

@ -1,120 +0,0 @@
{ lib
, buildPlatform
, hostPlatform
, fetchurl
, bash
, gcc2-mes
, gnumake
, gnupatch
, gnused
, gnugrep
, gnutar
, gzip
, gawk
, heirloom
, binutils
, linux-headers
}:
let
pname = "glibc";
buildGlibc = { version, src, patches, configureFlags, gcc, CC, CPP }:
bash.runCommand "${pname}-${version}" {
inherit pname version;
nativeBuildInputs = [
gcc
gnumake
gnupatch
gnused
gnugrep
gnutar
gzip
gawk
binutils
];
meta = with lib; {
description = "The GNU C Library";
homepage = "https://www.gnu.org/software/libc";
license = licenses.lgpl2Plus;
maintainers = teams.minimal-bootstrap.members;
platforms = platforms.linux;
};
} ''
# Unpack
tar xzf ${src}
cd glibc-${version}
# Patch
${lib.concatMapStringsSep "\n" (f: "patch -Np1 -i ${f}") patches}
# Configure
export CC="${CC}"
export CPP="${CPP}"
bash ./configure --prefix=$out ${lib.concatStringsSep " " (
[
"--build=${buildPlatform.config}"
"--host=${hostPlatform.config}"
"--with-headers=${linux-headers}/include"
"--enable-static"
"--disable-shared"
] ++ configureFlags)}
# Build
make
# Install
# GNU sed w/ mes-libc crashes on certain stdio actions
export PATH="${heirloom.sed}/bin:$PATH"
make install
'';
in
{
glibc22 = buildGlibc rec {
# GNU C Library 2.2.5 is the most recent glibc that we managed to build
# using gcc-2.95.3. Newer versions (2.3.x, 2.6, 2.1x) seem to need a newer
# gcc.
# - from guix/gnu/packages/commencement.scm
version = "2.2.5";
src = fetchurl {
url = "mirror://gnu/glibc/glibc-${version}.tar.gz";
sha256 = "1vl48i16gx6h68whjyhgnn1s57vqq32f9ygfa2fls7pdkbsqvp2q";
};
patches = [
# This patch enables building glibc-2.2.5 using TCC and GNU Make 4.x and Mes C Library.
# * Makefile: Do not assemble from stdin, use file indirection.
# * Makefile: Add new target: install-lib-all.
# * Makefile: Avoid building stub DOC.
# * [_LIBC_REENTRANT]: Add missing guarding.
# * [MES_BOOTSTRAP]: Disable some GCC extensions.
# * [MES_BOOTSTRAP]: Add missing GCC div/mod defines.
(fetchurl {
url = "https://git.savannah.gnu.org/cgit/guix.git/plain/gnu/packages/patches/glibc-boot-${version}.patch?id=50249cab3a98839ade2433456fe618acc6f804a5";
sha256 = "1nyz2dr9g7scqwwygd6jvbl7xxpwh11ryvgdz8aikkkna02q1pm8";
})
# We want to allow builds in chroots that lack /bin/sh. Thus, system(3)
# and popen(3) need to be tweaked to use the right shell. For the bootstrap
# glibc, we just use whatever `sh' can be found in $PATH. The final glibc
# instead uses the hard-coded absolute file name of `bash'.
(fetchurl {
url = "https://git.savannah.gnu.org/cgit/guix.git/plain/gnu/packages/patches/glibc-bootstrap-system-${version}.patch?id=50249cab3a98839ade2433456fe618acc6f804a5";
sha256 = "1l67w9rysrlsg2i0r210qxxn37h2969ba9lx7pp3ywlnikvi98m8";
})
];
configureFlags = [
"--disable-sanity-checks"
"--enable-static-nss"
"--without-__thread"
"--without-cvs"
"--without-gd"
"--without-tls"
];
gcc = gcc2-mes;
CC = "gcc -D MES_BOOTSTRAP=1 -D BOOTSTRAP_GLIBC=1 -L $(pwd)";
CPP = "gcc -E -D MES_BOOTSTRAP=1 -D BOOTSTRAP_GLIBC=1";
};
}