feat: stage 2 bash, binutils, bzip2, coreutils, diffutils, findutils, gawk, gnumake

This commit is contained in:
Jake Hamilton 2024-06-07 18:26:58 -07:00
parent d394492d9c
commit b2c019cf88
Signed by: jakehamilton
GPG key ID: 9762169A1B35EA68
15 changed files with 1098 additions and 1 deletions

View file

@ -8,6 +8,7 @@ let
platform = ./platform;
stage0 = ./stages/stage0;
stage1 = ./stages/stage1;
stage2 = ./stages/stage2;
system = ./system;
};
in

View file

@ -16,7 +16,7 @@ in {
options.aux.foundation.stages.stage1.bash = {
package = lib.options.create {
type = lib.types.package;
description = "The package to use for gnumake.";
description = "The package to use for bash.";
};
version = lib.options.create {

View file

@ -0,0 +1,117 @@
{
lib,
config,
}: let
cfg = config.aux.foundation.stages.stage2.bash;
platform = config.aux.platform;
builders = config.aux.foundation.builders;
stage1 = config.aux.foundation.stages.stage1;
in {
options.aux.foundation.stages.stage2.bash = {
package = lib.options.create {
type = lib.types.package;
description = "The package to use for bash.";
};
version = lib.options.create {
type = lib.types.string;
description = "Version of the package.";
};
src = lib.options.create {
type = lib.types.package;
description = "Source for the package.";
};
meta = {
description = lib.options.create {
type = lib.types.string;
description = "Description for the package.";
default.value = "GNU Bourne-Again Shell, the de facto standard shell on Linux";
};
homepage = lib.options.create {
type = lib.types.string;
description = "Homepage for the package.";
default.value = "https://www.gnu.org/software/bash";
};
license = lib.options.create {
# TODO: Add a proper type for licenses.
type = lib.types.attrs.any;
description = "License for the package.";
default.value = lib.licenses.gpl3Plus;
};
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["x86_64-linux" "aarch64-linux" "i686-linux"];
};
mainProgram = lib.options.create {
type = lib.types.string;
description = "The main program of the package.";
default.value = "bash";
};
};
};
config = {
aux.foundation.stages.stage2.bash = {
version = "5.2.15";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/bash/bash-${cfg.version}.tar.gz";
sha256 = "132qng0jy600mv1fs95ylnlisx2wavkkgpb19c6kmz7lnmjhjwhk";
};
package = builders.bash.build {
name = "bash-static-${cfg.version}";
meta = cfg.meta;
deps.build.host = [
stage1.gcc.package
stage1.musl.package
stage1.binutils.package
stage1.gnumake.package
stage1.gnupatch.package
stage1.gnused.package
stage1.gnugrep.package
stage1.gnutar.package
stage1.gawk.package
stage1.gzip.package
stage1.diffutils.package
stage1.findutils.package
];
script = ''
# Unpack
tar xf ${cfg.src}
cd bash-${cfg.version}
# Configure
bash ./configure \
--prefix=$out \
--build=${platform.build} \
--host=${platform.host} \
--without-bash-malloc \
--enable-static-link \
bash_cv_func_strtoimax=y \
CC=musl-gcc
# Build
make -j $NIX_BUILD_CORES
# Install
make -j $NIX_BUILD_CORES install-strip
rm $out/bin/bashbug
'';
};
};
};
}

View file

@ -0,0 +1,135 @@
{
lib,
config,
}: let
cfg = config.aux.foundation.stages.stage2.binutils;
platform = config.aux.platform;
builders = config.aux.foundation.builders;
stage1 = config.aux.foundation.stages.stage1;
in {
options.aux.foundation.stages.stage2.binutils = {
package = lib.options.create {
type = lib.types.package;
description = "The package to use for binutils.";
};
version = lib.options.create {
type = lib.types.string;
description = "Version of the package.";
};
src = lib.options.create {
type = lib.types.package;
description = "Source for the package.";
};
meta = {
description = lib.options.create {
type = lib.types.string;
description = "Description for the package.";
default.value = "Tools for manipulating binaries (linker, assembler, etc.)";
};
homepage = lib.options.create {
type = lib.types.string;
description = "Homepage for the package.";
default.value = "https://www.gnu.org/software/binutils";
};
license = lib.options.create {
# TODO: Add a proper type for licenses.
type = lib.types.attrs.any;
description = "License for the package.";
default.value = lib.licenses.gpl3Plus;
};
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["x86_64-linux" "aarch64-linux" "i686-linux"];
};
};
};
config = {
aux.foundation.stages.stage2.binutils = {
version = "2.41";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/binutils/binutils-${cfg.version}.tar.xz";
sha256 = "rppXieI0WeWWBuZxRyPy0//DHAMXQZHvDQFb3wYAdFA=";
};
package = let
patches = [
# Make binutils output deterministic by default.
./patches/deterministic.patch
];
configureFlags = [
"CC=musl-gcc"
"LDFLAGS=--static"
"--prefix=${builtins.placeholder "out"}"
"--build=${platform.build}"
"--host=${platform.host}"
"--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
# RUNPATH can be overridden using LD_LIBRARY_PATH at runtime.
"--enable-new-dtags"
# By default binutils searches $libdir for libraries. This brings in
# libbfd and libopcodes into a default visibility. Drop default lib
# path to force users to declare their use of these libraries.
"--with-lib-path=:"
];
in
builders.bash.build {
name = "binutils-static-${cfg.version}";
meta = cfg.meta;
deps.build.host = [
stage1.gcc.package
stage1.musl.package
stage1.binutils.package
stage1.gnumake.package
stage1.gnupatch.package
stage1.gnused.package
stage1.gnugrep.package
stage1.gawk.package
stage1.diffutils.package
stage1.findutils.package
stage1.gnutar.package
stage1.xz.package
];
script = ''
# Unpack
tar xf ${cfg.src}
cd binutils-${cfg.version}
# Patch
${lib.strings.concatMapSep "\n" (file: "patch -Np1 -i ${file}") patches}
# Configure
bash ./configure ${builtins.concatStringsSep " " configureFlags}
# Build
make -j $NIX_BUILD_CORES
# Install
# strip to remove build dependency store path references
make -j $NIX_BUILD_CORES install-strip
'';
};
};
};
}

