add bootstraped x86_64-linux cross compiled gcc #8
|
@ -3,17 +3,18 @@
|
||||||
"lib": {
|
"lib": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"dir": "lib",
|
"dir": "lib",
|
||||||
"dirtyRev": "2be3111b2c0911f40b47fe0a1fb22b5f5188cf59-dirty",
|
"lastModified": 1723737980,
|
||||||
"dirtyShortRev": "2be3111-dirty",
|
"narHash": "sha256-1WnFatW5kSuO2jjt62hvSbH84TSYyO+VmvkJ0d5e/ZY=",
|
||||||
"lastModified": 1719251485,
|
"ref": "master",
|
||||||
"narHash": "sha256-63NvfFVeTDITfNu60rmCUlaZtAeZUnvrIaOLSk9ScC8=",
|
"rev": "cadfaabc853d20f2bc20bad794fcbe520ea48f13",
|
||||||
|
"revCount": 82,
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "file:../?dir=lib"
|
"url": "file:../"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"dir": "lib",
|
"dir": "lib",
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "file:../?dir=lib"
|
"url": "file:../"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
|
|
|
@ -8,33 +8,33 @@
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"dir": "foundation",
|
"dir": "foundation",
|
||||||
"dirtyRev": "3f9d287065ac685ce500c2cddb35428b2927f5a2-dirty",
|
"dirtyRev": "cadfaabc853d20f2bc20bad794fcbe520ea48f13-dirty",
|
||||||
"dirtyShortRev": "3f9d287-dirty",
|
"dirtyShortRev": "cadfaab-dirty",
|
||||||
"lastModified": 1720514984,
|
"lastModified": 1723737980,
|
||||||
"narHash": "sha256-AuixwSlYk34Z6+GEc7y4QotF3Hk963zC9I9hAwX5KCE=",
|
"narHash": "sha256-wytg4odrfvFVYvTskWUficyi8VnaaEt54aIlKUn3SKw=",
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "file:../?dir=foundation"
|
"url": "file:../"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"dir": "foundation",
|
"dir": "foundation",
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "file:../?dir=foundation"
|
"url": "file:../"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lib": {
|
"lib": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"dir": "lib",
|
"dir": "lib",
|
||||||
"dirtyRev": "3f9d287065ac685ce500c2cddb35428b2927f5a2-dirty",
|
"dirtyRev": "cadfaabc853d20f2bc20bad794fcbe520ea48f13-dirty",
|
||||||
"dirtyShortRev": "3f9d287-dirty",
|
"dirtyShortRev": "cadfaab-dirty",
|
||||||
"lastModified": 1720514984,
|
"lastModified": 1723737980,
|
||||||
"narHash": "sha256-AuixwSlYk34Z6+GEc7y4QotF3Hk963zC9I9hAwX5KCE=",
|
"narHash": "sha256-wytg4odrfvFVYvTskWUficyi8VnaaEt54aIlKUn3SKw=",
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "file:../?dir=lib"
|
"url": "file:../"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"dir": "lib",
|
"dir": "lib",
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "file:../?dir=lib"
|
"url": "file:../"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
|
|
|
@ -65,7 +65,15 @@ in
|
||||||
PATH =
|
PATH =
|
||||||
let
|
let
|
||||||
bins = lib.paths.bin (
|
bins = lib.paths.bin (
|
||||||
(lib.packages.dependencies.get dependencies.build.host)
|
(lib.packages.dependencies.get dependencies.build.only)
|
||||||
|
++ (lib.packages.dependencies.get dependencies.build.build)
|
||||||
|
++ (lib.packages.dependencies.get dependencies.build.host)
|
||||||
|
++ (lib.packages.dependencies.get dependencies.build.target)
|
||||||
|
++ (lib.packages.dependencies.get dependencies.host.only)
|
||||||
|
++ (lib.packages.dependencies.get dependencies.host.host)
|
||||||
|
++ (lib.packages.dependencies.get dependencies.host.target)
|
||||||
|
++ (lib.packages.dependencies.get dependencies.target.only)
|
||||||
|
++ (lib.packages.dependencies.get dependencies.target.target)
|
||||||
++ [
|
++ [
|
||||||
foundation.stage2-bash
|
foundation.stage2-bash
|
||||||
foundation.stage2-coreutils
|
foundation.stage2-coreutils
|
||||||
|
@ -99,6 +107,7 @@ in
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
|
# (builtins.trace "build: ${package.name} -> build=${package.platform.build.triple} host=${package.platform.host.triple} target=${package.platform.target.triple}")
|
||||||
built
|
built
|
||||||
// {
|
// {
|
||||||
inherit (package) meta;
|
inherit (package) meta;
|
||||||
|
|
|
@ -26,16 +26,32 @@ in
|
||||||
# }))
|
# }))
|
||||||
# .config;
|
# .config;
|
||||||
foundation-gcc = config.packages.foundation.gcc;
|
foundation-gcc = config.packages.foundation.gcc;
|
||||||
|
foundation-glibc = config.packages.foundation.glibc;
|
||||||
foundation-binutils = config.packages.foundation.binutils;
|
foundation-binutils = config.packages.foundation.binutils;
|
||||||
foundation-linux-headers = config.packages.foundation.linux-headers;
|
foundation-linux-headers = config.packages.foundation.linux-headers;
|
||||||
# foundation-linux-headers = config.packages.foundation.linux-headers.versions.latest.extend {
|
# foundation-linux-headers = config.packages.foundation.linux-headers.versions.latest.extend {
|
||||||
# platform.host = lib.modules.overrides.force "x86_64-linux";
|
# platform.host = lib.modules.overrides.force "x86_64-linux";
|
||||||
# };
|
# };
|
||||||
# example-x = config.packages.example.x;
|
|
||||||
cross-aux-a-x86_64-linux = config.packages.cross.x86_64-linux.aux.a;
|
cross-aux-a-x86_64-linux = config.packages.cross.x86_64-linux.aux.a;
|
||||||
cross-foundation-gcc-x86_64-linux = config.packages.cross.x86_64-linux.foundation.gcc;
|
cross-foundation-gcc-x86_64-linux = config.packages.cross.x86_64-linux.foundation.gcc;
|
||||||
|
|
||||||
|
example-a = config.packages.foundation.gcc.versions.latest.extend {
|
||||||
|
platform = {
|
||||||
|
target = lib.modules.override 0 "x86_64-linux";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
# exported.packages.i686-linux.example-b =
|
||||||
|
# let
|
||||||
|
# pkg =
|
||||||
|
# config.packages.foundation.gcc.versions.latest.extend {
|
||||||
|
# platform = {
|
||||||
|
# target = "aarch64-linux";
|
||||||
|
# };
|
||||||
|
# };
|
||||||
|
# in
|
||||||
|
# pkg.package;
|
||||||
|
|
||||||
# exported.packages.i686-linux.cross-foundation-gcc-x86_64-linux = config.packages.cross.x86_64-linux.foundation.gcc.package;
|
# exported.packages.i686-linux.cross-foundation-gcc-x86_64-linux = config.packages.cross.x86_64-linux.foundation.gcc.package;
|
||||||
};
|
};
|
||||||
|
|
|
@ -230,6 +230,34 @@ in
|
||||||
default.value = [ ];
|
default.value = [ ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# extend = lib.options.create {
|
||||||
|
# description = "Extend the package definition.";
|
||||||
|
# type = lib.types.function lib.types.raw;
|
||||||
|
# internal = true;
|
||||||
|
# writable = false;
|
||||||
|
# default.value = module:
|
||||||
|
# let
|
||||||
|
# normalized =
|
||||||
|
# if builtins.isList module then
|
||||||
|
# module
|
||||||
|
# else if builtins.isFunction module || module ? config then
|
||||||
|
# [ module ]
|
||||||
|
# else
|
||||||
|
# [{
|
||||||
|
# config = module;
|
||||||
|
# }];
|
||||||
|
# result = meta.extend {
|
||||||
|
# modules =
|
||||||
|
# normalized ++ [
|
||||||
|
# {
|
||||||
|
# config.__modules__ = lib.modules.overrides.force (config.__modules__ ++ normalized);
|
||||||
|
# }
|
||||||
|
# ];
|
||||||
|
# };
|
||||||
|
# in
|
||||||
|
# result.config;
|
||||||
|
# };
|
||||||
|
|
||||||
extend = lib.options.create {
|
extend = lib.options.create {
|
||||||
description = "Extend the package definition.";
|
description = "Extend the package definition.";
|
||||||
type = lib.types.function lib.types.raw;
|
type = lib.types.function lib.types.raw;
|
||||||
|
@ -246,13 +274,14 @@ in
|
||||||
[{
|
[{
|
||||||
config = module;
|
config = module;
|
||||||
}];
|
}];
|
||||||
result = meta.extend {
|
|
||||||
modules =
|
modules = config.__modules__ ++ normalized;
|
||||||
normalized ++ [
|
|
||||||
{
|
result = lib.modules.run {
|
||||||
config.__modules__ = lib.modules.overrides.force (config.__modules__ ++ normalized);
|
modules = [
|
||||||
}
|
submodule
|
||||||
];
|
{ config.__modules__ = modules; }
|
||||||
|
] ++ modules;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
result.config;
|
result.config;
|
||||||
|
@ -261,8 +290,8 @@ in
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
description = "The description for the package.";
|
description = "The description for the package.";
|
||||||
type = lib.types.nullish lib.types.string;
|
type = lib.types.string;
|
||||||
default.value = null;
|
default.value = "";
|
||||||
};
|
};
|
||||||
|
|
||||||
homepage = lib.options.create {
|
homepage = lib.options.create {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ lib', config }:
|
{ config }:
|
||||||
let
|
let
|
||||||
inherit (config) builders packages;
|
inherit (config) builders packages;
|
||||||
in
|
in
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{ lib
|
||||||
lib,
|
, lib'
|
||||||
lib',
|
, config
|
||||||
config,
|
, options
|
||||||
options,
|
,
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (config)
|
inherit (config)
|
||||||
|
@ -27,101 +27,112 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config =
|
||||||
meta = {
|
let
|
||||||
platforms = [ "i686-linux" ];
|
isBuildBootstrapped = config.platform.build.double == "i686-linux";
|
||||||
};
|
isHostBootstrapped = config.platform.host.double == "i686-linux";
|
||||||
|
|
||||||
pname = "binutils";
|
isBootstrapped = isBuildBootstrapped && isHostBootstrapped;
|
||||||
version = "2.41";
|
in
|
||||||
|
{
|
||||||
|
meta = {
|
||||||
|
platforms = [ "i686-linux" ];
|
||||||
|
};
|
||||||
|
|
||||||
builder = builders.basic;
|
pname = "binutils";
|
||||||
|
version = "2.41";
|
||||||
|
|
||||||
deps = {
|
builder = builders.basic;
|
||||||
build = {
|
|
||||||
host = {
|
deps = {
|
||||||
inherit (packages.foundation) gcc;
|
build = {
|
||||||
|
only = {
|
||||||
|
gcc = lib.modules.when (!isBootstrapped) packages.foundation.gcc;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
env = {
|
env = {
|
||||||
PATH = lib.paths.bin [
|
PATH = lib.paths.bin (
|
||||||
# foundation.stage2-gcc
|
lib.lists.when isBootstrapped
|
||||||
foundation.stage2-binutils
|
[ foundation.stage2-gcc ]
|
||||||
foundation.stage2-gnumake
|
++ [
|
||||||
foundation.stage2-gnupatch
|
foundation.stage2-gcc
|
||||||
foundation.stage2-gnused
|
foundation.stage2-binutils
|
||||||
foundation.stage2-gnugrep
|
foundation.stage2-gnumake
|
||||||
foundation.stage2-gawk
|
foundation.stage2-gnupatch
|
||||||
foundation.stage2-diffutils
|
foundation.stage2-gnused
|
||||||
foundation.stage2-findutils
|
foundation.stage2-gnugrep
|
||||||
foundation.stage2-gnutar
|
foundation.stage2-gawk
|
||||||
foundation.stage1-xz
|
foundation.stage2-diffutils
|
||||||
];
|
foundation.stage2-findutils
|
||||||
};
|
foundation.stage2-gnutar
|
||||||
|
foundation.stage1-xz
|
||||||
phases =
|
]
|
||||||
let
|
);
|
||||||
patches = [
|
|
||||||
# Make binutils output deterministic by default.
|
|
||||||
./patches/deterministic.patch
|
|
||||||
];
|
|
||||||
|
|
||||||
configureFlags = [
|
|
||||||
# "CC=musl-gcc"
|
|
||||||
"LDFLAGS=--static"
|
|
||||||
"--prefix=${builtins.placeholder "out"}"
|
|
||||||
"--build=${config.platform.build.triple}"
|
|
||||||
"--host=${config.platform.host.triple}"
|
|
||||||
"--target=${config.platform.target.triple}"
|
|
||||||
|
|
||||||
"--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=:"
|
|
||||||
|
|
||||||
"--disable-multilib"
|
|
||||||
];
|
|
||||||
in
|
|
||||||
{
|
|
||||||
unpack = ''
|
|
||||||
tar xf ${config.src}
|
|
||||||
cd binutils-${config.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 = ''
|
|
||||||
make -j $NIX_BUILD_CORES install-strip
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
src = builtins.fetchurl {
|
phases =
|
||||||
url = "${mirrors.gnu}/binutils/binutils-${config.version}.tar.xz";
|
let
|
||||||
sha256 = "rppXieI0WeWWBuZxRyPy0//DHAMXQZHvDQFb3wYAdFA=";
|
patches = [
|
||||||
|
# Make binutils output deterministic by default.
|
||||||
|
./patches/deterministic.patch
|
||||||
|
];
|
||||||
|
|
||||||
|
configureFlags = [
|
||||||
|
# "CC=musl-gcc"
|
||||||
|
"LDFLAGS=--static"
|
||||||
|
"--prefix=${builtins.placeholder "out"}"
|
||||||
|
"--build=${config.platform.build.triple}"
|
||||||
|
"--host=${config.platform.host.triple}"
|
||||||
|
"--target=${config.platform.target.triple}"
|
||||||
|
|
||||||
|
"--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=:"
|
||||||
|
|
||||||
|
"--disable-multilib"
|
||||||
|
];
|
||||||
|
in
|
||||||
|
{
|
||||||
|
unpack = ''
|
||||||
|
tar xf ${config.src}
|
||||||
|
cd binutils-${config.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 = ''
|
||||||
|
make -j $NIX_BUILD_CORES install-strip
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
src = builtins.fetchurl {
|
||||||
|
url = "${mirrors.gnu}/binutils/binutils-${config.version}.tar.xz";
|
||||||
|
sha256 = "rppXieI0WeWWBuZxRyPy0//DHAMXQZHvDQFb3wYAdFA=";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -84,133 +84,207 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config =
|
||||||
meta = {
|
let
|
||||||
platforms = [ "i686-linux" ];
|
isBuildBootstrapped = config.platform.build.double == "i686-linux";
|
||||||
};
|
isHostBootstrapped = config.platform.host.double == "i686-linux";
|
||||||
|
|
||||||
pname = "gcc";
|
isBootstrapped = isBuildBootstrapped && isHostBootstrapped;
|
||||||
version = "13.2.0";
|
in
|
||||||
|
{
|
||||||
builder = builders.basic;
|
meta = {
|
||||||
|
platforms = [ "i686-linux" ];
|
||||||
env = {
|
|
||||||
PATH = lib.paths.bin [
|
|
||||||
foundation.stage2-gcc
|
|
||||||
foundation.stage2-binutils
|
|
||||||
foundation.stage2-gnumake
|
|
||||||
foundation.stage2-gnused
|
|
||||||
foundation.stage2-gnugrep
|
|
||||||
foundation.stage2-gawk
|
|
||||||
foundation.stage2-diffutils
|
|
||||||
foundation.stage2-findutils
|
|
||||||
foundation.stage2-gnutar
|
|
||||||
foundation.stage2-gzip
|
|
||||||
foundation.stage2-bzip2
|
|
||||||
foundation.stage1-xz
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
phases =
|
|
||||||
let
|
|
||||||
host = lib.systems.withBuildInfo config.platform.host;
|
|
||||||
|
|
||||||
mbits = if host.system.cpu.family == "x86" then if host.is64bit then "-m64" else "-m32" else "";
|
|
||||||
in
|
|
||||||
{
|
|
||||||
unpack = ''
|
|
||||||
# Unpack
|
|
||||||
tar xf ${config.src}
|
|
||||||
tar xf ${config.gmp.src}
|
|
||||||
tar xf ${config.mpfr.src}
|
|
||||||
tar xf ${config.mpc.src}
|
|
||||||
tar xf ${config.isl.src}
|
|
||||||
cd gcc-${config.version}
|
|
||||||
|
|
||||||
ln -s ../gmp-${config.gmp.version} gmp
|
|
||||||
ln -s ../mpfr-${config.mpfr.version} mpfr
|
|
||||||
ln -s ../mpc-${config.mpc.version} mpc
|
|
||||||
ln -s ../isl-${config.isl.version} isl
|
|
||||||
'';
|
|
||||||
|
|
||||||
patch = ''
|
|
||||||
# Patch
|
|
||||||
# force musl even if host triple is gnu
|
|
||||||
sed -i 's|"os/gnu-linux"|"os/generic"|' libstdc++-v3/configure.host
|
|
||||||
'';
|
|
||||||
|
|
||||||
configure = ''
|
|
||||||
# Configure
|
|
||||||
export CC="gcc -Wl,-dynamic-linker -Wl,${foundation.stage1-musl}/lib/libc.so"
|
|
||||||
export CXX="g++ -Wl,-dynamic-linker -Wl,${foundation.stage1-musl}/lib/libc.so"
|
|
||||||
export CFLAGS_FOR_TARGET="-Wl,-dynamic-linker -Wl,${foundation.stage1-musl}/lib/libc.so"
|
|
||||||
export LIBRARY_PATH="${foundation.stage1-musl}/lib"
|
|
||||||
|
|
||||||
bash ./configure \
|
|
||||||
--prefix=$out \
|
|
||||||
--build=${config.platform.build.triple} \
|
|
||||||
--host=${config.platform.host.triple} \
|
|
||||||
--target=${config.platform.target.triple} \
|
|
||||||
--with-native-system-header-dir=/include \
|
|
||||||
--with-sysroot=${foundation.stage1-musl} \
|
|
||||||
--enable-languages=c,c++ \
|
|
||||||
--disable-bootstrap \
|
|
||||||
--disable-libsanitizer \
|
|
||||||
--disable-lto \
|
|
||||||
--disable-multilib \
|
|
||||||
--disable-plugin \
|
|
||||||
CFLAGS=-static \
|
|
||||||
CXXFLAGS=-static
|
|
||||||
'';
|
|
||||||
|
|
||||||
build = ''
|
|
||||||
# Build
|
|
||||||
make -j $NIX_BUILD_CORES
|
|
||||||
'';
|
|
||||||
|
|
||||||
install = ''
|
|
||||||
# Install
|
|
||||||
make -j $NIX_BUILD_CORES install-strip
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
src = builtins.fetchurl {
|
pname = "gcc-${config.platform.build.double}--${config.platform.host.double}--${config.platform.target.double}";
|
||||||
url = "${mirrors.gnu}/gcc/gcc-${config.version}/gcc-${config.version}.tar.xz";
|
version = "13.2.0";
|
||||||
sha256 = "4nXnZEKmBnNBon8Exca4PYYTFEAEwEE1KIY9xrXHQ9o=";
|
|
||||||
};
|
builder = builders.basic;
|
||||||
|
|
||||||
|
# hooks = ctx: let
|
||||||
|
#
|
||||||
|
# in {
|
||||||
|
# "aux:gcc:env" = lib.dag.entry.before [ "unpack" ] ''
|
||||||
|
#
|
||||||
|
# '';
|
||||||
|
# };
|
||||||
|
|
||||||
|
deps =
|
||||||
|
let
|
||||||
|
platform =
|
||||||
|
if !isBuildBootstrapped then
|
||||||
|
{
|
||||||
|
build = "i686-linux";
|
||||||
|
host = lib.modules.override 0 config.platform.build.triple;
|
||||||
|
target = lib.modules.override 0 config.platform.build.triple;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
build = "i686-linux";
|
||||||
|
host = "i686-linux";
|
||||||
|
target = lib.modules.override 0 config.platform.host.triple;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
{
|
||||||
|
build = {
|
||||||
|
only = {
|
||||||
|
gcc =
|
||||||
|
lib.modules.when
|
||||||
|
(!isBootstrapped)
|
||||||
|
(packages.foundation.gcc.versions.latest.extend {
|
||||||
|
inherit platform;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
build = {
|
||||||
|
binutils = packages.foundation.binutils;
|
||||||
|
linux-headers = packages.foundation.linux-headers;
|
||||||
|
glibc = packages.foundation.glibc;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
hooks = ctx: {
|
||||||
|
"aux:compiler:setup" = lib.dag.entry.before [ "unpack" ] ''
|
||||||
|
: ''${AUX_COMPILER_LIBRARY_PATH:=}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
env = {
|
||||||
|
PATH = lib.paths.bin (
|
||||||
|
lib.lists.when
|
||||||
|
(isBootstrapped)
|
||||||
|
[
|
||||||
|
foundation.stage2-gcc
|
||||||
|
# foundation.stage2-binutils
|
||||||
|
]
|
||||||
|
++ [
|
||||||
|
foundation.stage2-gnumake
|
||||||
|
foundation.stage2-gnused
|
||||||
|
foundation.stage2-gnugrep
|
||||||
|
foundation.stage2-gawk
|
||||||
|
foundation.stage2-diffutils
|
||||||
|
foundation.stage2-findutils
|
||||||
|
foundation.stage2-gnutar
|
||||||
|
foundation.stage2-gzip
|
||||||
|
foundation.stage2-bzip2
|
||||||
|
foundation.stage1-xz
|
||||||
|
]
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
phases =
|
||||||
|
let
|
||||||
|
host = lib.systems.withBuildInfo config.platform.host;
|
||||||
|
|
||||||
|
compiler = if isBootstrapped then "gcc" else "${config.platform.build.triple}-gcc";
|
||||||
|
|
||||||
|
mbits = if host.system.cpu.family == "x86" then if host.is64bit then "-m64" else "-m32" else "";
|
||||||
|
in
|
||||||
|
{
|
||||||
|
"aux:compiler:setup" = ''
|
||||||
|
: ''${AUX_COMPILER_LIBRARY_PATH:=}
|
||||||
|
'';
|
||||||
|
|
||||||
|
unpack = ''
|
||||||
|
# Unpack
|
||||||
|
tar xf ${config.src}
|
||||||
|
tar xf ${config.gmp.src}
|
||||||
|
tar xf ${config.mpfr.src}
|
||||||
|
tar xf ${config.mpc.src}
|
||||||
|
tar xf ${config.isl.src}
|
||||||
|
cd gcc-${config.version}
|
||||||
|
|
||||||
|
ln -s ../gmp-${config.gmp.version} gmp
|
||||||
|
ln -s ../mpfr-${config.mpfr.version} mpfr
|
||||||
|
ln -s ../mpc-${config.mpc.version} mpc
|
||||||
|
ln -s ../isl-${config.isl.version} isl
|
||||||
|
'';
|
||||||
|
|
||||||
|
patch = ''
|
||||||
|
# Patch
|
||||||
|
# force musl even if host triple is gnu
|
||||||
|
# sed -i 's|"os/gnu-linux"|"os/generic"|' libstdc++-v3/configure.host
|
||||||
|
'';
|
||||||
|
|
||||||
|
configure = ''
|
||||||
|
# Configure
|
||||||
|
# export CC="gcc -Wl,-dynamic-linker -Wl,${foundation.stage1-musl}/lib/libc.so"
|
||||||
|
# export CXX="g++ -Wl,-dynamic-linker -Wl,${foundation.stage1-musl}/lib/libc.so"
|
||||||
|
# export CFLAGS_FOR_TARGET="-Wl,-dynamic-linker -Wl,${foundation.stage1-musl}/lib/libc.so"
|
||||||
|
export CC="gcc -Wl,-dynamic-linker"
|
||||||
|
export CXX="g++ -Wl,-dynamic-linker"
|
||||||
|
export CFLAGS_FOR_TARGET="-Wl,-dynamic-linker"
|
||||||
|
# export LIBRARY_PATH="${foundation.stage1-musl}/lib"
|
||||||
|
export LIBRARY_PATH="$AUX_COMPILER_LIBRARY_PATH"
|
||||||
|
|
||||||
|
: ''${LD_LIBRARY_PATH:=}
|
||||||
|
export LD_LIBRARY_PATH="$NIX_BUILD_TOP/gmp/lib:$NIX_BUILD_TOP/mpfr/lib:$NIX_BUILD_TOP/mpc/lib:$NIX_BUILD_TOP/isl/lib:$LD_LIBRARY_PATH"
|
||||||
|
|
||||||
|
# --with-sysroot=${foundation.stage1-musl} \
|
||||||
|
# --with-native-system-header-dir=/include \
|
||||||
|
bash ./configure \
|
||||||
|
--prefix=$out \
|
||||||
|
--build=${config.platform.build.triple} \
|
||||||
|
--host=${config.platform.host.triple} \
|
||||||
|
--target=${config.platform.target.triple} \
|
||||||
|
--enable-languages=c,c++ \
|
||||||
|
--disable-bootstrap \
|
||||||
|
--disable-libsanitizer \
|
||||||
|
--disable-lto \
|
||||||
|
--disable-multilib \
|
||||||
|
--disable-plugin \
|
||||||
|
CFLAGS=-static \
|
||||||
|
CXXFLAGS=-static
|
||||||
|
'';
|
||||||
|
|
||||||
|
build = ''
|
||||||
|
# Build
|
||||||
|
make -j $NIX_BUILD_CORES
|
||||||
|
'';
|
||||||
|
|
||||||
|
install = ''
|
||||||
|
# Install
|
||||||
|
make -j $NIX_BUILD_CORES install
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
gmp = {
|
|
||||||
version = "6.3.0";
|
|
||||||
src = builtins.fetchurl {
|
src = builtins.fetchurl {
|
||||||
url = "${mirrors.gnu}/gmp/gmp-${config.gmp.version}.tar.xz";
|
url = "${mirrors.gnu}/gcc/gcc-${config.version}/gcc-${config.version}.tar.xz";
|
||||||
sha256 = "o8K4AgG4nmhhb0rTC8Zq7kknw85Q4zkpyoGdXENTiJg=";
|
sha256 = "4nXnZEKmBnNBon8Exca4PYYTFEAEwEE1KIY9xrXHQ9o=";
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
mpfr = {
|
gmp = {
|
||||||
version = "4.2.1";
|
version = "6.3.0";
|
||||||
src = builtins.fetchurl {
|
src = builtins.fetchurl {
|
||||||
url = "${mirrors.gnu}/mpfr/mpfr-${config.mpfr.version}.tar.xz";
|
url = "${mirrors.gnu}/gmp/gmp-${config.gmp.version}.tar.xz";
|
||||||
sha256 = "J3gHNTpnJpeJlpRa8T5Sgp46vXqaW3+yeTiU4Y8fy7I=";
|
sha256 = "o8K4AgG4nmhhb0rTC8Zq7kknw85Q4zkpyoGdXENTiJg=";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
mpc = {
|
mpfr = {
|
||||||
version = "1.3.1";
|
version = "4.2.1";
|
||||||
src = builtins.fetchurl {
|
src = builtins.fetchurl {
|
||||||
url = "${mirrors.gnu}/mpc/mpc-${config.mpc.version}.tar.gz";
|
url = "${mirrors.gnu}/mpfr/mpfr-${config.mpfr.version}.tar.xz";
|
||||||
sha256 = "q2QkkvXPiCt0qgy3MM1BCoHtzb7IlRg86TDnBsHHWbg=";
|
sha256 = "J3gHNTpnJpeJlpRa8T5Sgp46vXqaW3+yeTiU4Y8fy7I=";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
|
||||||
isl = {
|
mpc = {
|
||||||
version = "0.24";
|
version = "1.3.1";
|
||||||
src = builtins.fetchurl {
|
src = builtins.fetchurl {
|
||||||
url = "https://gcc.gnu.org/pub/gcc/infrastructure/isl-${config.isl.version}.tar.bz2";
|
url = "${mirrors.gnu}/mpc/mpc-${config.mpc.version}.tar.gz";
|
||||||
sha256 = "/PeN2WVsEOuM+fvV9ZoLawE4YgX+GTSzsoegoYmBRcA=";
|
sha256 = "q2QkkvXPiCt0qgy3MM1BCoHtzb7IlRg86TDnBsHHWbg=";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
isl = {
|
||||||
|
version = "0.24";
|
||||||
|
src = builtins.fetchurl {
|
||||||
|
url = "https://gcc.gnu.org/pub/gcc/infrastructure/isl-${config.isl.version}.tar.bz2";
|
||||||
|
sha256 = "/PeN2WVsEOuM+fvV9ZoLawE4YgX+GTSzsoegoYmBRcA=";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -41,6 +41,12 @@ in
|
||||||
|
|
||||||
builder = builders.basic;
|
builder = builders.basic;
|
||||||
|
|
||||||
|
hooks = ctx: {
|
||||||
|
"aux:glibc:env" = lib.dag.entry.between ["aux:compiler:setup"] ["configure"] ''
|
||||||
|
AUX_COMPILER_LIBRARY_PATH="${config.package}/lib:$AUX_COMPILER_LIBRARY_PATH"
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
env = {
|
env = {
|
||||||
PATH =
|
PATH =
|
||||||
let
|
let
|
||||||
|
@ -74,6 +80,8 @@ in
|
||||||
foundation.stage2-gnutar
|
foundation.stage2-gnutar
|
||||||
foundation.stage2-gzip
|
foundation.stage2-gzip
|
||||||
foundation.stage2-bzip2
|
foundation.stage2-bzip2
|
||||||
|
foundation.stage1-python
|
||||||
|
foundation.stage1-bison
|
||||||
foundation.stage1-xz
|
foundation.stage1-xz
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
@ -103,7 +111,7 @@ in
|
||||||
|
|
||||||
install = ''
|
install = ''
|
||||||
# Install
|
# Install
|
||||||
make -j $NIX_BUILD_CORES install-strip
|
make -j $NIX_BUILD_CORES INSTALL_UNCOMPRESSED=yes install
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue