From 3e4b2e934749d161fe8e0681a3975738c2a470d6 Mon Sep 17 00:00:00 2001 From: Jonathan Ringer Date: Mon, 23 Sep 2024 21:13:19 -0700 Subject: [PATCH 1/2] WIP --- pkgs/binutils/default.nix | 29 +- pkgs/default.nix | 586 +++++++++++++++++++------------------- 2 files changed, 308 insertions(+), 307 deletions(-) diff --git a/pkgs/binutils/default.nix b/pkgs/binutils/default.nix index 27f85b3..7c3c691 100644 --- a/pkgs/binutils/default.nix +++ b/pkgs/binutils/default.nix @@ -3,13 +3,13 @@ let in { stdenv -, autoreconfHook -, autoconf269, automake, libtool +#, autoreconfHook +#, autoconf269, automake, libtool , bison , buildPackages -, fetchFromGitHub +# , fetchFromGitHub , fetchurl -, flex +# , flex , gettext , lib , noSysDirs @@ -40,12 +40,12 @@ let url = "mirror://gnu/binutils/binutils-${version}.tar.bz2"; hash = "sha256-qlSFDr2lBkxyzU7C2bBWwpQlKZFIY1DZqXqypt/frxI="; }; - vc4-none = fetchFromGitHub { - owner = "itszor"; - repo = "binutils-vc4"; - rev = "708acc851880dbeda1dd18aca4fd0a95b2573b36"; - sha256 = "1kdrz6fki55lm15rwwamn74fnqpy0zlafsida2zymk76n3656c63"; - }; + #vc4-none = fetchFromGitHub { + # owner = "itszor"; + # repo = "binutils-vc4"; + # rev = "708acc851880dbeda1dd18aca4fd0a95b2573b36"; + # sha256 = "1kdrz6fki55lm15rwwamn74fnqpy0zlafsida2zymk76n3656c63"; + #}; }; #INFO: The targetPrefix prepended to binary names to allow multiple binuntils @@ -57,7 +57,8 @@ stdenv.mkDerivation (finalAttrs: { pname = targetPrefix + "binutils"; inherit version; - src = srcs.${targetPlatform.system} or srcs.normal; + #src = srcs.${targetPlatform.system} or srcs.normal; + src = srcs.normal; # WARN: this package is used for bootstrapping fetchurl, and thus cannot use # fetchpatch! All mutable patches (generated by GitHub or cgit) that are @@ -117,9 +118,9 @@ stdenv.mkDerivation (finalAttrs: { bison perl ] - ++ lib.optionals targetPlatform.isiOS [ autoreconfHook ] - ++ lib.optionals buildPlatform.isDarwin [ autoconf269 automake gettext libtool ] - ++ lib.optionals targetPlatform.isVc4 [ flex ] + #++ lib.optionals targetPlatform.isiOS [ autoreconfHook ] + #++ lib.optionals buildPlatform.isDarwin [ autoconf269 automake gettext libtool ] + #++ lib.optionals targetPlatform.isVc4 [ flex ] ; buildInputs = [ zlib gettext ] ++ lib.optionals buildPlatform.isDarwin [ CoreServices ]; diff --git a/pkgs/default.nix b/pkgs/default.nix index f8910e4..e9972c3 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -20,101 +20,101 @@ final: prev: with final; { extraBuildInputs = []; } ); - - autoconf-archive = callPackage ./autoconf-archive { }; - - bash = lowPrio (callPackage ./bash/5.nix { }); - # WARNING: this attribute is used by nix-shell so it shouldn't be removed/renamed - bashInteractive = callPackage ./bash/5.nix { - interactive = true; - withDocs = true; - }; - bashInteractiveFHS = callPackage ./bash/5.nix { - interactive = true; - withDocs = true; - forFHSEnv = true; - }; - +# +# autoconf-archive = callPackage ./autoconf-archive { }; +# +# bash = lowPrio (callPackage ./bash/5.nix { }); +# # WARNING: this attribute is used by nix-shell so it shouldn't be removed/renamed +# bashInteractive = callPackage ./bash/5.nix { +# interactive = true; +# withDocs = true; +# }; +# bashInteractiveFHS = callPackage ./bash/5.nix { +# interactive = true; +# withDocs = true; +# forFHSEnv = true; +# }; +# binutils-unwrapped = callPackage ./binutils { - autoreconfHook = autoreconfHook269; # TODO: darwin support + #autoreconfHook = autoreconfHook269; # inherit (darwin.apple_sdk.frameworks) CoreServices; # FHS sys dirs presumably only have stuff for the build platform noSysDirs = (stdenv.targetPlatform != stdenv.hostPlatform) || noSysDirs; }; - - binutils-unwrapped-all-targets = callPackage ../development/tools/misc/binutils { - autoreconfHook = if targetPlatform.isiOS then autoreconfHook269 else autoreconfHook; - inherit (darwin.apple_sdk.frameworks) CoreServices; - # FHS sys dirs presumably only have stuff for the build platform - noSysDirs = (stdenv.targetPlatform != stdenv.hostPlatform) || noSysDirs; - withAllTargets = true; - }; - binutils = wrapBintoolsWith { - bintools = binutils-unwrapped; - }; - binutils_nogold = lowPrio (wrapBintoolsWith { - bintools = binutils-unwrapped.override { - enableGold = false; - }; - }); - binutilsNoLibc = wrapBintoolsWith { - bintools = binutils-unwrapped; - libc = preLibcCrossHeaders; - }; - - - - # Here we select the default bintools implementations to be used. Note when - # cross compiling these are used not for this stage but the *next* stage. - # That is why we choose using this stage's target platform / next stage's - # host platform. - # - # Because this is the *next* stages choice, it's a bit non-modular to put - # here. In theory, bootstraping is supposed to not be a chain but at tree, - # where each stage supports many "successor" stages, like multiple possible - # futures. We don't have a better alternative, but with this downside in - # mind, please be judicious when using this attribute. E.g. for building - # things in *this* stage you should use probably `stdenv.cc.bintools` (from a - # default or alternate `stdenv`), at build time, and try not to "force" a - # specific bintools at runtime at all. - # - # In other words, try to only use this in wrappers, and only use those - # wrappers from the next stage. - bintools-unwrapped = let - inherit (stdenv.targetPlatform) linker; - in if linker == "lld" then llvmPackages.bintools-unwrapped - else if linker == "cctools" then darwin.binutils-unwrapped - else if linker == "bfd" then binutils-unwrapped - else if linker == "gold" then binutils-unwrapped.override { enableGoldDefault = true; } - else null; - bintoolsNoLibc = wrapBintoolsWith { - bintools = bintools-unwrapped; - libc = preLibcCrossHeaders; - }; - - bintools = wrapBintoolsWith { - bintools = bintools-unwrapped; - }; - - bintoolsDualAs = wrapBintoolsWith { - bintools = darwin.binutilsDualAs-unwrapped; - wrapGas = true; - }; - - - lndir = callPackage ./lndir { }; - - acl = callPackage ./acl { }; - - attr = callPackage ./attr { }; - - autoconf = callPackage ./autoconf { }; - +# +# binutils-unwrapped-all-targets = callPackage ../development/tools/misc/binutils { +# autoreconfHook = if targetPlatform.isiOS then autoreconfHook269 else autoreconfHook; +# inherit (darwin.apple_sdk.frameworks) CoreServices; +# # FHS sys dirs presumably only have stuff for the build platform +# noSysDirs = (stdenv.targetPlatform != stdenv.hostPlatform) || noSysDirs; +# withAllTargets = true; +# }; +# binutils = wrapBintoolsWith { +# bintools = binutils-unwrapped; +# }; +# binutils_nogold = lowPrio (wrapBintoolsWith { +# bintools = binutils-unwrapped.override { +# enableGold = false; +# }; +# }); +# binutilsNoLibc = wrapBintoolsWith { +# bintools = binutils-unwrapped; +# libc = preLibcCrossHeaders; +# }; +# +# +# +# # Here we select the default bintools implementations to be used. Note when +# # cross compiling these are used not for this stage but the *next* stage. +# # That is why we choose using this stage's target platform / next stage's +# # host platform. +# # +# # Because this is the *next* stages choice, it's a bit non-modular to put +# # here. In theory, bootstraping is supposed to not be a chain but at tree, +# # where each stage supports many "successor" stages, like multiple possible +# # futures. We don't have a better alternative, but with this downside in +# # mind, please be judicious when using this attribute. E.g. for building +# # things in *this* stage you should use probably `stdenv.cc.bintools` (from a +# # default or alternate `stdenv`), at build time, and try not to "force" a +# # specific bintools at runtime at all. +# # +# # In other words, try to only use this in wrappers, and only use those +# # wrappers from the next stage. +# bintools-unwrapped = let +# inherit (stdenv.targetPlatform) linker; +# in if linker == "lld" then llvmPackages.bintools-unwrapped +# else if linker == "cctools" then darwin.binutils-unwrapped +# else if linker == "bfd" then binutils-unwrapped +# else if linker == "gold" then binutils-unwrapped.override { enableGoldDefault = true; } +# else null; +# bintoolsNoLibc = wrapBintoolsWith { +# bintools = bintools-unwrapped; +# libc = preLibcCrossHeaders; +# }; +# +# bintools = wrapBintoolsWith { +# bintools = bintools-unwrapped; +# }; +# +# bintoolsDualAs = wrapBintoolsWith { +# bintools = darwin.binutilsDualAs-unwrapped; +# wrapGas = true; +# }; +# +# +# lndir = callPackage ./lndir { }; +# +# acl = callPackage ./acl { }; +# +# attr = callPackage ./attr { }; +# +# autoconf = callPackage ./autoconf { }; +# autoconf269 = callPackage ./autoconf/269.nix { }; automake = callPackage ./automake { }; - +# autoreconfHook = callPackage ( { makeSetupHook, autoconf, automake, gettext, libtool }: makeSetupHook { @@ -128,60 +128,60 @@ final: prev: with final; { }; bison = callPackage ./bison { }; - - bzip2 = callPackage ./bzip2 { }; - - # TODO: Use latest +# +# bzip2 = callPackage ./bzip2 { }; +# +# # TODO: Use latest cloog = callPackage ./cloog { }; cloog_0_18_0 = callPackage ./cloog { }; - - coreutils = callPackage ./coreutils { }; - - dieHook = makeSetupHook { - name = "die-hook"; - } ../build-support/setup-hooks/die.sh; - - diffutils = callPackage ./diffutils { }; - - # Provided by libc on Operating Systems that use the Extensible Linker Format. - elf-header = if stdenv.hostPlatform.isElf then null else - throw "Non-elf builds are not supported yet in this stdenv repo"; +# +# coreutils = callPackage ./coreutils { }; +# +# dieHook = makeSetupHook { +# name = "die-hook"; +# } ../build-support/setup-hooks/die.sh; +# +# diffutils = callPackage ./diffutils { }; +# +# # Provided by libc on Operating Systems that use the Extensible Linker Format. +# elf-header = if stdenv.hostPlatform.isElf then null else +# throw "Non-elf builds are not supported yet in this stdenv repo"; expand-response-params = callPackage ../build-support/expand-response-params { }; - expat = callPackage ./expat { }; - - fetchFromGitHub = callPackage ../build-support/fetchgithub { }; - - fetchpatch = callPackage ../build-support/fetchpath { }; - - file = callPackage ./file { }; - - findutils = callPackage ./findutils { }; - - flex = callPackage ./flex { }; - - gawk = callPackage ./gawk { }; - - gnupatch = callPackage ./gnupatch { }; - +# expat = callPackage ./expat { }; +# +# fetchFromGitHub = callPackage ../build-support/fetchgithub { }; +# +# fetchpatch = callPackage ../build-support/fetchpath { }; +# +# file = callPackage ./file { }; +# +# findutils = callPackage ./findutils { }; +# +# flex = callPackage ./flex { }; +# +# gawk = callPackage ./gawk { }; +# +# gnupatch = callPackage ./gnupatch { }; +# inherit (callPackage ./gcc/all.nix { }) gcc6 gcc7 gcc8 gcc9 gcc10 gcc11 gcc12 gcc13 gcc14; - +# gcc_latest = gcc14; - - db = db5; - db5 = db53; - db53 = callPackage ./db/db-5.3.nix { }; - +# +# db = db5; +# db5 = db53; +# db53 = callPackage ./db/db-5.3.nix { }; +# # TODO: don't use a top-level defined attr to define this - default-gcc-version = + default-gcc-version = if (with stdenv.targetPlatform; isVc4 || libc == "relibc") then 6 else 13; gcc = pkgs.${"gcc${toString default-gcc-version}"}; gccFun = callPackage ./gcc; gcc-unwrapped = gcc.cc; - +# gccStdenv = if stdenv.cc.isGNU then stdenv else stdenv.override { @@ -203,36 +203,36 @@ final: prev: with final; { gcc14Stdenv = overrideCC gccStdenv buildPackages.gcc14; gettext = callPackage ./gettext { }; - +# glibc = callPackage ./glibc { stdenv = gccStdenv; # doesn't compile without gcc }; - - glibcLocales = callPackage ./glibc/locales.nix { }; - - gnu-config = callPackage ./gnu-config { }; - - gnugrep = callPackage ./gnugrep { }; - - gnulib = callPackage ./gnulib { }; - - gnumake = callPackage ./gnumake { }; - - gnum4 = callPackage ./gnum4 { }; - m4 = gnum4; - - gnused = callPackage ./gnused { }; - - gnutar = callPackage ./gnutar { }; - - gmp4 = callPackage ./gmp/4.3.2.nix { }; # required by older GHC versions - gmp5 = callPackage ./gmp/5.1.x.nix { }; - gmp6 = callPackage ./gmp/6.x.nix { }; - gmp = gmp6; - gmpxx = gmp.override { cxx = true; }; - - gzip = callPackage ./gzip { }; - +# +# glibcLocales = callPackage ./glibc/locales.nix { }; +# +# gnu-config = callPackage ./gnu-config { }; +# +# gnugrep = callPackage ./gnugrep { }; +# +# gnulib = callPackage ./gnulib { }; +# +# gnumake = callPackage ./gnumake { }; +# +# gnum4 = callPackage ./gnum4 { }; +# m4 = gnum4; +# +# gnused = callPackage ./gnused { }; +# +# gnutar = callPackage ./gnutar { }; +# +# gmp4 = callPackage ./gmp/4.3.2.nix { }; # required by older GHC versions +# gmp5 = callPackage ./gmp/5.1.x.nix { }; +# gmp6 = callPackage ./gmp/6.x.nix { }; +# gmp = gmp6; +# gmpxx = gmp.override { cxx = true; }; +# +# gzip = callPackage ./gzip { }; +# # TODO: make less messy, islVersions? isl = isl_0_20; isl_0_11 = callPackage ./isl/0.11.1.nix { }; @@ -240,9 +240,9 @@ final: prev: with final; { isl_0_17 = callPackage ./isl/0.17.1.nix { }; isl_0_20 = callPackage ./isl/0.20.0.nix { }; isl_0_24 = callPackage ./isl/0.24.0.nix { }; - - - +# +# +# # We can choose: libcCrossChooser = name: # libc is hackily often used from the previous stage. This `or` @@ -272,122 +272,122 @@ final: prev: with final; { else throw "Unknown libc ${name}"; libcCross = assert stdenv.targetPlatform != stdenv.buildPlatform; libcCrossChooser stdenv.targetPlatform.libc; - - libffi = callPackage ./libffi { }; - libffi_3_3 = callPackage ./libffi/3.3.nix { }; - libffiBoot = libffi.override { - doCheck = false; - }; - - libgcc = stdenv.cc.cc.libgcc or null; - - # GNU libc provides libiconv so systems with glibc don't need to - # build libiconv separately. Additionally, Apple forked/repackaged - # libiconv, so build and use the upstream one with a compatible ABI, - # and BSDs include libiconv in libc. - # - # We also provide `libiconvReal`, which will always be a standalone libiconv, - # just in case you want it regardless of platform. - libiconv = - if lib.elem stdenv.hostPlatform.libc [ "glibc" "musl" "nblibc" "wasilibc" "fblibc" ] - then libcIconv (if stdenv.hostPlatform != stdenv.buildPlatform - then libcCross - else stdenv.cc.libc) - else if stdenv.hostPlatform.isDarwin - then libiconv-darwin - else libiconvReal; - - libcIconv = libc: let - inherit (libc) pname version; - libcDev = lib.getDev libc; - in runCommand "${pname}-iconv-${version}" { strictDeps = true; } '' - mkdir -p $out/include - ln -sv ${libcDev}/include/iconv.h $out/include - ''; - - libiconvReal = callPackage ../development/libraries/libiconv { }; - - iconv = - if lib.elem stdenv.hostPlatform.libc [ "glibc" "musl" ] then - lib.getBin stdenv.cc.libc - else if stdenv.hostPlatform.isDarwin then - lib.getBin libiconv - else if stdenv.hostPlatform.isFreeBSD then - lib.getBin freebsd.iconv - else - lib.getBin libiconvReal; - - libidn2 = callPackage ./libidn2 { }; - - # On non-GNU systems we need GNU Gettext for libintl. - libintl = if stdenv.hostPlatform.libc != "glibc" then gettext else null; - - libmpc = callPackage ./libmpc { }; - - libtool = callPackage ./libtool/libtool2.nix { }; - - libunistring = callPackage ./libunistring { }; - - libxcrypt = callPackage ./libxcrypt { }; - - inherit (callPackages ../os-specific/linux/kernel-headers { inherit (pkgsBuildBuild) elf-header; }) - linuxHeaders makeLinuxHeaders; - - nix-update-script = lib.error "nix-update-script is not supported yet"; - - nukeReferences = callPackage ../build-support/nuke-references { }; - - makeWrapper = makeShellWrapper; - - makeShellWrapper = makeSetupHook { - name = "make-shell-wrapper-hook"; - propagatedBuildInputs = [ dieHook ]; - substitutions = { - # targetPackages.runtimeShell only exists when pkgs == targetPackages (when targetPackages is not __raw) - shell = if targetPackages ? runtimeShell then targetPackages.runtimeShell else throw "makeWrapper/makeShellWrapper must be in nativeBuildInputs"; - }; - passthru = { - tests = tests.makeWrapper; - }; - } ../build-support/setup-hooks/make-wrapper.sh; - - mpdecimal = callPackage ./mpdecimal { }; - - mpfr = callPackage ./mpfr { }; - - minizip = callPackage ./minizip { }; - - patch = gnupatch; - +# +# libffi = callPackage ./libffi { }; +# libffi_3_3 = callPackage ./libffi/3.3.nix { }; +# libffiBoot = libffi.override { +# doCheck = false; +# }; +# +# libgcc = stdenv.cc.cc.libgcc or null; +# +# # GNU libc provides libiconv so systems with glibc don't need to +# # build libiconv separately. Additionally, Apple forked/repackaged +# # libiconv, so build and use the upstream one with a compatible ABI, +# # and BSDs include libiconv in libc. +# # +# # We also provide `libiconvReal`, which will always be a standalone libiconv, +# # just in case you want it regardless of platform. +# libiconv = +# if lib.elem stdenv.hostPlatform.libc [ "glibc" "musl" "nblibc" "wasilibc" "fblibc" ] +# then libcIconv (if stdenv.hostPlatform != stdenv.buildPlatform +# then libcCross +# else stdenv.cc.libc) +# else if stdenv.hostPlatform.isDarwin +# then libiconv-darwin +# else libiconvReal; +# +# libcIconv = libc: let +# inherit (libc) pname version; +# libcDev = lib.getDev libc; +# in runCommand "${pname}-iconv-${version}" { strictDeps = true; } '' +# mkdir -p $out/include +# ln -sv ${libcDev}/include/iconv.h $out/include +# ''; +# +# libiconvReal = callPackage ../development/libraries/libiconv { }; +# +# iconv = +# if lib.elem stdenv.hostPlatform.libc [ "glibc" "musl" ] then +# lib.getBin stdenv.cc.libc +# else if stdenv.hostPlatform.isDarwin then +# lib.getBin libiconv +# else if stdenv.hostPlatform.isFreeBSD then +# lib.getBin freebsd.iconv +# else +# lib.getBin libiconvReal; +# +# libidn2 = callPackage ./libidn2 { }; +# +# # On non-GNU systems we need GNU Gettext for libintl. +# libintl = if stdenv.hostPlatform.libc != "glibc" then gettext else null; +# +# libmpc = callPackage ./libmpc { }; +# +# libtool = callPackage ./libtool/libtool2.nix { }; +# +# libunistring = callPackage ./libunistring { }; +# +# libxcrypt = callPackage ./libxcrypt { }; +# +# inherit (callPackages ../os-specific/linux/kernel-headers { inherit (pkgsBuildBuild) elf-header; }) +# linuxHeaders makeLinuxHeaders; +# +# nix-update-script = lib.error "nix-update-script is not supported yet"; +# +# nukeReferences = callPackage ../build-support/nuke-references { }; +# +# makeWrapper = makeShellWrapper; +# +# makeShellWrapper = makeSetupHook { +# name = "make-shell-wrapper-hook"; +# propagatedBuildInputs = [ dieHook ]; +# substitutions = { +# # targetPackages.runtimeShell only exists when pkgs == targetPackages (when targetPackages is not __raw) +# shell = if targetPackages ? runtimeShell then targetPackages.runtimeShell else throw "makeWrapper/makeShellWrapper must be in nativeBuildInputs"; +# }; +# passthru = { +# tests = tests.makeWrapper; +# }; +# } ../build-support/setup-hooks/make-wrapper.sh; +# +# mpdecimal = callPackage ./mpdecimal { }; +# +# mpfr = callPackage ./mpfr { }; +# +# minizip = callPackage ./minizip { }; +# +# patch = gnupatch; +# patchelf = callPackage ./patchelf { }; - - pcre2 = callPackage ./pcre2 { }; - - perlInterpreters = callPackage ./perl { }; - perl = perlInterpreters.perl538; - - pkg-config = callPackage ./pkg-config { }; - - pythonInterpreters = callPackage ./python { }; - inherit (pythonInterpreters) python3Minimal; - - # For the purpose of the stdenv repo - python3 = python3Minimal; - - readline = readline_8_2; - readline_7_0 = callPackage ./readline/7.0.nix { }; - readline_8_2 = callPackage ./readline/8.2.nix { }; +# +# pcre2 = callPackage ./pcre2 { }; +# +# perlInterpreters = callPackage ./perl { }; +# perl = perlInterpreters.perl538; +# +# pkg-config = callPackage ./pkg-config { }; +# +# pythonInterpreters = callPackage ./python { }; +# inherit (pythonInterpreters) python3Minimal; +# +# # For the purpose of the stdenv repo +# python3 = python3Minimal; +# +# readline = readline_8_2; +# readline_7_0 = callPackage ./readline/7.0.nix { }; +# readline_8_2 = callPackage ./readline/8.2.nix { }; runtimeShell = "${runtimeShellPackage}${runtimeShellPackage.shellPath}"; runtimeShellPackage = bash; - # TODO: stdenv: make this minimal for just stdenv - # testers = callPackage ../build-support/testers { }; - testers = null; - - texinfoVersions = callPackage ./texinfo/packages.nix { }; - texinfo = texinfoVersions.texinfo7; - +# # TODO: stdenv: make this minimal for just stdenv +# # testers = callPackage ../build-support/testers { }; +# testers = null; +# +# texinfoVersions = callPackage ./texinfo/packages.nix { }; +# texinfo = texinfoVersions.texinfo7; +# threadsCross = lib.optionalAttrs (stdenv.targetPlatform.isMinGW && !(stdenv.targetPlatform.useLLVM or false)) { # other possible values: win32 or posix @@ -395,27 +395,27 @@ final: prev: with final; { # For win32 or posix set this to null package = targetPackages.windows.mcfgthreads or windows.mcfgthreads; }; - - - updateAutotoolsGnuConfigScriptsHook = makeSetupHook { - name = "update-autotools-gnu-config-scripts-hook"; - substitutions = { gnu_config = gnu-config; }; - } ../build-support/setup-hooks/update-autotools-gnu-config-scripts.sh; - - wrapBintoolsWith = - { bintools - , libc ? if stdenv.targetPlatform != stdenv.hostPlatform then libcCross else stdenv.cc.libc - , ... - } @ extraArgs: - callPackage ../build-support/bintools-wrapper (let self = { - nativeTools = stdenv.targetPlatform == stdenv.hostPlatform && stdenv.cc.nativeTools or false; - nativeLibc = stdenv.targetPlatform == stdenv.hostPlatform && stdenv.cc.nativeLibc or false; - nativePrefix = stdenv.cc.nativePrefix or ""; - - noLibc = (self.libc == null); - - inherit bintools libc; - } // extraArgs; in self); +# +# +# updateAutotoolsGnuConfigScriptsHook = makeSetupHook { +# name = "update-autotools-gnu-config-scripts-hook"; +# substitutions = { gnu_config = gnu-config; }; +# } ../build-support/setup-hooks/update-autotools-gnu-config-scripts.sh; +# +# wrapBintoolsWith = +# { bintools +# , libc ? if stdenv.targetPlatform != stdenv.hostPlatform then libcCross else stdenv.cc.libc +# , ... +# } @ extraArgs: +# callPackage ../build-support/bintools-wrapper (let self = { +# nativeTools = stdenv.targetPlatform == stdenv.hostPlatform && stdenv.cc.nativeTools or false; +# nativeLibc = stdenv.targetPlatform == stdenv.hostPlatform && stdenv.cc.nativeLibc or false; +# nativePrefix = stdenv.cc.nativePrefix or ""; +# +# noLibc = (self.libc == null); +# +# inherit bintools libc; +# } // extraArgs; in self); wrapCCWith = { cc @@ -454,11 +454,11 @@ final: prev: with final; { wrapCC = cc: wrapCCWith { inherit cc; }; - - which = callPackage ./which { }; - - xz = callPackage ./xz { }; - +# +# which = callPackage ./which { }; +# +# xz = callPackage ./xz { }; +# zlib = callPackage ./zlib { }; } From 8afe3995a3abb8e661d0903c5c882ec2a41075eb Mon Sep 17 00:00:00 2001 From: Jonathan Ringer Date: Mon, 23 Sep 2024 22:51:31 -0700 Subject: [PATCH 2/2] More fat trimming --- linux/default.nix | 2 +- os-specific/linux/kernel-headers/default.nix | 10 +- pkgs/default.nix | 512 +++++++++---------- pkgs/gcc/default.nix | 45 +- pkgs/perl/interpreter.nix | 18 +- pkgs/python/cpython/default.nix | 14 +- pkgs/python/default.nix | 154 +----- pkgs/texinfo/common.nix | 14 +- pkgs/texinfo/packages.nix | 2 +- pkgs/zlib/default.nix | 4 +- 10 files changed, 322 insertions(+), 453 deletions(-) diff --git a/linux/default.nix b/linux/default.nix index 9945184..c0d4b22 100644 --- a/linux/default.nix +++ b/linux/default.nix @@ -508,7 +508,7 @@ in inherit (prevStage) ccWrapperStdenv binutils coreutils gnugrep gettext - perl patchelf linuxHeaders gnum4 bison libidn2 libunistring libxcrypt; + perl patchelf linuxHeaders gnum4 bison libidn2 libunistring; # We build a special copy of libgmp which doesn't use libstdc++, because # xgcc++'s libstdc++ references the bootstrap-files (which is what # compiles xgcc++). diff --git a/os-specific/linux/kernel-headers/default.nix b/os-specific/linux/kernel-headers/default.nix index 94d6075..4dd56d1 100644 --- a/os-specific/linux/kernel-headers/default.nix +++ b/os-specific/linux/kernel-headers/default.nix @@ -1,13 +1,15 @@ -{ stdenvNoCC, lib, buildPackages, fetchurl, perl, elf-header +{ stdenvNoCC, lib, buildPackages, fetchurl, perl # only on Android -, bison -, flex +, bison ? null +, flex ? null , rsync ? null , writeTextFile }: assert stdenvNoCC.hostPlatform.isAndroid -> rsync != null; +assert stdenvNoCC.hostPlatform.isAndroid -> flex != null; +assert stdenvNoCC.hostPlatform.isAndroid -> bison != null; let @@ -51,7 +53,7 @@ let depsBuildBuild = [ buildPackages.stdenv.cc ]; # `elf-header` is null when libc provides `elf.h`. nativeBuildInputs = [ - perl elf-header + perl ] ++ lib.optionals stdenvNoCC.hostPlatform.isAndroid [ bison flex rsync ] ++ lib.optionals (stdenvNoCC.buildPlatform.isDarwin && diff --git a/pkgs/default.nix b/pkgs/default.nix index e9972c3..b29e73d 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -20,21 +20,21 @@ final: prev: with final; { extraBuildInputs = []; } ); -# -# autoconf-archive = callPackage ./autoconf-archive { }; -# -# bash = lowPrio (callPackage ./bash/5.nix { }); -# # WARNING: this attribute is used by nix-shell so it shouldn't be removed/renamed -# bashInteractive = callPackage ./bash/5.nix { -# interactive = true; -# withDocs = true; -# }; -# bashInteractiveFHS = callPackage ./bash/5.nix { -# interactive = true; -# withDocs = true; -# forFHSEnv = true; -# }; -# + + autoconf-archive = callPackage ./autoconf-archive { }; + + bash = lowPrio (callPackage ./bash/5.nix { }); + # WARNING: this attribute is used by nix-shell so it shouldn't be removed/renamed + bashInteractive = callPackage ./bash/5.nix { + interactive = true; + withDocs = true; + }; + bashInteractiveFHS = callPackage ./bash/5.nix { + interactive = true; + withDocs = true; + forFHSEnv = true; + }; + binutils-unwrapped = callPackage ./binutils { # TODO: darwin support #autoreconfHook = autoreconfHook269; @@ -50,67 +50,67 @@ final: prev: with final; { # noSysDirs = (stdenv.targetPlatform != stdenv.hostPlatform) || noSysDirs; # withAllTargets = true; # }; -# binutils = wrapBintoolsWith { -# bintools = binutils-unwrapped; -# }; -# binutils_nogold = lowPrio (wrapBintoolsWith { -# bintools = binutils-unwrapped.override { -# enableGold = false; -# }; -# }); -# binutilsNoLibc = wrapBintoolsWith { -# bintools = binutils-unwrapped; -# libc = preLibcCrossHeaders; -# }; -# -# -# -# # Here we select the default bintools implementations to be used. Note when -# # cross compiling these are used not for this stage but the *next* stage. -# # That is why we choose using this stage's target platform / next stage's -# # host platform. -# # -# # Because this is the *next* stages choice, it's a bit non-modular to put -# # here. In theory, bootstraping is supposed to not be a chain but at tree, -# # where each stage supports many "successor" stages, like multiple possible -# # futures. We don't have a better alternative, but with this downside in -# # mind, please be judicious when using this attribute. E.g. for building -# # things in *this* stage you should use probably `stdenv.cc.bintools` (from a -# # default or alternate `stdenv`), at build time, and try not to "force" a -# # specific bintools at runtime at all. -# # -# # In other words, try to only use this in wrappers, and only use those -# # wrappers from the next stage. -# bintools-unwrapped = let -# inherit (stdenv.targetPlatform) linker; -# in if linker == "lld" then llvmPackages.bintools-unwrapped -# else if linker == "cctools" then darwin.binutils-unwrapped -# else if linker == "bfd" then binutils-unwrapped -# else if linker == "gold" then binutils-unwrapped.override { enableGoldDefault = true; } -# else null; -# bintoolsNoLibc = wrapBintoolsWith { -# bintools = bintools-unwrapped; -# libc = preLibcCrossHeaders; -# }; -# -# bintools = wrapBintoolsWith { -# bintools = bintools-unwrapped; -# }; -# -# bintoolsDualAs = wrapBintoolsWith { -# bintools = darwin.binutilsDualAs-unwrapped; -# wrapGas = true; -# }; -# -# + binutils = wrapBintoolsWith { + bintools = binutils-unwrapped; + }; + binutils_nogold = lowPrio (wrapBintoolsWith { + bintools = binutils-unwrapped.override { + enableGold = false; + }; + }); + binutilsNoLibc = wrapBintoolsWith { + bintools = binutils-unwrapped; + libc = preLibcCrossHeaders; + }; + + + + # Here we select the default bintools implementations to be used. Note when + # cross compiling these are used not for this stage but the *next* stage. + # That is why we choose using this stage's target platform / next stage's + # host platform. + # + # Because this is the *next* stages choice, it's a bit non-modular to put + # here. In theory, bootstraping is supposed to not be a chain but at tree, + # where each stage supports many "successor" stages, like multiple possible + # futures. We don't have a better alternative, but with this downside in + # mind, please be judicious when using this attribute. E.g. for building + # things in *this* stage you should use probably `stdenv.cc.bintools` (from a + # default or alternate `stdenv`), at build time, and try not to "force" a + # specific bintools at runtime at all. + # + # In other words, try to only use this in wrappers, and only use those + # wrappers from the next stage. + bintools-unwrapped = let + inherit (stdenv.targetPlatform) linker; + in if linker == "lld" then llvmPackages.bintools-unwrapped + else if linker == "cctools" then darwin.binutils-unwrapped + else if linker == "bfd" then binutils-unwrapped + else if linker == "gold" then binutils-unwrapped.override { enableGoldDefault = true; } + else null; + bintoolsNoLibc = wrapBintoolsWith { + bintools = bintools-unwrapped; + libc = preLibcCrossHeaders; + }; + + bintools = wrapBintoolsWith { + bintools = bintools-unwrapped; + }; + + bintoolsDualAs = wrapBintoolsWith { + bintools = darwin.binutilsDualAs-unwrapped; + wrapGas = true; + }; + + # lndir = callPackage ./lndir { }; -# -# acl = callPackage ./acl { }; -# -# attr = callPackage ./attr { }; -# -# autoconf = callPackage ./autoconf { }; -# + + acl = callPackage ./acl { }; + + attr = callPackage ./attr { }; + + autoconf = callPackage ./autoconf { }; + autoconf269 = callPackage ./autoconf/269.nix { }; automake = callPackage ./automake { }; @@ -128,24 +128,20 @@ final: prev: with final; { }; bison = callPackage ./bison { }; -# -# bzip2 = callPackage ./bzip2 { }; -# -# # TODO: Use latest + + bzip2 = callPackage ./bzip2 { }; + + # TODO: Use latest cloog = callPackage ./cloog { }; cloog_0_18_0 = callPackage ./cloog { }; -# -# coreutils = callPackage ./coreutils { }; -# -# dieHook = makeSetupHook { -# name = "die-hook"; -# } ../build-support/setup-hooks/die.sh; -# -# diffutils = callPackage ./diffutils { }; -# -# # Provided by libc on Operating Systems that use the Extensible Linker Format. -# elf-header = if stdenv.hostPlatform.isElf then null else -# throw "Non-elf builds are not supported yet in this stdenv repo"; + + coreutils = callPackage ./coreutils { }; + + dieHook = makeSetupHook { + name = "die-hook"; + } ../build-support/setup-hooks/die.sh; + + diffutils = callPackage ./diffutils { }; expand-response-params = callPackage ../build-support/expand-response-params { }; @@ -153,27 +149,27 @@ final: prev: with final; { # # fetchFromGitHub = callPackage ../build-support/fetchgithub { }; # -# fetchpatch = callPackage ../build-support/fetchpath { }; -# -# file = callPackage ./file { }; -# -# findutils = callPackage ./findutils { }; -# + fetchpatch = callPackage ../build-support/fetchpatch { }; + + file = callPackage ./file { }; + + findutils = callPackage ./findutils { }; + # flex = callPackage ./flex { }; # -# gawk = callPackage ./gawk { }; -# -# gnupatch = callPackage ./gnupatch { }; -# + gawk = callPackage ./gawk { }; + + gnupatch = callPackage ./gnupatch { }; + inherit (callPackage ./gcc/all.nix { }) gcc6 gcc7 gcc8 gcc9 gcc10 gcc11 gcc12 gcc13 gcc14; -# + gcc_latest = gcc14; -# + # db = db5; # db5 = db53; # db53 = callPackage ./db/db-5.3.nix { }; -# + # TODO: don't use a top-level defined attr to define this default-gcc-version = if (with stdenv.targetPlatform; isVc4 || libc == "relibc") then 6 @@ -203,36 +199,36 @@ final: prev: with final; { gcc14Stdenv = overrideCC gccStdenv buildPackages.gcc14; gettext = callPackage ./gettext { }; -# + glibc = callPackage ./glibc { stdenv = gccStdenv; # doesn't compile without gcc }; -# -# glibcLocales = callPackage ./glibc/locales.nix { }; -# -# gnu-config = callPackage ./gnu-config { }; -# -# gnugrep = callPackage ./gnugrep { }; -# -# gnulib = callPackage ./gnulib { }; -# -# gnumake = callPackage ./gnumake { }; -# -# gnum4 = callPackage ./gnum4 { }; -# m4 = gnum4; -# -# gnused = callPackage ./gnused { }; -# -# gnutar = callPackage ./gnutar { }; -# -# gmp4 = callPackage ./gmp/4.3.2.nix { }; # required by older GHC versions -# gmp5 = callPackage ./gmp/5.1.x.nix { }; -# gmp6 = callPackage ./gmp/6.x.nix { }; -# gmp = gmp6; -# gmpxx = gmp.override { cxx = true; }; -# -# gzip = callPackage ./gzip { }; -# + + glibcLocales = callPackage ./glibc/locales.nix { }; + + gnu-config = callPackage ./gnu-config { }; + + gnugrep = callPackage ./gnugrep { }; + + gnulib = callPackage ./gnulib { }; + + gnumake = callPackage ./gnumake { }; + + gnum4 = callPackage ./gnum4 { }; + m4 = gnum4; + + gnused = callPackage ./gnused { }; + + gnutar = callPackage ./gnutar { }; + + gmp4 = callPackage ./gmp/4.3.2.nix { }; # required by older GHC versions + gmp5 = callPackage ./gmp/5.1.x.nix { }; + gmp6 = callPackage ./gmp/6.x.nix { }; + gmp = gmp6; + gmpxx = gmp.override { cxx = true; }; + + gzip = callPackage ./gzip { }; + # TODO: make less messy, islVersions? isl = isl_0_20; isl_0_11 = callPackage ./isl/0.11.1.nix { }; @@ -240,9 +236,7 @@ final: prev: with final; { isl_0_17 = callPackage ./isl/0.17.1.nix { }; isl_0_20 = callPackage ./isl/0.20.0.nix { }; isl_0_24 = callPackage ./isl/0.24.0.nix { }; -# -# -# + # We can choose: libcCrossChooser = name: # libc is hackily often used from the previous stage. This `or` @@ -272,122 +266,126 @@ final: prev: with final; { else throw "Unknown libc ${name}"; libcCross = assert stdenv.targetPlatform != stdenv.buildPlatform; libcCrossChooser stdenv.targetPlatform.libc; -# + # libffi = callPackage ./libffi { }; # libffi_3_3 = callPackage ./libffi/3.3.nix { }; # libffiBoot = libffi.override { # doCheck = false; # }; -# -# libgcc = stdenv.cc.cc.libgcc or null; -# -# # GNU libc provides libiconv so systems with glibc don't need to -# # build libiconv separately. Additionally, Apple forked/repackaged -# # libiconv, so build and use the upstream one with a compatible ABI, -# # and BSDs include libiconv in libc. -# # -# # We also provide `libiconvReal`, which will always be a standalone libiconv, -# # just in case you want it regardless of platform. -# libiconv = -# if lib.elem stdenv.hostPlatform.libc [ "glibc" "musl" "nblibc" "wasilibc" "fblibc" ] -# then libcIconv (if stdenv.hostPlatform != stdenv.buildPlatform -# then libcCross -# else stdenv.cc.libc) -# else if stdenv.hostPlatform.isDarwin -# then libiconv-darwin -# else libiconvReal; -# -# libcIconv = libc: let -# inherit (libc) pname version; -# libcDev = lib.getDev libc; -# in runCommand "${pname}-iconv-${version}" { strictDeps = true; } '' -# mkdir -p $out/include -# ln -sv ${libcDev}/include/iconv.h $out/include -# ''; -# -# libiconvReal = callPackage ../development/libraries/libiconv { }; -# -# iconv = -# if lib.elem stdenv.hostPlatform.libc [ "glibc" "musl" ] then -# lib.getBin stdenv.cc.libc -# else if stdenv.hostPlatform.isDarwin then -# lib.getBin libiconv -# else if stdenv.hostPlatform.isFreeBSD then -# lib.getBin freebsd.iconv -# else -# lib.getBin libiconvReal; -# -# libidn2 = callPackage ./libidn2 { }; -# -# # On non-GNU systems we need GNU Gettext for libintl. -# libintl = if stdenv.hostPlatform.libc != "glibc" then gettext else null; -# -# libmpc = callPackage ./libmpc { }; -# -# libtool = callPackage ./libtool/libtool2.nix { }; -# -# libunistring = callPackage ./libunistring { }; -# -# libxcrypt = callPackage ./libxcrypt { }; -# -# inherit (callPackages ../os-specific/linux/kernel-headers { inherit (pkgsBuildBuild) elf-header; }) -# linuxHeaders makeLinuxHeaders; -# + + libgcc = stdenv.cc.cc.libgcc or null; + + # GNU libc provides libiconv so systems with glibc don't need to + # build libiconv separately. Additionally, Apple forked/repackaged + # libiconv, so build and use the upstream one with a compatible ABI, + # and BSDs include libiconv in libc. + # + # We also provide `libiconvReal`, which will always be a standalone libiconv, + # just in case you want it regardless of platform. + libiconv = + if lib.elem stdenv.hostPlatform.libc [ "glibc" "musl" "nblibc" "wasilibc" "fblibc" ] + then libcIconv (if stdenv.hostPlatform != stdenv.buildPlatform + then libcCross + else stdenv.cc.libc) + else if stdenv.hostPlatform.isDarwin + then libiconv-darwin + else libiconvReal; + + libcIconv = libc: let + inherit (libc) pname version; + libcDev = lib.getDev libc; + in runCommand "${pname}-iconv-${version}" { strictDeps = true; } '' + mkdir -p $out/include + ln -sv ${libcDev}/include/iconv.h $out/include + ''; + + libiconvReal = callPackage ../development/libraries/libiconv { }; + + iconv = + if lib.elem stdenv.hostPlatform.libc [ "glibc" "musl" ] then + lib.getBin stdenv.cc.libc + else if stdenv.hostPlatform.isDarwin then + lib.getBin libiconv + else if stdenv.hostPlatform.isFreeBSD then + lib.getBin freebsd.iconv + else + lib.getBin libiconvReal; + + libidn2 = callPackage ./libidn2 { }; + + # On non-GNU systems we need GNU Gettext for libintl. + libintl = if stdenv.hostPlatform.libc != "glibc" then gettext else null; + + libmpc = callPackage ./libmpc { }; + + libtool = callPackage ./libtool/libtool2.nix { }; + + libunistring = callPackage ./libunistring { }; + + # Needed by GCC for address sanitizer + libxcrypt = callPackage ./libxcrypt { }; + + # TODO: stdenv: make cleaner + inherit (callPackages ../os-specific/linux/kernel-headers { }) + linuxHeaders makeLinuxHeaders; + # nix-update-script = lib.error "nix-update-script is not supported yet"; -# -# nukeReferences = callPackage ../build-support/nuke-references { }; -# -# makeWrapper = makeShellWrapper; -# -# makeShellWrapper = makeSetupHook { -# name = "make-shell-wrapper-hook"; -# propagatedBuildInputs = [ dieHook ]; -# substitutions = { -# # targetPackages.runtimeShell only exists when pkgs == targetPackages (when targetPackages is not __raw) -# shell = if targetPackages ? runtimeShell then targetPackages.runtimeShell else throw "makeWrapper/makeShellWrapper must be in nativeBuildInputs"; -# }; -# passthru = { -# tests = tests.makeWrapper; -# }; -# } ../build-support/setup-hooks/make-wrapper.sh; -# + + nukeReferences = callPackage ../build-support/nuke-references { }; + + makeWrapper = makeShellWrapper; + + makeShellWrapper = makeSetupHook { + name = "make-shell-wrapper-hook"; + propagatedBuildInputs = [ dieHook ]; + substitutions = { + # targetPackages.runtimeShell only exists when pkgs == targetPackages (when targetPackages is not __raw) + shell = if targetPackages ? runtimeShell then targetPackages.runtimeShell else throw "makeWrapper/makeShellWrapper must be in nativeBuildInputs"; + }; + passthru = { + tests = tests.makeWrapper; + }; + } ../build-support/setup-hooks/make-wrapper.sh; + # mpdecimal = callPackage ./mpdecimal { }; -# -# mpfr = callPackage ./mpfr { }; + + mpfr = callPackage ./mpfr { }; # # minizip = callPackage ./minizip { }; # -# patch = gnupatch; -# + patch = gnupatch; + patchelf = callPackage ./patchelf { }; -# -# pcre2 = callPackage ./pcre2 { }; -# -# perlInterpreters = callPackage ./perl { }; -# perl = perlInterpreters.perl538; -# -# pkg-config = callPackage ./pkg-config { }; -# -# pythonInterpreters = callPackage ./python { }; -# inherit (pythonInterpreters) python3Minimal; + + pcre2 = callPackage ./pcre2 { }; + + # TODO: stdenv expose only one version + perlInterpreters = callPackage ./perl { }; + perl = perlInterpreters.perl538; + + pkg-config = callPackage ./pkg-config { }; + + pythonInterpreters = callPackage ./python { }; + inherit (pythonInterpreters) python3Minimal; # # # For the purpose of the stdenv repo -# python3 = python3Minimal; + python3 = python3Minimal; # -# readline = readline_8_2; + readline = readline_8_2; # readline_7_0 = callPackage ./readline/7.0.nix { }; -# readline_8_2 = callPackage ./readline/8.2.nix { }; + readline_8_2 = callPackage ./readline/8.2.nix { }; runtimeShell = "${runtimeShellPackage}${runtimeShellPackage.shellPath}"; runtimeShellPackage = bash; -# # TODO: stdenv: make this minimal for just stdenv -# # testers = callPackage ../build-support/testers { }; -# testers = null; -# -# texinfoVersions = callPackage ./texinfo/packages.nix { }; -# texinfo = texinfoVersions.texinfo7; -# + # TODO: stdenv: make this minimal for just stdenv + # testers = callPackage ../build-support/testers { }; + testers = null; + + # TODO: stdenv: make this minimal for just stdenv + texinfoVersions = callPackage ./texinfo/packages.nix { }; + texinfo = texinfoVersions.texinfo7; + threadsCross = lib.optionalAttrs (stdenv.targetPlatform.isMinGW && !(stdenv.targetPlatform.useLLVM or false)) { # other possible values: win32 or posix @@ -395,27 +393,27 @@ final: prev: with final; { # For win32 or posix set this to null package = targetPackages.windows.mcfgthreads or windows.mcfgthreads; }; -# -# -# updateAutotoolsGnuConfigScriptsHook = makeSetupHook { -# name = "update-autotools-gnu-config-scripts-hook"; -# substitutions = { gnu_config = gnu-config; }; -# } ../build-support/setup-hooks/update-autotools-gnu-config-scripts.sh; -# -# wrapBintoolsWith = -# { bintools -# , libc ? if stdenv.targetPlatform != stdenv.hostPlatform then libcCross else stdenv.cc.libc -# , ... -# } @ extraArgs: -# callPackage ../build-support/bintools-wrapper (let self = { -# nativeTools = stdenv.targetPlatform == stdenv.hostPlatform && stdenv.cc.nativeTools or false; -# nativeLibc = stdenv.targetPlatform == stdenv.hostPlatform && stdenv.cc.nativeLibc or false; -# nativePrefix = stdenv.cc.nativePrefix or ""; -# -# noLibc = (self.libc == null); -# -# inherit bintools libc; -# } // extraArgs; in self); + + # Needed by mpfr + updateAutotoolsGnuConfigScriptsHook = makeSetupHook { + name = "update-autotools-gnu-config-scripts-hook"; + substitutions = { gnu_config = gnu-config; }; + } ../build-support/setup-hooks/update-autotools-gnu-config-scripts.sh; + + wrapBintoolsWith = + { bintools + , libc ? if stdenv.targetPlatform != stdenv.hostPlatform then libcCross else stdenv.cc.libc + , ... + } @ extraArgs: + callPackage ../build-support/bintools-wrapper (let self = { + nativeTools = stdenv.targetPlatform == stdenv.hostPlatform && stdenv.cc.nativeTools or false; + nativeLibc = stdenv.targetPlatform == stdenv.hostPlatform && stdenv.cc.nativeLibc or false; + nativePrefix = stdenv.cc.nativePrefix or ""; + + noLibc = (self.libc == null); + + inherit bintools libc; + } // extraArgs; in self); wrapCCWith = { cc @@ -454,11 +452,11 @@ final: prev: with final; { wrapCC = cc: wrapCCWith { inherit cc; }; -# -# which = callPackage ./which { }; -# -# xz = callPackage ./xz { }; -# + + which = callPackage ./which { }; + + xz = callPackage ./xz { }; + zlib = callPackage ./zlib { }; } diff --git a/pkgs/gcc/default.nix b/pkgs/gcc/default.nix index 35a31d2..7a4d771 100644 --- a/pkgs/gcc/default.nix +++ b/pkgs/gcc/default.nix @@ -1,4 +1,6 @@ -{ lib, stdenv, targetPackages, fetchurl, fetchpatch, fetchFromGitHub, noSysDirs +{ lib, stdenv, targetPackages, fetchurl, fetchpatch +#, fetchFromGitHub +, noSysDirs , langC ? true, langCC ? true, langFortran ? false , langAda ? false , langObjC ? stdenv.targetPlatform.isDarwin @@ -15,7 +17,13 @@ , enableLTO ? stdenv.hostPlatform.hasSharedLibraries , texinfo ? null , perl ? null # optional, for texi2pod (then pod2man) -, gmp, mpfr, libmpc, gettext, which, patchelf, binutils +, gmp +, mpfr ? null +, libmpc +, gettext +, which +, patchelf +, binutils , isl ? null # optional, for the Graphite optimization framework. , zlib ? null , libucontext ? null @@ -42,7 +50,7 @@ # only for gcc<=6.x , langJava ? false -, flex +, flex ? null , boehmgc ? null , zip ? null, unzip ? null, pkg-config ? null , gtk2 ? null, libart_lgpl ? null @@ -261,17 +269,26 @@ pipe ((callFile ./common/builder.nix {}) ({ pname = "${crossNameAddon}${name}"; inherit version; - src = if is6 && stdenv.targetPlatform.isVc4 then fetchFromGitHub { - owner = "itszor"; - repo = "gcc-vc4"; - rev = "e90ff43f9671c760cf0d1dd62f569a0fb9bf8918"; - sha256 = "0gxf66hwqk26h8f853sybphqa5ca0cva2kmrw5jsiv6139g0qnp8"; - } else if is6 && stdenv.targetPlatform.isRedox then fetchFromGitHub { - owner = "redox-os"; - repo = "gcc"; - rev = "f360ac095028d286fc6dde4d02daed48f59813fa"; # `redox` branch - sha256 = "1an96h8l58pppyh3qqv90g8hgcfd9hj7igvh2gigmkxbrx94khfl"; - } else fetchurl { + # src = if is6 && stdenv.targetPlatform.isVc4 then fetchFromGitHub { + # owner = "itszor"; + # repo = "gcc-vc4"; + # rev = "e90ff43f9671c760cf0d1dd62f569a0fb9bf8918"; + # sha256 = "0gxf66hwqk26h8f853sybphqa5ca0cva2kmrw5jsiv6139g0qnp8"; + # } else if is6 && stdenv.targetPlatform.isRedox then fetchFromGitHub { + # owner = "redox-os"; + # repo = "gcc"; + # rev = "f360ac095028d286fc6dde4d02daed48f59813fa"; # `redox` branch + # sha256 = "1an96h8l58pppyh3qqv90g8hgcfd9hj7igvh2gigmkxbrx94khfl"; + # } else fetchurl { + # url = if atLeast7 + # then "mirror://gcc/releases/gcc-${version}/gcc-${version}.tar.xz" + # else if atLeast6 + # then "mirror://gnu/gcc/gcc-${version}/gcc-${version}.tar.xz" + # else "mirror://gnu/gcc/gcc-${version}/gcc-${version}.tar.bz2"; + # ${if is10 || is11 || is13 then "hash" else "sha256"} = + # gccVersions.srcHashForVersion version; + # }; + src = fetchurl { url = if atLeast7 then "mirror://gcc/releases/gcc-${version}/gcc-${version}.tar.xz" else if atLeast6 diff --git a/pkgs/perl/interpreter.nix b/pkgs/perl/interpreter.nix index 99eb606..98eb036 100644 --- a/pkgs/perl/interpreter.nix +++ b/pkgs/perl/interpreter.nix @@ -1,6 +1,6 @@ { stdenv , fetchurl -, fetchFromGitHub +#, fetchFromGitHub , buildPackages , lib , self @@ -16,7 +16,7 @@ , passthruFun , perlAttr ? "perl${lib.versions.major version}${lib.versions.minor version}" , enableThreading ? true, coreutils, makeWrapper -, enableCrypt ? true, libxcrypt ? null +, enableCrypt ? false, libxcrypt ? null , overrides ? config.perlPackageOverrides or (p: {}) # TODO: (self: super: {}) like in python } @ inputs: @@ -243,13 +243,17 @@ stdenv.mkDerivation (rec { } // lib.optionalAttrs (stdenv.buildPlatform != stdenv.hostPlatform) rec { crossVersion = "84db4c71ae3d3b01fb2966cd15a060a7be334710"; # Nov 29, 2023 - perl-cross-src = fetchFromGitHub { - name = "perl-cross-${crossVersion}"; - owner = "arsv"; - repo = "perl-cross"; - rev = crossVersion; + perl-cross-src = fetchurl { + url = "https://github.com/arsv/perl-cross/archive/${crossVersion}.tar.gz"; sha256 = "sha256-1Zqw4sy/lD2nah0Z8rAE11tSpq1Ym9nBbatDczR+mxs="; }; + #perl-cross-src = fetchFromGitHub { + # name = "perl-cross-${crossVersion}"; + # owner = "arsv"; + # repo = "perl-cross"; + # rev = crossVersion; + # sha256 = "sha256-1Zqw4sy/lD2nah0Z8rAE11tSpq1Ym9nBbatDczR+mxs="; + #}; depsBuildBuild = [ buildPackages.stdenv.cc makeWrapper ]; diff --git a/pkgs/python/cpython/default.nix b/pkgs/python/cpython/default.nix index 4212b91..d360e6f 100644 --- a/pkgs/python/cpython/default.nix +++ b/pkgs/python/cpython/default.nix @@ -13,10 +13,10 @@ # runtime dependencies , bzip2 ? null -, expat -, libffi -, libxcrypt -, mpdecimal +, expat ? null +, libffi ? null +, libxcrypt ? null +, mpdecimal ? null , ncurses , openssl , sqlite @@ -121,7 +121,7 @@ let ; # mixes libc and libxcrypt headers and libs and causes segfaults on importing crypt - libxcrypt = if stdenv.hostPlatform.isFreeBSD then null else inputs.libxcrypt; + libxcrypt = if stdenv.hostPlatform.isFreeBSD then null else (inputs.libxcrypt or null); buildPackages = pkgsBuildHost; inherit (passthru) pythonOnBuildForHost; @@ -400,8 +400,8 @@ in with passthru; stdenv.mkDerivation (finalAttrs: { # https://docs.python.org/3/using/configure.html configureFlags = [ "--without-ensurepip" - "--with-system-expat" - "--with-system-libmpdec" + #"--with-system-expat" + #"--with-system-libmpdec" ] ++ optionals (openssl != null) [ "--with-openssl=${openssl.dev}" ] ++ optionals tzdataSupport [ diff --git a/pkgs/python/default.nix b/pkgs/python/default.nix index 58c91f8..38d62f7 100644 --- a/pkgs/python/default.nix +++ b/pkgs/python/default.nix @@ -1,9 +1,8 @@ { __splicedPackages , callPackage , darwin ? null -, db , lib -, libffiBoot +, libffiBoot ? null , stdenv # For passthruFun , config @@ -33,76 +32,6 @@ assert stdenv.isDarwin -> darwin != null; in { - python27 = callPackage ./cpython/2.7 { - self = __splicedPackages.python27; - sourceVersion = { - major = "2"; - minor = "7"; - patch = "18"; - suffix = ".8"; # ActiveState's Python 2 extended support - }; - hash = "sha256-HUOzu3uJbtd+3GbmGD35KOk/CDlwL4S7hi9jJGRFiqI="; - inherit (darwin) configd; - inherit passthruFun python-setup-hook; - }; - - python39 = callPackage ./cpython { - self = __splicedPackages.python39; - sourceVersion = { - major = "3"; - minor = "9"; - patch = "19"; - suffix = ""; - }; - hash = "sha256-1Iks0WGPZFjLhRIIwDDfFIJ3lgnQ85OZkb04GE+MZ54="; - inherit (darwin) configd; - inherit passthruFun; - }; - - python310 = callPackage ./cpython { - self = __splicedPackages.python310; - sourceVersion = { - major = "3"; - minor = "10"; - patch = "14"; - suffix = ""; - }; - hash = "sha256-nFBIH6qMKDIym6D8iGjQpgamgPxPYOxI0mzo4HZ1H9o="; - inherit (darwin) configd; - inherit passthruFun; - }; - - python311 = callPackage ./cpython { - self = __splicedPackages.python311; - sourceVersion = { - major = "3"; - minor = "11"; - patch = "9"; - suffix = ""; - }; - hash = "sha256-mx6JZSP8UQaREmyGRAbZNgo9Hphqy9pZzaV7Wr2kW4c="; - inherit (darwin) configd; - inherit passthruFun; - }; - - python312 = callPackage ./cpython ({ - self = __splicedPackages.python312; - inherit (darwin) configd; - inherit passthruFun; - } // sources.python312); - - python313 = callPackage ./cpython { - self = __splicedPackages.python313; - sourceVersion = { - major = "3"; - minor = "13"; - patch = "0"; - suffix = "rc1"; - }; - hash = "sha256-Z4uIR3XuwCJNUVn6kAh5AgusoqNs6UL9lf6/oa20pr0="; - inherit (darwin) configd; - inherit passthruFun; - }; # Minimal versions of Python (built without optional dependencies) python3Minimal = (callPackage ./cpython ({ self = __splicedPackages.python3Minimal; @@ -133,85 +62,4 @@ in { pname = "python3-minimal"; }); - pypy27 = callPackage ./pypy { - self = __splicedPackages.pypy27; - sourceVersion = { - major = "7"; - minor = "3"; - patch = "12"; - }; - - hash = "sha256-3WHYjaJ0ws4s7HdmfUo9+aZSvMUOJvkJkdTdCvZrzPQ="; - pythonVersion = "2.7"; - db = db.override { dbmSupport = !stdenv.isDarwin; }; - python = __splicedPackages.pythonInterpreters.pypy27_prebuilt; - inherit passthruFun; - inherit (darwin) libunwind; - inherit (darwin.apple_sdk.frameworks) Security; - }; - - pypy39 = callPackage ./pypy { - self = __splicedPackages.pypy39; - sourceVersion = { - major = "7"; - minor = "3"; - patch = "12"; - }; - - hash = "sha256-56IEbH5sJfw4aru1Ey6Sp8wkkeOTVpmpRstdy7NCwqo="; - pythonVersion = "3.9"; - db = db.override { dbmSupport = !stdenv.isDarwin; }; - python = __splicedPackages.pypy27; - inherit passthruFun; - inherit (darwin) libunwind; - inherit (darwin.apple_sdk.frameworks) Security; - }; - - pypy310 = __splicedPackages.pypy39.override { - self = __splicedPackages.pythonInterpreters.pypy310; - pythonVersion = "3.10"; - hash = "sha256-huTk6sw2BGxhgvQwGHllN/4zpg4dKizGuOf5Gl3LPkI="; - }; - - pypy27_prebuilt = callPackage ./pypy/prebuilt_2_7.nix { - # Not included at top-level - self = __splicedPackages.pythonInterpreters.pypy27_prebuilt; - sourceVersion = { - major = "7"; - minor = "3"; - patch = "12"; - }; - - hash = { - aarch64-linux = "sha256-4E3LYoantHJOw/DlDTzBuoWDMB3RZYwG1/N1meQgHFk="; - x86_64-linux = "sha256-GmGiV0t5Rm9gYBDymZormVvZbNCF+Rp46909XCxA6B0="; - aarch64-darwin = "sha256-a3R6oHauhZfklgPF3sTKWTWhoKEy10BKVZvpaiYNm/c="; - x86_64-darwin = "sha256-bon/3RVTfOT/zjFFtl7lfC6clSiSvZW5NAEtLwCfUDs="; - }.${stdenv.system}; - pythonVersion = "2.7"; - inherit passthruFun; - }; - - pypy39_prebuilt = callPackage ./pypy/prebuilt.nix { - # Not included at top-level - self = __splicedPackages.pythonInterpreters.pypy39_prebuilt; - sourceVersion = { - major = "7"; - minor = "3"; - patch = "12"; - }; - hash = { - aarch64-linux = "sha256-6TJ/ue2vKtkZNdW4Vj7F/yQZO92xdcGsqvdywCWvGCQ="; - x86_64-linux = "sha256-hMiblm+rK1j0UaSC7jDKf+wzUENb0LlhRhXGHcbaI5A="; - aarch64-darwin = "sha256-DooaNGi5eQxzSsaY9bAMwD/BaJnMxs6HZGX6wLg5gOM="; - x86_64-darwin = "sha256-ZPAI/6BwxAfl70bIJWsuAU3nGW6l2Fg4WGElTnlZ9Os="; - }.${stdenv.system}; - pythonVersion = "3.9"; - inherit passthruFun; - }; - - rustpython = darwin.apple_sdk_11_0.callPackage ./rustpython/default.nix { - inherit (darwin.apple_sdk_11_0.frameworks) SystemConfiguration; - }; - }) diff --git a/pkgs/texinfo/common.nix b/pkgs/texinfo/common.nix index a43eab5..a9f39e8 100644 --- a/pkgs/texinfo/common.nix +++ b/pkgs/texinfo/common.nix @@ -86,10 +86,10 @@ stdenv.mkDerivation { bash libintl ] - ++ optionals stdenv.isSunOS [ - libiconv - gawk - ] + # ++ optionals stdenv.isSunOS [ + # libiconv + # gawk + # ] ++ optional interactive ncurses; configureFlags = @@ -99,12 +99,12 @@ stdenv.mkDerivation { # Also prevent the buildPlatform's awk being used in the texindex script ++ optionals crossBuildTools [ "--enable-perl-xs=no" - "TI_AWK=${getBin gawk}/bin/awk" + # "TI_AWK=${getBin gawk}/bin/awk" ] ++ optionals (crossBuildTools && lib.versionAtLeast version "7.1") [ "texinfo_cv_sys_iconv_converts_euc_cn=yes" - ] - ++ optional stdenv.isSunOS "AWK=${gawk}/bin/awk"; + ]; + #++ optional stdenv.isSunOS "AWK=${gawk}/bin/awk"; installFlags = [ "TEXMF=$(out)/texmf-dist" ]; installTargets = [ diff --git a/pkgs/texinfo/packages.nix b/pkgs/texinfo/packages.nix index cb79ccd..7ce3590 100644 --- a/pkgs/texinfo/packages.nix +++ b/pkgs/texinfo/packages.nix @@ -9,7 +9,7 @@ bash, updateAutotoolsGnuConfigScriptsHook, gnulib, - gawk, + gawk ? null, xz, # Not needed for linux bootstrapping diff --git a/pkgs/zlib/default.nix b/pkgs/zlib/default.nix index 23795b6..75236b3 100644 --- a/pkgs/zlib/default.nix +++ b/pkgs/zlib/default.nix @@ -8,8 +8,8 @@ # the `.pc` file lists only the main output's lib dir. # If false, and if `{ static = true; }`, the .a stays in the main output. , splitStaticOutput ? shared && static -, testers -, minizip +, testers ? null +, minizip ? null }: # Without either the build will actually still succeed because the build