View file

@ -0,0 +1,13 @@
diff -ur orig/binutils-2.23.1/ld/ldlang.c binutils-2.23.1/ld/ldlang.c
--- orig/ld/ldlang.c
+++ new/ld/ldlang.c
@@ -3095,6 +3095,8 @@
ldfile_output_machine))
einfo (_("%P%F:%s: can not set architecture: %E\n"), name);
+ link_info.output_bfd->flags |= BFD_DETERMINISTIC_OUTPUT;
+
link_info.hash = bfd_link_hash_table_create (link_info.output_bfd);
if (link_info.hash == NULL)
einfo (_("%P%F: can not create hash table: %E\n"));

View file

@ -0,0 +1,99 @@
{
lib,
config,
}: let
cfg = config.aux.foundation.stages.stage2.bzip2;
platform = config.aux.platform;
builders = config.aux.foundation.builders;
stage1 = config.aux.foundation.stages.stage1;
in {
options.aux.foundation.stages.stage2.bzip2 = {
package = lib.options.create {
type = lib.types.package;
description = "The package to use for bzip2.";
};
version = lib.options.create {
type = lib.types.string;
description = "Version of the package.";
};
src = lib.options.create {
type = lib.types.package;
description = "Source for the package.";
};
meta = {
description = lib.options.create {
type = lib.types.string;
description = "Description for the package.";
default.value = "High-quality data compression program";
};
homepage = lib.options.create {
type = lib.types.string;
description = "Homepage for the package.";
default.value = "https://www.sourceware.org/bzip2";
};
license = lib.options.create {
# TODO: Add a proper type for licenses.
type = lib.types.attrs.any;
description = "License for the package.";
default.value = lib.licenses.bsdOriginal;
};
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
# TODO: Support more platforms.
default.value = ["i686-linux"];
};
};
};
config = {
aux.foundation.stages.stage2.bzip2 = {
version = "1.0.8";
src = builtins.fetchurl {
url = "https://sourceware.org/pub/bzip2/bzip2-${cfg.version}.tar.gz";
sha256 = "0s92986cv0p692icqlw1j42y9nld8zd83qwhzbqd61p1dqbh6nmb";
};
package = builders.bash.build {
name = "bzip2-static-${cfg.version}";
meta = cfg.meta;
deps.build.host = [
stage1.gcc.package
stage1.musl.package
stage1.binutils.package
stage1.gnumake.package
stage1.gnutar.package
stage1.gzip.package
];
script = ''
# Unpack
tar xf ${cfg.src}
cd bzip2-${cfg.version}
# Build
make \
-j $NIX_BUILD_CORES \
CC=musl-gcc \
CFLAGS=-static \
bzip2 bzip2recover
# Install
make install -j $NIX_BUILD_CORES PREFIX=$out
'';
};
};
};
}

