Merge pull request #257559 from emilytrau/minimal-glibc-removal
minimal-bootstrap.*: rebuild packages with musl
This commit is contained in:
commit
3d007e8a60
27 changed files with 632 additions and 341 deletions
|
@ -4,15 +4,14 @@
|
|||
, fetchurl
|
||||
, bootBash
|
||||
, gnumake
|
||||
, gnupatch
|
||||
, gnused
|
||||
, gnugrep
|
||||
, gnutar
|
||||
, gawk
|
||||
, gzip
|
||||
, gcc
|
||||
, glibc
|
||||
, binutils
|
||||
, linux-headers
|
||||
, diffutils
|
||||
, tinycc
|
||||
, derivationWithMeta
|
||||
, bash
|
||||
, coreutils
|
||||
|
@ -25,19 +24,26 @@ let
|
|||
url = "mirror://gnu/bash/bash-${version}.tar.gz";
|
||||
sha256 = "132qng0jy600mv1fs95ylnlisx2wavkkgpb19c6kmz7lnmjhjwhk";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# flush output for generated code
|
||||
./mksignames-flush.patch
|
||||
];
|
||||
in
|
||||
bootBash.runCommand "${pname}-${version}" {
|
||||
inherit pname version;
|
||||
|
||||
nativeBuildInputs = [
|
||||
gcc
|
||||
binutils
|
||||
coreutils
|
||||
tinycc.compiler
|
||||
gnumake
|
||||
gnupatch
|
||||
gnused
|
||||
gnugrep
|
||||
gnutar
|
||||
gawk
|
||||
gzip
|
||||
diffutils
|
||||
];
|
||||
|
||||
passthru.runCommand = name: env: buildCommand:
|
||||
|
@ -78,22 +84,23 @@ bootBash.runCommand "${pname}-${version}" {
|
|||
tar xzf ${src}
|
||||
cd bash-${version}
|
||||
|
||||
# Patch
|
||||
${lib.concatMapStringsSep "\n" (f: "patch -Np1 -i ${f}") patches}
|
||||
|
||||
# Configure
|
||||
export CC="gcc -I${glibc}/include -I${linux-headers}/include"
|
||||
export LIBRARY_PATH="${glibc}/lib"
|
||||
export LIBS="-lc -lnss_files -lnss_dns -lresolv"
|
||||
export ac_cv_func_dlopen=no
|
||||
export CC="tcc -B ${tinycc.libs}/lib"
|
||||
export AR="tcc -ar"
|
||||
export LD=tcc
|
||||
bash ./configure \
|
||||
--prefix=$out \
|
||||
--build=${buildPlatform.config} \
|
||||
--host=${hostPlatform.config} \
|
||||
--disable-nls \
|
||||
--disable-net-redirections
|
||||
--without-bash-malloc
|
||||
|
||||
# Build
|
||||
make SHELL=bash
|
||||
make -j $NIX_BUILD_CORES SHELL=bash
|
||||
|
||||
# Install
|
||||
make install
|
||||
make -j $NIX_BUILD_CORES install
|
||||
ln -s bash $out/bin/sh
|
||||
''
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
--- a/support/mksignames.c
|
||||
+++ b/support/mksignames.c
|
||||
@@ -68,6 +68,7 @@ write_signames (stream)
|
||||
fprintf (stream, "};\n\n");
|
||||
fprintf (stream, "#define initialize_signames()\n\n");
|
||||
#endif
|
||||
+ fflush(stream);
|
||||
}
|
||||
|
||||
int
|
|
@ -3,35 +3,29 @@
|
|||
, hostPlatform
|
||||
, fetchurl
|
||||
, bash
|
||||
, coreutils
|
||||
, gnumake
|
||||
, gnupatch
|
||||
, gnused
|
||||
, gnugrep
|
||||
, gnutar
|
||||
, gawk
|
||||
, bzip2
|
||||
, sed
|
||||
, mesBootstrap ? false, tinycc ? null
|
||||
, gcc ? null, glibc ? null, binutils ? null, linux-headers
|
||||
, diffutils
|
||||
, gnutar
|
||||
, xz
|
||||
, tinycc
|
||||
}:
|
||||
assert mesBootstrap -> tinycc != null;
|
||||
assert !mesBootstrap -> gcc != null && glibc != null && binutils != null;
|
||||
|
||||
let
|
||||
pname = "binutils" + lib.optionalString mesBootstrap "-mes";
|
||||
version = "2.20.1";
|
||||
rev = "a";
|
||||
# Based on https://github.com/ZilchOS/bootstrap-from-tcc/blob/2e0c68c36b3437386f786d619bc9a16177f2e149/using-nix/2a1-static-binutils.nix
|
||||
pname = "binutils";
|
||||
version = "2.41";
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://gnu/binutils/binutils-${version}${rev}.tar.bz2";
|
||||
sha256 = "0r7dr0brfpchh5ic0z9r4yxqn4ybzmlh25sbp30cacqk8nb7rlvi";
|
||||
url = "mirror://gnu/binutils/binutils-${version}.tar.xz";
|
||||
hash = "sha256-rppXieI0WeWWBuZxRyPy0//DHAMXQZHvDQFb3wYAdFA=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# Enables building binutils using TCC and Mes C Library
|
||||
(fetchurl {
|
||||
url = "https://git.savannah.gnu.org/cgit/guix.git/plain/gnu/packages/patches/binutils-boot-2.20.1a.patch?id=50249cab3a98839ade2433456fe618acc6f804a5";
|
||||
sha256 = "086sf6an2k56axvs4jlky5n3hs2l3rq8zq5d37h0b69cdyh7igpn";
|
||||
})
|
||||
|
||||
# Make binutils output deterministic by default.
|
||||
./deterministic.patch
|
||||
];
|
||||
|
@ -40,10 +34,10 @@ let
|
|||
"--prefix=${placeholder "out"}"
|
||||
"--build=${buildPlatform.config}"
|
||||
"--host=${hostPlatform.config}"
|
||||
"--disable-nls"
|
||||
"--disable-shared"
|
||||
"--disable-werror"
|
||||
"--with-sysroot=/"
|
||||
"--enable-deterministic-archives"
|
||||
# depends on bison
|
||||
"--disable-gprofng"
|
||||
|
||||
# Turn on --enable-new-dtags by default to make the linker set
|
||||
# RUNPATH instead of RPATH on binaries. This is important because
|
||||
|
@ -60,15 +54,16 @@ bash.runCommand "${pname}-${version}" {
|
|||
inherit pname version;
|
||||
|
||||
nativeBuildInputs = [
|
||||
(if mesBootstrap then tinycc.compiler else gcc)
|
||||
tinycc.compiler
|
||||
gnumake
|
||||
gnupatch
|
||||
gnused
|
||||
gnugrep
|
||||
gnutar
|
||||
gawk
|
||||
bzip2
|
||||
sed
|
||||
] ++ lib.optional (!mesBootstrap) binutils;
|
||||
diffutils
|
||||
gnutar
|
||||
xz
|
||||
];
|
||||
|
||||
passthru.tests.get-version = result:
|
||||
bash.runCommand "${pname}-get-version-${version}" {} ''
|
||||
|
@ -85,32 +80,35 @@ bash.runCommand "${pname}-${version}" {
|
|||
};
|
||||
} ''
|
||||
# Unpack
|
||||
cp ${src} binutils.tar.bz2
|
||||
bunzip2 binutils.tar.bz2
|
||||
cp ${src} binutils.tar.xz
|
||||
unxz binutils.tar.xz
|
||||
tar xf binutils.tar
|
||||
rm binutils.tar
|
||||
cd binutils-${version}
|
||||
|
||||
# Patch
|
||||
${lib.concatMapStringsSep "\n" (f: "patch -Np1 -i ${f}") patches}
|
||||
sed -i 's|/bin/sh|${bash}/bin/bash|' \
|
||||
missing install-sh mkinstalldirs
|
||||
# see libtool's 74c8993c178a1386ea5e2363a01d919738402f30
|
||||
sed -i 's/| \$NL2SP/| sort | $NL2SP/' ltmain.sh
|
||||
# alias makeinfo to true
|
||||
mkdir aliases
|
||||
ln -s ${coreutils}/bin/true aliases/makeinfo
|
||||
export PATH="$(pwd)/aliases/:$PATH"
|
||||
|
||||
# Configure
|
||||
${if mesBootstrap then ''
|
||||
export CC="tcc -B ${tinycc.libs}/lib -D __GLIBC_MINOR__=6 -D MES_BOOTSTRAP=1"
|
||||
export CC="tcc -B ${tinycc.libs}/lib"
|
||||
export AR="tcc -ar"
|
||||
'' else ''
|
||||
export CC="gcc -B ${glibc}/lib -I${glibc}/include -I${linux-headers}/include"
|
||||
export CPP="gcc -E -I${glibc}/include -I${linux-headers}/include"
|
||||
export AR="ar"
|
||||
export LIBRARY_PATH="${glibc}/lib"
|
||||
export LIBS="-lc -lnss_files -lnss_dns -lresolv"
|
||||
''}
|
||||
export SED=sed
|
||||
export lt_cv_sys_max_cmd_len=32768
|
||||
export CFLAGS="-D__LITTLE_ENDIAN__=1"
|
||||
bash ./configure ${lib.concatStringsSep " " configureFlags}
|
||||
|
||||
# Build
|
||||
make
|
||||
make -j $NIX_BUILD_CORES all-libiberty all-gas all-bfd all-libctf all-zlib all-gprof
|
||||
make all-ld # race condition on ld/.deps/ldwrite.Po, serialize
|
||||
make -j $NIX_BUILD_CORES
|
||||
|
||||
# Install
|
||||
make install
|
||||
make -j $NIX_BUILD_CORES install
|
||||
''
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
, bash
|
||||
, tinycc
|
||||
, gnumake
|
||||
, gnupatch
|
||||
, gnutar
|
||||
, gzip
|
||||
}:
|
||||
let
|
||||
|
@ -14,16 +14,6 @@ let
|
|||
url = "https://sourceware.org/pub/bzip2/bzip2-${version}.tar.gz";
|
||||
sha256 = "0s92986cv0p692icqlw1j42y9nld8zd83qwhzbqd61p1dqbh6nmb";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# mes libc has no time support, so we remove that.
|
||||
# It also does not have fch{own,mod}, which we don't care about in the bootstrap
|
||||
# anyway, so we can null-op those calls.
|
||||
(fetchurl {
|
||||
url = "https://github.com/fosslinux/live-bootstrap/raw/87e9d7db9d22b400d1c05247254ac39ee2577e80/sysa/bzip2-1.0.8/patches/mes-libc.patch";
|
||||
sha256 = "14dciwib28h413skzfkh7samzh8x87dmwhldyxxphff04pvl1j3c";
|
||||
})
|
||||
];
|
||||
in
|
||||
bash.runCommand "${pname}-${version}" {
|
||||
inherit pname version;
|
||||
|
@ -31,13 +21,13 @@ bash.runCommand "${pname}-${version}" {
|
|||
nativeBuildInputs = [
|
||||
tinycc.compiler
|
||||
gnumake
|
||||
gnupatch
|
||||
gnutar
|
||||
gzip
|
||||
];
|
||||
|
||||
passthru.tests.get-version = result:
|
||||
bash.runCommand "${pname}-get-version-${version}" {} ''
|
||||
${result}/bin/bzip2 --version --help
|
||||
${result}/bin/bzip2 --help
|
||||
mkdir $out
|
||||
'';
|
||||
|
||||
|
@ -50,21 +40,16 @@ bash.runCommand "${pname}-${version}" {
|
|||
};
|
||||
} ''
|
||||
# Unpack
|
||||
cp ${src} bzip2.tar.gz
|
||||
gunzip bzip2.tar.gz
|
||||
untar --file bzip2.tar
|
||||
rm bzip2.tar
|
||||
tar xzf ${src}
|
||||
cd bzip2-${version}
|
||||
|
||||
# Patch
|
||||
${lib.concatMapStringsSep "\n" (f: "patch -Np0 -i ${f}") patches}
|
||||
|
||||
# Build
|
||||
make \
|
||||
CC="tcc -B ${tinycc.libs}/lib -I ." \
|
||||
-j $NIX_BUILD_CORES \
|
||||
CC="tcc -B ${tinycc.libs}/lib" \
|
||||
AR="tcc -ar" \
|
||||
bzip2 bzip2recover
|
||||
|
||||
# Install
|
||||
make install PREFIX=$out
|
||||
make install -j $NIX_BUILD_CORES PREFIX=$out
|
||||
''
|
||||
|
|
74
pkgs/os-specific/linux/minimal-bootstrap/coreutils/musl.nix
Normal file
74
pkgs/os-specific/linux/minimal-bootstrap/coreutils/musl.nix
Normal file
|
@ -0,0 +1,74 @@
|
|||
{ lib
|
||||
, buildPlatform
|
||||
, hostPlatform
|
||||
, fetchurl
|
||||
, bash
|
||||
, tinycc
|
||||
, gnumake
|
||||
, gnugrep
|
||||
, gnused
|
||||
, gawk
|
||||
, gnutar
|
||||
, gzip
|
||||
}:
|
||||
let
|
||||
pname = "coreutils";
|
||||
version = "9.4";
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://gnu/coreutils/coreutils-${version}.tar.gz";
|
||||
hash = "sha256-X2ANkJOXOwr+JTk9m8GMRPIjJlf0yg2V6jHHAutmtzk=";
|
||||
};
|
||||
|
||||
configureFlags = [
|
||||
"--prefix=${placeholder "out"}"
|
||||
"--build=${buildPlatform.config}"
|
||||
"--host=${hostPlatform.config}"
|
||||
# musl 1.1.x doesn't use 64bit time_t
|
||||
"--disable-year2038"
|
||||
# libstdbuf.so fails in static builds
|
||||
"--enable-no-install-program=stdbuf"
|
||||
];
|
||||
in
|
||||
bash.runCommand "${pname}-${version}" {
|
||||
inherit pname version;
|
||||
|
||||
nativeBuildInputs = [
|
||||
tinycc.compiler
|
||||
gnumake
|
||||
gnused
|
||||
gnugrep
|
||||
gawk
|
||||
gnutar
|
||||
gzip
|
||||
];
|
||||
|
||||
passthru.tests.get-version = result:
|
||||
bash.runCommand "${pname}-get-version-${version}" {} ''
|
||||
${result}/bin/cat --version
|
||||
mkdir $out
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "The GNU Core Utilities";
|
||||
homepage = "https://www.gnu.org/software/coreutils";
|
||||
license = licenses.gpl3Plus;
|
||||
maintainers = teams.minimal-bootstrap.members;
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
} ''
|
||||
# Unpack
|
||||
tar xzf ${src}
|
||||
cd coreutils-${version}
|
||||
|
||||
# Configure
|
||||
export CC="tcc -B ${tinycc.libs}/lib"
|
||||
export LD=tcc
|
||||
bash ./configure ${lib.concatStringsSep " " configureFlags}
|
||||
|
||||
# Build
|
||||
make -j $NIX_BUILD_CORES AR="tcc -ar" MAKEINFO="true"
|
||||
|
||||
# Install
|
||||
make -j $NIX_BUILD_CORES install MAKEINFO="true"
|
||||
''
|
|
@ -17,46 +17,46 @@ lib.makeScope
|
|||
|
||||
bash = callPackage ./bash {
|
||||
bootBash = bash_2_05;
|
||||
gcc = gcc2;
|
||||
glibc = glibc22;
|
||||
gawk = gawk-mes;
|
||||
tinycc = tinycc-musl;
|
||||
coreutils = coreutils-musl;
|
||||
gnumake = gnumake-musl;
|
||||
gnutar = gnutar-musl;
|
||||
};
|
||||
|
||||
binutils = callPackage ./binutils {
|
||||
bash = bash_2_05;
|
||||
gcc = gcc2;
|
||||
binutils = binutils-mes;
|
||||
glibc = glibc22;
|
||||
sed = heirloom.sed;
|
||||
gawk = gawk-mes;
|
||||
};
|
||||
binutils-mes = callPackage ./binutils {
|
||||
bash = bash_2_05;
|
||||
tinycc = tinycc-mes;
|
||||
sed = heirloom.sed;
|
||||
gawk = gawk-mes;
|
||||
mesBootstrap = true;
|
||||
tinycc = tinycc-musl;
|
||||
gnumake = gnumake-musl;
|
||||
gnutar = gnutar-musl;
|
||||
};
|
||||
|
||||
bzip2 = callPackage ./bzip2 {
|
||||
bash = bash_2_05;
|
||||
tinycc = tinycc-mes;
|
||||
tinycc = tinycc-musl;
|
||||
gnumake = gnumake-musl;
|
||||
gnutar = gnutar-musl;
|
||||
};
|
||||
|
||||
coreutils = callPackage ./coreutils { tinycc = tinycc-mes; };
|
||||
coreutils-musl = callPackage ./coreutils/musl.nix {
|
||||
bash = bash_2_05;
|
||||
tinycc = tinycc-musl;
|
||||
gnumake = gnumake-musl;
|
||||
gnutar = gnutar-musl;
|
||||
};
|
||||
|
||||
diffutils = callPackage ./diffutils {
|
||||
bash = bash_2_05;
|
||||
gcc = gcc2;
|
||||
glibc = glibc22;
|
||||
gawk = gawk-mes;
|
||||
tinycc = tinycc-musl;
|
||||
gnumake = gnumake-musl;
|
||||
gnutar = gnutar-musl;
|
||||
};
|
||||
|
||||
findutils = callPackage ./findutils {
|
||||
bash = bash_2_05;
|
||||
gcc = gcc2;
|
||||
glibc = glibc22;
|
||||
gawk = gawk-mes;
|
||||
tinycc = tinycc-musl;
|
||||
gnumake = gnumake-musl;
|
||||
gnutar = gnutar-musl;
|
||||
};
|
||||
|
||||
gawk-mes = callPackage ./gawk/mes.nix {
|
||||
|
@ -67,34 +67,34 @@ lib.makeScope
|
|||
|
||||
gawk = callPackage ./gawk {
|
||||
bash = bash_2_05;
|
||||
gcc = gcc2;
|
||||
glibc = glibc22;
|
||||
tinycc = tinycc-musl;
|
||||
gnumake = gnumake-musl;
|
||||
gnutar = gnutar-musl;
|
||||
bootGawk = gawk-mes;
|
||||
};
|
||||
|
||||
gcc2 = callPackage ./gcc/2.nix {
|
||||
bash = bash_2_05;
|
||||
gcc = gcc2-mes;
|
||||
binutils = binutils-mes;
|
||||
glibc = glibc22;
|
||||
};
|
||||
gcc2-mes = callPackage ./gcc/2.nix {
|
||||
bash = bash_2_05;
|
||||
tinycc = tinycc-mes;
|
||||
binutils = binutils-mes;
|
||||
mesBootstrap = true;
|
||||
};
|
||||
|
||||
gcc46 = callPackage ./gcc/4.6.nix {
|
||||
gcc = gcc2;
|
||||
glibc = glibc22;
|
||||
tinycc = tinycc-musl;
|
||||
gnumake = gnumake-musl;
|
||||
gnutar = gnutar-musl;
|
||||
# FIXME: not sure why new gawk doesn't work
|
||||
gawk = gawk-mes;
|
||||
};
|
||||
|
||||
inherit (callPackage ./glibc {
|
||||
bash = bash_2_05;
|
||||
gnused = gnused-mes;
|
||||
gawk = gawk-mes;
|
||||
}) glibc22;
|
||||
|
||||
gnugrep = callPackage ./gnugrep {
|
||||
|
@ -104,26 +104,37 @@ lib.makeScope
|
|||
|
||||
gnumake = callPackage ./gnumake { tinycc = tinycc-mes; };
|
||||
|
||||
gnumake-musl = callPackage ./gnumake/musl.nix {
|
||||
bash = bash_2_05;
|
||||
tinycc = tinycc-musl;
|
||||
gawk = gawk-mes;
|
||||
gnumakeBoot = gnumake;
|
||||
};
|
||||
|
||||
gnupatch = callPackage ./gnupatch { tinycc = tinycc-mes; };
|
||||
|
||||
gnused = callPackage ./gnused {
|
||||
bash = bash_2_05;
|
||||
gcc = gcc2;
|
||||
glibc = glibc22;
|
||||
tinycc = tinycc-musl;
|
||||
gnused = gnused-mes;
|
||||
};
|
||||
gnused-mes = callPackage ./gnused {
|
||||
gnused-mes = callPackage ./gnused/mes.nix {
|
||||
bash = bash_2_05;
|
||||
tinycc = tinycc-mes;
|
||||
mesBootstrap = true;
|
||||
};
|
||||
|
||||
gnutar = callPackage ./gnutar {
|
||||
gnutar = callPackage ./gnutar/mes.nix {
|
||||
bash = bash_2_05;
|
||||
tinycc = tinycc-mes;
|
||||
gnused = gnused-mes;
|
||||
};
|
||||
|
||||
gnutar-musl = callPackage ./gnutar/musl.nix {
|
||||
bash = bash_2_05;
|
||||
tinycc = tinycc-musl;
|
||||
gnused = gnused-mes;
|
||||
};
|
||||
|
||||
gzip = callPackage ./gzip {
|
||||
bash = bash_2_05;
|
||||
tinycc = tinycc-mes;
|
||||
|
@ -152,6 +163,7 @@ lib.makeScope
|
|||
|
||||
musl = callPackage ./musl {
|
||||
gcc = gcc46;
|
||||
gnumake = gnumake-musl;
|
||||
};
|
||||
|
||||
stage0-posix = callPackage ./stage0-posix { };
|
||||
|
@ -167,9 +179,9 @@ lib.makeScope
|
|||
|
||||
xz = callPackage ./xz {
|
||||
bash = bash_2_05;
|
||||
tinycc = tinycc-mes;
|
||||
gawk = gawk-mes;
|
||||
inherit (heirloom) sed;
|
||||
tinycc = tinycc-musl;
|
||||
gnumake = gnumake-musl;
|
||||
gnutar = gnutar-musl;
|
||||
};
|
||||
|
||||
inherit (callPackage ./utils.nix { }) derivationWithMeta writeTextFile writeText;
|
||||
|
@ -178,8 +190,8 @@ lib.makeScope
|
|||
echo ${bash.tests.get-version}
|
||||
echo ${bash_2_05.tests.get-version}
|
||||
echo ${binutils.tests.get-version}
|
||||
echo ${binutils-mes.tests.get-version}
|
||||
echo ${bzip2.tests.get-version}
|
||||
echo ${coreutils-musl.tests.get-version}
|
||||
echo ${diffutils.tests.get-version}
|
||||
echo ${findutils.tests.get-version}
|
||||
echo ${gawk-mes.tests.get-version}
|
||||
|
@ -191,6 +203,7 @@ lib.makeScope
|
|||
echo ${gnused.tests.get-version}
|
||||
echo ${gnused-mes.tests.get-version}
|
||||
echo ${gnutar.tests.get-version}
|
||||
echo ${gnutar-musl.tests.get-version}
|
||||
echo ${gzip.tests.get-version}
|
||||
echo ${heirloom.tests.get-version}
|
||||
echo ${mes.compiler.tests.get-version}
|
||||
|
|
|
@ -3,38 +3,35 @@
|
|||
, hostPlatform
|
||||
, fetchurl
|
||||
, bash
|
||||
, gcc
|
||||
, glibc
|
||||
, binutils
|
||||
, linux-headers
|
||||
, tinycc
|
||||
, gnumake
|
||||
, gnugrep
|
||||
, gnused
|
||||
, gawk
|
||||
, gnutar
|
||||
, gzip
|
||||
, xz
|
||||
}:
|
||||
let
|
||||
pname = "diffutils";
|
||||
version = "2.8.1";
|
||||
# last version that can be built by tinycc-musl 0.9.27
|
||||
version = "3.8";
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://gnu/diffutils/diffutils-${version}.tar.gz";
|
||||
sha256 = "0nizs9r76aiymzasmj1jngl7s71jfzl9xfziigcls8k9n141f065";
|
||||
url = "mirror://gnu/diffutils/diffutils-${version}.tar.xz";
|
||||
hash = "sha256-pr3X0bMSZtEcT03mwbdI1GB6sCMa9RiPwlM9CuJDj+w=";
|
||||
};
|
||||
in
|
||||
bash.runCommand "${pname}-${version}" {
|
||||
inherit pname version;
|
||||
|
||||
nativeBuildInputs = [
|
||||
gcc
|
||||
binutils
|
||||
tinycc.compiler
|
||||
gnumake
|
||||
gnused
|
||||
gnugrep
|
||||
gawk
|
||||
gnutar
|
||||
gzip
|
||||
xz
|
||||
];
|
||||
|
||||
passthru.tests.get-version = result:
|
||||
|
@ -52,21 +49,23 @@ bash.runCommand "${pname}-${version}" {
|
|||
};
|
||||
} ''
|
||||
# Unpack
|
||||
tar xzf ${src}
|
||||
cp ${src} diffutils.tar.xz
|
||||
unxz diffutils.tar.xz
|
||||
tar xf diffutils.tar
|
||||
rm diffutils.tar
|
||||
cd diffutils-${version}
|
||||
|
||||
# Configure
|
||||
export C_INCLUDE_PATH="${glibc}/include:${linux-headers}/include"
|
||||
export LIBRARY_PATH="${glibc}/lib"
|
||||
export LIBS="-lc -lnss_files -lnss_dns -lresolv"
|
||||
export CC="tcc -B ${tinycc.libs}/lib"
|
||||
export LD=tcc
|
||||
bash ./configure \
|
||||
--prefix=$out \
|
||||
--build=${buildPlatform.config} \
|
||||
--host=${hostPlatform.config}
|
||||
|
||||
# Build
|
||||
make
|
||||
make -j $NIX_BUILD_CORES AR="tcc -ar"
|
||||
|
||||
# Install
|
||||
make install
|
||||
make -j $NIX_BUILD_CORES install
|
||||
''
|
||||
|
|
|
@ -3,38 +3,34 @@
|
|||
, hostPlatform
|
||||
, fetchurl
|
||||
, bash
|
||||
, gcc
|
||||
, glibc
|
||||
, binutils
|
||||
, linux-headers
|
||||
, tinycc
|
||||
, gnumake
|
||||
, gnugrep
|
||||
, gnused
|
||||
, gawk
|
||||
, gnutar
|
||||
, gzip
|
||||
, xz
|
||||
}:
|
||||
let
|
||||
pname = "findutils";
|
||||
version = "4.4.2";
|
||||
version = "4.9.0";
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://gnu/findutils/findutils-${version}.tar.gz";
|
||||
sha256 = "0amn0bbwqvsvvsh6drfwz20ydc2czk374lzw5kksbh6bf78k4ks3";
|
||||
url = "mirror://gnu/findutils/findutils-${version}.tar.xz";
|
||||
hash = "sha256-or+4wJ1DZ3DtxZ9Q+kg+eFsWGjt7nVR1c8sIBl/UYv4=";
|
||||
};
|
||||
in
|
||||
bash.runCommand "${pname}-${version}" {
|
||||
inherit pname version;
|
||||
|
||||
nativeBuildInputs = [
|
||||
gcc
|
||||
binutils
|
||||
tinycc.compiler
|
||||
gnumake
|
||||
gnused
|
||||
gnugrep
|
||||
gawk
|
||||
gnutar
|
||||
gzip
|
||||
xz
|
||||
];
|
||||
|
||||
passthru.tests.get-version = result:
|
||||
|
@ -52,21 +48,28 @@ bash.runCommand "${pname}-${version}" {
|
|||
};
|
||||
} ''
|
||||
# Unpack
|
||||
tar xzf ${src}
|
||||
cp ${src} findutils.tar.xz
|
||||
unxz findutils.tar.xz
|
||||
tar xf findutils.tar
|
||||
rm findutils.tar
|
||||
cd findutils-${version}
|
||||
|
||||
# Patch
|
||||
# configure fails to accurately detect PATH_MAX support
|
||||
sed -i 's/chdir_long/chdir/' gl/lib/save-cwd.c
|
||||
|
||||
# Configure
|
||||
export C_INCLUDE_PATH="${glibc}/include:${linux-headers}/include"
|
||||
export LIBRARY_PATH="${glibc}/lib"
|
||||
export LIBS="-lc -lnss_files -lnss_dns -lresolv"
|
||||
export CC="tcc -B ${tinycc.libs}/lib"
|
||||
export AR="tcc -ar"
|
||||
export LD=tcc
|
||||
bash ./configure \
|
||||
--prefix=$out \
|
||||
--build=${buildPlatform.config} \
|
||||
--host=${hostPlatform.config}
|
||||
|
||||
# Build
|
||||
make
|
||||
make -j $NIX_BUILD_CORES
|
||||
|
||||
# Install
|
||||
make install
|
||||
make -j $NIX_BUILD_CORES install
|
||||
''
|
||||
|
|
|
@ -3,10 +3,7 @@
|
|||
, hostPlatform
|
||||
, fetchurl
|
||||
, bash
|
||||
, gcc
|
||||
, glibc
|
||||
, binutils
|
||||
, linux-headers
|
||||
, tinycc
|
||||
, gnumake
|
||||
, gnugrep
|
||||
, gnused
|
||||
|
@ -17,21 +14,18 @@
|
|||
let
|
||||
inherit (import ./common.nix { inherit lib; }) meta;
|
||||
pname = "gawk";
|
||||
# >= 4.2.0 fails to cleanly build. may be worth investigating in the future.
|
||||
# for now this version is sufficient to build glibc 2.16
|
||||
version = "4.1.4";
|
||||
version = "5.2.2";
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://gnu/gawk/gawk-${version}.tar.gz";
|
||||
sha256 = "0dadjkpyyizmyd0l098qps8lb39r0vrz3xl3hwz2cmjs5c70h0wc";
|
||||
hash = "sha256-lFrvfM/xAfILIqEIArwAXplKsrjqPnJMwaGXxi9B9lA=";
|
||||
};
|
||||
in
|
||||
bash.runCommand "${pname}-${version}" {
|
||||
inherit pname version meta;
|
||||
|
||||
nativeBuildInputs = [
|
||||
gcc
|
||||
binutils
|
||||
tinycc.compiler
|
||||
gnumake
|
||||
gnused
|
||||
gnugrep
|
||||
|
@ -51,18 +45,17 @@ bash.runCommand "${pname}-${version}" {
|
|||
cd gawk-${version}
|
||||
|
||||
# Configure
|
||||
export C_INCLUDE_PATH="${glibc}/include:${linux-headers}/include"
|
||||
export LIBRARY_PATH="${glibc}/lib"
|
||||
export LIBS="-lc -lnss_files -lnss_dns -lresolv"
|
||||
export CC="tcc -B ${tinycc.libs}/lib"
|
||||
export AR="tcc -ar"
|
||||
export LD=tcc
|
||||
bash ./configure \
|
||||
--prefix=$out \
|
||||
--build=${buildPlatform.config} \
|
||||
--host=${hostPlatform.config}
|
||||
|
||||
# Build
|
||||
make gawk
|
||||
make -j $NIX_BUILD_CORES
|
||||
|
||||
# Install
|
||||
install -D gawk $out/bin/gawk
|
||||
ln -s gawk $out/bin/awk
|
||||
make -j $NIX_BUILD_CORES install
|
||||
''
|
||||
|
|
|
@ -3,9 +3,7 @@
|
|||
, hostPlatform
|
||||
, fetchurl
|
||||
, bash
|
||||
, gcc
|
||||
, glibc
|
||||
, linux-headers
|
||||
, tinycc
|
||||
, binutils
|
||||
, gnumake
|
||||
, gnupatch
|
||||
|
@ -32,23 +30,10 @@ let
|
|||
};
|
||||
|
||||
patches = [
|
||||
# This patch enables building gcc-4.6.4 using gcc-2.95.3 and glibc-2.2.5
|
||||
# * Tweak Makefile to allow overriding NATIVE_SYSTEM_HEADER_DIR using #:makeflags
|
||||
# * Add missing limits.h include.
|
||||
# * Add SSIZE_MAX define. The SSIZE_MAX define has been added to Mes
|
||||
# upstream and can be removed with the next Mes release.
|
||||
# * Remove -fbuilding-libgcc flag, it assumes features being present from a
|
||||
# newer gcc or glibc.
|
||||
# * [MES_BOOTSTRAP_GCC]: Disable threads harder.
|
||||
(fetchurl {
|
||||
url = "https://git.savannah.gnu.org/cgit/guix.git/plain/gnu/packages/patches/gcc-boot-4.6.4.patch?id=50249cab3a98839ade2433456fe618acc6f804a5";
|
||||
sha256 = "1zzd8gnihw6znrgb6c6pfsmm0vix89xw3giv1nnsykm57j0v3z0d";
|
||||
})
|
||||
./libstdc++-target.patch
|
||||
# Remove hardcoded NATIVE_SYSTEM_HEADER_DIR
|
||||
./no-system-headers.patch
|
||||
];
|
||||
|
||||
# To reduce the set of pre-built bootstrap inputs, build
|
||||
# GMP & co. from GCC.
|
||||
gmpVersion = "4.3.2";
|
||||
gmp = fetchurl {
|
||||
url = "mirror://gnu/gmp/gmp-${gmpVersion}.tar.gz";
|
||||
|
@ -71,7 +56,7 @@ bash.runCommand "${pname}-${version}" {
|
|||
inherit pname version;
|
||||
|
||||
nativeBuildInputs = [
|
||||
gcc
|
||||
tinycc.compiler
|
||||
binutils
|
||||
gnumake
|
||||
gnupatch
|
||||
|
@ -84,10 +69,6 @@ bash.runCommand "${pname}-${version}" {
|
|||
gzip
|
||||
];
|
||||
|
||||
# condition in ./libcpp/configure requires `env` which is not available in this coreutils
|
||||
am_cv_CXX_dependencies_compiler_type = "gcc";
|
||||
am_cv_CC_dependencies_compiler_type = "gcc";
|
||||
|
||||
passthru.tests.get-version = result:
|
||||
bash.runCommand "${pname}-get-version-${version}" {} ''
|
||||
${result}/bin/gcc --version
|
||||
|
@ -118,18 +99,21 @@ bash.runCommand "${pname}-${version}" {
|
|||
${lib.concatMapStringsSep "\n" (f: "patch -Np1 -i ${f}") patches}
|
||||
|
||||
# Configure
|
||||
export C_INCLUDE_PATH="${gcc}/lib/gcc-lib/${hostPlatform.config}/${gcc.version}/include:${linux-headers}/include:${glibc}/include:$(pwd)/mpfr/src"
|
||||
export CC="tcc -B ${tinycc.libs}/lib"
|
||||
export C_INCLUDE_PATH="${tinycc.libs}/include:$(pwd)/mpfr/src"
|
||||
export CPLUS_INCLUDE_PATH="$C_INCLUDE_PATH"
|
||||
export LDFLAGS="-B${glibc}/lib -Wl,-dynamic-linker -Wl,${glibc}"
|
||||
export LDFLAGS_FOR_TARGET=$LDFLAGS
|
||||
export LIBRARY_PATH="${glibc}/lib:${gcc}/lib"
|
||||
export LIBS="-lc -lnss_files -lnss_dns -lresolv"
|
||||
|
||||
# Avoid "Link tests are not allowed after GCC_NO_EXECUTABLES"
|
||||
export lt_cv_shlibpath_overrides_runpath=yes
|
||||
export ac_cv_func_memcpy=yes
|
||||
export ac_cv_func_strerror=yes
|
||||
|
||||
bash ./configure \
|
||||
--prefix=$out \
|
||||
--build=${buildPlatform.config} \
|
||||
--host=${hostPlatform.config} \
|
||||
--with-native-system-header-dir=${glibc}/include \
|
||||
--with-build-sysroot=${glibc}/include \
|
||||
--with-native-system-header-dir=${tinycc.libs}/include \
|
||||
--with-build-sysroot=${tinycc.libs}/include \
|
||||
--disable-bootstrap \
|
||||
--disable-decimal-float \
|
||||
--disable-libatomic \
|
||||
|
@ -146,7 +130,7 @@ bash.runCommand "${pname}-${version}" {
|
|||
--disable-multilib \
|
||||
--disable-plugin \
|
||||
--disable-threads \
|
||||
--enable-languages=c,c++ \
|
||||
--enable-languages=c \
|
||||
--enable-static \
|
||||
--disable-shared \
|
||||
--enable-threads=single \
|
||||
|
@ -154,8 +138,8 @@ bash.runCommand "${pname}-${version}" {
|
|||
--disable-build-with-cxx
|
||||
|
||||
# Build
|
||||
make
|
||||
make -j $NIX_BUILD_CORES
|
||||
|
||||
# Install
|
||||
make install
|
||||
make -j $NIX_BUILD_CORES install
|
||||
''
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
--- a/gcc/Makefile.in
|
||||
+++ b/gcc/Makefile.in
|
||||
@@ -440,7 +440,7 @@ LINKER_PLUGIN_API_H = $(srcdir)/../include/plugin-api.h
|
||||
LTO_SYMTAB_H = $(srcdir)/../include/lto-symtab.h
|
||||
|
||||
# Default native SYSTEM_HEADER_DIR, to be overridden by targets.
|
||||
-NATIVE_SYSTEM_HEADER_DIR = /usr/include
|
||||
+# NATIVE_SYSTEM_HEADER_DIR = /usr/include
|
||||
# Default cross SYSTEM_HEADER_DIR, to be overridden by targets.
|
||||
CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
|
||||
|
|
@ -12,13 +12,13 @@
|
|||
, gzip
|
||||
, gawk
|
||||
, heirloom
|
||||
, binutils-mes
|
||||
, binutils
|
||||
, linux-headers
|
||||
}:
|
||||
let
|
||||
pname = "glibc";
|
||||
|
||||
buildGlibc = { version, src, patches, configureFlags, gcc, binutils, CC, CPP }:
|
||||
buildGlibc = { version, src, patches, configureFlags, gcc, CC, CPP }:
|
||||
bash.runCommand "${pname}-${version}" {
|
||||
inherit pname version;
|
||||
|
||||
|
@ -114,7 +114,6 @@ in
|
|||
];
|
||||
|
||||
gcc = gcc2-mes;
|
||||
binutils = binutils-mes;
|
||||
CC = "gcc -D MES_BOOTSTRAP=1 -D BOOTSTRAP_GLIBC=1 -L $(pwd)";
|
||||
CPP = "gcc -E -D MES_BOOTSTRAP=1 -D BOOTSTRAP_GLIBC=1";
|
||||
};
|
||||
|
|
82
pkgs/os-specific/linux/minimal-bootstrap/gnumake/musl.nix
Normal file
82
pkgs/os-specific/linux/minimal-bootstrap/gnumake/musl.nix
Normal file
|
@ -0,0 +1,82 @@
|
|||
{ lib
|
||||
, buildPlatform
|
||||
, hostPlatform
|
||||
, fetchurl
|
||||
, bash
|
||||
, tinycc
|
||||
, gnumakeBoot
|
||||
, gnupatch
|
||||
, gnused
|
||||
, gnugrep
|
||||
, gawk
|
||||
, gnutar
|
||||
, gzip
|
||||
}:
|
||||
let
|
||||
pname = "gnumake-musl";
|
||||
version = "4.4.1";
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://gnu/make/make-${version}.tar.gz";
|
||||
hash = "sha256-3Rb7HWe/q3mnL16DkHNcSePo5wtJRaFasfgd23hlj7M=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# Replaces /bin/sh with sh, see patch file for reasoning
|
||||
./0001-No-impure-bin-sh.patch
|
||||
# Purity: don't look for library dependencies (of the form `-lfoo') in /lib
|
||||
# and /usr/lib. It's a stupid feature anyway. Likewise, when searching for
|
||||
# included Makefiles, don't look in /usr/include and friends.
|
||||
./0002-remove-impure-dirs.patch
|
||||
];
|
||||
in
|
||||
bash.runCommand "${pname}-${version}" {
|
||||
inherit pname version;
|
||||
|
||||
nativeBuildInputs = [
|
||||
tinycc.compiler
|
||||
gnumakeBoot
|
||||
gnupatch
|
||||
gnused
|
||||
gnugrep
|
||||
gawk
|
||||
gnutar
|
||||
gzip
|
||||
];
|
||||
|
||||
passthru.tests.get-version = result:
|
||||
bash.runCommand "${pname}-get-version-${version}" {} ''
|
||||
${result}/bin/make --version
|
||||
mkdir $out
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "A tool to control the generation of non-source files from sources";
|
||||
homepage = "https://www.gnu.org/software/make";
|
||||
license = licenses.gpl3Plus;
|
||||
maintainers = teams.minimal-bootstrap.members;
|
||||
mainProgram = "make";
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
} ''
|
||||
# Unpack
|
||||
tar xzf ${src}
|
||||
cd make-${version}
|
||||
|
||||
# Patch
|
||||
${lib.concatMapStringsSep "\n" (f: "patch -Np1 -i ${f}") patches}
|
||||
|
||||
# Configure
|
||||
export CC="tcc -B ${tinycc.libs}/lib"
|
||||
export LD=tcc
|
||||
bash ./configure \
|
||||
--prefix=$out \
|
||||
--build=${buildPlatform.config} \
|
||||
--host=${hostPlatform.config}
|
||||
|
||||
# Build
|
||||
make AR="tcc -ar"
|
||||
|
||||
# Install
|
||||
make install
|
||||
''
|
12
pkgs/os-specific/linux/minimal-bootstrap/gnused/common.nix
Normal file
12
pkgs/os-specific/linux/minimal-bootstrap/gnused/common.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
{ lib }:
|
||||
|
||||
{
|
||||
meta = with lib; {
|
||||
description = "GNU sed, a batch stream editor";
|
||||
homepage = "https://www.gnu.org/software/sed";
|
||||
license = licenses.gpl3Plus;
|
||||
maintainers = teams.minimal-bootstrap.members;
|
||||
mainProgram = "sed";
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
}
|
|
@ -4,41 +4,34 @@
|
|||
, fetchurl
|
||||
, bash
|
||||
, gnumake
|
||||
, mesBootstrap ? false, tinycc ? null
|
||||
, gcc ? null, glibc ? null, binutils ? null, gnused ? null, linux-headers, gnugrep
|
||||
, tinycc
|
||||
, gnused
|
||||
, gnugrep
|
||||
, gnutar
|
||||
, gzip
|
||||
}:
|
||||
assert mesBootstrap -> tinycc != null;
|
||||
assert !mesBootstrap -> gcc != null && glibc != null && binutils != null && gnused != null;
|
||||
|
||||
let
|
||||
pname = "gnused" + lib.optionalString mesBootstrap "-mes";
|
||||
# last version that can be compiled with mes-libc
|
||||
version = "4.0.9";
|
||||
inherit (import ./common.nix { inherit lib; }) meta;
|
||||
pname = "gnused";
|
||||
# last version that can be bootstrapped with our slightly buggy gnused-mes
|
||||
version = "4.2";
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://gnu/sed/sed-${version}.tar.gz";
|
||||
sha256 = "0006gk1dw2582xsvgx6y6rzs9zw8b36rhafjwm288zqqji3qfrf3";
|
||||
};
|
||||
|
||||
# Thanks to the live-bootstrap project!
|
||||
# See https://github.com/fosslinux/live-bootstrap/blob/1bc4296091c51f53a5598050c8956d16e945b0f5/sysa/sed-4.0.9/sed-4.0.9.kaem
|
||||
makefile = fetchurl {
|
||||
url = "https://github.com/fosslinux/live-bootstrap/raw/1bc4296091c51f53a5598050c8956d16e945b0f5/sysa/sed-4.0.9/mk/main.mk";
|
||||
sha256 = "0w1f5ri0g5zla31m6l6xyzbqwdvandqfnzrsw90dd6ak126w3mya";
|
||||
hash = "sha256-20XNY/0BDmUFN9ZdXfznaJplJ0UjZgbl5ceCk3Jn2YM=";
|
||||
};
|
||||
in
|
||||
bash.runCommand "${pname}-${version}" {
|
||||
inherit pname version;
|
||||
inherit pname version meta;
|
||||
|
||||
nativeBuildInputs = [
|
||||
gnumake
|
||||
] ++ lib.optionals mesBootstrap [
|
||||
tinycc.compiler
|
||||
] ++ lib.optionals (!mesBootstrap) [
|
||||
gcc
|
||||
glibc
|
||||
binutils
|
||||
gnused
|
||||
gnugrep
|
||||
gnutar
|
||||
gzip
|
||||
];
|
||||
|
||||
passthru.tests.get-version = result:
|
||||
|
@ -46,51 +39,25 @@ bash.runCommand "${pname}-${version}" {
|
|||
${result}/bin/sed --version
|
||||
mkdir ''${out}
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "GNU sed, a batch stream editor";
|
||||
homepage = "https://www.gnu.org/software/sed";
|
||||
license = licenses.gpl3Plus;
|
||||
maintainers = teams.minimal-bootstrap.members;
|
||||
mainProgram = "sed";
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
} (''
|
||||
# Unpack
|
||||
ungz --file ${src} --output sed.tar
|
||||
untar --file sed.tar
|
||||
rm sed.tar
|
||||
tar xzf ${src}
|
||||
cd sed-${version}
|
||||
|
||||
'' + lib.optionalString mesBootstrap ''
|
||||
# Configure
|
||||
cp ${makefile} Makefile
|
||||
catm config.h
|
||||
|
||||
# Build
|
||||
make \
|
||||
CC="tcc -B ${tinycc.libs}/lib" \
|
||||
LIBC=mes
|
||||
|
||||
'' + lib.optionalString (!mesBootstrap) ''
|
||||
# Configure
|
||||
export CC="gcc -I${glibc}/include -I${linux-headers}/include"
|
||||
export LIBRARY_PATH="${glibc}/lib"
|
||||
export LIBS="-lc -lnss_files -lnss_dns -lresolv"
|
||||
chmod +x configure
|
||||
export CC="tcc -B ${tinycc.libs}/lib"
|
||||
export LD=tcc
|
||||
./configure \
|
||||
--build=${buildPlatform.config} \
|
||||
--host=${hostPlatform.config} \
|
||||
--disable-shared \
|
||||
--disable-nls \
|
||||
--disable-dependency-tracking \
|
||||
--without-included-regex \
|
||||
--prefix=$out
|
||||
|
||||
# Build
|
||||
make
|
||||
make AR="tcc -ar"
|
||||
|
||||
'' + ''
|
||||
# Install
|
||||
make install PREFIX=$out
|
||||
make install
|
||||
'')
|
||||
|
|
59
pkgs/os-specific/linux/minimal-bootstrap/gnused/mes.nix
Normal file
59
pkgs/os-specific/linux/minimal-bootstrap/gnused/mes.nix
Normal file
|
@ -0,0 +1,59 @@
|
|||
{ lib
|
||||
, buildPlatform
|
||||
, hostPlatform
|
||||
, fetchurl
|
||||
, bash
|
||||
, gnumake
|
||||
, tinycc
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (import ./common.nix { inherit lib; }) meta;
|
||||
pname = "gnused-mes";
|
||||
# last version that can be compiled with mes-libc
|
||||
version = "4.0.9";
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://gnu/sed/sed-${version}.tar.gz";
|
||||
sha256 = "0006gk1dw2582xsvgx6y6rzs9zw8b36rhafjwm288zqqji3qfrf3";
|
||||
};
|
||||
|
||||
# Thanks to the live-bootstrap project!
|
||||
# See https://github.com/fosslinux/live-bootstrap/blob/1bc4296091c51f53a5598050c8956d16e945b0f5/sysa/sed-4.0.9/sed-4.0.9.kaem
|
||||
makefile = fetchurl {
|
||||
url = "https://github.com/fosslinux/live-bootstrap/raw/1bc4296091c51f53a5598050c8956d16e945b0f5/sysa/sed-4.0.9/mk/main.mk";
|
||||
sha256 = "0w1f5ri0g5zla31m6l6xyzbqwdvandqfnzrsw90dd6ak126w3mya";
|
||||
};
|
||||
in
|
||||
bash.runCommand "${pname}-${version}" {
|
||||
inherit pname version meta;
|
||||
|
||||
nativeBuildInputs = [
|
||||
gnumake
|
||||
tinycc.compiler
|
||||
];
|
||||
|
||||
passthru.tests.get-version = result:
|
||||
bash.runCommand "${pname}-get-version-${version}" {} ''
|
||||
${result}/bin/sed --version
|
||||
mkdir ''${out}
|
||||
'';
|
||||
} (''
|
||||
# Unpack
|
||||
ungz --file ${src} --output sed.tar
|
||||
untar --file sed.tar
|
||||
rm sed.tar
|
||||
cd sed-${version}
|
||||
|
||||
# Configure
|
||||
cp ${makefile} Makefile
|
||||
catm config.h
|
||||
|
||||
# Build
|
||||
make \
|
||||
CC="tcc -B ${tinycc.libs}/lib" \
|
||||
LIBC=mes
|
||||
|
||||
# Install
|
||||
make install PREFIX=$out
|
||||
'')
|
70
pkgs/os-specific/linux/minimal-bootstrap/gnutar/musl.nix
Normal file
70
pkgs/os-specific/linux/minimal-bootstrap/gnutar/musl.nix
Normal file
|
@ -0,0 +1,70 @@
|
|||
{ lib
|
||||
, buildPlatform
|
||||
, hostPlatform
|
||||
, fetchurl
|
||||
, bash
|
||||
, tinycc
|
||||
, gnumake
|
||||
, gnugrep
|
||||
, gnused
|
||||
}:
|
||||
let
|
||||
# gnutar with musl preserves modify times, allowing make to not try
|
||||
# rebuilding pregenerated files
|
||||
pname = "gnutar-musl";
|
||||
version = "1.12";
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://gnu/tar/tar-${version}.tar.gz";
|
||||
hash = "sha256-xsN+iIsTbM76uQPFEUn0t71lnWnUrqISRfYQU6V6pgo=";
|
||||
};
|
||||
in
|
||||
bash.runCommand "${pname}-${version}" {
|
||||
inherit pname version;
|
||||
|
||||
nativeBuildInputs = [
|
||||
tinycc.compiler
|
||||
gnumake
|
||||
gnused
|
||||
gnugrep
|
||||
];
|
||||
|
||||
passthru.tests.get-version = result:
|
||||
bash.runCommand "${pname}-get-version-${version}" {} ''
|
||||
${result}/bin/tar --version
|
||||
mkdir $out
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "GNU implementation of the `tar' archiver";
|
||||
homepage = "https://www.gnu.org/software/tar";
|
||||
license = licenses.gpl3Plus;
|
||||
maintainers = teams.minimal-bootstrap.members;
|
||||
mainProgram = "tar";
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
} ''
|
||||
# Unpack
|
||||
ungz --file ${src} --output tar.tar
|
||||
untar --file tar.tar
|
||||
rm tar.tar
|
||||
cd tar-${version}
|
||||
|
||||
# Configure
|
||||
export CC="tcc -B ${tinycc.libs}/lib"
|
||||
export LD=tcc
|
||||
export ac_cv_sizeof_unsigned_long=4
|
||||
export ac_cv_sizeof_long_long=8
|
||||
export ac_cv_header_netdb_h=no
|
||||
bash ./configure \
|
||||
--prefix=$out \
|
||||
--build=${buildPlatform.config} \
|
||||
--host=${hostPlatform.config} \
|
||||
--disable-nls
|
||||
|
||||
# Build
|
||||
make AR="tcc -ar"
|
||||
|
||||
# Install
|
||||
make install
|
||||
''
|
|
@ -58,6 +58,8 @@ let
|
|||
# url = "${liveBootstrap}/patches/stdio_flush_on_exit.patch";
|
||||
# hash = "sha256-/z5ze3h3QTysay8nRvyvwPv3pmTcKptdkBIaMCoeLDg=";
|
||||
# })
|
||||
# HACK: always flush stdio immediately
|
||||
./always-flush.patch
|
||||
(fetchurl {
|
||||
url = "${liveBootstrap}/patches/va_list.patch";
|
||||
hash = "sha256-UmcMIl+YCi3wIeVvjbsCyqFlkyYsM4ECNwTfXP+s7vg=";
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
diff --git src/env/__libc_start_main.c src/env/__libc_start_main.c
|
||||
index 8fbe526..9476c22 100644
|
||||
--- src/env/__libc_start_main.c
|
||||
+++ src/env/__libc_start_main.c
|
||||
@@ -91,6 +91,7 @@ static int libc_start_main_stage2(int (*main)(int,char **,char **), int argc, ch
|
||||
__libc_start_init();
|
||||
|
||||
/* Pass control to the application */
|
||||
+ setbuf(stdout, NULL);
|
||||
exit(main(argc, argv, envp));
|
||||
return 0;
|
||||
}
|
|
@ -70,8 +70,8 @@ bash.runCommand "${pname}-${version}" {
|
|||
--host=${hostPlatform.config}
|
||||
|
||||
# Build
|
||||
make
|
||||
make -j $NIX_BUILD_CORES
|
||||
|
||||
# Install
|
||||
make install
|
||||
make -j $NIX_BUILD_CORES install
|
||||
''
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
--- tccelf.c
|
||||
+++ tccelf.c
|
||||
@@ -710,8 +710,9 @@ ST_FUNC int set_elf_sym(Section *s, addr_t value, unsigned long size,
|
||||
#if 0
|
||||
printf("new_bind=%x new_shndx=%x new_vis=%x old_bind=%x old_shndx=%x old_vis=%x\n",
|
||||
sym_bind, shndx, new_vis, esym_bind, esym->st_shndx, esym_vis);
|
||||
-#endif
|
||||
tcc_error_noabort("'%s' defined twice", name);
|
||||
+#endif
|
||||
+ goto do_patch;
|
||||
}
|
||||
} else {
|
||||
esym->st_other = other;
|
|
@ -0,0 +1,21 @@
|
|||
--- tccgen.c
|
||||
+++ tccgen.c
|
||||
@@ -4941,7 +4941,7 @@ static int post_type(CType *type, AttributeDef *ad, int storage, int td)
|
||||
next();
|
||||
n = -1;
|
||||
t1 = 0;
|
||||
- if (td & TYPE_PARAM) while (1) {
|
||||
+ while (1) {
|
||||
/* XXX The optional type-quals and static should only be accepted
|
||||
in parameter decls. The '*' as well, and then even only
|
||||
in prototypes (not function defs). */
|
||||
@@ -4972,7 +4972,8 @@ static int post_type(CType *type, AttributeDef *ad, int storage, int td)
|
||||
}
|
||||
break;
|
||||
|
||||
- } else if (tok != ']') {
|
||||
+ }
|
||||
+ if (tok != ']') {
|
||||
if (!local_stack || (storage & VT_STATIC))
|
||||
vpushi(expr_const());
|
||||
else {
|
|
@ -1,9 +1,3 @@
|
|||
# Build steps adapted from https://github.com/fosslinux/live-bootstrap/blob/1bc4296091c51f53a5598050c8956d16e945b0f5/sysa/tcc-0.9.27/tcc-musl-pass1.sh
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2021-22 fosslinux <fosslinux@aussies.space>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
{ lib
|
||||
, fetchurl
|
||||
, callPackage
|
||||
|
@ -12,38 +6,28 @@
|
|||
, musl
|
||||
, gnupatch
|
||||
, gnutar
|
||||
, bzip2
|
||||
, gzip
|
||||
}:
|
||||
let
|
||||
pname = "tinycc-musl";
|
||||
version = "0.9.27";
|
||||
# next commit introduces use of realpath (unsupported in mes-libc)
|
||||
version = "unstable-2023-07-10";
|
||||
rev = "fd6d2180c5c801bb0b4c5dde27d61503059fc97d";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://download.savannah.gnu.org/releases/tinycc/tcc-${version}.tar.bz2";
|
||||
hash = "sha256-3iOvePypDOMt/y3UWzQysjNHQLubt7Bb9g/b/Dls65w=";
|
||||
url = "https://repo.or.cz/tinycc.git/snapshot/${rev}.tar.gz";
|
||||
hash = "sha256-R81SNbEmh4s9FNQxCWZwUiMCYRkkwOHAdRf0aMnnRiA=";
|
||||
};
|
||||
|
||||
# Thanks to the live-bootstrap project!
|
||||
# See https://github.com/fosslinux/live-bootstrap/blob/424aa5be38a3023aa6842883a3954599b1597986/sysa/tcc-0.9.27/tcc-musl-pass1.sh
|
||||
liveBootstrap = "https://github.com/fosslinux/live-bootstrap/raw/424aa5be38a3023aa6842883a3954599b1597986/sysa/tcc-0.9.27";
|
||||
patches = [
|
||||
(fetchurl {
|
||||
url = "${liveBootstrap}/patches/ignore-duplicate-symbols.patch";
|
||||
hash = "sha256-6Js8HkzjYlA8ETxeEYRWu+03OJI60NvR5h1QPkcMTlQ=";
|
||||
})
|
||||
(fetchurl {
|
||||
url = "${liveBootstrap}/patches/ignore-static-inside-array.patch";
|
||||
hash = "sha256-IF4RevLGjzRBuYqhuyG7+x6SVljzMAsYRKicNsmtbDY=";
|
||||
})
|
||||
(fetchurl {
|
||||
url = "${liveBootstrap}/patches/static-link.patch";
|
||||
hash = "sha256-gX/hJ9a/0Zg29KIBUme+mOA8WrPQvp0SvojP8DN9mSI=";
|
||||
})
|
||||
./ignore-duplicate-symbols.patch
|
||||
./ignore-static-inside-array.patch
|
||||
./static-link.patch
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
description = "Small, fast, and embeddable C compiler and interpreter";
|
||||
homepage = "http://savannah.nongnu.org/projects/tinycc";
|
||||
homepage = "https://repo.or.cz/w/tinycc.git";
|
||||
license = licenses.lgpl21Only;
|
||||
maintainers = teams.minimal-bootstrap.members;
|
||||
platforms = [ "i686-linux" ];
|
||||
|
@ -56,15 +40,12 @@ let
|
|||
tinycc-bootstrappable.compiler
|
||||
gnupatch
|
||||
gnutar
|
||||
bzip2
|
||||
gzip
|
||||
];
|
||||
} ''
|
||||
# Unpack
|
||||
cp ${src} tinycc.tar.bz2
|
||||
bunzip2 tinycc.tar.bz2
|
||||
tar xf tinycc.tar
|
||||
rm tinycc.tar
|
||||
cd tcc-${version}
|
||||
tar xzf ${src}
|
||||
cd tinycc-${builtins.substring 0 7 rev}
|
||||
|
||||
# Patch
|
||||
${lib.concatMapStringsSep "\n" (f: "patch -Np0 -i ${f}") patches}
|
||||
|
@ -77,6 +58,13 @@ let
|
|||
# but when linked with musl it is.
|
||||
ln -s ${musl}/lib/libtcc1.a ./libtcc1.a
|
||||
|
||||
tcc \
|
||||
-B ${tinycc-bootstrappable.libs}/lib \
|
||||
-DC2STR \
|
||||
-o c2str \
|
||||
conftest.c
|
||||
./c2str include/tccdefs.h tccdefs_.h
|
||||
|
||||
tcc -v \
|
||||
-static \
|
||||
-o tcc-musl \
|
||||
|
@ -92,6 +80,9 @@ let
|
|||
-D CONFIG_USE_LIBGCC=1 \
|
||||
-D TCC_VERSION=\"0.9.27\" \
|
||||
-D ONE_SOURCE=1 \
|
||||
-D TCC_MUSL=1 \
|
||||
-D CONFIG_TCC_PREDEFS=1 \
|
||||
-D CONFIG_TCC_SEMLOCK=0 \
|
||||
-B . \
|
||||
-B ${tinycc-bootstrappable.libs}/lib \
|
||||
tcc.c
|
||||
|
@ -117,13 +108,17 @@ let
|
|||
-D CONFIG_USE_LIBGCC=1 \
|
||||
-D TCC_VERSION=\"0.9.27\" \
|
||||
-D ONE_SOURCE=1 \
|
||||
-D TCC_MUSL=1 \
|
||||
-D CONFIG_TCC_PREDEFS=1 \
|
||||
-D CONFIG_TCC_SEMLOCK=0 \
|
||||
-B . \
|
||||
-B ${musl}/lib \
|
||||
tcc.c
|
||||
# libtcc1.a
|
||||
rm -f libtcc1.a
|
||||
./tcc-musl -c -D HAVE_CONFIG_H=1 lib/libtcc1.c
|
||||
./tcc-musl -ar cr libtcc1.a libtcc1.o
|
||||
./tcc-musl -c -D HAVE_CONFIG_H=1 lib/alloca.S
|
||||
./tcc-musl -ar cr libtcc1.a libtcc1.o alloca.o
|
||||
|
||||
# Install
|
||||
install -D tcc-musl $out/bin/tcc
|
||||
|
@ -151,5 +146,10 @@ in
|
|||
|
||||
libs = bash.runCommand "${pname}-${version}-libs" {
|
||||
inherit pname version meta;
|
||||
} "install -D ${tinycc-musl}/lib/libtcc1.a $out/lib/libtcc1.a";
|
||||
} ''
|
||||
mkdir $out
|
||||
cp -r ${musl}/* $out
|
||||
chmod +w $out/lib/libtcc1.a
|
||||
cp ${tinycc-musl}/lib/libtcc1.a $out/lib/libtcc1.a
|
||||
'';
|
||||
}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
--- libtcc.c
|
||||
+++ libtcc.c
|
||||
@@ -793,6 +793,7 @@ LIBTCCAPI TCCState *tcc_new(void)
|
||||
|
||||
s->gnu_ext = 1;
|
||||
s->tcc_ext = 1;
|
||||
+ s->static_link = 1;
|
||||
s->nocommon = 1;
|
||||
s->dollars_in_identifiers = 1; /*on by default like in gcc/clang*/
|
||||
s->cversion = 199901; /* default unless -std=c11 is supplied */
|
|
@ -5,18 +5,19 @@
|
|||
, bash
|
||||
, tinycc
|
||||
, gnumake
|
||||
, gnused
|
||||
, gnugrep
|
||||
, gawk
|
||||
, sed
|
||||
, gnutar
|
||||
, gzip
|
||||
}:
|
||||
let
|
||||
pname = "xz";
|
||||
# >=5.2 uses poll.h, unsupported by meslibc
|
||||
version = "5.0.8";
|
||||
version = "5.4.3";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://tukaani.org/xz/xz-${version}.tar.bz2";
|
||||
sha256 = "1nkb68dyrf16xwyqichcy1vhgbfg20dxz459rcsdx85h1gczk1i2";
|
||||
url = "https://tukaani.org/xz/xz-${version}.tar.gz";
|
||||
hash = "sha256-HDguC8Lk4K9YOYqQPdYv/35RAXHS3keh6+BtFSjpt+k=";
|
||||
};
|
||||
in
|
||||
bash.runCommand "${pname}-${version}" {
|
||||
|
@ -25,9 +26,11 @@ bash.runCommand "${pname}-${version}" {
|
|||
nativeBuildInputs = [
|
||||
tinycc.compiler
|
||||
gnumake
|
||||
gnused
|
||||
gnugrep
|
||||
gawk
|
||||
sed
|
||||
gnutar
|
||||
gzip
|
||||
];
|
||||
|
||||
passthru.tests.get-version = result:
|
||||
|
@ -45,34 +48,23 @@ bash.runCommand "${pname}-${version}" {
|
|||
};
|
||||
} ''
|
||||
# Unpack
|
||||
unbz2 --file ${src} --output xz.tar
|
||||
untar --file xz.tar
|
||||
rm xz.tar
|
||||
tar xzf ${src}
|
||||
cd xz-${version}
|
||||
|
||||
# Configure
|
||||
export CC="tcc -B ${tinycc.libs}/lib -include${./stubs.h}"
|
||||
export CPP="tcc -E"
|
||||
export LD=tcc
|
||||
export CC="tcc -B ${tinycc.libs}/lib"
|
||||
export AR="tcc -ar"
|
||||
export SED=sed
|
||||
export ac_cv_prog_cc_c99=
|
||||
export ac_cv_header_fcntl_h=yes
|
||||
export ac_cv_header_limits_h=yes
|
||||
export ac_cv_header_sys_time_h=yes
|
||||
export ac_cv_func_utime=no
|
||||
export LD=tcc
|
||||
bash ./configure \
|
||||
--prefix=$out \
|
||||
--build=${buildPlatform.config} \
|
||||
--host=${hostPlatform.config} \
|
||||
--disable-shared \
|
||||
--disable-nls \
|
||||
--disable-threads \
|
||||
--disable-assembler
|
||||
|
||||
# Build
|
||||
make all
|
||||
make -j $NIX_BUILD_CORES
|
||||
|
||||
# Install
|
||||
make install
|
||||
make -j $NIX_BUILD_CORES install
|
||||
''
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
#define sig_atomic_t int
|
||||
|
||||
#define SSIZE_MAX LONG_MAX
|
||||
|
||||
#define O_NOCTTY 0400
|
||||
#define O_NONBLOCK 04000
|
||||
|
||||
#define S_ISVTX 01000
|
||||
#define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK)
|
||||
|
||||
int fchmod (int fd, int mode)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fchown (int fd, int owner, int group)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include <signal.h>
|
||||
int sigfillset (sigset_t * set)
|
||||
{
|
||||
return 0;
|
||||
}
|
Loading…
Reference in a new issue