tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
minimal-bootstrap.gcc46: build with tinycc-musl
Emily Trau
2 years ago
29b98b0f
a680950c
+36
-35
3 changed files
expand all
collapse all
unified
split
pkgs
os-specific
linux
minimal-bootstrap
default.nix
gcc
4.6.nix
no-system-headers.patch
+6
-2
pkgs/os-specific/linux/minimal-bootstrap/default.nix
···
73
};
74
75
gcc46 = callPackage ./gcc/4.6.nix {
76
-
gcc = gcc2;
77
-
glibc = glibc22;
0
0
0
0
78
};
79
80
inherit (callPackage ./glibc {
···
73
};
74
75
gcc46 = callPackage ./gcc/4.6.nix {
76
+
coreutils = coreutils-musl;
77
+
tinycc = tinycc-musl;
78
+
gnumake = gnumake-musl;
79
+
gnutar = gnutar-musl;
80
+
# FIXME: not sure why new gawk doesn't work
81
+
gawk = gawk-mes;
82
};
83
84
inherit (callPackage ./glibc {
+19
-33
pkgs/os-specific/linux/minimal-bootstrap/gcc/4.6.nix
···
3
, hostPlatform
4
, fetchurl
5
, bash
6
-
, gcc
7
-
, glibc
8
-
, linux-headers
9
, binutils
10
, gnumake
11
, gnupatch
···
32
};
33
34
patches = [
35
-
# This patch enables building gcc-4.6.4 using gcc-2.95.3 and glibc-2.2.5
36
-
# * Tweak Makefile to allow overriding NATIVE_SYSTEM_HEADER_DIR using #:makeflags
37
-
# * Add missing limits.h include.
38
-
# * Add SSIZE_MAX define. The SSIZE_MAX define has been added to Mes
39
-
# upstream and can be removed with the next Mes release.
40
-
# * Remove -fbuilding-libgcc flag, it assumes features being present from a
41
-
# newer gcc or glibc.
42
-
# * [MES_BOOTSTRAP_GCC]: Disable threads harder.
43
-
(fetchurl {
44
-
url = "https://git.savannah.gnu.org/cgit/guix.git/plain/gnu/packages/patches/gcc-boot-4.6.4.patch?id=50249cab3a98839ade2433456fe618acc6f804a5";
45
-
sha256 = "1zzd8gnihw6znrgb6c6pfsmm0vix89xw3giv1nnsykm57j0v3z0d";
46
-
})
47
-
./libstdc++-target.patch
48
];
49
50
-
# To reduce the set of pre-built bootstrap inputs, build
51
-
# GMP & co. from GCC.
52
gmpVersion = "4.3.2";
53
gmp = fetchurl {
54
url = "mirror://gnu/gmp/gmp-${gmpVersion}.tar.gz";
···
71
inherit pname version;
72
73
nativeBuildInputs = [
74
-
gcc
0
75
binutils
76
gnumake
77
gnupatch
···
84
gzip
85
];
86
87
-
# condition in ./libcpp/configure requires `env` which is not available in this coreutils
88
-
am_cv_CXX_dependencies_compiler_type = "gcc";
89
-
am_cv_CC_dependencies_compiler_type = "gcc";
90
-
91
passthru.tests.get-version = result:
92
bash.runCommand "${pname}-get-version-${version}" {} ''
93
${result}/bin/gcc --version
···
118
${lib.concatMapStringsSep "\n" (f: "patch -Np1 -i ${f}") patches}
119
120
# Configure
121
-
export C_INCLUDE_PATH="${gcc}/lib/gcc-lib/${hostPlatform.config}/${gcc.version}/include:${linux-headers}/include:${glibc}/include:$(pwd)/mpfr/src"
0
122
export CPLUS_INCLUDE_PATH="$C_INCLUDE_PATH"
123
-
export LDFLAGS="-B${glibc}/lib -Wl,-dynamic-linker -Wl,${glibc}"
124
-
export LDFLAGS_FOR_TARGET=$LDFLAGS
125
-
export LIBRARY_PATH="${glibc}/lib:${gcc}/lib"
126
-
export LIBS="-lc -lnss_files -lnss_dns -lresolv"
0
0
127
bash ./configure \
128
--prefix=$out \
129
--build=${buildPlatform.config} \
130
--host=${hostPlatform.config} \
131
-
--with-native-system-header-dir=${glibc}/include \
132
-
--with-build-sysroot=${glibc}/include \
133
--disable-bootstrap \
134
--disable-decimal-float \
135
--disable-libatomic \
···
146
--disable-multilib \
147
--disable-plugin \
148
--disable-threads \
149
-
--enable-languages=c,c++ \
150
--enable-static \
151
--disable-shared \
152
--enable-threads=single \
···
154
--disable-build-with-cxx
155
156
# Build
157
-
make
158
159
# Install
160
-
make install
161
''
···
3
, hostPlatform
4
, fetchurl
5
, bash
6
+
, coreutils
7
+
, tinycc
0
8
, binutils
9
, gnumake
10
, gnupatch
···
31
};
32
33
patches = [
34
+
# Remove hardcoded NATIVE_SYSTEM_HEADER_DIR
35
+
./no-system-headers.patch
0
0
0
0
0
0
0
0
0
0
0
36
];
37
0
0
38
gmpVersion = "4.3.2";
39
gmp = fetchurl {
40
url = "mirror://gnu/gmp/gmp-${gmpVersion}.tar.gz";
···
57
inherit pname version;
58
59
nativeBuildInputs = [
60
+
coreutils
61
+
tinycc.compiler
62
binutils
63
gnumake
64
gnupatch
···
71
gzip
72
];
73
0
0
0
0
74
passthru.tests.get-version = result:
75
bash.runCommand "${pname}-get-version-${version}" {} ''
76
${result}/bin/gcc --version
···
101
${lib.concatMapStringsSep "\n" (f: "patch -Np1 -i ${f}") patches}
102
103
# Configure
104
+
export CC="tcc -B ${tinycc.libs}/lib"
105
+
export C_INCLUDE_PATH="${tinycc.libs}/include:$(pwd)/mpfr/src"
106
export CPLUS_INCLUDE_PATH="$C_INCLUDE_PATH"
107
+
108
+
# Avoid "Link tests are not allowed after GCC_NO_EXECUTABLES"
109
+
export lt_cv_shlibpath_overrides_runpath=yes
110
+
export ac_cv_func_memcpy=yes
111
+
export ac_cv_func_strerror=yes
112
+
113
bash ./configure \
114
--prefix=$out \
115
--build=${buildPlatform.config} \
116
--host=${hostPlatform.config} \
117
+
--with-native-system-header-dir=${tinycc.libs}/include \
118
+
--with-build-sysroot=${tinycc.libs}/include \
119
--disable-bootstrap \
120
--disable-decimal-float \
121
--disable-libatomic \
···
132
--disable-multilib \
133
--disable-plugin \
134
--disable-threads \
135
+
--enable-languages=c \
136
--enable-static \
137
--disable-shared \
138
--enable-threads=single \
···
140
--disable-build-with-cxx
141
142
# Build
143
+
make -j $NIX_BUILD_CORES
144
145
# Install
146
+
make -j $NIX_BUILD_CORES install
147
''
+11
pkgs/os-specific/linux/minimal-bootstrap/gcc/no-system-headers.patch
···
0
0
0
0
0
0
0
0
0
0
0
···
1
+
--- a/gcc/Makefile.in
2
+
+++ b/gcc/Makefile.in
3
+
@@ -440,7 +440,7 @@ LINKER_PLUGIN_API_H = $(srcdir)/../include/plugin-api.h
4
+
LTO_SYMTAB_H = $(srcdir)/../include/lto-symtab.h
5
+
6
+
# Default native SYSTEM_HEADER_DIR, to be overridden by targets.
7
+
-NATIVE_SYSTEM_HEADER_DIR = /usr/include
8
+
+# NATIVE_SYSTEM_HEADER_DIR = /usr/include
9
+
# Default cross SYSTEM_HEADER_DIR, to be overridden by targets.
10
+
CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
11
+