View file

@ -0,0 +1,113 @@
{
lib,
config,
}: let
cfg = config.aux.foundation.stages.stage2.coreutils;
platform = config.aux.platform;
builders = config.aux.foundation.builders;
stage1 = config.aux.foundation.stages.stage1;
in {
options.aux.foundation.stages.stage2.coreutils = {
package = lib.options.create {
type = lib.types.package;
description = "The package to use for coreutils-boot.";
};
version = lib.options.create {
type = lib.types.string;
description = "Version of the package.";
};
src = lib.options.create {
type = lib.types.package;
description = "Source for the package.";
};
meta = {
description = lib.options.create {
type = lib.types.string;
description = "Description for the package.";
default.value = "The GNU Core Utilities.";
};
homepage = lib.options.create {
type = lib.types.string;
description = "Homepage for the package.";
default.value = "https://www.gnu.org/software/coreutils";
};
license = lib.options.create {
# TODO: Add a proper type for licenses.
type = lib.types.attrs.any;
description = "License for the package.";
default.value = lib.licenses.gpl3Plus;
};
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["x86_64-linux" "aarch64-linux" "i686-linux"];
};
};
};
config = {
aux.foundation.stages.stage2.coreutils = {
version = "9.4";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/coreutils/coreutils-${cfg.version}.tar.gz";
sha256 = "X2ANkJOXOwr+JTk9m8GMRPIjJlf0yg2V6jHHAutmtzk=";
};
package = let
configureFlags = [
"--prefix=${builtins.placeholder "out"}"
"--build=${platform.build}"
"--host=${platform.host}"
# libstdbuf.so fails in static builds
"--enable-no-install-program=stdbuf"
"--enable-single-binary=symlinks"
"CC=musl-gcc"
"CFLAGS=-static"
];
in
builders.bash.build {
name = "coreutils-${cfg.version}";
meta = cfg.meta;
deps.build.host = [
stage1.gcc.package
stage1.musl.package
stage1.binutils.package
stage1.gnumake.package
stage1.gnused.package
stage1.gnugrep.package
stage1.gawk.package
stage1.gnutar.musl.package
stage1.gzip.package
stage1.findutils.package
stage1.diffutils.package
];
script = ''
# Unpack
tar xzf ${cfg.src}
cd coreutils-${cfg.version}
# Configure
bash ./configure ${builtins.concatStringsSep " " configureFlags}
# Build
make -j $NIX_BUILD_CORES
# Install
make -j $NIX_BUILD_CORES install
'';
};
};
};
}

View file

@ -0,0 +1,32 @@
{
lib,
config,
}: let
stage2 = config.aux.foundation.stages.stage2;
in {
includes = [
./bash
./gnumake
./binutils
./coreutils
./bzip2
./diffutils
./findutils
./gawk
];
config = {
exports = {
packages = {
stage2-bash = stage2.bash.package;
stage2-gnumake = stage2.gnumake.package;
stage2-binutils = stage2.binutils.package;
stage2-coreutils = stage2.coreutils.package;
stage2-bzip2 = stage2.bzip2.package;
stage2-diffutils = stage2.diffutils.package;
stage2-findutils = stage2.findutils.package;
stage2-gawk = stage2.gawk.package;
};
};
};
}

View file

