···1190 variables which will be available when the binary is run. For example,
1191 `makeWrapperArgs = ["--set FOO BAR" "--set BAZ QUX"]`.
1192* `namePrefix`: Prepends text to `${name}` parameter. In case of libraries, this
1193- defaults to `"python3.8-"` for Python 3.8, etc., and in case of applications
1194- to `""`.
1195* `pipInstallFlags ? []`: A list of strings. Arguments to be passed to `pip
1196 install`. To pass options to `python setup.py install`, use
1197 `--install-option`. E.g., `pipInstallFlags=["--install-option='--cpp_implementation'"]`.
001198* `pythonPath ? []`: List of packages to be added into `$PYTHONPATH`. Packages
1199 in `pythonPath` are not propagated (contrary to `propagatedBuildInputs`).
1200* `preShellHook`: Hook to execute commands before `shellHook`.
···12481249in python.withPackages(ps: [ ps.blaze ])).env
1250```
00000000000000000000012511252#### Optional extra dependencies {#python-optional-dependencies}
1253···1468- `flitBuildHook` to build a wheel using `flit`.
1469- `pipBuildHook` to build a wheel using `pip` and PEP 517. Note a build system
1470 (e.g. `setuptools` or `flit`) should still be added as `nativeBuildInput`.
00001471- `pipInstallHook` to install wheels.
1472- `pytestCheckHook` to run tests with `pytest`. See [example usage](#using-pytestcheckhook).
1473- `pythonCatchConflictsHook` to check whether a Python package is not already existing.
···1190 variables which will be available when the binary is run. For example,
1191 `makeWrapperArgs = ["--set FOO BAR" "--set BAZ QUX"]`.
1192* `namePrefix`: Prepends text to `${name}` parameter. In case of libraries, this
1193+ defaults to `"python3.8-"` for Python 3.8, etc., and in case of applications to `""`.
01194* `pipInstallFlags ? []`: A list of strings. Arguments to be passed to `pip
1195 install`. To pass options to `python setup.py install`, use
1196 `--install-option`. E.g., `pipInstallFlags=["--install-option='--cpp_implementation'"]`.
1197+* `pipBuildFlags ? []`: A list of strings. Arguments to be passed to `pip wheel`.
1198+* `pypaBuildFlags ? []`: A list of strings. Arguments to be passed to `python -m build --wheel`.
1199* `pythonPath ? []`: List of packages to be added into `$PYTHONPATH`. Packages
1200 in `pythonPath` are not propagated (contrary to `propagatedBuildInputs`).
1201* `preShellHook`: Hook to execute commands before `shellHook`.
···12491250in python.withPackages(ps: [ ps.blaze ])).env
1251```
1252+1253+The next example shows a non trivial overriding of the `blas` implementation to
1254+be used through out all of the Python package set:
1255+1256+```nix
1257+python3MyBlas = pkgs.python3.override {
1258+ packageOverrides = self: super: {
1259+ # We need toPythonModule for the package set to evaluate this
1260+ blas = super.toPythonModule(super.pkgs.blas.override {
1261+ blasProvider = super.pkgs.mkl;
1262+ });
1263+ lapack = super.toPythonModule(super.pkgs.lapack.override {
1264+ lapackProvider = super.pkgs.mkl;
1265+ });
1266+ };
1267+};
1268+```
1269+1270+This is particularly useful for numpy and scipy users who want to gain speed with other blas implementations.
1271+Note that using simply `scipy = super.scipy.override { blas = super.pkgs.mkl; };` will likely result in
1272+compilation issues, because scipy dependencies need to use the same blas implementation as well.
12731274#### Optional extra dependencies {#python-optional-dependencies}
1275···1490- `flitBuildHook` to build a wheel using `flit`.
1491- `pipBuildHook` to build a wheel using `pip` and PEP 517. Note a build system
1492 (e.g. `setuptools` or `flit`) should still be added as `nativeBuildInput`.
1493+- `pypaBuildHook` to build a wheel using
1494+ [`pypa/build`](https://pypa-build.readthedocs.io/en/latest/index.html) and
1495+ PEP 517/518. Note a build system (e.g. `setuptools` or `flit`) should still
1496+ be added as `nativeBuildInput`.
1497- `pipInstallHook` to install wheels.
1498- `pytestCheckHook` to run tests with `pytest`. See [example usage](#using-pytestcheckhook).
1499- `pythonCatchConflictsHook` to check whether a Python package is not already existing.
···103 inherit version;
104 hash = "sha256-0rUlXHxjSbwb0eWeCM0SrLvWPOZJ8liHVXg6qU37axo=";
105 };
0106 });
107 # Now requires `lingua` as check input that requires a newer `click`,
108 # however `click-7` is needed by the older flask we need here. Since it's just
···103 inherit version;
104 hash = "sha256-0rUlXHxjSbwb0eWeCM0SrLvWPOZJ8liHVXg6qU37axo=";
105 };
106+ disabledTests = [ "test_bytes_args" ]; # https://github.com/pallets/click/commit/6e05e1fa1c2804
107 });
108 # Now requires `lingua` as check input that requires a newer `click`,
109 # however `click-7` is needed by the older flask we need here. Since it's just
···1{ lib
2, stdenv
3, fetchurl
4-, perl
5, gmp
6, mpfr
7, flint
···15, ninja
16, ant
17, openjdk
18-, perlPackages
19, makeWrapper
20}:
21-000022# polymake compiles its own version of sympol and atint because we
23# don't have those packages. other missing optional dependencies:
24# javaview, libnormaliz, scip, soplex, jreality.
···1{ lib
2, stdenv
3, fetchurl
04, gmp
5, mpfr
6, flint
···14, ninja
15, ant
16, openjdk
17+, perl536Packages
18, makeWrapper
19}:
20+let
21+ # log says: polymake does not work with perl 5.37 or newer;
22+ perlPackages = perl536Packages;
23+ inherit (perlPackages) perl;
24+in
25# polymake compiles its own version of sympol and atint because we
26# don't have those packages. other missing optional dependencies:
27# javaview, libnormaliz, scip, soplex, jreality.
···81 hardeningCFlags+=('-fPIC')
82 ;;
83 strictoverflow)
84- if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling strictoverflow >&2; fi
85- hardeningCFlags+=('-fno-strict-overflow')
000000000086 ;;
87 format)
88 if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling format >&2; fi
···81 hardeningCFlags+=('-fPIC')
82 ;;
83 strictoverflow)
84+ if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling strictoverflow >&2; fi
85+ if (( @isClang@ )); then
86+ # In Clang, -fno-strict-overflow only serves to set -fwrapv and is
87+ # reported as an unused CLI argument if -fwrapv or -fno-wrapv is set
88+ # explicitly, so we side step that by doing the conversion here.
89+ #
90+ # See: https://github.com/llvm/llvm-project/blob/llvmorg-16.0.6/clang/lib/Driver/ToolChains/Clang.cpp#L6315
91+ #
92+ hardeningCFlags+=('-fwrapv')
93+ else
94+ hardeningCFlags+=('-fno-strict-overflow')
95+ fi
96 ;;
97 format)
98 if (( "${NIX_DEBUG:-0}" >= 1 )); then echo HARDENING: enabling format >&2; fi
+2
pkgs/build-support/cc-wrapper/default.nix
···609610611 env = {
00612 # for substitution in utils.bash
613 expandResponseParams = "${expand-response-params}/bin/expand-response-params";
614 shell = getBin shell + shell.shellPath or "";
···609610611 env = {
612+ inherit isClang;
613+614 # for substitution in utils.bash
615 expandResponseParams = "${expand-response-params}/bin/expand-response-params";
616 shell = getBin shell + shell.shellPath or "";
+12-5
pkgs/build-support/libredirect/default.nix
···1-{ lib, stdenv, bintools-unwrapped, llvmPackages_13, coreutils }:
200000003if stdenv.hostPlatform.isStatic
4then throw ''
5 libredirect is not available on static builds.
···39 # and the library search directory for libdl.
40 # We can't build this on x86_64, because the libSystem we point to doesn't
41 # like arm64(e).
42- PATH=${bintools-unwrapped}/bin:${llvmPackages_13.clang-unwrapped}/bin:$PATH \
43 clang -arch x86_64 -arch arm64 -arch arm64e \
44- -isystem ${llvmPackages_13.clang.libc}/include \
45- -isystem ${llvmPackages_13.libclang.lib}/lib/clang/*/include \
46- -L${llvmPackages_13.clang.libc}/lib \
47 -Wl,-install_name,$libName \
48 -Wall -std=c99 -O3 -fPIC libredirect.c \
49 -shared -o "$libName"
···1+{ lib, stdenv, bintools-unwrapped, llvmPackages, llvmPackages_13, coreutils }:
23+let
4+ # aarch64-darwin needs a clang that can build arm64e binaries, so make sure a version of LLVM
5+ # is used that can do that, but prefer the stdenv one if it is new enough.
6+ llvmPkgs = if (lib.versionAtLeast (lib.getVersion llvmPackages.clang) "13")
7+ then llvmPackages
8+ else llvmPackages_13;
9+ in
10if stdenv.hostPlatform.isStatic
11then throw ''
12 libredirect is not available on static builds.
···46 # and the library search directory for libdl.
47 # We can't build this on x86_64, because the libSystem we point to doesn't
48 # like arm64(e).
49+ PATH=${bintools-unwrapped}/bin:${llvmPkgs.clang-unwrapped}/bin:$PATH \
50 clang -arch x86_64 -arch arm64 -arch arm64e \
51+ -isystem ${llvmPkgs.clang.libc}/include \
52+ -isystem ${llvmPkgs.libclang.lib}/lib/clang/*/include \
53+ -L${llvmPkgs.clang.libc}/lib \
54 -Wl,-install_name,$libName \
55 -Wall -std=c99 -O3 -fPIC libredirect.c \
56 -shared -o "$libName"
···24 ${maturinBuildFlags-}
25 )
2627- runHook postBuild
28-29 if [ ! -z "${buildAndTestSubdir-}" ]; then
30 popd
31 fi
···33 # Move the wheel to dist/ so that regular Python tooling can find it.
34 mkdir -p dist
35 mv target/wheels/*.whl dist/
0003637 echo "Finished maturinBuildHook"
38}
···24 ${maturinBuildFlags-}
25 )
260027 if [ ! -z "${buildAndTestSubdir-}" ]; then
28 popd
29 fi
···31 # Move the wheel to dist/ so that regular Python tooling can find it.
32 mkdir -p dist
33 mv target/wheels/*.whl dist/
34+35+ # These are python build hooks and may depend on ./dist
36+ runHook postBuild
3738 echo "Finished maturinBuildHook"
39}
···1+# This setup hook strips libraries and executables in the fixup phase.
2+3+fixupOutputHooks+=(_doStrip)
4+5+_doStrip() {
6+ # We don't bother to strip build platform code because it shouldn't make it
7+ # to $out anyways---if it does, that's a bigger problem that a lack of
8+ # stripping will help catch.
9+ local -ra flags=(dontStripHost dontStripTarget)
10+ local -ra debugDirs=(stripDebugList stripDebugListTarget)
11+ local -ra allDirs=(stripAllList stripAllListTarget)
12+ local -ra stripCmds=(STRIP STRIP_FOR_TARGET)
13+ local -ra ranlibCmds=(RANLIB RANLIB_FOR_TARGET)
14+15+ # TODO(structured-attrs): This doesn't work correctly if one of
16+ # the items in strip*List or strip*Flags contains a space,
17+ # even with structured attrs enabled. This is OK for now
18+ # because very few packages set any of these, and it doesn't
19+ # affect any of them.
20+ #
21+ # After __structuredAttrs = true is universal, come back and
22+ # push arrays all the way through this logic.
23+24+ # Strip only host paths by default. Leave targets as is.
25+ stripDebugList=${stripDebugList[*]:-lib lib32 lib64 libexec bin sbin}
26+ stripDebugListTarget=${stripDebugListTarget[*]:-}
27+ stripAllList=${stripAllList[*]:-}
28+ stripAllListTarget=${stripAllListTarget[*]:-}
29+30+ local i
31+ for i in ${!stripCmds[@]}; do
32+ local -n flag="${flags[$i]}"
33+ local -n debugDirList="${debugDirs[$i]}"
34+ local -n allDirList="${allDirs[$i]}"
35+ local -n stripCmd="${stripCmds[$i]}"
36+ local -n ranlibCmd="${ranlibCmds[$i]}"
37+38+ # `dontStrip` disables them all
39+ if [[ "${dontStrip-}" || "${flag-}" ]] || ! type -f "${stripCmd-}" 2>/dev/null 1>&2
40+ then continue; fi
41+42+ stripDirs "$stripCmd" "$ranlibCmd" "$debugDirList" "${stripDebugFlags[*]:--S -p}"
43+ stripDirs "$stripCmd" "$ranlibCmd" "$allDirList" "${stripAllFlags[*]:--s -p}"
44+ done
45+}
46+47+stripDirs() {
48+ local cmd="$1"
49+ local ranlibCmd="$2"
50+ local paths="$3"
51+ local stripFlags="$4"
52+ local pathsNew=
53+54+ [ -z "$cmd" ] && echo "stripDirs: Strip command is empty" 1>&2 && exit 1
55+ [ -z "$ranlibCmd" ] && echo "stripDirs: Ranlib command is empty" 1>&2 && exit 1
56+57+ local p
58+ for p in ${paths}; do
59+ if [ -e "$prefix/$p" ]; then
60+ pathsNew="${pathsNew} $prefix/$p"
61+ fi
62+ done
63+ paths=${pathsNew}
64+65+ if [ -n "${paths}" ]; then
66+ echo "stripping (with command $cmd and flags $stripFlags) in $paths"
67+ local striperr
68+ striperr="$(mktemp 'striperr.XXXXXX')"
69+ # Do not strip lib/debug. This is a directory used by setup-hooks/separate-debug-info.sh.
70+ find $paths -type f -a '!' -path "$prefix/lib/debug/*" -print0 |
71+ # Make sure we process files under symlinks only once. Otherwise
72+ # 'strip` can corrupt files when writes to them in parallel:
73+ # https://github.com/NixOS/nixpkgs/issues/246147#issuecomment-1657072039
74+ xargs -r -0 -n1 -- realpath -z | sort -u -z |
75+76+ xargs -r -0 -n1 -P "$NIX_BUILD_CORES" -- $cmd $stripFlags 2>"$striperr" || exit_code=$?
77+ # xargs exits with status code 123 if some but not all of the
78+ # processes fail. We don't care if some of the files couldn't
79+ # be stripped, so ignore specifically this code.
80+ [[ "$exit_code" = 123 || -z "$exit_code" ]] || (cat "$striperr" 1>&2 && exit 1)
81+82+ rm "$striperr"
83+ # 'strip' does not normally preserve archive index in .a files.
84+ # This usually causes linking failures against static libs like:
85+ # ld: ...-i686-w64-mingw32-stage-final-gcc-13.0.0-lib/i686-w64-mingw32/lib/libstdc++.dll.a:
86+ # error adding symbols: archive has no index; run ranlib to add one
87+ # Restore the index by running 'ranlib'.
88+ find $paths -name '*.a' -type f -exec $ranlibCmd '{}' \; 2>/dev/null
89+ fi
90+}
+13-1
pkgs/build-support/setup-hooks/strip.sh
···51 local stripFlags="$4"
52 local pathsNew=
5300054 local p
55 for p in ${paths}; do
56 if [ -e "$prefix/$p" ]; then
···6162 if [ -n "${paths}" ]; then
63 echo "stripping (with command $cmd and flags $stripFlags) in $paths"
0064 # Do not strip lib/debug. This is a directory used by setup-hooks/separate-debug-info.sh.
65- find $paths -type f -a '!' -wholename "$prefix/lib/debug/*" -exec $cmd $stripFlags '{}' \; 2>/dev/null
000000066 # 'strip' does not normally preserve archive index in .a files.
67 # This usually causes linking failures against static libs like:
68 # ld: ...-i686-w64-mingw32-stage-final-gcc-13.0.0-lib/i686-w64-mingw32/lib/libstdc++.dll.a:
···51 local stripFlags="$4"
52 local pathsNew=
5354+ [ -z "$cmd" ] && echo "stripDirs: Strip command is empty" 1>&2 && exit 1
55+ [ -z "$ranlibCmd" ] && echo "stripDirs: Ranlib command is empty" 1>&2 && exit 1
56+57 local p
58 for p in ${paths}; do
59 if [ -e "$prefix/$p" ]; then
···6465 if [ -n "${paths}" ]; then
66 echo "stripping (with command $cmd and flags $stripFlags) in $paths"
67+ local striperr
68+ striperr="$(mktemp 'striperr.XXXXXX')"
69 # Do not strip lib/debug. This is a directory used by setup-hooks/separate-debug-info.sh.
70+ find $paths -type f -a '!' -path "$prefix/lib/debug/*" -print0 |
71+ xargs -r -0 -n1 -P "$NIX_BUILD_CORES" -- $cmd $stripFlags 2>"$striperr" || exit_code=$?
72+ # xargs exits with status code 123 if some but not all of the
73+ # processes fail. We don't care if some of the files couldn't
74+ # be stripped, so ignore specifically this code.
75+ [[ "$exit_code" = 123 || -z "$exit_code" ]] || (cat "$striperr" 1>&2 && exit 1)
76+77+ rm "$striperr"
78 # 'strip' does not normally preserve archive index in .a files.
79 # This usually causes linking failures against static libs like:
80 # ld: ...-i686-w64-mingw32-stage-final-gcc-13.0.0-lib/i686-w64-mingw32/lib/libstdc++.dll.a:
+2-2
pkgs/data/misc/cacert/default.nix
···30 ]));
31 extraCertificatesBundle = writeText "cacert-extra-certificates-bundle.crt" (lib.concatStringsSep "\n\n" extraCertificateStrings);
3233- srcVersion = "3.90";
34 version = if nssOverride != null then nssOverride.version else srcVersion;
35 meta = with lib; {
36 homepage = "https://curl.haxx.se/docs/caextract.html";
···4546 src = if nssOverride != null then nssOverride.src else fetchurl {
47 url = "mirror://mozilla/security/nss/releases/NSS_${lib.replaceStrings ["."] ["_"] version}_RTM/src/nss-${version}.tar.gz";
48- hash = "sha256-ms1lNMQdjq0Z/Kb8s//+0vnwnEN8PXn+5qTuZoqqk7Y=";
49 };
5051 dontBuild = true;
···30 ]));
31 extraCertificatesBundle = writeText "cacert-extra-certificates-bundle.crt" (lib.concatStringsSep "\n\n" extraCertificateStrings);
3233+ srcVersion = "3.92";
34 version = if nssOverride != null then nssOverride.version else srcVersion;
35 meta = with lib; {
36 homepage = "https://curl.haxx.se/docs/caextract.html";
···4546 src = if nssOverride != null then nssOverride.src else fetchurl {
47 url = "mirror://mozilla/security/nss/releases/NSS_${lib.replaceStrings ["."] ["_"] version}_RTM/src/nss-${version}.tar.gz";
48+ hash = "sha256-PbGS1uiCA5rwKufq8yF+0RS7etg0FMZGdyq4Ah4kolQ=";
49 };
5051 dontBuild = true;
···193# We need all these X libraries when building AWT with GTK.
194assert x11Support -> (filter (x: x == null) ([ gtk2 libart_lgpl ] ++ xlibs)) == [];
195196-lib.pipe (stdenv.mkDerivation ({
197 pname = "${crossNameAddon}${name}";
198 inherit version;
199-200- builder = ../builder.sh;
201202 src = fetchurl {
203 url = "mirror://gnu/gcc/gcc-${version}/gcc-${version}.tar.bz2";
···193# We need all these X libraries when building AWT with GTK.
194assert x11Support -> (filter (x: x == null) ([ gtk2 libart_lgpl ] ++ xlibs)) == [];
195196+lib.pipe ((callFile ../common/builder.nix {}) ({
197 pname = "${crossNameAddon}${name}";
198 inherit version;
00199200 src = fetchurl {
201 url = "mirror://gnu/gcc/gcc-${version}/gcc-${version}.tar.bz2";
+1-3
pkgs/development/compilers/gcc/4.9/default.nix
···210# We need all these X libraries when building AWT with GTK.
211assert x11Support -> (filter (x: x == null) ([ gtk2 libart_lgpl ] ++ xlibs)) == [];
212213-lib.pipe (stdenv.mkDerivation ({
214 pname = "${crossNameAddon}${name}";
215 inherit version;
216-217- builder = ../builder.sh;
218219 src = fetchurl {
220 url = "mirror://gnu/gcc/gcc-${version}/gcc-${version}.tar.bz2";
···210# We need all these X libraries when building AWT with GTK.
211assert x11Support -> (filter (x: x == null) ([ gtk2 libart_lgpl ] ++ xlibs)) == [];
212213+lib.pipe ((callFile ../common/builder.nix {}) ({
214 pname = "${crossNameAddon}${name}";
215 inherit version;
00216217 src = fetchurl {
218 url = "mirror://gnu/gcc/gcc-${version}/gcc-${version}.tar.bz2";
+1-3
pkgs/development/compilers/gcc/6/default.nix
···199# We need all these X libraries when building AWT with GTK.
200assert x11Support -> (filter (x: x == null) ([ gtk2 libart_lgpl ] ++ xlibs)) == [];
201202-lib.pipe (stdenv.mkDerivation ({
203 pname = "${crossNameAddon}${name}";
204 inherit version;
205-206- builder = ../builder.sh;
207208 src = if stdenv.targetPlatform.isVc4 then fetchFromGitHub {
209 owner = "itszor";
···199# We need all these X libraries when building AWT with GTK.
200assert x11Support -> (filter (x: x == null) ([ gtk2 libart_lgpl ] ++ xlibs)) == [];
201202+lib.pipe ((callFile ../common/builder.nix {}) ({
203 pname = "${crossNameAddon}${name}";
204 inherit version;
00205206 src = if stdenv.targetPlatform.isVc4 then fetchFromGitHub {
207 owner = "itszor";
···1-if [ -e .attrs.sh ]; then source .attrs.sh; fi
2-source $stdenv/setup
3-4-5-oldOpts="$(shopt -po nounset)" || true
6-set -euo pipefail
7-8-9-export NIX_FIXINC_DUMMY="$NIX_BUILD_TOP/dummy"
10-mkdir "$NIX_FIXINC_DUMMY"
11-12-13-if test "$staticCompiler" = "1"; then
14- EXTRA_LDFLAGS="-static"
15-else
16- EXTRA_LDFLAGS="-Wl,-rpath,${!outputLib}/lib"
17-fi
18-19-20-# GCC interprets empty paths as ".", which we don't want.
21-if test -z "${CPATH-}"; then unset CPATH; fi
22-if test -z "${LIBRARY_PATH-}"; then unset LIBRARY_PATH; fi
23-echo "\$CPATH is \`${CPATH-}'"
24-echo "\$LIBRARY_PATH is \`${LIBRARY_PATH-}'"
25-26-if test "$noSysDirs" = "1"; then
27-28- declare \
29- EXTRA_FLAGS_FOR_BUILD EXTRA_FLAGS EXTRA_FLAGS_FOR_TARGET \
30- EXTRA_LDFLAGS_FOR_BUILD EXTRA_LDFLAGS_FOR_TARGET
31-32- # Extract flags from Bintools Wrappers
33- for post in '_FOR_BUILD' ''; do
34- curBintools="NIX_BINTOOLS${post}"
35-36- declare -a extraLDFlags=()
37- if [[ -e "${!curBintools}/nix-support/orig-libc" ]]; then
38- # Figure out what extra flags when linking to pass to the gcc
39- # compilers being generated to make sure that they use our libc.
40- extraLDFlags=($(< "${!curBintools}/nix-support/libc-ldflags") $(< "${!curBintools}/nix-support/libc-ldflags-before" || true))
41- if [ -e ${!curBintools}/nix-support/ld-set-dynamic-linker ]; then
42- extraLDFlags=-dynamic-linker=$(< ${!curBintools}/nix-support/dynamic-linker)
43- fi
44-45- # The path to the Libc binaries such as `crti.o'.
46- libc_libdir="$(< "${!curBintools}/nix-support/orig-libc")/lib"
47- else
48- # Hack: support impure environments.
49- extraLDFlags=("-L/usr/lib64" "-L/usr/lib")
50- libc_libdir="/usr/lib"
51- fi
52- extraLDFlags=("-L$libc_libdir" "-rpath" "$libc_libdir"
53- "${extraLDFlags[@]}")
54- for i in "${extraLDFlags[@]}"; do
55- declare EXTRA_LDFLAGS${post}+=" -Wl,$i"
56- done
57- done
58-59- # Extract flags from CC Wrappers
60- for post in '_FOR_BUILD' ''; do
61- curCC="NIX_CC${post}"
62- curFIXINC="NIX_FIXINC_DUMMY${post}"
63-64- declare -a extraFlags=()
65- if [[ -e "${!curCC}/nix-support/orig-libc" ]]; then
66- # Figure out what extra compiling flags to pass to the gcc compilers
67- # being generated to make sure that they use our libc.
68- extraFlags=($(< "${!curCC}/nix-support/libc-crt1-cflags") $(< "${!curCC}/nix-support/libc-cflags"))
69-70- # The path to the Libc headers
71- libc_devdir="$(< "${!curCC}/nix-support/orig-libc-dev")"
72-73- # Use *real* header files, otherwise a limits.h is generated that
74- # does not include Libc's limits.h (notably missing SSIZE_MAX,
75- # which breaks the build).
76- declare NIX_FIXINC_DUMMY${post}="$libc_devdir/include"
77- else
78- # Hack: support impure environments.
79- extraFlags=("-isystem" "/usr/include")
80- declare NIX_FIXINC_DUMMY${post}=/usr/include
81- fi
82-83- extraFlags=("-I${!curFIXINC}" "${extraFlags[@]}")
84-85- # BOOT_CFLAGS defaults to `-g -O2'; since we override it below, make
86- # sure to explictly add them so that files compiled with the bootstrap
87- # compiler are optimized and (optionally) contain debugging information
88- # (info "(gccinstall) Building").
89- if test -n "${dontStrip-}"; then
90- extraFlags=("-O2" "-g" "${extraFlags[@]}")
91- else
92- # Don't pass `-g' at all; this saves space while building.
93- extraFlags=("-O2" "${extraFlags[@]}")
94- fi
95-96- declare EXTRA_FLAGS${post}="${extraFlags[*]}"
97- done
98-99- if test -z "${targetConfig-}"; then
100- # host = target, so the flags are the same
101- EXTRA_FLAGS_FOR_TARGET="$EXTRA_FLAGS"
102- EXTRA_LDFLAGS_FOR_TARGET="$EXTRA_LDFLAGS"
103- fi
104-105- # CFLAGS_FOR_TARGET are needed for the libstdc++ configure script to find
106- # the startfiles.
107- # FLAGS_FOR_TARGET are needed for the target libraries to receive the -Bxxx
108- # for the startfiles.
109- makeFlagsArray+=(
110- "BUILD_SYSTEM_HEADER_DIR=$NIX_FIXINC_DUMMY_FOR_BUILD"
111- "SYSTEM_HEADER_DIR=$NIX_FIXINC_DUMMY_FOR_BUILD"
112- "NATIVE_SYSTEM_HEADER_DIR=$NIX_FIXINC_DUMMY"
113-114- "LDFLAGS_FOR_BUILD=$EXTRA_LDFLAGS_FOR_BUILD"
115- #"LDFLAGS=$EXTRA_LDFLAGS"
116- "LDFLAGS_FOR_TARGET=$EXTRA_LDFLAGS_FOR_TARGET"
117-118- "CFLAGS_FOR_BUILD=$EXTRA_FLAGS_FOR_BUILD $EXTRA_LDFLAGS_FOR_BUILD"
119- "CXXFLAGS_FOR_BUILD=$EXTRA_FLAGS_FOR_BUILD $EXTRA_LDFLAGS_FOR_BUILD"
120- "FLAGS_FOR_BUILD=$EXTRA_FLAGS_FOR_BUILD $EXTRA_LDFLAGS_FOR_BUILD"
121-122- # It seems there is a bug in GCC 5
123- #"CFLAGS=$EXTRA_FLAGS $EXTRA_LDFLAGS"
124- #"CXXFLAGS=$EXTRA_FLAGS $EXTRA_LDFLAGS"
125-126- "CFLAGS_FOR_TARGET=$EXTRA_FLAGS_FOR_TARGET $EXTRA_LDFLAGS_FOR_TARGET"
127- "CXXFLAGS_FOR_TARGET=$EXTRA_FLAGS_FOR_TARGET $EXTRA_LDFLAGS_FOR_TARGET"
128- "FLAGS_FOR_TARGET=$EXTRA_FLAGS_FOR_TARGET $EXTRA_LDFLAGS_FOR_TARGET"
129- )
130-131- if test -z "${targetConfig-}"; then
132- makeFlagsArray+=(
133- "BOOT_CFLAGS=$EXTRA_FLAGS $EXTRA_LDFLAGS"
134- "BOOT_LDFLAGS=$EXTRA_FLAGS_FOR_TARGET $EXTRA_LDFLAGS_FOR_TARGET"
135- )
136- fi
137-138- if test "$withoutTargetLibc" == 1; then
139- # We don't want the gcc build to assume there will be a libc providing
140- # limits.h in this stage
141- makeFlagsArray+=(
142- 'LIMITS_H_TEST=false'
143- )
144- else
145- makeFlagsArray+=(
146- 'LIMITS_H_TEST=true'
147- )
148- fi
149-fi
150-151-eval "$oldOpts"
152-153-providedPreConfigure="$preConfigure";
154-preConfigure() {
155- if test -n "$newlibSrc"; then
156- tar xvf "$newlibSrc" -C ..
157- ln -s ../newlib-*/newlib newlib
158- # Patch to get armvt5el working:
159- sed -i -e 's/ arm)/ arm*)/' newlib/configure.host
160- fi
161-162- # Bug - they packaged zlib
163- if test -d "zlib"; then
164- # This breaks the build without-headers, which should build only
165- # the target libgcc as target libraries.
166- # See 'configure:5370'
167- rm -Rf zlib
168- fi
169-170- if test -n "$crossMingw" -a -n "$withoutTargetLibc"; then
171- mkdir -p ../mingw
172- # --with-build-sysroot expects that:
173- cp -R $libcCross/include ../mingw
174- configureFlags="$configureFlags --with-build-sysroot=`pwd`/.."
175- fi
176-177- # Eval the preConfigure script from nix expression.
178- eval "$providedPreConfigure"
179-180- # Perform the build in a different directory.
181- mkdir ../build
182- cd ../build
183- configureScript=../$sourceRoot/configure
184-}
185-186-187-postConfigure() {
188- # Avoid store paths when embedding ./configure flags into gcc.
189- # Mangled arguments are still useful when reporting bugs upstream.
190- sed -e "/TOPLEVEL_CONFIGURE_ARGUMENTS=/ s|$NIX_STORE/[a-z0-9]\{32\}-|$NIX_STORE/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-|g" -i Makefile
191-}
192-193-194-preInstall() {
195- mkdir -p "$out/${targetConfig}/lib"
196- mkdir -p "${!outputLib}/${targetConfig}/lib"
197- # Make ‘lib64’ symlinks to ‘lib’.
198- if [ -n "$linkLib64toLib" ]; then
199- ln -s lib "$out/${targetConfig}/lib64"
200- ln -s lib "${!outputLib}/${targetConfig}/lib64"
201- fi
202- # Make ‘lib32’ symlinks to ‘lib’.
203- if [ -n "$linkLib32toLib" ]; then
204- ln -s lib "$out/${targetConfig}/lib32"
205- ln -s lib "${!outputLib}/${targetConfig}/lib32"
206- fi
207-}
208-209-210-postInstall() {
211- # Move runtime libraries to lib output.
212- moveToOutput "${targetConfig+$targetConfig/}lib/lib*.so*" "${!outputLib}"
213- moveToOutput "${targetConfig+$targetConfig/}lib/lib*.la" "${!outputLib}"
214- moveToOutput "${targetConfig+$targetConfig/}lib/lib*.dylib" "${!outputLib}"
215- moveToOutput "${targetConfig+$targetConfig/}lib/lib*.dll.a" "${!outputLib}"
216- moveToOutput "share/gcc-*/python" "${!outputLib}"
217-218- if [ -z "$enableShared" ]; then
219- moveToOutput "${targetConfig+$targetConfig/}lib/lib*.a" "${!outputLib}"
220- fi
221-222- for i in "${!outputLib}/${targetConfig}"/lib/*.{la,py}; do
223- substituteInPlace "$i" --replace "$out" "${!outputLib}"
224- done
225-226- if [ -n "$enableMultilib" ]; then
227- moveToOutput "${targetConfig+$targetConfig/}lib64/lib*.so*" "${!outputLib}"
228- moveToOutput "${targetConfig+$targetConfig/}lib64/lib*.la" "${!outputLib}"
229- moveToOutput "${targetConfig+$targetConfig/}lib64/lib*.dylib" "${!outputLib}"
230-231- for i in "${!outputLib}/${targetConfig}"/lib64/*.{la,py}; do
232- substituteInPlace "$i" --replace "$out" "${!outputLib}"
233- done
234- fi
235-236- # Remove `fixincl' to prevent a retained dependency on the
237- # previous gcc.
238- rm -rf $out/libexec/gcc/*/*/install-tools
239- rm -rf $out/lib/gcc/*/*/install-tools
240-241- # More dependencies with the previous gcc or some libs (gccbug stores the build command line)
242- rm -rf $out/bin/gccbug
243-244- if type "install_name_tool"; then
245- for i in "${!outputLib}"/lib/*.*.dylib "${!outputLib}"/lib/*.so.[0-9]; do
246- install_name_tool -id "$i" "$i" || true
247- for old_path in $(otool -L "$i" | grep "$out" | awk '{print $1}'); do
248- new_path=`echo "$old_path" | sed "s,$out,${!outputLib},"`
249- install_name_tool -change "$old_path" "$new_path" "$i" || true
250- done
251- done
252- fi
253-254- # Cross-compiler specific:
255- # --with-headers=$dir option triggers gcc to make a private copy
256- # of $dir headers and use it later as `-isysroot`. This prevents
257- # cc-wrapper from overriding libc headers with `-idirafter`.
258- # It should be safe to drop it and rely solely on the cc-wrapper.
259- local sysinc_dir=$out/${targetConfig+$targetConfig/}sys-include
260- if [ -d "$sysinc_dir" ]; then
261- chmod -R u+w "$out/${targetConfig+$targetConfig/}sys-include"
262- rm -rfv "$out/${targetConfig+$targetConfig/}sys-include"
263- fi
264-265- # Get rid of some "fixed" header files
266- rm -rfv $out/lib/gcc/*/*/include-fixed/{root,linux,sys/mount.h,bits/statx.h}
267-268- # Replace hard links for i686-pc-linux-gnu-gcc etc. with symlinks.
269- for i in $out/bin/*-gcc*; do
270- if cmp -s $out/bin/gcc $i; then
271- ln -sfn gcc $i
272- fi
273- done
274-275- for i in $out/bin/c++ $out/bin/*-c++* $out/bin/*-g++*; do
276- if cmp -s $out/bin/g++ $i; then
277- ln -sfn g++ $i
278- fi
279- done
280-281- # Two identical man pages are shipped (moving and compressing is done later)
282- for i in "$out"/share/man/man1/*g++.1; do
283- if test -e "$i"; then
284- man_prefix=`echo "$i" | sed "s,.*/\(.*\)g++.1,\1,"`
285- ln -sf "$man_prefix"gcc.1 "$i"
286- fi
287- done
288-}
289-290-genericBuild
···1+{ lib
2+, stdenv
3+, enableMultilib
4+}:
5+6+originalAttrs: (stdenv.mkDerivation (finalAttrs: originalAttrs // {
7+ preUnpack = ''
8+ oldOpts="$(shopt -po nounset)" || true
9+ set -euo pipefail
10+11+ export NIX_FIXINC_DUMMY="$NIX_BUILD_TOP/dummy"
12+ mkdir "$NIX_FIXINC_DUMMY"
13+14+ if test "$staticCompiler" = "1"; then
15+ EXTRA_LDFLAGS="-static"
16+ else
17+ EXTRA_LDFLAGS="-Wl,-rpath,''${!outputLib}/lib"
18+ fi
19+20+ # GCC interprets empty paths as ".", which we don't want.
21+ if test -z "''${CPATH-}"; then unset CPATH; fi
22+ if test -z "''${LIBRARY_PATH-}"; then unset LIBRARY_PATH; fi
23+ echo "\$CPATH is \`''${CPATH-}'"
24+ echo "\$LIBRARY_PATH is \`''${LIBRARY_PATH-}'"
25+26+ if test "$noSysDirs" = "1"; then
27+28+ declare -g \
29+ EXTRA_FLAGS_FOR_BUILD EXTRA_FLAGS EXTRA_FLAGS_FOR_TARGET \
30+ EXTRA_LDFLAGS_FOR_BUILD EXTRA_LDFLAGS_FOR_TARGET
31+32+ # Extract flags from Bintools Wrappers
33+ for post in '_FOR_BUILD' ""; do
34+ curBintools="NIX_BINTOOLS''${post}"
35+36+ declare -a extraLDFlags=()
37+ if [[ -e "''${!curBintools}/nix-support/orig-libc" ]]; then
38+ # Figure out what extra flags when linking to pass to the gcc
39+ # compilers being generated to make sure that they use our libc.
40+ extraLDFlags=($(< "''${!curBintools}/nix-support/libc-ldflags") $(< "''${!curBintools}/nix-support/libc-ldflags-before" || true))
41+ if [ -e ''${!curBintools}/nix-support/ld-set-dynamic-linker ]; then
42+ extraLDFlags=-dynamic-linker=$(< ''${!curBintools}/nix-support/dynamic-linker)
43+ fi
44+45+ # The path to the Libc binaries such as `crti.o'.
46+ libc_libdir="$(< "''${!curBintools}/nix-support/orig-libc")/lib"
47+ else
48+ # Hack: support impure environments.
49+ extraLDFlags=("-L/usr/lib64" "-L/usr/lib")
50+ libc_libdir="/usr/lib"
51+ fi
52+ extraLDFlags=("-L$libc_libdir" "-rpath" "$libc_libdir"
53+ "''${extraLDFlags[@]}")
54+ for i in "''${extraLDFlags[@]}"; do
55+ declare -g EXTRA_LDFLAGS''${post}+=" -Wl,$i"
56+ done
57+ done
58+59+ # Extract flags from CC Wrappers
60+ for post in '_FOR_BUILD' ""; do
61+ curCC="NIX_CC''${post}"
62+ curFIXINC="NIX_FIXINC_DUMMY''${post}"
63+64+ declare -a extraFlags=()
65+ if [[ -e "''${!curCC}/nix-support/orig-libc" ]]; then
66+ # Figure out what extra compiling flags to pass to the gcc compilers
67+ # being generated to make sure that they use our libc.
68+ extraFlags=($(< "''${!curCC}/nix-support/libc-crt1-cflags") $(< "''${!curCC}/nix-support/libc-cflags"))
69+70+ # The path to the Libc headers
71+ libc_devdir="$(< "''${!curCC}/nix-support/orig-libc-dev")"
72+73+ # Use *real* header files, otherwise a limits.h is generated that
74+ # does not include Libc's limits.h (notably missing SSIZE_MAX,
75+ # which breaks the build).
76+ declare -g NIX_FIXINC_DUMMY''${post}="$libc_devdir/include"
77+ else
78+ # Hack: support impure environments.
79+ extraFlags=("-isystem" "/usr/include")
80+ declare -g NIX_FIXINC_DUMMY''${post}=/usr/include
81+ fi
82+83+ extraFlags=("-I''${!curFIXINC}" "''${extraFlags[@]}")
84+85+ # BOOT_CFLAGS defaults to `-g -O2'; since we override it below, make
86+ # sure to explictly add them so that files compiled with the bootstrap
87+ # compiler are optimized and (optionally) contain debugging information
88+ # (info "(gccinstall) Building").
89+ if test -n "''${dontStrip-}"; then
90+ extraFlags=("-O2" "-g" "''${extraFlags[@]}")
91+ else
92+ # Don't pass `-g' at all; this saves space while building.
93+ extraFlags=("-O2" "''${extraFlags[@]}")
94+ fi
95+96+ declare -g EXTRA_FLAGS''${post}="''${extraFlags[*]}"
97+ done
98+99+ if test -z "''${targetConfig-}"; then
100+ # host = target, so the flags are the same
101+ EXTRA_FLAGS_FOR_TARGET="$EXTRA_FLAGS"
102+ EXTRA_LDFLAGS_FOR_TARGET="$EXTRA_LDFLAGS"
103+ fi
104+105+ # CFLAGS_FOR_TARGET are needed for the libstdc++ configure script to find
106+ # the startfiles.
107+ # FLAGS_FOR_TARGET are needed for the target libraries to receive the -Bxxx
108+ # for the startfiles.
109+ makeFlagsArray+=(
110+ "BUILD_SYSTEM_HEADER_DIR=$NIX_FIXINC_DUMMY_FOR_BUILD"
111+ "SYSTEM_HEADER_DIR=$NIX_FIXINC_DUMMY_FOR_BUILD"
112+ "NATIVE_SYSTEM_HEADER_DIR=$NIX_FIXINC_DUMMY"
113+114+ "LDFLAGS_FOR_BUILD=$EXTRA_LDFLAGS_FOR_BUILD"
115+ #"LDFLAGS=$EXTRA_LDFLAGS"
116+ "LDFLAGS_FOR_TARGET=$EXTRA_LDFLAGS_FOR_TARGET"
117+118+ "CFLAGS_FOR_BUILD=$EXTRA_FLAGS_FOR_BUILD $EXTRA_LDFLAGS_FOR_BUILD"
119+ "CXXFLAGS_FOR_BUILD=$EXTRA_FLAGS_FOR_BUILD $EXTRA_LDFLAGS_FOR_BUILD"
120+ "FLAGS_FOR_BUILD=$EXTRA_FLAGS_FOR_BUILD $EXTRA_LDFLAGS_FOR_BUILD"
121+122+ # It seems there is a bug in GCC 5
123+ #"CFLAGS=$EXTRA_FLAGS $EXTRA_LDFLAGS"
124+ #"CXXFLAGS=$EXTRA_FLAGS $EXTRA_LDFLAGS"
125+126+ "CFLAGS_FOR_TARGET=$EXTRA_FLAGS_FOR_TARGET $EXTRA_LDFLAGS_FOR_TARGET"
127+ "CXXFLAGS_FOR_TARGET=$EXTRA_FLAGS_FOR_TARGET $EXTRA_LDFLAGS_FOR_TARGET"
128+ "FLAGS_FOR_TARGET=$EXTRA_FLAGS_FOR_TARGET $EXTRA_LDFLAGS_FOR_TARGET"
129+ )
130+131+ if test -z "''${targetConfig-}"; then
132+ makeFlagsArray+=(
133+ "BOOT_CFLAGS=$EXTRA_FLAGS $EXTRA_LDFLAGS"
134+ "BOOT_LDFLAGS=$EXTRA_FLAGS_FOR_TARGET $EXTRA_LDFLAGS_FOR_TARGET"
135+ )
136+ fi
137+138+ if test "$withoutTargetLibc" == 1; then
139+ # We don't want the gcc build to assume there will be a libc providing
140+ # limits.h in this stage
141+ makeFlagsArray+=(
142+ 'LIMITS_H_TEST=false'
143+ )
144+ else
145+ makeFlagsArray+=(
146+ 'LIMITS_H_TEST=true'
147+ )
148+ fi
149+ fi
150+151+ eval "$oldOpts"
152+ '';
153+154+ preConfigure = (originalAttrs.preConfigure or "") + ''
155+ if test -n "$newlibSrc"; then
156+ tar xvf "$newlibSrc" -C ..
157+ ln -s ../newlib-*/newlib newlib
158+ # Patch to get armvt5el working:
159+ sed -i -e 's/ arm)/ arm*)/' newlib/configure.host
160+ fi
161+162+ # Bug - they packaged zlib
163+ if test -d "zlib"; then
164+ # This breaks the build without-headers, which should build only
165+ # the target libgcc as target libraries.
166+ # See 'configure:5370'
167+ rm -Rf zlib
168+ fi
169+170+ if test -n "$crossMingw" -a -n "$withoutTargetLibc"; then
171+ mkdir -p ../mingw
172+ # --with-build-sysroot expects that:
173+ cp -R $libcCross/include ../mingw
174+ configureFlags="$configureFlags --with-build-sysroot=`pwd`/.."
175+ fi
176+177+ # Perform the build in a different directory.
178+ mkdir ../build
179+ cd ../build
180+ configureScript=../$sourceRoot/configure
181+ '';
182+183+ postConfigure = ''
184+ # Avoid store paths when embedding ./configure flags into gcc.
185+ # Mangled arguments are still useful when reporting bugs upstream.
186+ sed -e "/TOPLEVEL_CONFIGURE_ARGUMENTS=/ s|$NIX_STORE/[a-z0-9]\{32\}-|$NIX_STORE/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-|g" -i Makefile
187+ '';
188+189+ preInstall = ''
190+ mkdir -p "$out/''${targetConfig}/lib"
191+ mkdir -p "''${!outputLib}/''${targetConfig}/lib"
192+ '' +
193+ # Make `lib64` symlinks to `lib`.
194+ lib.optionalString (!enableMultilib && stdenv.hostPlatform.is64bit && !stdenv.hostPlatform.isMips64n32) ''
195+ ln -s lib "$out/''${targetConfig}/lib64"
196+ ln -s lib "''${!outputLib}/''${targetConfig}/lib64"
197+ '' +
198+ # On mips platforms, gcc follows the IRIX naming convention:
199+ #
200+ # $PREFIX/lib = mips32
201+ # $PREFIX/lib32 = mips64n32
202+ # $PREFIX/lib64 = mips64
203+ #
204+ # Make `lib32` symlinks to `lib`.
205+ lib.optionalString (!enableMultilib && stdenv.targetPlatform.isMips64n32) ''
206+ ln -s lib "$out/''${targetConfig}/lib32"
207+ ln -s lib "''${!outputLib}/''${targetConfig}/lib32"
208+ '';
209+210+ postInstall = ''
211+ # Move runtime libraries to lib output.
212+ moveToOutput "''${targetConfig+$targetConfig/}lib/lib*.so*" "''${!outputLib}"
213+ moveToOutput "''${targetConfig+$targetConfig/}lib/lib*.la" "''${!outputLib}"
214+ moveToOutput "''${targetConfig+$targetConfig/}lib/lib*.dylib" "''${!outputLib}"
215+ moveToOutput "''${targetConfig+$targetConfig/}lib/lib*.dll.a" "''${!outputLib}"
216+ moveToOutput "share/gcc-*/python" "''${!outputLib}"
217+218+ if [ -z "$enableShared" ]; then
219+ moveToOutput "''${targetConfig+$targetConfig/}lib/lib*.a" "''${!outputLib}"
220+ fi
221+222+ for i in "''${!outputLib}/''${targetConfig}"/lib/*.{la,py}; do
223+ substituteInPlace "$i" --replace "$out" "''${!outputLib}"
224+ done
225+226+ if [ -n "$enableMultilib" ]; then
227+ moveToOutput "''${targetConfig+$targetConfig/}lib64/lib*.so*" "''${!outputLib}"
228+ moveToOutput "''${targetConfig+$targetConfig/}lib64/lib*.la" "''${!outputLib}"
229+ moveToOutput "''${targetConfig+$targetConfig/}lib64/lib*.dylib" "''${!outputLib}"
230+231+ for i in "''${!outputLib}/''${targetConfig}"/lib64/*.{la,py}; do
232+ substituteInPlace "$i" --replace "$out" "''${!outputLib}"
233+ done
234+ fi
235+236+ # Remove `fixincl' to prevent a retained dependency on the
237+ # previous gcc.
238+ rm -rf $out/libexec/gcc/*/*/install-tools
239+ rm -rf $out/lib/gcc/*/*/install-tools
240+241+ # More dependencies with the previous gcc or some libs (gccbug stores the build command line)
242+ rm -rf $out/bin/gccbug
243+244+ if type "install_name_tool"; then
245+ for i in "''${!outputLib}"/lib/*.*.dylib "''${!outputLib}"/lib/*.so.[0-9]; do
246+ install_name_tool -id "$i" "$i" || true
247+ for old_path in $(otool -L "$i" | grep "$out" | awk '{print $1}'); do
248+ new_path=`echo "$old_path" | sed "s,$out,''${!outputLib},"`
249+ install_name_tool -change "$old_path" "$new_path" "$i" || true
250+ done
251+ done
252+ fi
253+254+ # Get rid of some "fixed" header files
255+ rm -rfv $out/lib/gcc/*/*/include-fixed/{root,linux,sys/mount.h,bits/statx.h}
256+257+ # Replace hard links for i686-pc-linux-gnu-gcc etc. with symlinks.
258+ for i in $out/bin/*-gcc*; do
259+ if cmp -s $out/bin/gcc $i; then
260+ ln -sfn gcc $i
261+ fi
262+ done
263+264+ for i in $out/bin/c++ $out/bin/*-c++* $out/bin/*-g++*; do
265+ if cmp -s $out/bin/g++ $i; then
266+ ln -sfn g++ $i
267+ fi
268+ done
269+270+ # Two identical man pages are shipped (moving and compressing is done later)
271+ for i in "$out"/share/man/man1/*g++.1; do
272+ if test -e "$i"; then
273+ man_prefix=`echo "$i" | sed "s,.*/\(.*\)g++.1,\1,"`
274+ ln -sf "$man_prefix"gcc.1 "$i"
275+ fi
276+ done
277+ '';
278+}))
···1-# New rust versions should first go to staging.
2-# Things to check after updating:
3-# 1. Rustc should produce rust binaries on x86_64-linux, aarch64-linux and x86_64-darwin:
4-# i.e. nix-shell -p fd or @GrahamcOfBorg build fd on github
5-# This testing can be also done by other volunteers as part of the pull
6-# request review, in case platforms cannot be covered.
7-# 2. The LLVM version used for building should match with rust upstream.
8-# Check the version number in the src/llvm-project git submodule in:
9-# https://github.com/rust-lang/rust/blob/<version-tag>/.gitmodules
10-# 3. Firefox and Thunderbird should still build on x86_64-linux.
11-12-{ stdenv, lib
13-, buildPackages
14-, newScope, callPackage
15-, CoreFoundation, Security, SystemConfiguration
16-, pkgsBuildTarget, pkgsBuildBuild, pkgsBuildHost
17-, makeRustPlatform
18-, llvmPackages_16, llvm_16
19-} @ args:
20-21-import ./default.nix {
22- rustcVersion = "1.70.0";
23- rustcSha256 = "sha256-sr+uAAt6UEDk7Eu8UKCfIVSBkMt1cLDtdzWDaEE70nw=";
24-25- llvmSharedForBuild = pkgsBuildBuild.llvmPackages_16.libllvm.override { enableSharedLibraries = true; };
26- llvmSharedForHost = pkgsBuildHost.llvmPackages_16.libllvm.override { enableSharedLibraries = true; };
27- llvmSharedForTarget = pkgsBuildTarget.llvmPackages_16.libllvm.override { enableSharedLibraries = true; };
28-29- # For use at runtime
30- llvmShared = llvm_16.override { enableSharedLibraries = true; };
31-32- # Expose llvmPackages used for rustc from rustc via passthru for LTO in Firefox
33- llvmPackages = llvmPackages_16;
34-35- # Note: the version MUST be one version prior to the version we're
36- # building
37- bootstrapVersion = "1.69.0";
38-39- # fetch hashes by running `print-hashes.sh ${bootstrapVersion}`
40- bootstrapHashes = {
41- i686-unknown-linux-gnu = "08b2b4f58c0861f40ae159c39cc12f6d41b6858e04a43c6c0aeb36707e2971d0";
42- x86_64-unknown-linux-gnu = "2ca4a306047c0b8b4029c382910fcbc895badc29680e0332c9df990fd1c70d4f";
43- x86_64-unknown-linux-musl = "071cb04819b15d8801584a1395b28d0472ce99c0e716296e3c0bb4e6318cf171";
44- arm-unknown-linux-gnueabihf = "64c82735b4e5606af61be0d01317da436a9590b969e503cdbd19e24636e15845";
45- armv7-unknown-linux-gnueabihf = "a509f02d910041c97847e2ccc4ee908c761b7dc5b3c4715922d2b1c573a09675";
46- aarch64-unknown-linux-gnu = "88af5aa7a40c8f1b40416a1f27de8ffbe09c155d933f69d3e109c0ccee92353b";
47- aarch64-unknown-linux-musl = "76aaf3e4fd7b552feb2d70752c43896a960a2a7c940002f58a5c3f03d2b3c862";
48- x86_64-apple-darwin = "9818dab2c3726d63dfbfde12c9273e62e484ef6d6f6e05a6431a3e089c335454";
49- aarch64-apple-darwin = "36228cac303298243fb84235db87a5ecf2af49db28585a82af091caefd598677";
50- powerpc64le-unknown-linux-gnu = "8ef68b77971c079dbe23b54a2cfb52da012873d96399c424bc223635306e9a58";
51- riscv64gc-unknown-linux-gnu = "e1976bf7d0edb7e7789a1ad7ff8086fdb5306a932650fa8182a5d009883fa6c5";
52- mips64el-unknown-linux-gnuabi64 = "c4bf3043451d6122a3845db825cbe35b5ca61a44659a00004f6cca1299ad9d72";
53- };
54-55- selectRustPackage = pkgs: pkgs.rust_1_70;
56-57- rustcPatches = [ ];
58-}
59-60-(builtins.removeAttrs args [ "pkgsBuildTarget" "pkgsBuildBuild" "pkgsBuildHost" "llvmPackages_16" "llvm_16"])
···1+# New rust versions should first go to staging.
2+# Things to check after updating:
3+# 1. Rustc should produce rust binaries on x86_64-linux, aarch64-linux and x86_64-darwin:
4+# i.e. nix-shell -p fd or @GrahamcOfBorg build fd on github
5+# This testing can be also done by other volunteers as part of the pull
6+# request review, in case platforms cannot be covered.
7+# 2. The LLVM version used for building should match with rust upstream.
8+# Check the version number in the src/llvm-project git submodule in:
9+# https://github.com/rust-lang/rust/blob/<version-tag>/.gitmodules
10+# 3. Firefox and Thunderbird should still build on x86_64-linux.
11+12+{ stdenv, lib
13+, buildPackages
14+, newScope, callPackage
15+, CoreFoundation, Security, SystemConfiguration
16+, pkgsBuildTarget, pkgsBuildBuild, pkgsBuildHost
17+, makeRustPlatform
18+, llvmPackages_16, llvm_16
19+} @ args:
20+21+import ./default.nix {
22+ rustcVersion = "1.71.1";
23+ rustcSha256 = "sha256-b6kNUNHVKadfbMNJeE3lfX7AuiQZsJvefTNcJb1ORy4=";
24+25+ llvmSharedForBuild = pkgsBuildBuild.llvmPackages_16.libllvm.override { enableSharedLibraries = true; };
26+ llvmSharedForHost = pkgsBuildHost.llvmPackages_16.libllvm.override { enableSharedLibraries = true; };
27+ llvmSharedForTarget = pkgsBuildTarget.llvmPackages_16.libllvm.override { enableSharedLibraries = true; };
28+29+ # For use at runtime
30+ llvmShared = llvm_16.override { enableSharedLibraries = true; };
31+32+ # Expose llvmPackages used for rustc from rustc via passthru for LTO in Firefox
33+ llvmPackages = llvmPackages_16;
34+35+ # Note: the version MUST be one version prior to the version we're
36+ # building
37+ bootstrapVersion = "1.70.0";
38+39+ # fetch hashes by running `print-hashes.sh ${bootstrapVersion}`
40+ bootstrapHashes = {
41+ i686-unknown-linux-gnu = "119dfd4ee3da6c8fc36444dd15a12187e1f9b34ee6792fb75a6a25d09ea7e865";
42+ x86_64-unknown-linux-gnu = "8499c0b034dd881cd9a880c44021632422a28dc23d7a81ca0a97b04652245982";
43+ x86_64-unknown-linux-musl = "d97c2ac1d9f17e754fa6b7d48c28531d16278547e3fa47050a01da037ddb6de3";
44+ arm-unknown-linux-gnueabihf = "ac98b513c31789d0c3201dfe2bbcc81b9437f7e1a15695d09402efec7934c20e";
45+ armv7-unknown-linux-gnueabihf = "23e6029c2a7363b307af539f0c81f4bb9f0ade12b588658343c8a8cfa41526ae";
46+ aarch64-unknown-linux-gnu = "3aa012fc4d9d5f17ca30af41f87e1c2aacdac46b51adc5213e7614797c6fd24c";
47+ aarch64-unknown-linux-musl = "6381de0b55f1741ac322bf1b56701d8aab4e509ff5302043941170f8df34228e";
48+ x86_64-apple-darwin = "e5819fdbfc7f1a4d5d82cb4c3b7662250748450b45a585433bfb75648bc45547";
49+ aarch64-apple-darwin = "75cbc356a06c9b2daf6b9249febda0f0c46df2a427f7cc8467c7edbd44636e53";
50+ powerpc64le-unknown-linux-gnu = "ba8cb5e3078b1bc7c6b27ab53cfa3af14001728db9a047d0bdf29b8f05a4db34";
51+ riscv64gc-unknown-linux-gnu = "5964f78e5fb30506101a929162a42be6260b887660b71592c5f38466753440c3";
52+ mips64el-unknown-linux-gnuabi64 = "de5fd0b249fbb95b9b67928ba08d7ec49f18f0ae25cbe1b0ede3c02390d7b93a";
53+ };
54+55+ selectRustPackage = pkgs: pkgs.rust_1_71;
56+57+ rustcPatches = [ ];
58+}
59+60+(builtins.removeAttrs args [ "pkgsBuildTarget" "pkgsBuildBuild" "pkgsBuildHost" "llvmPackages_16" "llvm_16"])
+1-1
pkgs/development/compilers/rust/binary.nix
···56 # binaries. The lib.rmeta object inside the ar archive should contain an
57 # .rmeta section, but it is removed. Luckily, this doesn't appear to be an
58 # issue for Rust builds produced by Nix.
59- dontStrip = stdenv.isDarwin;
6061 setupHooks = ./setup-hook.sh;
62 };
···56 # binaries. The lib.rmeta object inside the ar archive should contain an
57 # .rmeta section, but it is removed. Luckily, this doesn't appear to be an
58 # issue for Rust builds produced by Nix.
59+ dontStrip = true;
6061 setupHooks = ./setup-hook.sh;
62 };
+1-4
pkgs/development/compilers/rust/rustc.nix
···75 "--release-channel=stable"
76 "--set=build.rustc=${rustc}/bin/rustc"
77 "--set=build.cargo=${cargo}/bin/cargo"
078 "--enable-rpath"
79 "--enable-vendor"
80 "--build=${rust.toRustTargetSpec stdenv.buildPlatform}"
···148 patchShebangs src/etc
149150 ${optionalString (!withBundledLLVM) "rm -rf src/llvm"}
151-152- # Fix the configure script to not require curl as we won't use it
153- sed -i configure \
154- -e '/probe_need CFG_CURL curl/d'
155156 # Useful debugging parameter
157 # export VERBOSE=1
···1+diff --git a/Configure b/Configure
2+index e261cb9548..3bbbc4b9df 100755
3+--- a/Configure
4++++ b/Configure
5+@@ -108,15 +108,7 @@ if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' 2>&1 ) 2>&1 >/dev/null ; th
6+ fi
7+8+ : Proper PATH setting
9+-paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
10+-paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
11+-paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
12+-paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
13+-paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
14+-paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
15+-paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
16+-paths="$paths /sbin /usr/sbin /usr/libexec"
17+-paths="$paths /system/gnu_library/bin"
18++paths=''
19+20+ for p in $paths
21+ do
22+@@ -1455,8 +1447,7 @@ groupstype=''
23+ i_whoami=''
24+ : Possible local include directories to search.
25+ : Set locincpth to "" in a hint file to defeat local include searches.
26+-locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
27+-locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
28++locincpth=""
29+ :
30+ : no include file wanted by default
31+ inclwanted=''
32+@@ -1470,17 +1461,12 @@ DEBUGGING=''
33+ archobjs=''
34+ libnames=''
35+ : change the next line if compiling for Xenix/286 on Xenix/386
36+-xlibpth='/usr/lib/386 /lib/386'
37++xlibpth=''
38+ : Possible local library directories to search.
39+-loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
40+-loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
41++loclibpth=""
42+43+ : general looking path for locating libraries
44+-glibpth="/lib /usr/lib $xlibpth"
45+-glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
46+-test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
47+-test -f /shlib/libc.so && glibpth="/shlib $glibpth"
48+-test -d /usr/lib64 && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
49++glibpth=""
50+51+ : Private path used by Configure to find libraries. Its value
52+ : is prepended to libpth. This variable takes care of special
53+@@ -1515,8 +1501,6 @@ libswanted="cl pthread socket bind inet ndbm gdbm dbm db malloc dl ld"
54+ libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
55+ : We probably want to search /usr/shlib before most other libraries.
56+ : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
57+-glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
58+-glibpth="/usr/shlib $glibpth"
59+ : Do not use vfork unless overridden by a hint file.
60+ usevfork=false
61+62+@@ -2581,7 +2565,6 @@ uname
63+ zip
64+ "
65+ pth=`echo $PATH | sed -e "s/$p_/ /g"`
66+-pth="$pth $sysroot/lib $sysroot/usr/lib"
67+ for file in $loclist; do
68+ eval xxx=\$$file
69+ case "$xxx" in
70+@@ -5023,7 +5006,7 @@ esac
71+ : Set private lib path
72+ case "$plibpth" in
73+ '') if ./mips; then
74+- plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
75++ plibpth="$incpath/usr/lib"
76+ fi;;
77+ esac
78+ case "$libpth" in
79+@@ -8860,13 +8843,8 @@ esac
80+ echo " "
81+ case "$sysman" in
82+ '')
83+- syspath='/usr/share/man/man1 /usr/man/man1'
84+- syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
85+- syspath="$syspath /usr/man/u_man/man1"
86+- syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
87+- syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
88+- syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
89+- sysman=`./loc . /usr/man/man1 $syspath`
90++ syspath=''
91++ sysman=''
92+ ;;
93+ esac
94+ if $test -d "$sysman"; then
95+@@ -21500,9 +21478,10 @@ $rm_try tryp
96+ case "$full_ar" in
97+ '') full_ar=$ar ;;
98+ esac
99++full_ar=ar
100+101+ : Store the full pathname to the sed program for use in the C program
102+-full_sed=$sed
103++full_sed=sed
104+105+ : see what type gids are declared as in the kernel
106+ echo " "
107+diff --git a/ext/Errno/Errno_pm.PL b/ext/Errno/Errno_pm.PL
108+index ae647d5f06..9a05d66592 100644
109+--- a/ext/Errno/Errno_pm.PL
110++++ b/ext/Errno/Errno_pm.PL
111+@@ -135,12 +135,7 @@ sub get_files {
112+ if ($dep =~ /(\S+errno\.h)/) {
113+ push(@file, $1);
114+ }
115+- } elsif ($^O eq 'linux' &&
116+- $Config{gccversion} ne '' &&
117+- $Config{gccversion} !~ /intel/i &&
118+- # might be using, say, Intel's icc
119+- $linux_errno_h
120+- ) {
121++ } elsif (0) {
122+ push(@file, $linux_errno_h);
123+ } elsif ($^O eq 'haiku') {
124+ # hidden in a special place
125+diff --git a/hints/freebsd.sh b/hints/freebsd.sh
126+index 4d26835e99..c6d365d84d 100644
127+--- a/hints/freebsd.sh
128++++ b/hints/freebsd.sh
129+@@ -127,21 +127,21 @@ case "$osvers" in
130+ objformat=`/usr/bin/objformat`
131+ if [ x$objformat = xaout ]; then
132+ if [ -e /usr/lib/aout ]; then
133+- libpth="/usr/lib/aout /usr/local/lib /usr/lib"
134+- glibpth="/usr/lib/aout /usr/local/lib /usr/lib"
135++ libpth=""
136++ glibpth=""
137+ fi
138+ lddlflags='-Bshareable'
139+ else
140+- libpth="/usr/lib /usr/local/lib"
141+- glibpth="/usr/lib /usr/local/lib"
142++ libpth=""
143++ glibpth=""
144+ ldflags="-Wl,-E "
145+ lddlflags="-shared "
146+ fi
147+ cccdlflags='-DPIC -fPIC'
148+ ;;
149+ *)
150+- libpth="/usr/lib /usr/local/lib"
151+- glibpth="/usr/lib /usr/local/lib"
152++ libpth=""
153++ glibpth=""
154+ ldflags="-Wl,-E "
155+ lddlflags="-shared "
156+ cccdlflags='-DPIC -fPIC'
157+diff --git a/hints/linux.sh b/hints/linux.sh
158+index e1508c7509..5a187c583a 100644
159+--- a/hints/linux.sh
160++++ b/hints/linux.sh
161+@@ -150,28 +150,6 @@ case "$optimize" in
162+ ;;
163+ esac
164+165+-# Ubuntu 11.04 (and later, presumably) doesn't keep most libraries
166+-# (such as -lm) in /lib or /usr/lib. So we have to ask gcc to tell us
167+-# where to look. We don't want gcc's own libraries, however, so we
168+-# filter those out.
169+-# This could be conditional on Ubuntu, but other distributions may
170+-# follow suit, and this scheme seems to work even on rather old gcc's.
171+-# This unconditionally uses gcc because even if the user is using another
172+-# compiler, we still need to find the math library and friends, and I don't
173+-# know how other compilers will cope with that situation.
174+-# Morever, if the user has their own gcc earlier in $PATH than the system gcc,
175+-# we don't want its libraries. So we try to prefer the system gcc
176+-# Still, as an escape hatch, allow Configure command line overrides to
177+-# plibpth to bypass this check.
178+-if [ -x /usr/bin/gcc ] ; then
179+- gcc=/usr/bin/gcc
180+-# clang also provides -print-search-dirs
181+-elif ${cc:-cc} --version 2>/dev/null | grep -q '^clang ' ; then
182+- gcc=${cc:-cc}
183+-else
184+- gcc=gcc
185+-fi
186+-
187+ case "$plibpth" in
188+ '') plibpth=`LANG=C LC_ALL=C $gcc $ccflags $ldflags -print-search-dirs | grep libraries |
189+ cut -f2- -d= | tr ':' $trnl | grep -v 'gcc' | sed -e 's:/$::'`
190+@@ -208,32 +186,6 @@ case "$usequadmath" in
191+ ;;
192+ esac
193+194+-case "$libc" in
195+-'')
196+-# If you have glibc, then report the version for ./myconfig bug reporting.
197+-# (Configure doesn't need to know the specific version since it just uses
198+-# gcc to load the library for all tests.)
199+-# We don't use __GLIBC__ and __GLIBC_MINOR__ because they
200+-# are insufficiently precise to distinguish things like
201+-# libc-2.0.6 and libc-2.0.7.
202+- for p in $plibpth
203+- do
204+- for trylib in libc.so.6 libc.so
205+- do
206+- if $test -e $p/$trylib; then
207+- libc=`ls -l $p/$trylib | awk '{print $NF}'`
208+- if $test "X$libc" != X; then
209+- break
210+- fi
211+- fi
212+- done
213+- if $test "X$libc" != X; then
214+- break
215+- fi
216+- done
217+- ;;
218+-esac
219+-
220+ if ${sh:-/bin/sh} -c exit; then
221+ echo ''
222+ echo 'You appear to have a working bash. Good.'
223+@@ -311,33 +263,6 @@ sparc*)
224+ ;;
225+ esac
226+227+-# SuSE8.2 has /usr/lib/libndbm* which are ld scripts rather than
228+-# true libraries. The scripts cause binding against static
229+-# version of -lgdbm which is a bad idea. So if we have 'nm'
230+-# make sure it can read the file
231+-# NI-S 2003/08/07
232+-case "$nm" in
233+- '') ;;
234+- *)
235+- for p in $plibpth
236+- do
237+- if $test -r $p/libndbm.so; then
238+- if $nm $p/libndbm.so >/dev/null 2>&1 ; then
239+- echo 'Your shared -lndbm seems to be a real library.'
240+- _libndbm_real=1
241+- break
242+- fi
243+- fi
244+- done
245+- if $test "X$_libndbm_real" = X; then
246+- echo 'Your shared -lndbm is not a real library.'
247+- set `echo X "$libswanted "| sed -e 's/ ndbm / /'`
248+- shift
249+- libswanted="$*"
250+- fi
251+- ;;
252+-esac
253+-
254+ # Linux on Synology.
255+ if [ -f /etc/synoinfo.conf -a -d /usr/syno ]; then
256+ # Tested on Synology DS213 and DS413
···1+echo "Sourcing setuptools-rust-hook"
2+3+setuptoolsRustSetup() {
4+ # This can work only if rustPlatform.cargoSetupHook is also included
5+ if ! command -v cargoSetupPostPatchHook >/dev/null; then
6+ echo "ERROR: setuptools-rust has to be used alongside with rustPlatform.cargoSetupHook!"
7+ exit 1
8+ fi
9+10+ export PYO3_CROSS_LIB_DIR="@pyLibDir@"
11+ export CARGO_BUILD_TARGET=@cargoBuildTarget@
12+ # TODO theoretically setting linker should not be required because it is
13+ # already set in pkgs/build-support/rust/hooks/default.nix but build fails
14+ # on missing linker without this.
15+ export CARGO_TARGET_@cargoLinkerVar@_LINKER=@targetLinker@
16+}
17+18+preConfigureHooks+=(setuptoolsRustSetup)
···38 mv pip* pip
39 mv setuptools* setuptools
40 mv wheel* wheel
41- # Set up PYTHONPATH. The above folders need to be on PYTHONPATH
42- # $out is where we are installing to and takes precedence
43- export PYTHONPATH="$out/${python.sitePackages}:$(pwd)/pip/src:$(pwd)/setuptools:$(pwd)/setuptools/pkg_resources:$(pwd)/wheel:$PYTHONPATH"
04445 echo "Building setuptools wheel..."
46 pushd setuptools
···38 mv pip* pip
39 mv setuptools* setuptools
40 mv wheel* wheel
41+ # Set up PYTHONPATH:
42+ # - pip and setuptools need to be in PYTHONPATH to install setuptools, wheel, and pip.
43+ # - $out is where we are installing to and takes precedence, and is where wheel will end so we can install pip.
44+ export PYTHONPATH="$out/${python.sitePackages}:$(pwd)/pip/src:$(pwd)/setuptools:$(pwd)/setuptools/pkg_resources:$PYTHONPATH"
4546 echo "Building setuptools wheel..."
47 pushd setuptools
+6-5
pkgs/development/python-modules/boto3/default.nix
···1011buildPythonPackage rec {
12 pname = "boto3";
13- version = "1.26.79"; # N.B: if you change this, change botocore and awscli to a matching version
14 format = "pyproject";
1516 src = fetchFromGitHub {
17 owner = "boto";
18 repo = pname;
19 rev = version;
20- hash = "sha256-9Xsng4xZ+IGNZ3ViYVrOyKZdRH6QPSjZALj9Q3HECBU=";
21 };
22000023 propagatedBuildInputs = [
24 botocore
25 jmespath
26 s3transfer
27- setuptools
28 ];
29-30- doCheck = true;
3132 nativeCheckInputs = [
33 pytestCheckHook
···1011buildPythonPackage rec {
12 pname = "boto3";
13+ version = "1.28.9"; # N.B: if you change this, change botocore and awscli to a matching version
14 format = "pyproject";
1516 src = fetchFromGitHub {
17 owner = "boto";
18 repo = pname;
19 rev = version;
20+ hash = "sha256-NkNHA20yn1Q7uoq/EL1Wn8F1fpi1waQujutGIKsnxlI=";
21 };
2223+ nativeBuildInputs = [
24+ setuptools
25+ ];
26+27 propagatedBuildInputs = [
28 botocore
29 jmespath
30 s3transfer
031 ];
003233 nativeCheckInputs = [
34 pytestCheckHook
···4748 DJANGO_SETTINGS_MODULE = "tests.settings";
4950+ # xdist is disabled right now because it can cause race conditions on high core machines
51+ # https://github.com/jazzband/django-oauth-toolkit/issues/1300
52 nativeCheckInputs = [
53 djangorestframework
54 pytest-django
55+ # pytest-xdist
56 pytest-mock
57 pytestCheckHook
58 ];
···1{ lib
2, stdenv
3+, fetchFromGitHub
4, buildPythonPackage
5, python
6, llvm
···1213buildPythonPackage rec {
14 pname = "llvmlite";
15+ # The main dependency of llvmlite is numba, which we currently package an
16+ # untagged version of it (for numpy>1.25 support). That numba version
17+ # requires at least this version of llvmlite (also not yet officially
18+ # released, but at least tagged).
19+ version = "0.41.0dev0";
2021 disabled = isPyPy || !isPy3k;
2223+ src = fetchFromGitHub {
24+ owner = "numba";
25+ repo = "llvmlite";
26+ rev = "v${version}";
27+ hash = "sha256-fsH+rqouweNENU+YlWr7m0bC0YdreQLNp1n2rwrOiFw=";
28 };
2930 nativeBuildInputs = [ llvm ];
···1+# Add all of mesonFlags to -Csetup-args for pypa builds
2+for f in $mesonFlags; do
3+ pypaBuildFlags+=" -Csetup-args=$f"
4+ # This requires pip>23.0.1, see: https://meson-python.readthedocs.io/en/latest/how-to-guides/config-settings.html
5+ pipBuildFlags+=" --config-settings=setup-args=$f"
6+done
···2, stdenv
3, pythonAtLeast
4, pythonOlder
5+, fetchFromGitHub
6, python
7, buildPythonPackage
8, setuptools
···27let
28 inherit (cudaPackages) cudatoolkit;
29in buildPythonPackage rec {
30+ # Using an untagged version, with numpy 1.25 support
31+ version = "unstable-2023-08-02";
32 pname = "numba";
33 format = "setuptools";
34 disabled = pythonOlder "3.6" || pythonAtLeast "3.11";
3536+ src = fetchFromGitHub {
37+ owner = "numba";
38+ repo = "numba";
39+ rev = "fcf94205335dcc6135d2e19c07bbef968d13610d";
40+ # Upstream uses .gitattributes to inject information about the revision
41+ # hash and the refname into `numba/_version.py`, see:
42+ #
43+ # - https://git-scm.com/docs/gitattributes#_export_subst and
44+ # - https://github.com/numba/numba/blame/5ef7c86f76a6e8cc90e9486487294e0c34024797/numba/_version.py#L25-L31
45+ #
46+ # Hence this hash may change if GitHub / Git will change it's behavior.
47+ # Hopefully this will not happen until the next release. We are fairly sure
48+ # that upstream relies on those strings to be valid, that's why we don't
49+ # use `forceFetchGit = true;`.` If in the future we'll observe the hash
50+ # changes too often, we can always use forceFetchGit, and inject the
51+ # relevant strings ourselves, using `sed` commands, in extraPostFetch.
52+ hash = "sha256-Wm1sV4uS/Xkz1BkT2xNmwgBZS0X8YziC6jlbfolXGB8=";
53 };
0000000054 env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-I${lib.getDev libcxx}/include/c++/v1";
5556 nativeBuildInputs = [
···70 cudatoolkit.lib
71 ];
7273+ patches = lib.optionals cudaSupport [
000000000074 (substituteAll {
75 src = ./cuda_path.patch;
76 cuda_toolkit_path = cudatoolkit;
+15-24
pkgs/development/python-modules/numpy/default.nix
···39 };
40 };
41 };
42-in buildPythonPackage (rec {
43 pname = "numpy";
44- version = "1.24.2";
45 format = "setuptools";
46 disabled = pythonOlder "3.7";
4748 src = fetchPypi {
49 inherit pname version;
50 extension = "tar.gz";
51- hash = "sha256-ADqfUw6IDLLNF3y6GvciC5qkLe+cSvwqL8Pua+frKyI=";
52 };
5354- patches = lib.optionals python.hasDistutilsCxxPatch [
55- # We patch cpython/distutils to fix https://bugs.python.org/issue1222585
56- # Patching of numpy.distutils is needed to prevent it from undoing the
57- # patch to distutils.
58- ./numpy-distutils-C++.patch
59- ]
60- ++ lib.optionals stdenv.cc.isClang [
61 # f2py.f90mod_rules generates code with invalid function pointer conversions, which are
62 # clang 16 makes an error by default.
63 (fetchpatch {
64 url = "https://github.com/numpy/numpy/commit/609fee4324f3521d81a3454f5fcc33abb0d3761e.patch";
65 hash = "sha256-6Dbmf/RWvQJPTIjvchVaywHGcKCsgap/0wAp5WswuCo=";
66 })
67- ]
68- ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
69- # Backport from 1.25. `platform.machine` returns `arm64` on aarch64-darwin, which causes
70- # differing results between `_selected_real_kind_func` and Fortran’s `selected_real_kind`.
71- (fetchpatch {
72- url = "https://github.com/numpy/numpy/commit/afcedf4b63f4a94187e6995c2adea0da3bb18e83.patch";
73- hash = "sha256-cxBoimX5a9wC2qUIGAo5o/M2E9+eV63bV2/wLmfDYKg=";
74- })
75- ]
76- ++ lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [
77 # Disable `numpy/core/tests/test_umath.py::TestComplexFunctions::test_loss_of_precision[complex256]`
78 # on x86_64-darwin because it fails under Rosetta 2 due to issues with trig functions and
79 # 80-bit long double complex numbers.
80 ./disable-failing-long-double-test-Rosetta-2.patch
00000081 ];
8283 postPatch = ''
···9091 nativeBuildInputs = [ gfortran cython ];
92 buildInputs = [ blas lapack ];
0009394 # we default openblas to build with 64 threads
95 # if a machine has more than 64 threads, it will segfault
···137 license = lib.licenses.bsd3;
138 maintainers = with lib.maintainers; [ fridh ];
139 };
140-} // lib.optionalAttrs stdenv.cc.isClang {
141- # Causes `error: argument unused during compilation: '-fno-strict-overflow'` due to `-Werror`.
142- hardeningDisable = [ "strictoverflow" ];
143-})
···39 };
40 };
41 };
42+in buildPythonPackage rec {
43 pname = "numpy";
44+ version = "1.25.1";
45 format = "setuptools";
46 disabled = pythonOlder "3.7";
4748 src = fetchPypi {
49 inherit pname version;
50 extension = "tar.gz";
51+ hash = "sha256-mjqfOmFIDMCGEXtCaovYaGnCE/xAcuYG8BxOS2brkr8=";
52 };
5354+ patches = [
00000055 # f2py.f90mod_rules generates code with invalid function pointer conversions, which are
56 # clang 16 makes an error by default.
57 (fetchpatch {
58 url = "https://github.com/numpy/numpy/commit/609fee4324f3521d81a3454f5fcc33abb0d3761e.patch";
59 hash = "sha256-6Dbmf/RWvQJPTIjvchVaywHGcKCsgap/0wAp5WswuCo=";
60 })
61+00000000062 # Disable `numpy/core/tests/test_umath.py::TestComplexFunctions::test_loss_of_precision[complex256]`
63 # on x86_64-darwin because it fails under Rosetta 2 due to issues with trig functions and
64 # 80-bit long double complex numbers.
65 ./disable-failing-long-double-test-Rosetta-2.patch
66+ ]
67+ # We patch cpython/distutils to fix https://bugs.python.org/issue1222585
68+ # Patching of numpy.distutils is needed to prevent it from undoing the
69+ # patch to distutils.
70+ ++ lib.optionals python.hasDistutilsCxxPatch [
71+ ./numpy-distutils-C++.patch
72 ];
7374 postPatch = ''
···8182 nativeBuildInputs = [ gfortran cython ];
83 buildInputs = [ blas lapack ];
84+85+ # Causes `error: argument unused during compilation: '-fno-strict-overflow'` due to `-Werror`.
86+ hardeningDisable = lib.optionals stdenv.cc.isClang [ "strictoverflow" ];
8788 # we default openblas to build with 64 threads
89 # if a machine has more than 64 threads, it will segfault
···131 license = lib.licenses.bsd3;
132 maintainers = with lib.maintainers; [ fridh ];
133 };
134+}
000
···38 mv pip* pip
39 mv setuptools* setuptools
40 mv wheel* wheel
41- # Set up PYTHONPATH. The above folders need to be on PYTHONPATH
42- # $out is where we are installing to and takes precedence
43- export PYTHONPATH="$out/${python.sitePackages}:$(pwd)/pip/src:$(pwd)/setuptools:$(pwd)/setuptools/pkg_resources:$(pwd)/wheel:$PYTHONPATH"
04445 echo "Building setuptools wheel..."
46 pushd setuptools
···38 mv pip* pip
39 mv setuptools* setuptools
40 mv wheel* wheel
41+ # Set up PYTHONPATH:
42+ # - pip and setuptools need to be in PYTHONPATH to install setuptools, wheel, and pip.
43+ # - $out is where we are installing to and takes precedence, and is where wheel will end so we can install pip.
44+ export PYTHONPATH="$out/${python.sitePackages}:$(pwd)/pip/src:$(pwd)/setuptools:$(pwd)/setuptools/pkg_resources:$PYTHONPATH"
4546 echo "Building setuptools wheel..."
47 pushd setuptools
···1617stdenv.mkDerivation rec {
18 pname = "kbd";
19- version = "2.5.1";
2021 src = fetchurl {
22 url = "mirror://kernel/linux/utils/kbd/${pname}-${version}.tar.xz";
23- sha256 = "sha256-zN9FI4emOAlz0pJzY+nLuTn6IGiRWm+Tf/nSRSICRoM=";
24 };
2526 # vlock is moved into its own output, since it depends on pam. This
···1617stdenv.mkDerivation rec {
18 pname = "kbd";
19+ version = "2.6.1";
2021 src = fetchurl {
22 url = "mirror://kernel/linux/utils/kbd/${pname}-${version}.tar.xz";
23+ sha256 = "sha256-LrbGyXK+lYm6tzMnW/AgvrX2RNX5Q5c3kg5wGvbPNIU=";
24 };
2526 # vlock is moved into its own output, since it depends on pam. This
+4-1
pkgs/os-specific/linux/libsmbios/default.nix
···35 cp -a out/public-include/smbios_c $out/include/
36 '';
3738- preFixup = ''rm -rf "$(pwd)" ''; # Hack to avoid TMPDIR in RPATHs
0003940 meta = with lib; {
41 homepage = "https://github.com/dell/libsmbios";
···35 cp -a out/public-include/smbios_c $out/include/
36 '';
3738+ # remove forbidden reference to $TMPDIR
39+ preFixup = ''
40+ patchelf --shrink-rpath --allowed-rpath-prefixes "/nix/store" "$out/sbin/smbios-sys-info-lite"
41+ '';
4243 meta = with lib; {
44 homepage = "https://github.com/dell/libsmbios";
+4-1
pkgs/os-specific/linux/lm-sensors/default.nix
···4849 # Making regexp to patch-out installing of .so symlinks from Makefile is
50 # complicated, it is easier to remove them post-install.
51- postInstall = lib.optionalString stdenv.hostPlatform.isStatic ''
00052 rm $out/lib/*.so*
53 '';
54
···4849 # Making regexp to patch-out installing of .so symlinks from Makefile is
50 # complicated, it is easier to remove them post-install.
51+ postInstall = ''
52+ mkdir -p $out/share/doc/${pname}
53+ cp -r configs doc/* $out/share/doc/${pname}
54+ '' + lib.optionalString stdenv.hostPlatform.isStatic ''
55 rm $out/lib/*.so*
56 '';
57
···3031 makeWrapper ${jdk11}/bin/java $out/bin/janusgraph-server \
32 --add-flags "-classpath $classpath org.janusgraph.graphdb.server.JanusGraphServer"
000033 '';
3435 meta = with lib; {
···3031 makeWrapper ${jdk11}/bin/java $out/bin/janusgraph-server \
32 --add-flags "-classpath $classpath org.janusgraph.graphdb.server.JanusGraphServer"
33+34+ # temporary workaround for
35+ # https://github.com/NixOS/nixpkgs/pull/244400#issuecomment-1667330430
36+ cd "$TMPDIR"
37 '';
3839 meta = with lib; {
+6-3
pkgs/servers/openafs/1.8/default.nix
···117 cp -r doc/doxygen/output/html $devdoc/share/devhelp/openafs/doxygen
118 '';
119120- # Avoid references to $TMPDIR by removing it and let patchelf cleanup the
121- # binaries.
122 preFixup = ''
123- rm -rf "$(pwd)" && mkdir "$(pwd)"
0000124 '';
125126 meta = with lib; {
···117 cp -r doc/doxygen/output/html $devdoc/share/devhelp/openafs/doxygen
118 '';
119120+ # remove forbidden references to $TMPDIR
0121 preFixup = ''
122+ for f in "$out"/bin/*; do
123+ if isELF "$f"; then
124+ patchelf --shrink-rpath --allowed-rpath-prefixes "$NIX_STORE" "$f"
125+ fi
126+ done
127 '';
128129 meta = with lib; {
···15941595 if [ "$curPhase" = unpackPhase ]; then
1596 # make sure we can cd into the directory
1597- [ -z "${sourceRoot}" ] || chmod +x "${sourceRoot}"
15981599 cd "${sourceRoot:-.}"
1600 fi
···15941595 if [ "$curPhase" = unpackPhase ]; then
1596 # make sure we can cd into the directory
1597+ [ -n "${sourceRoot:-}" ] && chmod +x "${sourceRoot}"
15981599 cd "${sourceRoot:-.}"
1600 fi
···1-{ lib, stdenv, fetchurl, autoreconfHook, acl }:
23# Note: this package is used for bootstrapping fetchurl, and thus
4# cannot use fetchpatch! All mutable patches (generated by GitHub or
···78stdenv.mkDerivation rec {
9 pname = "gnutar";
10- version = "1.34";
1112 src = fetchurl {
13 url = "mirror://gnu/tar/tar-${version}.tar.xz";
14- sha256 = "sha256-Y769JoecXh7qQ1Lw0DyZH5Zq6z3es8dEXJAlaNVBHSg=";
15 };
1617 # avoid retaining reference to CF during stdenv bootstrap
···31 outputs = [ "out" "info" ];
3233 nativeBuildInputs = lib.optional stdenv.isDarwin autoreconfHook;
34- buildInputs = lib.optional stdenv.isLinux acl;
000003536 # May have some issues with root compilation because the bootstrap tool
37 # cannot be used as a login shell for now.
···1+{ lib, stdenv, fetchurl, autoreconfHook, acl, libintl }:
23# Note: this package is used for bootstrapping fetchurl, and thus
4# cannot use fetchpatch! All mutable patches (generated by GitHub or
···78stdenv.mkDerivation rec {
9 pname = "gnutar";
10+ version = "1.35";
1112 src = fetchurl {
13 url = "mirror://gnu/tar/tar-${version}.tar.xz";
14+ sha256 = "sha256-TWL/NzQux67XSFNTI5MMfPlKz3HDWRiCsmp+pQ8+3BY=";
15 };
1617 # avoid retaining reference to CF during stdenv bootstrap
···31 outputs = [ "out" "info" ];
3233 nativeBuildInputs = lib.optional stdenv.isDarwin autoreconfHook;
34+ # Add libintl on Darwin specifically as it fails to link (or skip)
35+ # NLS on it's own:
36+ # "_libintl_textdomain", referenced from:
37+ # _main in tar.o
38+ # ld: symbol(s) not found for architecture x86_64
39+ buildInputs = lib.optional stdenv.isLinux acl ++ lib.optional stdenv.isDarwin libintl;
4041 # May have some issues with root compilation because the bootstrap tool
42 # cannot be used as a login shell for now.
···9. char \' \N'39'
10. \}
11.
12-. \" Shut off SGR by default (groff colors)
13-. \" Require GROFF_SGR envvar defined to turn it on
14-. if '\V[GROFF_SGR]'' \
15-. output x X tty: sgr 0
16-.\}
17-.
18.ds doc-default-operating-system Nixpkgs
19.ds doc-volume-operating-system Nixpkgs
···210 mrkd = throw "mrkd has been promoted to a top-level attribute"; # added 2023-08-01
211 mutmut = throw "mutmut has been promoted to a top-level attribute"; # added 2022-10-02
212 net2grid = gridnet; # add 2022-04-22
0213 nose-cover3 = throw "nose-cover3 has been removed, it was using setuptools 2to3 translation feature, which has been removed in setuptools 58"; # added 2022-02-16
214 nose_progressive = throw "nose_progressive has been removed, it was using setuptools 2to3 translation feature, which has been removed in setuptools 58"; #added 2023-02-21
215 notifymuch = throw "notifymuch has been promoted to a top-level attribute"; # added 2022-10-02
···210 mrkd = throw "mrkd has been promoted to a top-level attribute"; # added 2023-08-01
211 mutmut = throw "mutmut has been promoted to a top-level attribute"; # added 2022-10-02
212 net2grid = gridnet; # add 2022-04-22
213+ nghttp2 = throw "in 1.52.0 removed deprecated python bindings."; # added 2023-06-08
214 nose-cover3 = throw "nose-cover3 has been removed, it was using setuptools 2to3 translation feature, which has been removed in setuptools 58"; # added 2022-02-16
215 nose_progressive = throw "nose_progressive has been removed, it was using setuptools 2to3 translation feature, which has been removed in setuptools 58"; #added 2023-02-21
216 notifymuch = throw "notifymuch has been promoted to a top-level attribute"; # added 2022-10-02