@ -0,0 +1,108 @@
{
lib,
config,
}: let
cfg = config.aux.foundation.stages.stage2.diffutils;
platform = config.aux.platform;
builders = config.aux.foundation.builders;
stage1 = config.aux.foundation.stages.stage1;
in {
options.aux.foundation.stages.stage2.diffutils = {
package = lib.options.create {
type = lib.types.package;
description = "The package to use for diffutils.";
};
version = lib.options.create {
type = lib.types.string;
description = "Version of the package.";
};
src = lib.options.create {
type = lib.types.package;
description = "Source for the package.";
};
meta = {
description = lib.options.create {
type = lib.types.string;
description = "Description for the package.";
default.value = "Commands for showing the differences between files (diff, cmp, etc.)";
};
homepage = lib.options.create {
type = lib.types.string;
description = "Homepage for the package.";
default.value = "https://www.gnu.org/software/diffutils";
};
license = lib.options.create {
# TODO: Add a proper type for licenses.
type = lib.types.attrs.any;
description = "License for the package.";
default.value = lib.licenses.gpl3Only;
};
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["x86_64-linux" "aarch64-linux" "i686-linux"];
};
};
};
config = {
aux.foundation.stages.stage2.diffutils = {
version = "3.10";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/diffutils/diffutils-${cfg.version}.tar.xz";
sha256 = "kOXpPMck5OvhLt6A3xY0Bjx6hVaSaFkZv+YLVWyb0J4=";
};
package = builders.bash.build {
name = "diffutils-static-${cfg.version}";
meta = cfg.meta;
deps.build.host = [
stage1.gcc.package
stage1.musl.package
stage1.binutils.package
stage1.gnumake.package
stage1.gnused.package
stage1.gnugrep.package
stage1.gnutar.package
stage1.gawk.package
stage1.xz.package
stage1.diffutils.package
stage1.findutils.package
];
script = ''
# Unpack
tar xf ${cfg.src}
cd diffutils-${cfg.version}
# Configure
bash ./configure \
--prefix=$out \
--build=${platform.build} \
--host=${platform.host} \
CC=musl-gcc \
CFLAGS=-static \
ac_cv_path_PR_PROGRAM=pr
# Build
make -j $NIX_BUILD_CORES
# Install
make -j $NIX_BUILD_CORES install
'';
};
};
};
}

View file

@ -0,0 +1,108 @@
{
lib,
config,
}: let
cfg = config.aux.foundation.stages.stage2.findutils;
platform = config.aux.platform;
builders = config.aux.foundation.builders;
stage1 = config.aux.foundation.stages.stage1;
in {
options.aux.foundation.stages.stage2.findutils = {
package = lib.options.create {
type = lib.types.package;
description = "The package to use for findutils.";
};
version = lib.options.create {
type = lib.types.string;
description = "Version of the package.";
};
src = lib.options.create {
type = lib.types.package;
description = "Source for the package.";
};
meta = {
description = lib.options.create {
type = lib.types.string;
description = "Description for the package.";
default.value = "GNU Find Utilities, the basic directory searching utilities of the GNU operating system";
};
homepage = lib.options.create {
type = lib.types.string;
description = "Homepage for the package.";
default.value = "https://www.gnu.org/software/findutils";
};
license = lib.options.create {
# TODO: Add a proper type for licenses.
type = lib.types.attrs.any;
description = "License for the package.";
default.value = lib.licenses.gpl3Plus;
};
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["x86_64-linux" "aarch64-linux" "i686-linux"];
};
};
};
config = {
aux.foundation.stages.stage2.findutils = {
version = "4.9.0";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/findutils/findutils-${cfg.version}.tar.xz";
sha256 = "or+4wJ1DZ3DtxZ9Q+kg+eFsWGjt7nVR1c8sIBl/UYv4=";
};
package = builders.bash.build {
name = "findutils-static-${cfg.version}";
meta = cfg.meta;
deps.build.host = [
stage1.gcc.package
stage1.binutils.package
stage1.musl.package
stage1.gnumake.package
stage1.gnused.package
stage1.gnugrep.package
stage1.gnutar.package
stage1.gawk.package
stage1.xz.package
stage1.diffutils.package
stage1.findutils.package
];
script = ''
# Unpack
tar xf ${cfg.src}
cd findutils-${cfg.version}
# Configure
bash ./configure \
--prefix=$out \
--build=${platform.build} \
--host=${platform.host} \
CC=musl-gcc \
CFLAGS=-static
# Build
make -j $NIX_BUILD_CORES
# Install
make -j $NIX_BUILD_CORES install
rm $out/bin/updatedb
'';
};
};
};
}

View file

@ -0,0 +1,113 @@
{
lib,
config,
}: let
cfg = config.aux.foundation.stages.stage2.gawk;
platform = config.aux.platform;
builders = config.aux.foundation.builders;
stage1 = config.aux.foundation.stages.stage1;
in {
options.aux.foundation.stages.stage2.gawk = {
package = lib.options.create {
type = lib.types.package;
description = "The package to use for gawk.";
};
version = lib.options.create {
type = lib.types.string;
description = "Version of the package.";
};
src = lib.options.create {
type = lib.types.package;
description = "Source for the package.";
};
meta = {
description = lib.options.create {
type = lib.types.string;
description = "Description for the package.";
default.value = "GNU implementation of the Awk programming language";
};
homepage = lib.options.create {
type = lib.types.string;
description = "Homepage for the package.";
default.value = "https://www.gnu.org/software/gawk";
};
license = lib.options.create {
# TODO: Add a proper type for licenses.
type = lib.types.attrs.any;
description = "License for the package.";
default.value = lib.licenses.gpl3Plus;
};
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["i686-linux"];
};
mainProgram = lib.options.create {
type = lib.types.string;
description = "The main program of the package.";
default.value = "awk";
};
};
};
config = {
aux.foundation.stages.stage2.gawk = {
version = "5.2.2";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/gawk/gawk-${cfg.version}.tar.gz";
sha256 = "lFrvfM/xAfILIqEIArwAXplKsrjqPnJMwaGXxi9B9lA=";
};
package = builders.bash.boot.build {
name = "gawk-static-${cfg.version}";
meta = cfg.meta;
deps.build.host = [
stage1.gcc.package
stage1.musl.package
stage1.binutils.package
stage1.gnumake.package
stage1.gnused.package
stage1.gnugrep.package
stage1.gnutar.package
stage1.gzip.package
stage1.gawk.boot.package
stage1.diffutils.package
stage1.findutils.package
];
script = ''
# Unpack
tar xf ${cfg.src}
cd gawk-${cfg.version}
# Configure
bash ./configure \
--prefix=$out \
--build=${platform.build} \
--host=${platform.host} \
CC=musl-gcc \
CFLAGS=-static
# Build
make -j $NIX_BUILD_CORES
# Install
make -j $NIX_BUILD_CORES install
rm $out/bin/gawkbug
'';
};
};
};
}

View file

@ -0,0 +1,122 @@
{
lib,
config,
}: let
cfg = config.aux.foundation.stages.stage2.gnumake;
platform = config.aux.platform;
builders = config.aux.foundation.builders;
stage1 = config.aux.foundation.stages.stage1;
stage2 = config.aux.foundation.stages.stage2;
in {
options.aux.foundation.stages.stage2.gnumake = {
package = lib.options.create {
type = lib.types.package;
description = "The package to use for gnumake.";
};
meta = {
description = lib.options.create {
type = lib.types.string;
description = "Description for the package.";
default.value = "A tool to control the generation of non-source files from sources";
};
homepage = lib.options.create {
type = lib.types.string;
description = "Homepage for the package.";
default.value = "https://www.gnu.org/software/make";
};
license = lib.options.create {
# TODO: Add a proper type for licenses.
type = lib.types.attrs.any;
description = "License for the package.";
default.value = lib.licenses.gpl3Plus;
};
platforms = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Platforms the package supports.";
default.value = ["x86_64-linux" "aarch64-linux" "i686-linux"];
};
};
version = lib.options.create {
type = lib.types.string;
description = "Version of the package.";
};
src = lib.options.create {
type = lib.types.package;
description = "Source for the package.";
};
};
config = {
aux.foundation.stages.stage2.gnumake = {
version = "4.4.1";
src = builtins.fetchurl {
url = "https://ftpmirror.gnu.org/make/make-${cfg.version}.tar.gz";
sha256 = "3Rb7HWe/q3mnL16DkHNcSePo5wtJRaFasfgd23hlj7M=";
};
package = let
patches = [
# Replaces /bin/sh with sh, see patch file for reasoning
./patches/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.
./patches/0002-remove-impure-dirs.patch
];
in
builders.bash.boot.build {
name = "gnumake-static-${cfg.version}";
meta = cfg.meta;
deps.build.host = [
stage1.gcc.package
stage1.musl.package
stage1.binutils.package
stage1.gnumake.package
stage1.gnupatch.package
stage1.gnused.package
stage1.gnugrep.package
stage1.gawk.package
stage1.diffutils.package
stage1.findutils.package
stage1.gnutar.package
stage1.gzip.package
];
script = ''
# Unpack
tar xf ${cfg.src}
cd make-${cfg.version}
# Patch
${lib.strings.concatMapSep "\n" (file: "patch -Np1 -i ${file}") patches}
# Configure
bash ./configure \
--prefix=$out \
--build=${platform.build} \
--host=${platform.host} \
CC=musl-gcc \
CFLAGS=-static
# Build
make -j $NIX_BUILD_CORES
# Install
make -j $NIX_BUILD_CORES install
'';
};
};
};
}

View file

@ -0,0 +1,36 @@
From e00a5257a6ca5fedbf68b09eee7df3502971a057 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
Date: Sat, 24 Apr 2021 10:11:40 +0200
Subject: [PATCH 1/2] No impure bin sh
default_shell is used to populuate default shell used to execute jobs.
Unless SHELL is set to a different value this would be /bin/sh.
Our stdenv provides sh in form of bash anyway. Having this value not
hard-coded has some advantages:
- It would ensure that on all systems it uses sh from its PATH rather
than /bin/sh, which helps as different systems might have different
shells there (bash vs. dash)
- In the past I had issues with LD_PRELOAD with BEAR, where /bin/sh
used a different glibc than BEAR which came from my development shell.
---
src/job.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/job.c b/src/job.c
index ae1f18b..6b4ddb3 100644
--- a/src/job.c
+++ b/src/job.c
@@ -77,7 +77,7 @@ char * vms_strsignal (int status);
#else
-const char *default_shell = "/bin/sh";
+const char *default_shell = "sh";
int batch_mode_shell = 0;
#endif
--
2.31.1

View file

@ -0,0 +1,41 @@
From 795d63d3c8b5c0dbb7e544954f75507b371b7228 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
Date: Sat, 24 Apr 2021 10:20:16 +0200
Subject: [PATCH 2/2] remove impure dirs
---
src/read.c | 3 ---
src/remake.c | 2 --
2 files changed, 5 deletions(-)
diff --git a/src/read.c b/src/read.c
index fa197fb..defacfb 100644
--- a/src/read.c
+++ b/src/read.c
@@ -109,9 +109,6 @@ static const char *default_include_directories[] =
#endif
INCLUDEDIR,
#ifndef _AMIGA
- "/usr/gnu/include",
- "/usr/local/include",
- "/usr/include",
#endif
0
};
diff --git a/src/remake.c b/src/remake.c
index fb237c5..94bff7d 100644
--- a/src/remake.c
+++ b/src/remake.c
@@ -1601,8 +1601,6 @@ library_search (const char *lib, FILE_TIMESTAMP *mtime_ptr)
static const char *dirs[] =
{
#ifndef _AMIGA
- "/lib",
- "/usr/lib",
#endif
#if defined(WINDOWS32) && !defined(LIBDIR)
/*
--
2.31.1

View file

@ -0,0 +1,59 @@
diff --git a/src/dir.c b/src/dir.c
index 3e94b98..cfaa6a2 100644
--- a/src/dir.c
+++ b/src/dir.c
@@ -1331,10 +1331,9 @@ local_stat (const char *path, struct stat *buf)
/* Similarly for lstat. */
#if !defined(lstat) && !defined(WINDOWS32) || defined(VMS)
-# ifndef VMS
-# ifndef HAVE_SYS_STAT_H
+// mes-libc implements but does not declare lstat
+# if (!defined(VMS) && !defined(HAVE_SYS_STAT_H)) || defined(__TINYC__)
int lstat (const char *path, struct stat *sbuf);
-# endif
# else
/* We are done with the fake lstat. Go back to the real lstat */
# ifdef lstat
diff --git a/src/job.c b/src/job.c
index ea88561..8388a82 100644
--- a/src/job.c
+++ b/src/job.c
@@ -2052,7 +2052,8 @@ job_next_command (struct child *child)
static int
load_too_high (void)
{
-#if defined(__MSDOS__) || defined(VMS) || defined(_AMIGA) || defined(__riscos__)
+// mes-libc does not support getloadavg
+#if defined(__MSDOS__) || defined(VMS) || defined(_AMIGA) || defined(__riscos__) || defined (__TINYC__)
return 1;
#else
static double last_sec;
diff --git a/src/main.c b/src/main.c
index a9d3a64..664d40f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2770,7 +2770,7 @@ main (int argc, char **argv, char **envp)
char *b = alloca (40);
sprintf (b, "MAKE_RESTARTS=%s%u",
OUTPUT_IS_TRACED () ? "-" : "", restarts);
- putenv (b);
+ // mes-libc does not support putenv
}
fflush (stdout);
diff --git a/src/misc.c b/src/misc.c
index eb14f40..bffca82 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -653,7 +653,8 @@ get_tmppath ()
# ifdef HAVE_MKTEMP
path = get_tmptemplate ();
- if (*mktemp (path) == '\0')
+ // tinycc: "src/misc.c:656: error: pointer expected"
+ if (!strcmp(mktemp (path), ""))
{
OSS (error, NILF,
_("cannot generate temp path from %s: %s"), path, strerror (errno));