Merge branch 'staging-next'

This commit is contained in:
Vladimír Čunát 2020-06-10 16:13:48 +02:00
commit a5f5d020c6
No known key found for this signature in database
GPG Key ID: E747DF1F9575A3AA
132 changed files with 1132 additions and 567 deletions

View File

@ -8,10 +8,10 @@ with lib;
option = x: option = x:
x // { optional = true; }; x // { optional = true; };
yes = { tristate = "y"; }; yes = { tristate = "y"; optional = false; };
no = { tristate = "n"; }; no = { tristate = "n"; optional = false; };
module = { tristate = "m"; }; module = { tristate = "m"; optional = false; };
freeform = x: { freeform = x; }; freeform = x: { freeform = x; optional = false; };
/* /*
Common patterns/legacy used in common-config/hardened/config.nix Common patterns/legacy used in common-config/hardened/config.nix

View File

@ -491,6 +491,17 @@ systemd.services.nginx.serviceConfig.ReadWritePaths = [ "/var/www" ];
</para> </para>
</listitem> </listitem>
<listitem> <listitem>
<para>
The cc- and binutils-wrapper's "infix salt" and <literal>_BUILD_</literal> and <literal>_TARGET_</literal> user infixes have been replaced with with a "suffix salt" and suffixes and <literal>_FOR_BUILD</literal> and <literal>_FOR_TARGET</literal>.
This matches the autotools convention for env vars which standard for these things, making interfacing with other tools easier.
</para>
</listitem>
<listitem>
<para>
Additional Git documentation (HTML and text files) is now available via the <literal>git-doc</literal> package.
</para>
</listitem>
<listitem>
<para> <para>
Default algorithm for ZRAM swap was changed to <literal>zstd</literal>. Default algorithm for ZRAM swap was changed to <literal>zstd</literal>.
</para> </para>

View File

@ -22,7 +22,7 @@ let
mergeFalseByDefault = locs: defs: mergeFalseByDefault = locs: defs:
if defs == [] then abort "This case should never happen." if defs == [] then abort "This case should never happen."
else if any (x: x == false) defs then false else if any (x: x == false) (getValues defs) then false
else true; else true;
kernelItem = types.submodule { kernelItem = types.submodule {
@ -55,6 +55,7 @@ let
default = false; default = false;
description = '' description = ''
Wether option should generate a failure when unused. Wether option should generate a failure when unused.
Upon merging values, mandatory wins over optional.
''; '';
}; };
}; };
@ -121,7 +122,7 @@ in
type = types.attrsOf kernelItem; type = types.attrsOf kernelItem;
example = literalExample '' with lib.kernel; { example = literalExample '' with lib.kernel; {
"9P_NET" = yes; "9P_NET" = yes;
USB = optional yes; USB = option yes;
MMC_BLOCK_MINORS = freeform "32"; MMC_BLOCK_MINORS = freeform "32";
}''; }'';
description = '' description = ''

View File

@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
enableParallelBuilding = true; enableParallelBuilding = true;
makeFlags = [ "PKG_CONFIG=${buildPackages.pkgconfig}/bin/pkg-config" ]; makeFlags = [ "PKG_CONFIG=${buildPackages.pkgconfig}/bin/${buildPackages.pkgconfig.targetPrefix}pkg-config" ];
installPhase = '' installPhase = ''
install -m 555 -Dt $out/bin mg install -m 555 -Dt $out/bin mg

View File

@ -1,12 +1,12 @@
{ lib, fetchFromGitHub }: { lib, fetchFromGitHub }:
rec { rec {
version = "8.2.0510"; version = "8.2.0701";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "vim"; owner = "vim";
repo = "vim"; repo = "vim";
rev = "v${version}"; rev = "v${version}";
sha256 = "16ggwf238pzzkn3ng6n09qz9cgdzha9vc0ghlcxhwilnjh12l7p9"; sha256 = "1cbh2nhbvhp4kclc9fd8gqij2vi11c5zwdwn1nzg805k06hwmsrp";
}; };
enableParallelBuilding = true; enableParallelBuilding = true;

View File

@ -71,7 +71,7 @@ stdenv.mkDerivation {
moveToOutput "lib/ImageMagick-*/config-Q16HDRI" "$dev" # includes configure params moveToOutput "lib/ImageMagick-*/config-Q16HDRI" "$dev" # includes configure params
for file in "$dev"/bin/*-config; do for file in "$dev"/bin/*-config; do
substituteInPlace "$file" --replace pkg-config \ substituteInPlace "$file" --replace pkg-config \
"PKG_CONFIG_PATH='$dev/lib/pkgconfig' '${pkgconfig}/bin/pkg-config'" "PKG_CONFIG_PATH='$dev/lib/pkgconfig' '${pkgconfig}/bin/${pkgconfig.targetPrefix}pkg-config'"
done done
'' + lib.optionalString (ghostscript != null) '' '' + lib.optionalString (ghostscript != null) ''
for la in $out/lib/*.la; do for la in $out/lib/*.la; do

View File

@ -85,9 +85,9 @@ stdenv.mkDerivation {
moveToOutput "lib/ImageMagick-*/config-Q16" "$dev" # includes configure params moveToOutput "lib/ImageMagick-*/config-Q16" "$dev" # includes configure params
for file in "$dev"/bin/*-config; do for file in "$dev"/bin/*-config; do
substituteInPlace "$file" --replace "${pkgconfig}/bin/pkg-config -config" \ substituteInPlace "$file" --replace "${pkgconfig}/bin/pkg-config -config" \
${pkgconfig}/bin/pkg-config ${pkgconfig}/bin/${pkgconfig.targetPrefix}pkg-config
substituteInPlace "$file" --replace ${pkgconfig}/bin/pkg-config \ substituteInPlace "$file" --replace ${pkgconfig}/bin/pkg-config \
"PKG_CONFIG_PATH='$dev/lib/pkgconfig' '${pkgconfig}/bin/pkg-config'" "PKG_CONFIG_PATH='$dev/lib/pkgconfig' '${pkgconfig}/bin/${pkgconfig.targetPrefix}pkg-config'"
done done
'' + lib.optionalString (ghostscript != null) '' '' + lib.optionalString (ghostscript != null) ''
for la in $out/lib/*.la; do for la in $out/lib/*.la; do

View File

@ -15,7 +15,7 @@ stdenv.mkDerivation {
sha256 = "1f73wvqqvj5pr3fvb7jjc4bi1iwgkkknz24k8n69mdb75jnfjipp"; sha256 = "1f73wvqqvj5pr3fvb7jjc4bi1iwgkkknz24k8n69mdb75jnfjipp";
}; };
makeFlags = [ "PKGCONFIG=${pkgconfig}/bin/pkg-config" "binary=stupidterm" ]; makeFlags = [ "PKGCONFIG=${pkgconfig}/bin/${pkgconfig.targetPrefix}pkg-config" "binary=stupidterm" ];
installPhase = '' installPhase = ''
install -D stupidterm $out/bin/stupidterm install -D stupidterm $out/bin/stupidterm

View File

@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ cmake perl ]; nativeBuildInputs = [ cmake perl ];
buildInputs = [ opencv3 gtest blas ] buildInputs = [ opencv3 gtest blas.provider ]
++ lib.optionals cudaSupport [ cudatoolkit nvidia_x11 ] ++ lib.optionals cudaSupport [ cudatoolkit nvidia_x11 ]
++ lib.optional cudnnSupport cudnn; ++ lib.optional cudnnSupport cudnn;

View File

@ -82,6 +82,14 @@ let
inherit (darwin.apple_sdk.frameworks) CoreFoundation Security; inherit (darwin.apple_sdk.frameworks) CoreFoundation Security;
}; };
git-doc = lib.addMetaAttrs {
description = "Additional documentation for Git";
longDescription = ''
This package contains additional documentation (HTML and text files) that
is referenced in the man pages of Git.
'';
} gitFull.doc;
git-extras = callPackage ./git-extras { }; git-extras = callPackage ./git-extras { };
git-fame = callPackage ./git-fame {}; git-fame = callPackage ./git-fame {};

View File

@ -36,7 +36,7 @@ stdenv.mkDerivation {
sha256 = "0j685w6pzkn926z5nf5r8fij4ziipvw4c9yb0wc577nzf4j16rbd"; sha256 = "0j685w6pzkn926z5nf5r8fij4ziipvw4c9yb0wc577nzf4j16rbd";
}; };
outputs = [ "out" ]; outputs = [ "out" ] ++ stdenv.lib.optional withManual "doc";
hardeningDisable = [ "format" ]; hardeningDisable = [ "format" ];
@ -234,7 +234,7 @@ stdenv.mkDerivation {
'') '')
+ stdenv.lib.optionalString withManual ''# Install man pages and Info manual + stdenv.lib.optionalString withManual ''# Install man pages and Info manual
make -j $NIX_BUILD_CORES -l $NIX_BUILD_CORES PERL_PATH="${buildPackages.perl}/bin/perl" cmd-list.made install install-info \ make -j $NIX_BUILD_CORES -l $NIX_BUILD_CORES PERL_PATH="${buildPackages.perl}/bin/perl" cmd-list.made install install-html install-info \
-C Documentation '' -C Documentation ''
+ (if guiSupport then '' + (if guiSupport then ''

View File

@ -182,7 +182,7 @@ stdenv.mkDerivation rec {
preConfigure = '' preConfigure = ''
configureFlagsArray+=( configureFlagsArray+=(
"--cc=$CC" "--cc=$CC"
"--host-cc=$BUILD_CC" "--host-cc=$CC_FOR_BUILD"
"--as=$AS" "--as=$AS"
"--nm=$NM" "--nm=$NM"
"--ar=$AR" "--ar=$AR"

View File

@ -35,15 +35,15 @@ let
in in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
version = "4.2.0"; version = "5.0.0";
pname = "qemu" pname = "qemu"
+ stdenv.lib.optionalString xenSupport "-xen" + stdenv.lib.optionalString xenSupport "-xen"
+ stdenv.lib.optionalString hostCpuOnly "-host-cpu-only" + stdenv.lib.optionalString hostCpuOnly "-host-cpu-only"
+ stdenv.lib.optionalString nixosTestRunner "-for-vm-tests"; + stdenv.lib.optionalString nixosTestRunner "-for-vm-tests";
src = fetchurl { src = fetchurl {
url = "https://wiki.qemu.org/download/qemu-${version}.tar.bz2"; url= "https://download.qemu.org/qemu-${version}.tar.xz";
sha256 = "1gczv8hn3wqci86css3mhzrppp3z8vppxw25l08j589k6bvz7x1w"; sha256 = "1dlcwyshdp94fwd30pddxf9bn2q8dfw5jsvry2gvdj551wmaj4rg";
}; };
nativeBuildInputs = [ python python.pkgs.sphinx pkgconfig flex bison ] nativeBuildInputs = [ python python.pkgs.sphinx pkgconfig flex bison ]
@ -78,44 +78,6 @@ stdenv.mkDerivation rec {
./no-etc-install.patch ./no-etc-install.patch
./fix-qemu-ga.patch ./fix-qemu-ga.patch
./9p-ignore-noatime.patch ./9p-ignore-noatime.patch
(fetchpatch {
name = "CVE-2019-15890.patch";
url = "https://git.qemu.org/?p=libslirp.git;a=patch;h=c59279437eda91841b9d26079c70b8a540d41204";
sha256 = "1q2rc67mfdz034mk81z9bw105x9zad7n954sy3kq068b1svrf7iy";
stripLen = 1;
extraPrefix = "slirp/";
})
# patches listed at: https://nvd.nist.gov/vuln/detail/CVE-2020-7039
(fetchpatch {
name = "CVE-2020-7039-1.patch";
url = "https://git.qemu.org/?p=libslirp.git;a=patch;h=2655fffed7a9e765bcb4701dd876e9dab975f289";
sha256 = "1jh0k3lg3553c2x1kq1kl3967jabhba5gm584wjpmr5mjqk3lnz1";
stripLen = 1;
extraPrefix = "slirp/";
excludes = ["slirp/CHANGELOG.md"];
})
(fetchpatch {
name = "CVE-2020-7039-2.patch";
url = "https://git.qemu.org/?p=libslirp.git;a=patch;h=82ebe9c370a0e2970fb5695aa19aa5214a6a1c80";
sha256 = "08ccxcmrhzknnzd1a1q2brszv3a7h02n26r73kpli10b0hn12r2l";
stripLen = 1;
extraPrefix = "slirp/";
})
(fetchpatch {
name = "CVE-2020-7039-3.patch";
url = "https://git.qemu.org/?p=libslirp.git;a=patch;h=ce131029d6d4a405cb7d3ac6716d03e58fb4a5d9";
sha256 = "18ypj9an2jmsmdn58853rbz42r10587h7cz5fdws2x4635778ibd";
stripLen = 1;
extraPrefix = "slirp/";
})
# patches listed at: https://nvd.nist.gov/vuln/detail/CVE-2020-7211
(fetchpatch {
name = "CVE-2020-7211.patch";
url = "https://git.qemu.org/?p=libslirp.git;a=patch;h=14ec36e107a8c9af7d0a80c3571fe39b291ff1d4";
sha256 = "1lc8zabqs580iqrsr5k7zwgkx6qjmja7apwfbc36lkvnrxwfzmrc";
stripLen = 1;
extraPrefix = "slirp/";
})
] ++ optional nixosTestRunner ./force-uid0-on-9p.patch ] ++ optional nixosTestRunner ./force-uid0-on-9p.patch
++ optionals stdenv.hostPlatform.isMusl [ ++ optionals stdenv.hostPlatform.isMusl [
(fetchpatch { (fetchpatch {
@ -146,6 +108,8 @@ stdenv.mkDerivation rec {
"--sysconfdir=/etc" "--sysconfdir=/etc"
"--localstatedir=/var" "--localstatedir=/var"
"--enable-docs" "--enable-docs"
"--enable-tools"
"--enable-guest-agent"
] ]
# disable sysctl check on darwin. # disable sysctl check on darwin.
++ optional stdenv.isDarwin "--cpu=x86_64" ++ optional stdenv.isDarwin "--cpu=x86_64"

View File

@ -1,22 +1,36 @@
diff --git a/qga/commands-posix.c b/qga/commands-posix.c diff -Naur a/qga/commands-posix.c b/qga/commands-posix.c
index 0dc219d..9d020d3 100644
--- a/qga/commands-posix.c --- a/qga/commands-posix.c
+++ b/qga/commands-posix.c +++ b/qga/commands-posix.c
@@ -102,6 +102,8 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp) @@ -109,6 +109,8 @@
reopen_fd_to_null(1); reopen_fd_to_null(1);
reopen_fd_to_null(2); reopen_fd_to_null(2);
+ execle("/run/current-system/sw/bin/shutdown", "shutdown", "-h", shutdown_flag, "+0", + execle("/run/current-system/sw/bin/shutdown", "shutdown", "-h", shutdown_flag, "+0",
+ "hypervisor initiated shutdown", (char*)NULL, environ); + "hypervisor initiated shutdown", (char*)NULL, environ);
execle("/sbin/shutdown", "shutdown", "-h", shutdown_flag, "+0", execle("/sbin/shutdown", "shutdown", "-h", shutdown_flag, "+0",
"hypervisor initiated shutdown", (char*)NULL, environ); "hypervisor initiated shutdown", (char*)NULL, environ);
_exit(EXIT_FAILURE); _exit(EXIT_FAILURE);
@@ -189,6 +191,8 @@ void qmp_guest_set_time(bool has_time, int64_t time_ns, Error **errp) @@ -157,11 +159,13 @@
pid_t pid;
Error *local_err = NULL;
struct timeval tv;
+ static const char hwclock_path_nix[] = "/run/current-system/sw/bin/hwclock";
static const char hwclock_path[] = "/sbin/hwclock";
static int hwclock_available = -1;
if (hwclock_available < 0) {
- hwclock_available = (access(hwclock_path, X_OK) == 0);
+ hwclock_available = (access(hwclock_path_nix, X_OK) == 0) ||
+ (access(hwclock_path, X_OK) == 0);
}
if (!hwclock_available) {
@@ -207,6 +211,8 @@
/* Use '/sbin/hwclock -w' to set RTC from the system time, /* Use '/sbin/hwclock -w' to set RTC from the system time,
* or '/sbin/hwclock -s' to set the system time from RTC. */ * or '/sbin/hwclock -s' to set the system time from RTC. */
+ execle("/run/current-system/sw/bin/hwclock", "hwclock", has_time ? "-w" : "-s", + execle(hwclock_path_nix, "hwclock", has_time ? "-w" : "-s",
+ NULL, environ); + NULL, environ);
execle("/sbin/hwclock", "hwclock", has_time ? "-w" : "-s", execle(hwclock_path, "hwclock", has_time ? "-w" : "-s",
NULL, environ); NULL, environ);
_exit(EXIT_FAILURE); _exit(EXIT_FAILURE);

View File

@ -1,32 +1,32 @@
# See cc-wrapper for comments. # See cc-wrapper for comments.
var_templates_list=( var_templates_list=(
NIX+IGNORE_LD_THROUGH_GCC NIX_IGNORE_LD_THROUGH_GCC
NIX+LDFLAGS NIX_LDFLAGS
NIX+LDFLAGS_BEFORE NIX_LDFLAGS_BEFORE
NIX+LDFLAGS_AFTER NIX_LDFLAGS_AFTER
NIX+LDFLAGS_HARDEN NIX_LDFLAGS_HARDEN
NIX+HARDENING_ENABLE NIX_HARDENING_ENABLE
) )
var_templates_bool=( var_templates_bool=(
NIX+SET_BUILD_ID NIX_SET_BUILD_ID
NIX+DONT_SET_RPATH NIX_DONT_SET_RPATH
) )
accumulateRoles accumulateRoles
for var in "${var_templates_list[@]}"; do for var in "${var_templates_list[@]}"; do
mangleVarList "$var" ${role_infixes[@]+"${role_infixes[@]}"} mangleVarList "$var" ${role_suffixes[@]+"${role_suffixes[@]}"}
done done
for var in "${var_templates_bool[@]}"; do for var in "${var_templates_bool[@]}"; do
mangleVarBool "$var" ${role_infixes[@]+"${role_infixes[@]}"} mangleVarBool "$var" ${role_suffixes[@]+"${role_suffixes[@]}"}
done done
if [ -e @out@/nix-support/libc-ldflags ]; then if [ -e @out@/nix-support/libc-ldflags ]; then
NIX_@infixSalt@_LDFLAGS+=" $(< @out@/nix-support/libc-ldflags)" NIX_LDFLAGS_@suffixSalt@+=" $(< @out@/nix-support/libc-ldflags)"
fi fi
if [ -e @out@/nix-support/libc-ldflags-before ]; then if [ -e @out@/nix-support/libc-ldflags-before ]; then
NIX_@infixSalt@_LDFLAGS_BEFORE="$(< @out@/nix-support/libc-ldflags-before) $NIX_@infixSalt@_LDFLAGS_BEFORE" NIX_LDFLAGS_BEFORE_@suffixSalt@="$(< @out@/nix-support/libc-ldflags-before) $NIX_LDFLAGS_BEFORE_@suffixSalt@"
fi fi
export NIX_BINTOOLS_WRAPPER_@infixSalt@_FLAGS_SET=1 export NIX_BINTOOLS_WRAPPER_FLAGS_SET_@suffixSalt@=1

View File

@ -5,7 +5,7 @@ declare -A hardeningEnableMap=()
# Intentionally word-split in case 'NIX_HARDENING_ENABLE' is defined in Nix. The # Intentionally word-split in case 'NIX_HARDENING_ENABLE' is defined in Nix. The
# array expansion also prevents undefined variables from causing trouble with # array expansion also prevents undefined variables from causing trouble with
# `set -u`. # `set -u`.
for flag in ${NIX_@infixSalt@_HARDENING_ENABLE-}; do for flag in ${NIX_HARDENING_ENABLE_@suffixSalt@-}; do
hardeningEnableMap["$flag"]=1 hardeningEnableMap["$flag"]=1
done done

View File

@ -45,7 +45,7 @@ let
coreutils_bin = if nativeTools then "" else getBin coreutils; coreutils_bin = if nativeTools then "" else getBin coreutils;
# See description in cc-wrapper. # See description in cc-wrapper.
infixSalt = replaceStrings ["-" "."] ["_" "_"] targetPlatform.config; suffixSalt = replaceStrings ["-" "."] ["_" "_"] targetPlatform.config;
# The dynamic linker has different names on different platforms. This is a # The dynamic linker has different names on different platforms. This is a
# shell glob that ought to match it. # shell glob that ought to match it.
@ -83,7 +83,7 @@ stdenv.mkDerivation {
shell = getBin shell + shell.shellPath or ""; shell = getBin shell + shell.shellPath or "";
gnugrep_bin = if nativeTools then "" else gnugrep; gnugrep_bin = if nativeTools then "" else gnugrep;
inherit targetPrefix infixSalt; inherit targetPrefix suffixSalt;
outputs = [ "out" ] ++ optionals propagateDoc ([ "man" ] ++ optional (bintools ? info) "info"); outputs = [ "out" ] ++ optionals propagateDoc ([ "man" ] ++ optional (bintools ? info) "info");
@ -95,9 +95,9 @@ stdenv.mkDerivation {
(mapc (mapc
(lambda (arg) (lambda (arg)
(when (file-directory-p (concat arg "/lib")) (when (file-directory-p (concat arg "/lib"))
(setenv "NIX_${infixSalt}_LDFLAGS" (concat (getenv "NIX_${infixSalt}_LDFLAGS") " -L" arg "/lib"))) (setenv "NIX_LDFLAGS_${suffixSalt}" (concat (getenv "NIX_LDFLAGS_${suffixSalt}") " -L" arg "/lib")))
(when (file-directory-p (concat arg "/lib64")) (when (file-directory-p (concat arg "/lib64"))
(setenv "NIX_${infixSalt}_LDFLAGS" (concat (getenv "NIX_${infixSalt}_LDFLAGS") " -L" arg "/lib64")))) (setenv "NIX_LDFLAGS_${suffixSalt}" (concat (getenv "NIX_LDFLAGS_${suffixSalt}") " -L" arg "/lib64"))))
'(${concatStringsSep " " (map (pkg: "\"${pkg}\"") pkgs)})) '(${concatStringsSep " " (map (pkg: "\"${pkg}\"") pkgs)}))
''; '';
}; };
@ -248,6 +248,11 @@ stdenv.mkDerivation {
printWords "''${ldflagsBefore[@]}" > $out/nix-support/libc-ldflags-before printWords "''${ldflagsBefore[@]}" > $out/nix-support/libc-ldflags-before
'') '')
+ optionalString stdenv.targetPlatform.isMacOS ''
# Ensure consistent LC_VERSION_MIN_MACOSX and remove LC_UUID.
echo "-macosx_version_min 10.12 -sdk_version 10.12 -no_uuid" >> $out/nix-support/libc-ldflags-before
''
+ optionalString (!nativeTools) '' + optionalString (!nativeTools) ''
## ##
## User env support ## User env support

View File

@ -16,7 +16,7 @@ fi
source @out@/nix-support/utils.bash source @out@/nix-support/utils.bash
if [ -z "${NIX_BINTOOLS_WRAPPER_@infixSalt@_FLAGS_SET:-}" ]; then if [ -z "${NIX_BINTOOLS_WRAPPER_FLAGS_SET_@suffixSalt@:-}" ]; then
source @out@/nix-support/add-flags.sh source @out@/nix-support/add-flags.sh
fi fi
@ -24,7 +24,7 @@ fi
# Optionally filter out paths not refering to the store. # Optionally filter out paths not refering to the store.
expandResponseParams "$@" expandResponseParams "$@"
if [[ "${NIX_ENFORCE_PURITY:-}" = 1 && -n "${NIX_STORE:-}" if [[ "${NIX_ENFORCE_PURITY:-}" = 1 && -n "${NIX_STORE:-}"
&& ( -z "$NIX_@infixSalt@_IGNORE_LD_THROUGH_GCC" || -z "${NIX_@infixSalt@_LDFLAGS_SET:-}" ) ]]; then && ( -z "$NIX_IGNORE_LD_THROUGH_GCC_@suffixSalt@" || -z "${NIX_LDFLAGS_SET_@suffixSalt@:-}" ) ]]; then
rest=() rest=()
nParams=${#params[@]} nParams=${#params[@]}
declare -i n=0 declare -i n=0
@ -60,12 +60,12 @@ source @out@/nix-support/add-hardening.sh
extraAfter=() extraAfter=()
extraBefore=(${hardeningLDFlags[@]+"${hardeningLDFlags[@]}"}) extraBefore=(${hardeningLDFlags[@]+"${hardeningLDFlags[@]}"})
if [ -z "${NIX_@infixSalt@_LDFLAGS_SET:-}" ]; then if [ -z "${NIX_LDFLAGS_SET_@suffixSalt@:-}" ]; then
extraAfter+=($NIX_@infixSalt@_LDFLAGS) extraAfter+=($NIX_LDFLAGS_@suffixSalt@)
extraBefore+=($NIX_@infixSalt@_LDFLAGS_BEFORE) extraBefore+=($NIX_LDFLAGS_BEFORE_@suffixSalt@)
fi fi
extraAfter+=($NIX_@infixSalt@_LDFLAGS_AFTER) extraAfter+=($NIX_LDFLAGS_AFTER_@suffixSalt@)
# Specify the target emulation if nothing is passed in ("-m" overrides this # Specify the target emulation if nothing is passed in ("-m" overrides this
# environment variable). Ensures we never blindly fallback on targeting the host # environment variable). Ensures we never blindly fallback on targeting the host
@ -84,8 +84,8 @@ declare -A libs
declare -i relocatable=0 link32=0 declare -i relocatable=0 link32=0
if if
[ "$NIX_@infixSalt@_DONT_SET_RPATH" != 1 ] \ [ "$NIX_DONT_SET_RPATH_@suffixSalt@" != 1 ] \
|| [ "$NIX_@infixSalt@_SET_BUILD_ID" = 1 ] \ || [ "$NIX_SET_BUILD_ID_@suffixSalt@" = 1 ] \
|| [ -e @out@/nix-support/dynamic-linker-m32 ] || [ -e @out@/nix-support/dynamic-linker-m32 ]
then then
prev= prev=
@ -144,7 +144,7 @@ if [ -e "@out@/nix-support/dynamic-linker-m32" ] && (( "$link32" )); then
fi fi
# Add all used dynamic libraries to the rpath. # Add all used dynamic libraries to the rpath.
if [ "$NIX_@infixSalt@_DONT_SET_RPATH" != 1 ]; then if [ "$NIX_DONT_SET_RPATH_@suffixSalt@" != 1 ]; then
# For each directory in the library search path (-L...), # For each directory in the library search path (-L...),
# see if it contains a dynamic library used by a -l... flag. If # see if it contains a dynamic library used by a -l... flag. If
# so, add the directory to the rpath. # so, add the directory to the rpath.
@ -186,7 +186,7 @@ fi
# Only add --build-id if this is a final link. FIXME: should build gcc # Only add --build-id if this is a final link. FIXME: should build gcc
# with --enable-linker-build-id instead? # with --enable-linker-build-id instead?
if [ "$NIX_@infixSalt@_SET_BUILD_ID" = 1 ] && ! (( "$relocatable" )); then if [ "$NIX_SET_BUILD_ID_@suffixSalt@" = 1 ] && ! (( "$relocatable" )); then
extraAfter+=(--build-id) extraAfter+=(--build-id)
fi fi

View File

@ -10,11 +10,11 @@
bintoolsWrapper_addLDVars () { bintoolsWrapper_addLDVars () {
# See ../setup-hooks/role.bash # See ../setup-hooks/role.bash
local role_post role_pre local role_post
getHostRoleEnvHook getHostRoleEnvHook
if [[ -d "$1/lib64" && ! -L "$1/lib64" ]]; then if [[ -d "$1/lib64" && ! -L "$1/lib64" ]]; then
export NIX_${role_pre}LDFLAGS+=" -L$1/lib64" export NIX_LDFLAGS${role_post}+=" -L$1/lib64"
fi fi
if [[ -d "$1/lib" ]]; then if [[ -d "$1/lib" ]]; then
@ -24,7 +24,7 @@ bintoolsWrapper_addLDVars () {
# directories and bloats the size of the environment variable space. # directories and bloats the size of the environment variable space.
local -a glob=( $1/lib/lib* ) local -a glob=( $1/lib/lib* )
if [ "${#glob[*]}" -gt 0 ]; then if [ "${#glob[*]}" -gt 0 ]; then
export NIX_${role_pre}LDFLAGS+=" -L$1/lib" export NIX_LDFLAGS${role_post}+=" -L$1/lib"
fi fi
fi fi
} }
@ -52,7 +52,7 @@ fi
# Export tool environment variables so various build systems use the right ones. # Export tool environment variables so various build systems use the right ones.
export NIX_${role_pre}BINTOOLS=@out@ export NIX_BINTOOLS${role_post}=@out@
for cmd in \ for cmd in \
ar as ld nm objcopy objdump readelf ranlib strip strings size windres ar as ld nm objcopy objdump readelf ranlib strip strings size windres
@ -60,7 +60,6 @@ do
if if
PATH=$_PATH type -p "@targetPrefix@${cmd}" > /dev/null PATH=$_PATH type -p "@targetPrefix@${cmd}" > /dev/null
then then
export "${role_pre}${cmd^^}=@targetPrefix@${cmd}";
export "${cmd^^}${role_post}=@targetPrefix@${cmd}"; export "${cmd^^}${role_post}=@targetPrefix@${cmd}";
fi fi
done done
@ -70,4 +69,4 @@ done
export NIX_HARDENING_ENABLE export NIX_HARDENING_ENABLE
# No local scope in sourced file # No local scope in sourced file
unset -v role_pre role_post cmd upper_case unset -v role_post cmd upper_case

View File

@ -58,7 +58,7 @@ let
# Force compilers and other tools to look in default search paths # Force compilers and other tools to look in default search paths
unset NIX_ENFORCE_PURITY unset NIX_ENFORCE_PURITY
export NIX_CC_WRAPPER_${stdenv.cc.infixSalt}_TARGET_HOST=1 export NIX_CC_WRAPPER_TARGET_HOST_${stdenv.cc.suffixSalt}=1
export NIX_CFLAGS_COMPILE='-idirafter /usr/include' export NIX_CFLAGS_COMPILE='-idirafter /usr/include'
export NIX_CFLAGS_LINK='-L/usr/lib -L/usr/lib32' export NIX_CFLAGS_LINK='-L/usr/lib -L/usr/lib32'
export NIX_LDFLAGS='-L/usr/lib -L/usr/lib32' export NIX_LDFLAGS='-L/usr/lib -L/usr/lib32'

View File

@ -5,15 +5,15 @@
# wrapped binary just inherit the work of the forker's wrapper script. # wrapped binary just inherit the work of the forker's wrapper script.
var_templates_list=( var_templates_list=(
NIX+CFLAGS_COMPILE NIX_CFLAGS_COMPILE
NIX+CFLAGS_COMPILE_BEFORE NIX_CFLAGS_COMPILE_BEFORE
NIX+CFLAGS_LINK NIX_CFLAGS_LINK
NIX+CXXSTDLIB_COMPILE NIX_CXXSTDLIB_COMPILE
NIX+CXXSTDLIB_LINK NIX_CXXSTDLIB_LINK
NIX+GNATFLAGS_COMPILE NIX_GNATFLAGS_COMPILE
) )
var_templates_bool=( var_templates_bool=(
NIX+ENFORCE_NO_NATIVE NIX_ENFORCE_NO_NATIVE
) )
accumulateRoles accumulateRoles
@ -21,37 +21,37 @@ accumulateRoles
# We need to mangle names for hygiene, but also take parameters/overrides # We need to mangle names for hygiene, but also take parameters/overrides
# from the environment. # from the environment.
for var in "${var_templates_list[@]}"; do for var in "${var_templates_list[@]}"; do
mangleVarList "$var" ${role_infixes[@]+"${role_infixes[@]}"} mangleVarList "$var" ${role_suffixes[@]+"${role_suffixes[@]}"}
done done
for var in "${var_templates_bool[@]}"; do for var in "${var_templates_bool[@]}"; do
mangleVarBool "$var" ${role_infixes[@]+"${role_infixes[@]}"} mangleVarBool "$var" ${role_suffixes[@]+"${role_suffixes[@]}"}
done done
# `-B@out@/bin' forces cc to use ld-wrapper.sh when calling ld. # `-B@out@/bin' forces cc to use ld-wrapper.sh when calling ld.
NIX_@infixSalt@_CFLAGS_COMPILE="-B@out@/bin/ $NIX_@infixSalt@_CFLAGS_COMPILE" NIX_CFLAGS_COMPILE_@suffixSalt@="-B@out@/bin/ $NIX_CFLAGS_COMPILE_@suffixSalt@"
# Export and assign separately in order that a failing $(..) will fail # Export and assign separately in order that a failing $(..) will fail
# the script. # the script.
if [ -e @out@/nix-support/libc-cflags ]; then if [ -e @out@/nix-support/libc-cflags ]; then
NIX_@infixSalt@_CFLAGS_COMPILE="$(< @out@/nix-support/libc-cflags) $NIX_@infixSalt@_CFLAGS_COMPILE" NIX_CFLAGS_COMPILE_@suffixSalt@="$(< @out@/nix-support/libc-cflags) $NIX_CFLAGS_COMPILE_@suffixSalt@"
fi fi
if [ -e @out@/nix-support/cc-cflags ]; then if [ -e @out@/nix-support/cc-cflags ]; then
NIX_@infixSalt@_CFLAGS_COMPILE="$(< @out@/nix-support/cc-cflags) $NIX_@infixSalt@_CFLAGS_COMPILE" NIX_CFLAGS_COMPILE_@suffixSalt@="$(< @out@/nix-support/cc-cflags) $NIX_CFLAGS_COMPILE_@suffixSalt@"
fi fi
if [ -e @out@/nix-support/gnat-cflags ]; then if [ -e @out@/nix-support/gnat-cflags ]; then
NIX_@infixSalt@_GNATFLAGS_COMPILE="$(< @out@/nix-support/gnat-cflags) $NIX_@infixSalt@_GNATFLAGS_COMPILE" NIX_GNATFLAGS_COMPILE_@suffixSalt@="$(< @out@/nix-support/gnat-cflags) $NIX_GNATFLAGS_COMPILE_@suffixSalt@"
fi fi
if [ -e @out@/nix-support/cc-ldflags ]; then if [ -e @out@/nix-support/cc-ldflags ]; then
NIX_@infixSalt@_LDFLAGS+=" $(< @out@/nix-support/cc-ldflags)" NIX_LDFLAGS_@suffixSalt@+=" $(< @out@/nix-support/cc-ldflags)"
fi fi
if [ -e @out@/nix-support/cc-cflags-before ]; then if [ -e @out@/nix-support/cc-cflags-before ]; then
NIX_@infixSalt@_CFLAGS_COMPILE_BEFORE="$(< @out@/nix-support/cc-cflags-before) $NIX_@infixSalt@_CFLAGS_COMPILE_BEFORE" NIX_CFLAGS_COMPILE_BEFORE_@suffixSalt@="$(< @out@/nix-support/cc-cflags-before) $NIX_CFLAGS_COMPILE_BEFORE_@suffixSalt@"
fi fi
# That way forked processes will not extend these environment variables again. # That way forked processes will not extend these environment variables again.
export NIX_CC_WRAPPER_@infixSalt@_FLAGS_SET=1 export NIX_CC_WRAPPER_FLAGS_SET_@suffixSalt@=1

View File

@ -5,7 +5,7 @@ declare -A hardeningEnableMap=()
# Intentionally word-split in case 'NIX_HARDENING_ENABLE' is defined in Nix. The # Intentionally word-split in case 'NIX_HARDENING_ENABLE' is defined in Nix. The
# array expansion also prevents undefined variables from causing trouble with # array expansion also prevents undefined variables from causing trouble with
# `set -u`. # `set -u`.
for flag in ${NIX_@infixSalt@_HARDENING_ENABLE-}; do for flag in ${NIX_HARDENING_ENABLE_@suffixSalt@-}; do
hardeningEnableMap["$flag"]=1 hardeningEnableMap["$flag"]=1
done done

View File

@ -18,12 +18,12 @@ fi
source @out@/nix-support/utils.bash source @out@/nix-support/utils.bash
# Flirting with a layer violation here. # Flirting with a layer violation here.
if [ -z "${NIX_BINTOOLS_WRAPPER_@infixSalt@_FLAGS_SET:-}" ]; then if [ -z "${NIX_BINTOOLS_WRAPPER_FLAGS_SET_@suffixSalt@:-}" ]; then
source @bintools@/nix-support/add-flags.sh source @bintools@/nix-support/add-flags.sh
fi fi
# Put this one second so libc ldflags take priority. # Put this one second so libc ldflags take priority.
if [ -z "${NIX_CC_WRAPPER_@infixSalt@_FLAGS_SET:-}" ]; then if [ -z "${NIX_CC_WRAPPER_FLAGS_SET_@suffixSalt@:-}" ]; then
source @out@/nix-support/add-flags.sh source @out@/nix-support/add-flags.sh
fi fi
@ -113,7 +113,7 @@ fi
# Clear march/mtune=native -- they bring impurity. # Clear march/mtune=native -- they bring impurity.
if [ "$NIX_@infixSalt@_ENFORCE_NO_NATIVE" = 1 ]; then if [ "$NIX_ENFORCE_NO_NATIVE_@suffixSalt@" = 1 ]; then
rest=() rest=()
# Old bash empty array hack # Old bash empty array hack
for p in ${params+"${params[@]}"}; do for p in ${params+"${params[@]}"}; do
@ -129,36 +129,36 @@ fi
if [[ "$isCpp" = 1 ]]; then if [[ "$isCpp" = 1 ]]; then
if [[ "$cppInclude" = 1 ]]; then if [[ "$cppInclude" = 1 ]]; then
NIX_@infixSalt@_CFLAGS_COMPILE+=" ${NIX_@infixSalt@_CXXSTDLIB_COMPILE:-@default_cxx_stdlib_compile@}" NIX_CFLAGS_COMPILE_@suffixSalt@+=" ${NIX_CXXSTDLIB_COMPILE_@suffixSalt@:-@default_cxx_stdlib_compile@}"
fi fi
NIX_@infixSalt@_CFLAGS_LINK+=" $NIX_@infixSalt@_CXXSTDLIB_LINK" NIX_CFLAGS_LINK_@suffixSalt@+=" $NIX_CXXSTDLIB_LINK_@suffixSalt@"
fi fi
source @out@/nix-support/add-hardening.sh source @out@/nix-support/add-hardening.sh
# Add the flags for the C compiler proper. # Add the flags for the C compiler proper.
extraAfter=($NIX_@infixSalt@_CFLAGS_COMPILE) extraAfter=($NIX_CFLAGS_COMPILE_@suffixSalt@)
extraBefore=(${hardeningCFlags[@]+"${hardeningCFlags[@]}"} $NIX_@infixSalt@_CFLAGS_COMPILE_BEFORE) extraBefore=(${hardeningCFlags[@]+"${hardeningCFlags[@]}"} $NIX_CFLAGS_COMPILE_BEFORE_@suffixSalt@)
if [ "$dontLink" != 1 ]; then if [ "$dontLink" != 1 ]; then
# Add the flags that should only be passed to the compiler when # Add the flags that should only be passed to the compiler when
# linking. # linking.
extraAfter+=($NIX_@infixSalt@_CFLAGS_LINK) extraAfter+=($NIX_CFLAGS_LINK_@suffixSalt@)
# Add the flags that should be passed to the linker (and prevent # Add the flags that should be passed to the linker (and prevent
# `ld-wrapper' from adding NIX_@infixSalt@_LDFLAGS again). # `ld-wrapper' from adding NIX_LDFLAGS_@suffixSalt@ again).
for i in $NIX_@infixSalt@_LDFLAGS_BEFORE; do for i in $NIX_LDFLAGS_BEFORE_@suffixSalt@; do
extraBefore+=("-Wl,$i") extraBefore+=("-Wl,$i")
done done
for i in $NIX_@infixSalt@_LDFLAGS; do for i in $NIX_LDFLAGS_@suffixSalt@; do
if [ "${i:0:3}" = -L/ ]; then if [ "${i:0:3}" = -L/ ]; then
extraAfter+=("$i") extraAfter+=("$i")
else else
extraAfter+=("-Wl,$i") extraAfter+=("-Wl,$i")
fi fi
done done
export NIX_@infixSalt@_LDFLAGS_SET=1 export NIX_LDFLAGS_SET_@suffixSalt@=1
fi fi
# As a very special hack, if the arguments are just `-v', then don't # As a very special hack, if the arguments are just `-v', then don't

View File

@ -54,12 +54,12 @@ let
"-isystem ${libcxx}/include/c++/v1" "-isystem ${libcxx}/include/c++/v1"
else ""; else "";
# The "infix salt" is a arbitrary string added in the middle of env vars # The "suffix salt" is a arbitrary string added in the end of env vars
# defined by cc-wrapper's hooks so that multiple cc-wrappers can be used # defined by cc-wrapper's hooks so that multiple cc-wrappers can be used
# without interfering. For the moment, it is defined as the target triple, # without interfering. For the moment, it is defined as the target triple,
# adjusted to be a valid bash identifier. This should be considered an # adjusted to be a valid bash identifier. This should be considered an
# unstable implementation detail, however. # unstable implementation detail, however.
infixSalt = replaceStrings ["-" "."] ["_" "_"] targetPlatform.config; suffixSalt = replaceStrings ["-" "."] ["_" "_"] targetPlatform.config;
expand-response-params = expand-response-params =
if buildPackages.stdenv.hasCC && buildPackages.stdenv.cc != "/dev/null" if buildPackages.stdenv.hasCC && buildPackages.stdenv.cc != "/dev/null"
@ -106,7 +106,7 @@ stdenv.mkDerivation {
shell = getBin shell + shell.shellPath or ""; shell = getBin shell + shell.shellPath or "";
gnugrep_bin = if nativeTools then "" else gnugrep; gnugrep_bin = if nativeTools then "" else gnugrep;
inherit targetPrefix infixSalt; inherit targetPrefix suffixSalt;
outputs = [ "out" ] ++ optionals propagateDoc [ "man" "info" ]; outputs = [ "out" ] ++ optionals propagateDoc [ "man" "info" ];
@ -123,7 +123,7 @@ stdenv.mkDerivation {
(mapc (mapc
(lambda (arg) (lambda (arg)
(when (file-directory-p (concat arg "/include")) (when (file-directory-p (concat arg "/include"))
(setenv "NIX_${infixSalt}_CFLAGS_COMPILE" (concat (getenv "NIX_${infixSalt}_CFLAGS_COMPILE") " -isystem " arg "/include")))) (setenv "NIX_CFLAGS_COMPILE_${suffixSalt}" (concat (getenv "NIX_CFLAGS_COMPILE_${suffixSalt}") " -isystem " arg "/include"))))
'(${concatStringsSep " " (map (pkg: "\"${pkg}\"") pkgs)})) '(${concatStringsSep " " (map (pkg: "\"${pkg}\"") pkgs)}))
''; '';
}; };

View File

@ -18,12 +18,12 @@ fi
source @out@/nix-support/utils.bash source @out@/nix-support/utils.bash
# Flirting with a layer violation here. # Flirting with a layer violation here.
if [ -z "${NIX_BINTOOLS_WRAPPER_@infixSalt@_FLAGS_SET:-}" ]; then if [ -z "${NIX_BINTOOLS_WRAPPER_FLAGS_SET_@suffixSalt@:-}" ]; then
source @bintools@/nix-support/add-flags.sh source @bintools@/nix-support/add-flags.sh
fi fi
# Put this one second so libc ldflags take priority. # Put this one second so libc ldflags take priority.
if [ -z "${NIX_CC_WRAPPER_@infixSalt@_FLAGS_SET:-}" ]; then if [ -z "${NIX_CC_WRAPPER_FLAGS_SET_@suffixSalt@:-}" ]; then
source @out@/nix-support/add-flags.sh source @out@/nix-support/add-flags.sh
fi fi
@ -108,7 +108,7 @@ fi
# Clear march/mtune=native -- they bring impurity. # Clear march/mtune=native -- they bring impurity.
if [ "$NIX_@infixSalt@_ENFORCE_NO_NATIVE" = 1 ]; then if [ "$NIX_ENFORCE_NO_NATIVE_@suffixSalt@" = 1 ]; then
rest=() rest=()
# Old bash empty array hack # Old bash empty array hack
for p in ${params+"${params[@]}"}; do for p in ${params+"${params[@]}"}; do
@ -124,12 +124,12 @@ fi
if [ "$(basename $0)x" = "gnatmakex" ]; then if [ "$(basename $0)x" = "gnatmakex" ]; then
extraBefore=("--GNATBIND=@out@/bin/gnatbind" "--GNATLINK=@out@/bin/gnatlink") extraBefore=("--GNATBIND=@out@/bin/gnatbind" "--GNATLINK=@out@/bin/gnatlink")
extraAfter=($NIX_@infixSalt@_GNATFLAGS_COMPILE) extraAfter=($NIX_GNATFLAGS_COMPILE_@suffixSalt@)
fi fi
if [ "$(basename $0)x" = "gnatbindx" ]; then if [ "$(basename $0)x" = "gnatbindx" ]; then
extraBefore=() extraBefore=()
extraAfter=($NIX_@infixSalt@_GNATFLAGS_COMPILE) extraAfter=($NIX_GNATFLAGS_COMPILE_@suffixSalt@)
fi fi
if [ "$(basename $0)x" = "gnatlinkx" ]; then if [ "$(basename $0)x" = "gnatlinkx" ]; then

View File

@ -6,9 +6,9 @@
# tools. For example: # tools. For example:
# #
# # Flags for compiling (whether or not linking) C code for the... # # Flags for compiling (whether or not linking) C code for the...
# NIX_BUILD_CFLAGS_COMPILE # ...build platform # NIX_CFLAGS_COMPILE_FOR_BUILD # ...build platform
# NIX_CFLAGS_COMPILE # ...host platform # NIX_CFLAGS_COMPILE # ...host platform
# NIX_TARGET_CFLAGS_COMPILE # ...target platform # NIX_CFLAGS_COMPILE_FOR_TARGET # ...target platform
# #
# Notice that these platforms are the 3 *relative* to the package using # Notice that these platforms are the 3 *relative* to the package using
# cc-wrapper, not absolute like `x86_64-pc-linux-gnu`. # cc-wrapper, not absolute like `x86_64-pc-linux-gnu`.
@ -33,12 +33,12 @@
# The basic strategy is: # The basic strategy is:
# #
# - Everyone exclusively *adds information* to relative-platform-specific # - Everyone exclusively *adds information* to relative-platform-specific
# environment variables, like `NIX_TARGET_CFLAGS_COMPILE`, to communicate # environment variables, like `NIX_CFLAGS_COMPILE_FOR_TARGET`, to communicate
# with the wrapped binaries. # with the wrapped binaries.
# #
# - The wrapped binaries will exclusively *read* cc-wrapper-derivation-specific # - The wrapped binaries will exclusively *read* cc-wrapper-derivation-specific
# environment variables distinguished with with `infixSalt`, like # environment variables distinguished with with `suffixSalt`, like
# `NIX_@infixSalt@_CFLAGS_COMPILE`. # `NIX_CFLAGS_COMPILE_@suffixSalt@`.
# #
# - `add-flags`, beyond its old task of reading extra flags stuck inside the # - `add-flags`, beyond its old task of reading extra flags stuck inside the
# cc-wrapper derivation, will convert the relative-platform-specific # cc-wrapper derivation, will convert the relative-platform-specific
@ -65,15 +65,15 @@
# function is guaranteed to be exactly the same. # function is guaranteed to be exactly the same.
ccWrapper_addCVars () { ccWrapper_addCVars () {
# See ../setup-hooks/role.bash # See ../setup-hooks/role.bash
local role_post role_pre local role_post
getHostRoleEnvHook getHostRoleEnvHook
if [ -d "$1/include" ]; then if [ -d "$1/include" ]; then
export NIX_${role_pre}CFLAGS_COMPILE+=" -isystem $1/include" export NIX_CFLAGS_COMPILE${role_post}+=" -isystem $1/include"
fi fi
if [ -d "$1/Library/Frameworks" ]; then if [ -d "$1/Library/Frameworks" ]; then
export NIX_${role_pre}CFLAGS_COMPILE+=" -iframework $1/Library/Frameworks" export NIX_CFLAGS_COMPILE${role_post}+=" -iframework $1/Library/Frameworks"
fi fi
} }
@ -105,10 +105,10 @@ fi
# Export tool environment variables so various build systems use the right ones. # Export tool environment variables so various build systems use the right ones.
export NIX_${role_pre}CC=@out@ export NIX_CC${role_post}=@out@
export ${role_pre}CC=@named_cc@ export CC${role_post}=@named_cc@
export ${role_pre}CXX=@named_cxx@ export CXX${role_post}=@named_cxx@
export CC${role_post}=@named_cc@ export CC${role_post}=@named_cc@
export CXX${role_post}=@named_cxx@ export CXX${role_post}=@named_cxx@
@ -117,4 +117,4 @@ export CXX${role_post}=@named_cxx@
export NIX_HARDENING_ENABLE export NIX_HARDENING_ENABLE
# No local scope in sourced file # No local scope in sourced file
unset -v role_pre role_post unset -v role_post

View File

@ -12,7 +12,7 @@
cp -v "$script" "$target"/"$scriptName" cp -v "$script" "$target"/"$scriptName"
chmod 755 "$target"/"$scriptName" chmod 755 "$target"/"$scriptName"
patchShebangs "$target"/"$scriptName" patchShebangs "$target"/"$scriptName"
substituteInPlace "$target"/"$scriptName" --replace pkg-config ${pkgconfig}/bin/pkg-config substituteInPlace "$target"/"$scriptName" --replace pkg-config ${pkgconfig}/bin/${pkgconfig.targetPrefix}pkg-config
substituteInPlace "$target"/"$scriptName" --replace monodis ${mono}/bin/monodis substituteInPlace "$target"/"$scriptName" --replace monodis ${mono}/bin/monodis
done done
'' ''

View File

@ -0,0 +1,12 @@
# See cc-wrapper for comments.
var_templates_list=(
PKG_CONFIG_PATH
)
accumulateRoles
for var in "${var_templates_list[@]}"; do
mangleVarList "$var" ${role_suffixes[@]+"${role_suffixes[@]}"}
done
export NIX_PKG_CONFIG_WRAPPER_FLAGS_SET_@suffixSalt@=1

View File

@ -0,0 +1,126 @@
# The wrapper script ensures variables like PKG_CONFIG_PATH and
# PKG_CONFIG_PATH_FOR_BUILD work properly.
{ stdenvNoCC
, buildPackages
, pkg-config
, baseBinName ? "pkg-config"
, propagateDoc ? pkg-config != null && pkg-config ? man
, extraPackages ? [], extraBuildCommands ? ""
}:
with stdenvNoCC.lib;
let
stdenv = stdenvNoCC;
inherit (stdenv) hostPlatform targetPlatform;
# Prefix for binaries. Customarily ends with a dash separator.
#
# TODO(@Ericson2314) Make unconditional, or optional but always true by
# default.
targetPrefix = stdenv.lib.optionalString (targetPlatform != hostPlatform)
(targetPlatform.config + "-");
# See description in cc-wrapper.
suffixSalt = replaceStrings ["-" "."] ["_" "_"] targetPlatform.config;
in
stdenv.mkDerivation {
pname = targetPrefix + pkg-config.pname + "-wrapper";
inherit (pkg-config) version;
preferLocalBuild = true;
shell = getBin stdenvNoCC.shell + stdenvNoCC.shell.shellPath or "";
inherit targetPrefix suffixSalt baseBinName;
outputs = [ "out" ] ++ optionals propagateDoc ([ "man" ] ++ optional (pkg-config ? doc) "doc");
passthru = {
inherit pkg-config;
};
dontBuild = true;
dontConfigure = true;
unpackPhase = ''
src=$PWD
'';
installPhase =
''
mkdir -p $out/bin $out/nix-support
wrap() {
local dst="$1"
local wrapper="$2"
export prog="$3"
substituteAll "$wrapper" "$out/bin/$dst"
chmod +x "$out/bin/$dst"
}
echo $pkg-config > $out/nix-support/orig-pkg-config
wrap ${targetPrefix}${baseBinName} ${./pkg-config-wrapper.sh} "${getBin pkg-config}/bin/${baseBinName}"
''
# symlink in share for autoconf to find macros
# TODO(@Ericson2314): in the future just make the unwrapped pkg-config a
# propagated dep once we can rely on downstream deps comming first in
# search paths. (https://github.com/NixOS/nixpkgs/pull/31414 took a crack
# at this.)
+ ''
ln -s ${pkg-config}/share $out/share
'';
strictDeps = true;
wrapperName = "PKG_CONFIG_WRAPPER";
setupHooks = [
../setup-hooks/role.bash
./setup-hook.sh
];
postFixup =
##
## User env support
##
# Propagate the underling unwrapped pkg-config so that if you
# install the wrapper, you get anything else it might provide.
''
printWords ${pkg-config} > $out/nix-support/propagated-user-env-packages
''
##
## Man page and doc support
##
+ optionalString propagateDoc (''
ln -s ${pkg-config.man} $man
'' + optionalString (pkg-config ? doc) ''
ln -s ${pkg-config.doc} $doc
'')
+ ''
substituteAll ${./add-flags.sh} $out/nix-support/add-flags.sh
substituteAll ${../wrapper-common/utils.bash} $out/nix-support/utils.bash
''
##
## Extra custom steps
##
+ extraBuildCommands;
meta =
let pkg-config_ = if pkg-config != null then pkg-config else {}; in
(if pkg-config_ ? meta then removeAttrs pkg-config.meta ["priority"] else {}) //
{ description =
stdenv.lib.attrByPath ["meta" "description"] "pkg-config" pkg-config_
+ " (wrapper script)";
priority = 10;
};
}

View File

@ -0,0 +1,21 @@
#! @shell@
set -eu -o pipefail +o posix
shopt -s nullglob
if (( "${NIX_DEBUG:-0}" >= 7 )); then
set -x
fi
source @out@/nix-support/utils.bash
if [ -z "${NIX_PKG_CONFIG_WRAPPER_FLAGS_SET_@suffixSalt@:-}" ]; then
source @out@/nix-support/add-flags.sh
fi
if (( ${#role_suffixes[@]} > 0 )); then
# replace env var with nix-modified one
PKG_CONFIG_PATH=$PKG_CONFIG_PATH_@suffixSalt@ exec @prog@ "$@"
else
# pkg-config isn't a bonafied dependency so ignore setup hook entirely
exec @prog@ "$@"
fi

View File

@ -0,0 +1,29 @@
# pkg-config Wrapper hygiene
#
# See comments in cc-wrapper's setup hook. This works exactly the same way.
# Skip setup hook if we're neither a build-time dep, nor, temporarily, doing a
# native compile.
#
# TODO(@Ericson2314): No native exception
[[ -z ${strictDeps-} ]] || (( "$hostOffset" < 0 )) || return 0
pkgConfigWrapper_addPkgConfigPath () {
# See ../setup-hooks/role.bash
local role_post
getHostRoleEnvHook
addToSearchPath "PKG_CONFIG_PATH${role_post}" "$1/lib/pkgconfig"
addToSearchPath "PKG_CONFIG_PATH${role_post}" "$1/share/pkgconfig"
}
# See ../setup-hooks/role.bash
getTargetRole
getTargetRoleWrapper
addEnvHooks "$targetOffset" pkgConfigWrapper_addPkgConfigPath
export PKG_CONFIG${role_post}=@targetPrefix@@baseBinName@
# No local scope in sourced file
unset -v role_post

View File

@ -3,21 +3,17 @@
# derivation) in which the derivation is used. # derivation) in which the derivation is used.
# #
# The role is intened to be use as part of other variables names like # The role is intened to be use as part of other variables names like
# - $NIX_${role_pre}_SOMETHING # - $NIX_SOMETHING${role_post}
# - $NIX_SOMETHING_${role_post}
function getRole() { function getRole() {
case $1 in case $1 in
-1) -1)
role_pre='BUILD_'
role_post='_FOR_BUILD' role_post='_FOR_BUILD'
;; ;;
0) 0)
role_pre=''
role_post='' role_post=''
;; ;;
1) 1)
role_pre='TARGET_'
role_post='_FOR_TARGET' role_post='_FOR_TARGET'
;; ;;
*) *)
@ -54,18 +50,18 @@ function getTargetRoleEnvHook() {
} }
# This variant is inteneded specifically for code-prodocing tool wrapper scripts # This variant is inteneded specifically for code-prodocing tool wrapper scripts
# `NIX_@wrapperName@_@infixSalt@_TARGET_*` tracks this (needs to be an exported # `NIX_@wrapperName@_TARGET_*_@suffixSalt@` tracks this (needs to be an exported
# env var so can't use fancier data structures). # env var so can't use fancier data structures).
function getTargetRoleWrapper() { function getTargetRoleWrapper() {
case $targetOffset in case $targetOffset in
-1) -1)
export NIX_@wrapperName@_@infixSalt@_TARGET_BUILD=1 export NIX_@wrapperName@_TARGET_BUILD_@suffixSalt@=1
;; ;;
0) 0)
export NIX_@wrapperName@_@infixSalt@_TARGET_HOST=1 export NIX_@wrapperName@_TARGET_HOST_@suffixSalt@=1
;; ;;
1) 1)
export NIX_@wrapperName@_@infixSalt@_TARGET_TARGET=1 export NIX_@wrapperName@_TARGET_TARGET_@suffixSalt@=1
;; ;;
*) *)
echo "@name@: used as improper sort of dependency" >2 echo "@name@: used as improper sort of dependency" >2

View File

@ -1,29 +1,29 @@
# Accumulate infixes for taking in the right input parameters with the `mangle*` # Accumulate suffixes for taking in the right input parameters with the `mangle*`
# functions below. See setup-hook for details. # functions below. See setup-hook for details.
accumulateRoles() { accumulateRoles() {
declare -ga role_infixes=() declare -ga role_suffixes=()
if [ "${NIX_@wrapperName@_@infixSalt@_TARGET_BUILD:-}" ]; then if [ "${NIX_@wrapperName@_TARGET_BUILD_@suffixSalt@:-}" ]; then
role_infixes+=(_BUILD_) role_suffixes+=('_FOR_BUILD')
fi fi
if [ "${NIX_@wrapperName@_@infixSalt@_TARGET_HOST:-}" ]; then if [ "${NIX_@wrapperName@_TARGET_HOST_@suffixSalt@:-}" ]; then
role_infixes+=(_) role_suffixes+=('')
fi fi
if [ "${NIX_@wrapperName@_@infixSalt@_TARGET_TARGET:-}" ]; then if [ "${NIX_@wrapperName@_TARGET_TARGET_@suffixSalt@:-}" ]; then
role_infixes+=(_TARGET_) role_suffixes+=('_FOR_TARGET')
fi fi
} }
mangleVarList() { mangleVarList() {
local var="$1" local var="$1"
shift shift
local -a role_infixes=("$@") local -a role_suffixes=("$@")
local outputVar="${var/+/_@infixSalt@_}" local outputVar="${var}_@suffixSalt@"
declare -gx ${outputVar}+='' declare -gx ${outputVar}+=''
# For each role we serve, we accumulate the input parameters into our own # For each role we serve, we accumulate the input parameters into our own
# cc-wrapper-derivation-specific environment variables. # cc-wrapper-derivation-specific environment variables.
for infix in "${role_infixes[@]}"; do for suffix in "${role_suffixes[@]}"; do
local inputVar="${var/+/${infix}}" local inputVar="${var}${suffix}"
if [ -v "$inputVar" ]; then if [ -v "$inputVar" ]; then
export ${outputVar}+="${!outputVar:+ }${!inputVar}" export ${outputVar}+="${!outputVar:+ }${!inputVar}"
fi fi
@ -33,12 +33,12 @@ mangleVarList() {
mangleVarBool() { mangleVarBool() {
local var="$1" local var="$1"
shift shift
local -a role_infixes=("$@") local -a role_suffixes=("$@")
local outputVar="${var/+/_@infixSalt@_}" local outputVar="${var}_@suffixSalt@"
declare -gxi ${outputVar}+=0 declare -gxi ${outputVar}+=0
for infix in "${role_infixes[@]}"; do for suffix in "${role_suffixes[@]}"; do
local inputVar="${var/+/${infix}}" local inputVar="${var}${suffix}"
if [ -v "$inputVar" ]; then if [ -v "$inputVar" ]; then
# "1" in the end makes `let` return success error code when # "1" in the end makes `let` return success error code when
# expression itself evaluates to zero. # expression itself evaluates to zero.

View File

@ -37,7 +37,7 @@ stdenv.mkDerivation rec {
postInstall = '' postInstall = ''
wrapProgram $out/bin/startlazarus --prefix NIX_LDFLAGS ' ' \ wrapProgram $out/bin/startlazarus --prefix NIX_LDFLAGS ' ' \
"$(echo "$NIX_LDFLAGS" | sed -re 's/-rpath [^ ]+//g')" \ "$(echo "$NIX_LDFLAGS" | sed -re 's/-rpath [^ ]+//g')" \
--prefix NIX_${binutils.infixSalt}_LDFLAGS ' ' \ --prefix NIX_LDFLAGS_${binutils.suffixSalt} ' ' \
"$(echo "$NIX_LDFLAGS" | sed -re 's/-rpath [^ ]+//g')" \ "$(echo "$NIX_LDFLAGS" | sed -re 's/-rpath [^ ]+//g')" \
--prefix LCL_PLATFORM ' ' "$LCL_PLATFORM" \ --prefix LCL_PLATFORM ' ' "$LCL_PLATFORM" \
--prefix PATH ':' "${fpc}/bin:${gdb}/bin:${gnumake}/bin:${binutils}/bin" --prefix PATH ':' "${fpc}/bin:${gdb}/bin:${gnumake}/bin:${binutils}/bin"

View File

@ -239,8 +239,8 @@ stdenv.mkDerivation ({
(import ../common/extra-target-flags.nix { (import ../common/extra-target-flags.nix {
inherit stdenv crossStageStatic libcCross threadsCross; inherit stdenv crossStageStatic libcCross threadsCross;
}) })
EXTRA_TARGET_FLAGS EXTRA_FLAGS_FOR_TARGET
EXTRA_TARGET_LDFLAGS EXTRA_LDFLAGS_FOR_TARGET
; ;
passthru = { passthru = {

View File

@ -264,8 +264,8 @@ stdenv.mkDerivation ({
(import ../common/extra-target-flags.nix { (import ../common/extra-target-flags.nix {
inherit stdenv crossStageStatic libcCross threadsCross; inherit stdenv crossStageStatic libcCross threadsCross;
}) })
EXTRA_TARGET_FLAGS EXTRA_FLAGS_FOR_TARGET
EXTRA_TARGET_LDFLAGS EXTRA_LDFLAGS_FOR_TARGET
; ;
passthru = { passthru = {

View File

@ -276,8 +276,8 @@ stdenv.mkDerivation ({
(import ../common/extra-target-flags.nix { (import ../common/extra-target-flags.nix {
inherit stdenv crossStageStatic libcCross threadsCross; inherit stdenv crossStageStatic libcCross threadsCross;
}) })
EXTRA_TARGET_FLAGS EXTRA_FLAGS_FOR_TARGET
EXTRA_TARGET_LDFLAGS EXTRA_LDFLAGS_FOR_TARGET
; ;
passthru = { passthru = {

View File

@ -292,8 +292,8 @@ stdenv.mkDerivation ({
(import ../common/extra-target-flags.nix { (import ../common/extra-target-flags.nix {
inherit stdenv crossStageStatic libcCross threadsCross; inherit stdenv crossStageStatic libcCross threadsCross;
}) })
EXTRA_TARGET_FLAGS EXTRA_FLAGS_FOR_TARGET
EXTRA_TARGET_LDFLAGS EXTRA_LDFLAGS_FOR_TARGET
; ;
passthru = { passthru = {

View File

@ -247,8 +247,8 @@ stdenv.mkDerivation ({
(import ../common/extra-target-flags.nix { (import ../common/extra-target-flags.nix {
inherit stdenv crossStageStatic libcCross threadsCross; inherit stdenv crossStageStatic libcCross threadsCross;
}) })
EXTRA_TARGET_FLAGS EXTRA_FLAGS_FOR_TARGET
EXTRA_TARGET_LDFLAGS EXTRA_LDFLAGS_FOR_TARGET
; ;
passthru = { passthru = {

View File

@ -234,8 +234,8 @@ stdenv.mkDerivation ({
(import ../common/extra-target-flags.nix { (import ../common/extra-target-flags.nix {
inherit stdenv crossStageStatic libcCross threadsCross; inherit stdenv crossStageStatic libcCross threadsCross;
}) })
EXTRA_TARGET_FLAGS EXTRA_FLAGS_FOR_TARGET
EXTRA_TARGET_LDFLAGS EXTRA_LDFLAGS_FOR_TARGET
; ;
passthru = { passthru = {

View File

@ -242,8 +242,8 @@ stdenv.mkDerivation ({
(import ../common/extra-target-flags.nix { (import ../common/extra-target-flags.nix {
inherit stdenv crossStageStatic langD libcCross threadsCross; inherit stdenv crossStageStatic langD libcCross threadsCross;
}) })
EXTRA_TARGET_FLAGS EXTRA_FLAGS_FOR_TARGET
EXTRA_TARGET_LDFLAGS EXTRA_LDFLAGS_FOR_TARGET
; ;
passthru = { passthru = {

View File

@ -25,12 +25,12 @@ echo "\$LIBRARY_PATH is \`${LIBRARY_PATH-}'"
if test "$noSysDirs" = "1"; then if test "$noSysDirs" = "1"; then
declare \ declare \
EXTRA_BUILD_FLAGS EXTRA_FLAGS EXTRA_TARGET_FLAGS \ EXTRA_FLAGS_FOR_BUILD EXTRA_FLAGS EXTRA_FLAGS_FOR_TARGET \
EXTRA_BUILD_LDFLAGS EXTRA_TARGET_LDFLAGS EXTRA_LDFLAGS_FOR_BUILD EXTRA_LDFLAGS_FOR_TARGET
# Extract flags from Bintools Wrappers # Extract flags from Bintools Wrappers
for pre in 'BUILD_' ''; do for post in '_FOR_BUILD' ''; do
curBintools="NIX_${pre}BINTOOLS" curBintools="NIX_BINTOOLS${post}"
declare -a extraLDFlags=() declare -a extraLDFlags=()
if [[ -e "${!curBintools}/nix-support/orig-libc" ]]; then if [[ -e "${!curBintools}/nix-support/orig-libc" ]]; then
@ -48,14 +48,14 @@ if test "$noSysDirs" = "1"; then
extraLDFlags=("-L$libc_libdir" "-rpath" "$libc_libdir" extraLDFlags=("-L$libc_libdir" "-rpath" "$libc_libdir"
"${extraLDFlags[@]}") "${extraLDFlags[@]}")
for i in "${extraLDFlags[@]}"; do for i in "${extraLDFlags[@]}"; do
declare EXTRA_${pre}LDFLAGS+=" -Wl,$i" declare EXTRA_LDFLAGS${post}+=" -Wl,$i"
done done
done done
# Extract flags from CC Wrappers # Extract flags from CC Wrappers
for pre in 'BUILD_' ''; do for post in '_FOR_BUILD' ''; do
curCC="NIX_${pre}CC" curCC="NIX_CC${post}"
curFIXINC="NIX_${pre}FIXINC_DUMMY" curFIXINC="NIX_FIXINC_DUMMY${post}"
declare -a extraFlags=() declare -a extraFlags=()
if [[ -e "${!curCC}/nix-support/orig-libc" ]]; then if [[ -e "${!curCC}/nix-support/orig-libc" ]]; then
@ -69,11 +69,11 @@ if test "$noSysDirs" = "1"; then
# Use *real* header files, otherwise a limits.h is generated that # Use *real* header files, otherwise a limits.h is generated that
# does not include Libc's limits.h (notably missing SSIZE_MAX, # does not include Libc's limits.h (notably missing SSIZE_MAX,
# which breaks the build). # which breaks the build).
declare NIX_${pre}FIXINC_DUMMY="$libc_devdir/include" declare NIX_FIXINC_DUMMY${post}="$libc_devdir/include"
else else
# Hack: support impure environments. # Hack: support impure environments.
extraFlags=("-isystem" "/usr/include") extraFlags=("-isystem" "/usr/include")
declare NIX_${pre}FIXINC_DUMMY=/usr/include declare NIX_FIXINC_DUMMY${post}=/usr/include
fi fi
extraFlags=("-I${!curFIXINC}" "${extraFlags[@]}") extraFlags=("-I${!curFIXINC}" "${extraFlags[@]}")
@ -89,13 +89,13 @@ if test "$noSysDirs" = "1"; then
extraFlags=("-O2" "${extraFlags[@]}") extraFlags=("-O2" "${extraFlags[@]}")
fi fi
declare EXTRA_${pre}FLAGS="${extraFlags[*]}" declare EXTRA_FLAGS${post}="${extraFlags[*]}"
done done
if test -z "${targetConfig-}"; then if test -z "${targetConfig-}"; then
# host = target, so the flags are the same # host = target, so the flags are the same
EXTRA_TARGET_FLAGS="$EXTRA_FLAGS" EXTRA_FLAGS_FOR_TARGET="$EXTRA_FLAGS"
EXTRA_TARGET_LDFLAGS="$EXTRA_LDFLAGS" EXTRA_LDFLAGS_FOR_TARGET="$EXTRA_LDFLAGS"
fi fi
# CFLAGS_FOR_TARGET are needed for the libstdc++ configure script to find # CFLAGS_FOR_TARGET are needed for the libstdc++ configure script to find
@ -103,31 +103,31 @@ if test "$noSysDirs" = "1"; then
# FLAGS_FOR_TARGET are needed for the target libraries to receive the -Bxxx # FLAGS_FOR_TARGET are needed for the target libraries to receive the -Bxxx
# for the startfiles. # for the startfiles.
makeFlagsArray+=( makeFlagsArray+=(
"BUILD_SYSTEM_HEADER_DIR=$NIX_BUILD_FIXINC_DUMMY" "BUILD_SYSTEM_HEADER_DIR=$NIX_FIXINC_DUMMY_FOR_BUILD"
"SYSTEM_HEADER_DIR=$NIX_BUILD_FIXINC_DUMMY" "SYSTEM_HEADER_DIR=$NIX_FIXINC_DUMMY_FOR_BUILD"
"NATIVE_SYSTEM_HEADER_DIR=$NIX_FIXINC_DUMMY" "NATIVE_SYSTEM_HEADER_DIR=$NIX_FIXINC_DUMMY"
"LDFLAGS_FOR_BUILD=$EXTRA_BUILD_LDFLAGS" "LDFLAGS_FOR_BUILD=$EXTRA_LDFLAGS_FOR_BUILD"
#"LDFLAGS=$EXTRA_LDFLAGS" #"LDFLAGS=$EXTRA_LDFLAGS"
"LDFLAGS_FOR_TARGET=$EXTRA_TARGET_LDFLAGS" "LDFLAGS_FOR_TARGET=$EXTRA_LDFLAGS_FOR_TARGET"
"CFLAGS_FOR_BUILD=$EXTRA_BUILD_FLAGS $EXTRA_BUILD_LDFLAGS" "CFLAGS_FOR_BUILD=$EXTRA_FLAGS_FOR_BUILD $EXTRA_LDFLAGS_FOR_BUILD"
"CXXFLAGS_FOR_BUILD=$EXTRA_BUILD_FLAGS $EXTRA_BUILD_LDFLAGS" "CXXFLAGS_FOR_BUILD=$EXTRA_FLAGS_FOR_BUILD $EXTRA_LDFLAGS_FOR_BUILD"
"FLAGS_FOR_BUILD=$EXTRA_BUILD_FLAGS $EXTRA_BUILD_LDFLAGS" "FLAGS_FOR_BUILD=$EXTRA_FLAGS_FOR_BUILD $EXTRA_LDFLAGS_FOR_BUILD"
# It seems there is a bug in GCC 5 # It seems there is a bug in GCC 5
#"CFLAGS=$EXTRA_FLAGS $EXTRA_LDFLAGS" #"CFLAGS=$EXTRA_FLAGS $EXTRA_LDFLAGS"
#"CXXFLAGS=$EXTRA_FLAGS $EXTRA_LDFLAGS" #"CXXFLAGS=$EXTRA_FLAGS $EXTRA_LDFLAGS"
"CFLAGS_FOR_TARGET=$EXTRA_TARGET_FLAGS $EXTRA_TARGET_LDFLAGS" "CFLAGS_FOR_TARGET=$EXTRA_FLAGS_FOR_TARGET $EXTRA_LDFLAGS_FOR_TARGET"
"CXXFLAGS_FOR_TARGET=$EXTRA_TARGET_FLAGS $EXTRA_TARGET_LDFLAGS" "CXXFLAGS_FOR_TARGET=$EXTRA_FLAGS_FOR_TARGET $EXTRA_LDFLAGS_FOR_TARGET"
"FLAGS_FOR_TARGET=$EXTRA_TARGET_FLAGS $EXTRA_TARGET_LDFLAGS" "FLAGS_FOR_TARGET=$EXTRA_FLAGS_FOR_TARGET $EXTRA_LDFLAGS_FOR_TARGET"
) )
if test -z "${targetConfig-}"; then if test -z "${targetConfig-}"; then
makeFlagsArray+=( makeFlagsArray+=(
"BOOT_CFLAGS=$EXTRA_FLAGS $EXTRA_LDFLAGS" "BOOT_CFLAGS=$EXTRA_FLAGS $EXTRA_LDFLAGS"
"BOOT_LDFLAGS=$EXTRA_TARGET_FLAGS $EXTRA_TARGET_LDFLAGS" "BOOT_LDFLAGS=$EXTRA_FLAGS_FOR_TARGET $EXTRA_LDFLAGS_FOR_TARGET"
) )
fi fi

View File

@ -8,7 +8,7 @@ in
# For non-cross builds these flags are currently assigned in builder.sh. # For non-cross builds these flags are currently assigned in builder.sh.
# It would be good to consolidate the generation of makeFlags # It would be good to consolidate the generation of makeFlags
# ({C,CXX,LD}FLAGS_FOR_{BUILD,TARGET}, etc...) at some point. # ({C,CXX,LD}FLAGS_FOR_{BUILD,TARGET}, etc...) at some point.
EXTRA_TARGET_FLAGS = let EXTRA_FLAGS_FOR_TARGET = let
mkFlags = dep: langD: lib.optionals (targetPlatform != hostPlatform && dep != null && !langD) ([ mkFlags = dep: langD: lib.optionals (targetPlatform != hostPlatform && dep != null && !langD) ([
"-O2 -idirafter ${lib.getDev dep}${dep.incdir or "/include"}" "-O2 -idirafter ${lib.getDev dep}${dep.incdir or "/include"}"
] ++ stdenv.lib.optionals (! crossStageStatic) [ ] ++ stdenv.lib.optionals (! crossStageStatic) [
@ -18,7 +18,7 @@ in
++ lib.optionals (!crossStageStatic) (mkFlags threadsCross langD) ++ lib.optionals (!crossStageStatic) (mkFlags threadsCross langD)
; ;
EXTRA_TARGET_LDFLAGS = let EXTRA_LDFLAGS_FOR_TARGET = let
mkFlags = dep: lib.optionals (targetPlatform != hostPlatform && dep != null) ([ mkFlags = dep: lib.optionals (targetPlatform != hostPlatform && dep != null) ([
"-Wl,-L${lib.getLib dep}${dep.libdir or "/lib"}" "-Wl,-L${lib.getLib dep}${dep.libdir or "/lib"}"
] ++ (if crossStageStatic then [ ] ++ (if crossStageStatic then [

View File

@ -1,4 +1,4 @@
# See pkgs/build-support/setup-hooks/role.bash # See pkgs/build-support/setup-hooks/role.bash
getHostRole getHostRole
export NIX_${role_pre}CXXSTDLIB_COMPILE+=" -isystem $(echo -n @gcc@/include/c++/*) -isystem $(echo -n @gcc@/include/c++/*)/@targetConfig@" export NIX_CXXSTDLIB_COMPILE${role_post}+=" -isystem $(echo -n @gcc@/include/c++/*) -isystem $(echo -n @gcc@/include/c++/*)/@targetConfig@"

View File

@ -30,11 +30,11 @@ in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "go"; pname = "go";
version = "1.14.2"; version = "1.14.3";
src = fetchurl { src = fetchurl {
url = "https://dl.google.com/go/go${version}.src.tar.gz"; url = "https://dl.google.com/go/go${version}.src.tar.gz";
sha256 = "0z3zxsnhmsxplnwfw1l9gr6jgglwp50sr3p5njknv9i6jzk89plq"; sha256 = "0mmgf74snprdiajgh99jjliwjl5im71qcgm5qrxpnyfisiw3f0lk";
}; };
# perl is used for testing go vet # perl is used for testing go vet
@ -229,8 +229,6 @@ stdenv.mkDerivation rec {
runHook postInstall runHook postInstall
''; '';
setupHook = ./setup-hook.sh;
disallowedReferences = [ goBootstrap ]; disallowedReferences = [ goBootstrap ];
meta = with stdenv.lib; { meta = with stdenv.lib; {

View File

@ -151,8 +151,6 @@ stdenv.mkDerivation rec {
./all.bash ./all.bash
''; '';
setupHook = ./setup-hook.sh;
meta = with stdenv.lib; { meta = with stdenv.lib; {
branch = "1.4"; branch = "1.4";
homepage = "http://golang.org/"; homepage = "http://golang.org/";

View File

@ -1,5 +0,0 @@
addToGoPath() {
addToSearchPath GOPATH $1/share/go
}
addEnvHooks "$targetOffset" addToGoPath

View File

@ -462,7 +462,7 @@ in rec {
export CC="gcc" export CC="gcc"
export CPP="gcc -E" export CPP="gcc -E"
export NIX_CXXSTDLIB_LINK="" export NIX_CXXSTDLIB_LINK=""
export NIX_TARGET_CXXSTDLIB_LINK="" export NIX_CXXSTDLIB_LINK_FOR_TARGET=""
export OPENSSL_PREFIX=$(realpath openssl) export OPENSSL_PREFIX=$(realpath openssl)
# this fixes error: impure path 'LibFFIHeaderDirectives' used in link # this fixes error: impure path 'LibFFIHeaderDirectives' used in link
export NIX_ENFORCE_PURITY=0 export NIX_ENFORCE_PURITY=0

View File

@ -57,7 +57,7 @@ stdenv.mkDerivation rec {
# can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd # can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd
# get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by # get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by
# a flag and turn the flag off during the stdenv build. # a flag and turn the flag off during the stdenv build.
postPatch = '' postPatch = stdenv.lib.optionalString (!stdenv.isDarwin) ''
substituteInPlace cmake/builtin-config-ix.cmake \ substituteInPlace cmake/builtin-config-ix.cmake \
--replace 'set(X86 i386)' 'set(X86 i386 i486 i586 i686)' --replace 'set(X86 i386)' 'set(X86 i386 i486 i586 i686)'
'' + stdenv.lib.optionalString stdenv.isDarwin '' '' + stdenv.lib.optionalString stdenv.isDarwin ''

View File

@ -2,5 +2,5 @@
getHostRole getHostRole
linkCxxAbi="@linkCxxAbi@" linkCxxAbi="@linkCxxAbi@"
export NIX_${role_pre}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" export NIX_CXXSTDLIB_COMPILE${role_post}+=" -isystem @out@/include/c++/v1"
export NIX_${role_pre}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" export NIX_CXXSTDLIB_LINK${role_post}=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}"

View File

@ -2,5 +2,5 @@
getHostRole getHostRole
linkCxxAbi="@linkCxxAbi@" linkCxxAbi="@linkCxxAbi@"
export NIX_${role_pre}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" export NIX_CXXSTDLIB_COMPILE${role_post}+=" -isystem @out@/include/c++/v1"
export NIX_${role_pre}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" export NIX_CXXSTDLIB_LINK${role_post}=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}"

View File

@ -55,7 +55,7 @@ stdenv.mkDerivation {
# can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd # can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd
# get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by # get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by
# a flag and turn the flag off during the stdenv build. # a flag and turn the flag off during the stdenv build.
postPatch = '' postPatch = stdenv.lib.optionalString (!stdenv.isDarwin) ''
substituteInPlace cmake/builtin-config-ix.cmake \ substituteInPlace cmake/builtin-config-ix.cmake \
--replace 'set(X86 i386)' 'set(X86 i386 i486 i586 i686)' --replace 'set(X86 i386)' 'set(X86 i386 i486 i586 i686)'
'' + stdenv.lib.optionalString stdenv.isDarwin '' '' + stdenv.lib.optionalString stdenv.isDarwin ''

View File

@ -2,5 +2,5 @@
getHostRole getHostRole
linkCxxAbi="@linkCxxAbi@" linkCxxAbi="@linkCxxAbi@"
export NIX_${role_pre}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" export NIX_CXXSTDLIB_COMPILE${role_post}+=" -isystem @out@/include/c++/v1"
export NIX_${role_pre}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" export NIX_CXXSTDLIB_LINK${role_post}=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}"

View File

@ -56,7 +56,7 @@ stdenv.mkDerivation {
# can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd # can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd
# get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by # get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by
# a flag and turn the flag off during the stdenv build. # a flag and turn the flag off during the stdenv build.
postPatch = '' postPatch = stdenv.lib.optionalString (!stdenv.isDarwin) ''
substituteInPlace cmake/builtin-config-ix.cmake \ substituteInPlace cmake/builtin-config-ix.cmake \
--replace 'set(X86 i386)' 'set(X86 i386 i486 i586 i686)' --replace 'set(X86 i386)' 'set(X86 i386 i486 i586 i686)'
'' + stdenv.lib.optionalString stdenv.isDarwin '' '' + stdenv.lib.optionalString stdenv.isDarwin ''

View File

@ -2,5 +2,5 @@
getHostRole getHostRole
linkCxxAbi="@linkCxxAbi@" linkCxxAbi="@linkCxxAbi@"
export NIX_${role_pre}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" export NIX_CXXSTDLIB_COMPILE${role_post}+=" -isystem @out@/include/c++/v1"
export NIX_${role_pre}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" export NIX_CXXSTDLIB_LINK${role_post}=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}"

View File

@ -56,7 +56,7 @@ stdenv.mkDerivation {
# can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd # can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd
# get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by # get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by
# a flag and turn the flag off during the stdenv build. # a flag and turn the flag off during the stdenv build.
postPatch = '' postPatch = stdenv.lib.optionalString (!stdenv.isDarwin) ''
substituteInPlace cmake/builtin-config-ix.cmake \ substituteInPlace cmake/builtin-config-ix.cmake \
--replace 'set(X86 i386)' 'set(X86 i386 i486 i586 i686)' --replace 'set(X86 i386)' 'set(X86 i386 i486 i586 i686)'
'' + stdenv.lib.optionalString stdenv.isDarwin '' '' + stdenv.lib.optionalString stdenv.isDarwin ''

View File

@ -2,5 +2,5 @@
getHostRole getHostRole
linkCxxAbi="@linkCxxAbi@" linkCxxAbi="@linkCxxAbi@"
export NIX_${role_pre}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" export NIX_CXXSTDLIB_COMPILE${role_post}+=" -isystem @out@/include/c++/v1"
export NIX_${role_pre}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" export NIX_CXXSTDLIB_LINK${role_post}=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}"

View File

@ -55,7 +55,7 @@ stdenv.mkDerivation rec {
# can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd # can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd
# get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by # get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by
# a flag and turn the flag off during the stdenv build. # a flag and turn the flag off during the stdenv build.
postPatch = '' postPatch = stdenv.lib.optionalString (!stdenv.isDarwin) ''
substituteInPlace cmake/builtin-config-ix.cmake \ substituteInPlace cmake/builtin-config-ix.cmake \
--replace 'set(X86 i386)' 'set(X86 i386 i486 i586 i686)' --replace 'set(X86 i386)' 'set(X86 i386 i486 i586 i686)'
'' + stdenv.lib.optionalString stdenv.isDarwin '' '' + stdenv.lib.optionalString stdenv.isDarwin ''

View File

@ -2,5 +2,5 @@
getHostRole getHostRole
linkCxxAbi="@linkCxxAbi@" linkCxxAbi="@linkCxxAbi@"
export NIX_${role_pre}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1" export NIX_CXXSTDLIB_COMPILE${role_post}+=" -isystem @out@/include/c++/v1"
export NIX_${role_pre}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}" export NIX_CXXSTDLIB_LINK${role_post}=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}"

View File

@ -7,7 +7,7 @@ symlinkJoin {
postBuild = '' postBuild = ''
wrapProgram $out/bin/idris \ wrapProgram $out/bin/idris \
--run 'export IDRIS_CC=''${IDRIS_CC:-${stdenv.cc}/bin/cc}' \ --run 'export IDRIS_CC=''${IDRIS_CC:-${stdenv.cc}/bin/cc}' \
--set NIX_CC_WRAPPER_${stdenv.cc.infixSalt}_TARGET_HOST 1 \ --set 'NIX_CC_WRAPPER_TARGET_HOST_${stdenv.cc.suffixSalt}' 1 \
--prefix NIX_CFLAGS_COMPILE " " "-I${lib.getDev gmp}/include" \ --prefix NIX_CFLAGS_COMPILE " " "-I${lib.getDev gmp}/include" \
--prefix NIX_CFLAGS_LINK " " "-L${lib.getLib gmp}/lib" --prefix NIX_CFLAGS_LINK " " "-L${lib.getLib gmp}/lib"
''; '';

View File

@ -107,10 +107,10 @@ in {
sourceVersion = { sourceVersion = {
major = "3"; major = "3";
minor = "8"; minor = "8";
patch = "2"; patch = "3";
suffix = ""; suffix = "";
}; };
sha256 = "1ps5v323cp5czfshqjmbsqw7nvrdpcbk06f62jbzaqik4gfffii6"; sha256 = "0r2qg4pdvv52ld5dd95fl6lzzsxxxhbsxmymwcphh6624g3mxayz";
inherit (darwin) configd; inherit (darwin) configd;
inherit passthruFun; inherit passthruFun;
}; };

View File

@ -21,9 +21,11 @@ paths = os.environ.pop('NIX_PYTHONPATH', None)
if paths: if paths:
functools.reduce(lambda k, p: site.addsitedir(p, k), paths.split(':'), site._init_pathinfo()) functools.reduce(lambda k, p: site.addsitedir(p, k), paths.split(':'), site._init_pathinfo())
# Check whether we are in a venv. # Check whether we are in a venv or virtualenv.
# Note Python 2 does not support base_prefix so we assume we are not in a venv. # For Python 3 we check whether our `base_prefix` is different from our current `prefix`.
in_venv = sys.version_info.major == 3 and sys.prefix != sys.base_prefix # For Python 2 we check whether the non-standard `real_prefix` is set.
# https://stackoverflow.com/questions/1871549/determine-if-python-is-running-inside-virtualenv
in_venv = (sys.version_info.major == 3 and sys.prefix != sys.base_prefix) or (sys.version_info.major == 2 and hasattr(sys, "real_prefix"))
if not in_venv: if not in_venv:
executable = os.environ.pop('NIX_PYTHONEXECUTABLE', None) executable = os.environ.pop('NIX_PYTHONEXECUTABLE', None)
@ -32,8 +34,6 @@ if not in_venv:
if 'PYTHONEXECUTABLE' not in os.environ and executable is not None: if 'PYTHONEXECUTABLE' not in os.environ and executable is not None:
sys.executable = executable sys.executable = executable
if prefix is not None: if prefix is not None:
# Because we cannot check with Python 2 whether we are in a venv, # Sysconfig does not like it when sys.prefix is set to None
# creating a venv from a Nix env won't work as well with Python 2.
# Also, note that sysconfig does not like it when sys.prefix is set to None
sys.prefix = sys.exec_prefix = prefix sys.prefix = sys.exec_prefix = prefix
site.PREFIXES.insert(0, prefix) site.PREFIXES.insert(0, prefix)

View File

@ -19,10 +19,8 @@ let
is_nixenv = "False"; is_nixenv = "False";
is_virtualenv = "False"; is_virtualenv = "False";
}; };
} // lib.optionalAttrs (python.isPy3k && !python.isPyPy) { } // lib.optionalAttrs (!python.isPyPy) {
# Use virtualenv from a Nix env. # Use virtualenv from a Nix env.
# Does not function with Python 2
# ValueError: source and destination is the same /nix/store/38kz3j1a87cq5y59k5w7k9yk4cqgc5b2-python-2.7.18/lib/python2.7/os.py
nixenv-virtualenv = rec { nixenv-virtualenv = rec {
env = runCommand "${python.name}-virtualenv" {} '' env = runCommand "${python.name}-virtualenv" {} ''
${pythonVirtualEnv.interpreter} -m virtualenv $out ${pythonVirtualEnv.interpreter} -m virtualenv $out
@ -39,7 +37,7 @@ let
interpreter = env.interpreter; interpreter = env.interpreter;
is_venv = "False"; is_venv = "False";
is_nixenv = "True"; is_nixenv = "True";
is_virtualenv = "True"; is_virtualenv = "False";
}; };
} // lib.optionalAttrs (python.isPy3k && (!python.isPyPy)) rec { } // lib.optionalAttrs (python.isPy3k && (!python.isPyPy)) rec {
# Venv built using plain Python # Venv built using plain Python
@ -52,7 +50,7 @@ let
interpreter = "${env}/bin/${python.executable}"; interpreter = "${env}/bin/${python.executable}";
is_venv = "True"; is_venv = "True";
is_nixenv = "False"; is_nixenv = "False";
is_virtualenv = "True"; is_virtualenv = "False";
}; };
} // lib.optionalAttrs (python.pythonAtLeast "3.8") { } // lib.optionalAttrs (python.pythonAtLeast "3.8") {
@ -66,7 +64,7 @@ let
interpreter = "${env}/bin/${pythonEnv.executable}"; interpreter = "${env}/bin/${pythonEnv.executable}";
is_venv = "True"; is_venv = "True";
is_nixenv = "True"; is_nixenv = "True";
is_virtualenv = "True"; is_virtualenv = "False";
}; };
}; };

View File

@ -43,6 +43,10 @@ class TestCasePython(unittest.TestCase):
else: else:
self.assertEqual(sys.prefix, sys.base_prefix) self.assertEqual(sys.prefix, sys.base_prefix)
@unittest.skipIf(sys.version_info.major==3, "sys.real_prefix is only set by virtualenv in case of Python 2.")
def test_real_prefix(self):
self.assertTrue(hasattr(sys, "real_prefix") == IS_VIRTUALENV)
def test_python_version(self): def test_python_version(self):
self.assertTrue(platform.python_version().startswith(PYTHON_VERSION)) self.assertTrue(platform.python_version().startswith(PYTHON_VERSION))

View File

@ -2,11 +2,11 @@
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "lilv"; pname = "lilv";
version = "0.24.6"; version = "0.24.8";
src = fetchurl { src = fetchurl {
url = "https://download.drobilla.net/${pname}-${version}.tar.bz2"; url = "https://download.drobilla.net/${pname}-${version}.tar.bz2";
sha256 = "1p3hafsxgs5d4za7n66lf5nz74qssfqpmk520cm7iq2njvvlqm2z"; sha256 = "0063i5zgf3d3accwmyx651hw0wh5ik7kji2hvfkcdbl1qia3dp6a";
}; };
patches = [ ./lilv-pkgconfig.patch ]; patches = [ ./lilv-pkgconfig.patch ];

View File

@ -163,7 +163,6 @@ stdenv.mkDerivation rec {
] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ ] ++ optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
"--cross-prefix=${stdenv.cc.targetPrefix}" "--cross-prefix=${stdenv.cc.targetPrefix}"
"--enable-cross-compile" "--enable-cross-compile"
"--pkg-config=pkg-config" # Override ffmpeg's ./configure assumption that pkg-config is prefixed by the architecture. (e.g. aarch64-unknown-linux-gnu-pkg-config)
] ++ optional stdenv.cc.isClang "--cc=clang"); ] ++ optional stdenv.cc.isClang "--cc=clang");
depsBuildBuild = [ buildPackages.stdenv.cc ]; depsBuildBuild = [ buildPackages.stdenv.cc ];
@ -174,7 +173,7 @@ stdenv.mkDerivation rec {
libvorbis lzma soxr x264 x265 xvidcore zlib libopus speex nv-codec-headers libvorbis lzma soxr x264 x265 xvidcore zlib libopus speex nv-codec-headers
] ++ optionals openglSupport [ libGL libGLU ] ] ++ optionals openglSupport [ libGL libGLU ]
++ optional libmfxSupport intel-media-sdk ++ optional libmfxSupport intel-media-sdk
++ optional vpxSupport libaom ++ optional libaomSupport libaom
++ optional vpxSupport libvpx ++ optional vpxSupport libvpx
++ optionals (!isDarwin && !isAarch32) [ libpulseaudio ] # Need to be fixed on Darwin and ARM ++ optionals (!isDarwin && !isAarch32) [ libpulseaudio ] # Need to be fixed on Darwin and ARM
++ optional ((isLinux || isFreeBSD) && !isAarch32) libva ++ optional ((isLinux || isFreeBSD) && !isAarch32) libva
@ -199,9 +198,10 @@ stdenv.mkDerivation rec {
--replace "includedir=$out" "includedir=''${!outputInclude}" --replace "includedir=$out" "includedir=''${!outputInclude}"
done done
'' + optionalString stdenv.isLinux '' '' + optionalString stdenv.isLinux ''
# Set RUNPATH so that libnvcuvid in /run/opengl-driver(-32)/lib can be found. # Set RUNPATH so that libnvcuvid and libcuda in /run/opengl-driver(-32)/lib can be found.
# See the explanation in addOpenGLRunpath. # See the explanation in addOpenGLRunpath.
addOpenGLRunpath $out/lib/libavcodec.so* addOpenGLRunpath $out/lib/libavcodec.so
addOpenGLRunpath $out/lib/libavutil.so
''; '';
installFlags = [ "install-man" ]; installFlags = [ "install-man" ];

View File

@ -14,7 +14,7 @@ let
in stdenv.mkDerivation rec { in stdenv.mkDerivation rec {
pname = "freetype"; pname = "freetype";
version = "2.10.1"; version = "2.10.2";
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "A font rendering engine"; description = "A font rendering engine";
@ -33,7 +33,7 @@ in stdenv.mkDerivation rec {
src = fetchurl { src = fetchurl {
url = "mirror://savannah/${pname}/${pname}-${version}.tar.xz"; url = "mirror://savannah/${pname}/${pname}-${version}.tar.xz";
sha256 = "0vx2dg1jh5kq34dd6ifpjywkpapp8a7p1bvyq9yq5zi1i94gmnqn"; sha256 = "12rd181yzz6952cyjqaa4253f5szam93cmhw18p33rnj4l8dchqm";
}; };
propagatedBuildInputs = [ zlib bzip2 libpng ]; # needed when linking against freetype propagatedBuildInputs = [ zlib bzip2 libpng ]; # needed when linking against freetype

View File

@ -1,23 +1,43 @@
{ stdenv, fetchurl, nixosTests, fixDarwinDylibNames, meson, ninja, pkgconfig, gettext, python3, libxml2, libxslt, docbook_xsl { stdenv
, docbook_xml_dtd_43, gtk-doc, glib, libtiff, libjpeg, libpng, libX11, gnome3 , fetchurl
, gobject-introspection, doCheck ? false, makeWrapper , nixosTests
, fixDarwinDylibNames
, meson
, ninja
, pkg-config
, gettext
, python3
, libxml2
, libxslt
, docbook-xsl-nons
, docbook_xml_dtd_43
, gtk-doc
, glib
, libtiff
, libjpeg
, libpng
, gnome3
, gobject-introspection
, doCheck ? false
, makeWrapper
, fetchpatch , fetchpatch
}: }:
let stdenv.mkDerivation rec {
pname = "gdk-pixbuf"; pname = "gdk-pixbuf";
version = "2.40.0"; version = "2.40.0";
in stdenv.mkDerivation rec {
name = "${pname}-${version}"; outputs = [ "out" "dev" "man" "devdoc" "installedTests" ];
src = fetchurl { src = fetchurl {
url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz"; url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
sha256 = "1rnlx9yfw970maxi2x6niaxmih5la11q1ilr7gzshz2kk585k0hm"; sha256 = "1rnlx9yfw970maxi2x6niaxmih5la11q1ilr7gzshz2kk585k0hm";
}; };
patches = [ patches = [
# Move installed tests to a separate output # Move installed tests to a separate output
./installed-tests-path.patch ./installed-tests-path.patch
# Temporary until the fix is released. # Temporary until the fix is released.
(fetchpatch { (fetchpatch {
name = "tests-circular-table.patch"; name = "tests-circular-table.patch";
@ -26,24 +46,34 @@ in stdenv.mkDerivation rec {
}) })
]; ];
outputs = [ "out" "dev" "man" "devdoc" "installedTests" ];
setupHook = ./setup-hook.sh;
# !!! We might want to factor out the gdk-pixbuf-xlib subpackage.
buildInputs = [ libX11 ];
nativeBuildInputs = [ nativeBuildInputs = [
meson ninja pkgconfig gettext python3 libxml2 libxslt docbook_xsl docbook_xml_dtd_43 meson
gtk-doc gobject-introspection makeWrapper glib ninja
] pkg-config
++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames; gettext
python3
libxml2
libxslt
docbook-xsl-nons
docbook_xml_dtd_43
gtk-doc
gobject-introspection
makeWrapper
glib
] ++ stdenv.lib.optional stdenv.isDarwin [
fixDarwinDylibNames
];
propagatedBuildInputs = [ glib libtiff libjpeg libpng ]; propagatedBuildInputs = [
glib
libtiff
libjpeg
libpng
];
mesonFlags = [ mesonFlags = [
"-Ddocs=true" "-Ddocs=true"
"-Dx11=true" "-Dx11=false" # use gdk-pixbuf-xlib
"-Dgir=${if gobject-introspection != null then "true" else "false"}" "-Dgir=${if gobject-introspection != null then "true" else "false"}"
"-Dgio_sniffing=false" "-Dgio_sniffing=false"
]; ];
@ -87,6 +117,8 @@ in stdenv.mkDerivation rec {
# The tests take an excessive amount of time (> 1.5 hours) and memory (> 6 GB). # The tests take an excessive amount of time (> 1.5 hours) and memory (> 6 GB).
inherit doCheck; inherit doCheck;
setupHook = ./setup-hook.sh;
passthru = { passthru = {
updateScript = gnome3.updateScript { updateScript = gnome3.updateScript {
packageName = pname; packageName = pname;
@ -102,8 +134,8 @@ in stdenv.mkDerivation rec {
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "A library for image loading and manipulation"; description = "A library for image loading and manipulation";
homepage = "http://library.gnome.org/devel/gdk-pixbuf/"; homepage = "https://gitlab.gnome.org/GNOME/gdk-pixbuf";
maintainers = [ maintainers.eelco ]; maintainers = [ maintainers.eelco ] ++ teams.gnome.members;
license = licenses.lgpl21; license = licenses.lgpl21;
platforms = platforms.unix; platforms = platforms.unix;
}; };

View File

@ -0,0 +1,55 @@
{ stdenv
, fetchFromGitLab
, meson
, ninja
, pkg-config
, docbook-xsl-nons
, docbook_xml_dtd_43
, gtk-doc
, gdk-pixbuf
, libX11
}:
stdenv.mkDerivation rec {
pname = "gdk-pixbuf-xlib";
version = "2019-10-19-unstable";
outputs = [ "out" "dev" "devdoc" ];
src = fetchFromGitLab {
domain = "gitlab.gnome.org";
owner = "Archive";
repo = "gdk-pixbuf-xlib";
rev = "dc22ea36f69755007c66877284596df270532cc1";
sha256 = "XhBQ4wano+MtGaqF6JNKoWgYQN6eBW+b8ZCGEBGt8IM=";
};
nativeBuildInputs = [
meson
ninja
pkg-config
docbook-xsl-nons
docbook_xml_dtd_43
gtk-doc
];
buildInputs = [
libX11
];
propagatedBuildInputs = [
gdk-pixbuf
];
mesonFlags = [
"-Dgtk_doc=true"
];
meta = with stdenv.lib; {
description = "Deprecated API for integrating GdkPixbuf with Xlib data types";
homepage = "https://gitlab.gnome.org/Archive/gdk-pixbuf-xlib";
maintainers = teams.gnome.members;
license = licenses.lgpl21Plus;
platforms = platforms.unix;
};
}

View File

@ -13,5 +13,5 @@ addEnvHooks "$hostOffset" gettextDataDirsHook
if [ -n "@gettextNeedsLdflags@" -a -z "${dontAddExtraLibs-}" ]; then if [ -n "@gettextNeedsLdflags@" -a -z "${dontAddExtraLibs-}" ]; then
# See pkgs/build-support/setup-hooks/role.bash # See pkgs/build-support/setup-hooks/role.bash
getHostRole getHostRole
export NIX_${role_pre}LDFLAGS+=" -lintl" export NIX_LDFLAGS${role_post}+=" -lintl"
fi fi

View File

@ -48,11 +48,11 @@ in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "glib"; pname = "glib";
version = "2.64.1"; version = "2.64.3";
src = fetchurl { src = fetchurl {
url = "mirror://gnome/sources/glib/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz"; url = "mirror://gnome/sources/glib/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
sha256 = "1ixvjmsrj45xq9bq3chhj98jhgcsqa08v627mjx6sjxlph1pd5hp"; sha256 = "08pbgiv5m3rica4ydvwvpq5mrxbyswx7l1jzjc2ch52xjabvr77y";
}; };
patches = optionals stdenv.isDarwin [ patches = optionals stdenv.isDarwin [

View File

@ -140,3 +140,46 @@
def extract_libtool(la_file): def extract_libtool(la_file):
--- a/tests/scanner/test_shlibs.py
+++ b/tests/scanner/test_shlibs.py
@@ -7,6 +7,30 @@ from giscanner.shlibs import resolve_from_ldd_output, sanitize_shlib_path
class TestLddParser(unittest.TestCase):
+ def test_resolve_from_ldd_output_nix(self):
+ output = '''\
+ libglib-2.0.so.0 => @nixStoreDir@/gmrf09y7sfxrr0mcx90dba7w41jj2kzk-glib-2.58.1/lib/libglib-2.0.so.0 (0x00007f0ee1b28000)
+ libgobject-2.0.so.0 => @nixStoreDir@/gmrf09y7sfxrr0mcx90dba7w41jj2kzk-glib-2.58.1/lib/libgobject-2.0.so.0 (0x00007f0ee18cf000)
+ libgio-2.0.so.0 => @nixStoreDir@/gmrf09y7sfxrr0mcx90dba7w41jj2kzk-glib-2.58.1/lib/libgio-2.0.so.0 (0x00007f0ee1502000)
+ libxml2.so.2 => @nixStoreDir@/72mxkk74cv266snkjpz1kwl1i2rg8rpc-libxml2-2.9.8/lib/libxml2.so.2 (0x00007f0ee119c000)
+ libsqlite3.so.0 => @nixStoreDir@/ck5ay23hsmlc67pg3m34kzd1k2hhvww0-sqlite-3.24.0/lib/libsqlite3.so.0 (0x00007f0ee0e98000)
+ libpsl.so.5 => @nixStoreDir@/qn3l2gn7m76f318676wflrs2z6d4rrkj-libpsl-0.20.2-list-2017-02-03/lib/libpsl.so.5 (0x00007f0ee0c88000)
+ libc.so.6 => @nixStoreDir@/g2yk54hifqlsjiha3szr4q3ccmdzyrdv-glibc-2.27/lib/libc.so.6 (0x00007f0ee08d4000)
+ libpcre.so.1 => @nixStoreDir@/hxbq8lpc53qsf1bc0dfcsm47wmcxzjvh-pcre-8.42/lib/libpcre.so.1 (0x00007f0ee0662000)
+ @nixStoreDir@/g2yk54hifqlsjiha3szr4q3ccmdzyrdv-glibc-2.27/lib64/ld-linux-x86-64.so.2 (0x00007f0ee20ff000)
+ libblkid.so.1 => @nixStoreDir@/q0kgnq21j0l2yd77gdlld371246cwghh-util-linux-2.32.1/lib/libblkid.so.1 (0x00007f0edd0cd000)
+ libuuid.so.1 => @nixStoreDir@/q0kgnq21j0l2yd77gdlld371246cwghh-util-linux-2.32.1/lib/libuuid.so.1 (0x00007f0edcec5000)
+ librt.so.1 => @nixStoreDir@/g2yk54hifqlsjiha3szr4q3ccmdzyrdv-glibc-2.27/lib/librt.so.1 (0x00007f0edccbd000)
+ libstdc++.so.6 => @nixStoreDir@/3v5r7fkrbkw2qajadvjbf6p6qriz9p1i-gcc-7.3.0-lib/lib/libstdc++.so.6 (0x00007f0edc936000)
+ libgcc_s.so.1 => @nixStoreDir@/g2yk54hifqlsjiha3szr4q3ccmdzyrdv-glibc-2.27/lib/libgcc_s.so.1 (0x00007f0edc720000)
+ '''
+ libraries = ['glib-2.0', 'gio-2.0']
+
+ self.assertEqual(
+ ['@nixStoreDir@/gmrf09y7sfxrr0mcx90dba7w41jj2kzk-glib-2.58.1/lib/libglib-2.0.so.0',
+ '@nixStoreDir@/gmrf09y7sfxrr0mcx90dba7w41jj2kzk-glib-2.58.1/lib/libgio-2.0.so.0'],
+ resolve_from_ldd_output(libraries, output))
+
def test_resolve_from_ldd_output(self):
output = '''\
libglib-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fbe12d68000)
@@ -40,7 +64,8 @@ class TestLddParser(unittest.TestCase):
self.assertEqual(
sanitize_shlib_path('/foo/bar'),
- '/foo/bar' if sys.platform == 'darwin' else 'bar')
+ # NixOS always want the absolute path
+ '/foo/bar')
def test_unresolved_library(self):
output = ''

View File

@ -1,61 +1,97 @@
{ stdenv, fetchurl, glib, flex, bison, meson, ninja, pkgconfig, libffi, python3 { stdenv
, libintl, cctools, cairo, gnome3, glibcLocales , fetchurl
, substituteAll, nixStoreDir ? builtins.storeDir , glib
, flex
, bison
, meson
, ninja
, gtk-doc
, docbook-xsl-nons
, docbook_xml_dtd_43
, docbook_xml_dtd_45
, pkg-config
, libffi
, python3
, cctools
, cairo
, gnome3
, substituteAll
, nixStoreDir ? builtins.storeDir
, x11Support ? true , x11Support ? true
}: }:
# now that gobject-introspection creates large .gir files (eg gtk3 case) # now that gobject-introspection creates large .gir files (eg gtk3 case)
# it may be worth thinking about using multiple derivation outputs # it may be worth thinking about using multiple derivation outputs
# In that case its about 6MB which could be separated # In that case its about 6MB which could be separated
with stdenv.lib;
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "gobject-introspection"; pname = "gobject-introspection";
version = "1.64.1"; version = "1.64.1";
# outputs TODO: share/gobject-introspection-1.0/tests is needed during build
# by pygobject3 (and maybe others), but it's only searched in $out
outputs = [ "out" "dev" "devdoc" "man" ];
outputBin = "dev";
src = fetchurl { src = fetchurl {
url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz"; url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
sha256 = "19vz7vp10h0zj3f491yk72dp89bix6rgkzxg4qcm4d6151ksxgl0"; sha256 = "19vz7vp10h0zj3f491yk72dp89bix6rgkzxg4qcm4d6151ksxgl0";
}; };
outputs = [ "out" "dev" "man" ]; patches = [
outputBin = "dev"; # Make g-ir-scanner put absolute path to GIR files it generates
# so that programs can just dlopen them without having to muck
# with LD_LIBRARY_PATH environment variable.
(substituteAll {
src = ./absolute_shlib_path.patch;
inherit nixStoreDir;
})
] ++ stdenv.lib.optionals x11Support [
# Hardcode the cairo shared library path in the Cairo gir shipped with this package.
# https://github.com/NixOS/nixpkgs/issues/34080
(substituteAll {
src = ./absolute_gir_path.patch;
cairoLib = "${stdenv.lib.getLib cairo}/lib";
})
];
LC_ALL = "en_US.UTF-8"; # for tests nativeBuildInputs = [
meson
ninja
pkg-config
flex
bison
gtk-doc
docbook-xsl-nons
docbook_xml_dtd_43 # FIXME: remove in next release
docbook_xml_dtd_45
python3
setupHook # move .gir files
];
nativeBuildInputs = [ meson ninja pkgconfig libintl glibcLocales ]; buildInputs = [
buildInputs = [ flex bison python3 setupHook/*move .gir*/ ] python3
++ stdenv.lib.optional stdenv.isDarwin cctools; ];
propagatedBuildInputs = [ libffi glib ];
checkInputs = stdenv.lib.optionals stdenv.isDarwin [
cctools # for otool
];
propagatedBuildInputs = [
libffi
glib
];
mesonFlags = [ mesonFlags = [
"--datadir=${placeholder "dev"}/share" "--datadir=${placeholder "dev"}/share"
"-Ddoctool=disabled" "-Ddoctool=disabled"
"-Dcairo=disabled" "-Dcairo=disabled"
"-Dgtk_doc=true"
]; ];
# outputs TODO: share/gobject-introspection-1.0/tests is needed during build
# by pygobject3 (and maybe others), but it's only searched in $out
setupHook = ./setup-hook.sh;
patches = [
(substituteAll {
src = ./test_shlibs.patch;
inherit nixStoreDir;
})
(substituteAll {
src = ./absolute_shlib_path.patch;
inherit nixStoreDir;
})
] ++ stdenv.lib.optional x11Support # https://github.com/NixOS/nixpkgs/issues/34080
(substituteAll {
src = ./absolute_gir_path.patch;
cairoLib = "${getLib cairo}/lib";
});
doCheck = !stdenv.isAarch64; doCheck = !stdenv.isAarch64;
preBuild = '' preCheck = ''
# Our gobject-introspection patches make the shared library paths absolute # Our gobject-introspection patches make the shared library paths absolute
# in the GIR files. When running tests, the library is not yet installed, # in the GIR files. When running tests, the library is not yet installed,
# though, so we need to replace the absolute path with a local one during build. # though, so we need to replace the absolute path with a local one during build.
@ -64,10 +100,12 @@ stdenv.mkDerivation rec {
ln -s $PWD/tests/scanner/libregress-1.0${stdenv.targetPlatform.extensions.sharedLibrary} $out/lib/libregress-1.0${stdenv.targetPlatform.extensions.sharedLibrary} ln -s $PWD/tests/scanner/libregress-1.0${stdenv.targetPlatform.extensions.sharedLibrary} $out/lib/libregress-1.0${stdenv.targetPlatform.extensions.sharedLibrary}
''; '';
preInstall = '' postCheck = ''
rm $out/lib/libregress-1.0${stdenv.targetPlatform.extensions.sharedLibrary} rm $out/lib/libregress-1.0${stdenv.targetPlatform.extensions.sharedLibrary}
''; '';
setupHook = ./setup-hook.sh;
passthru = { passthru = {
updateScript = gnome3.updateScript { updateScript = gnome3.updateScript {
packageName = pname; packageName = pname;
@ -76,9 +114,9 @@ stdenv.mkDerivation rec {
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "A middleware layer between C libraries and language bindings"; description = "A middleware layer between C libraries and language bindings";
homepage = "http://live.gnome.org/GObjectIntrospection"; homepage = "https://gi.readthedocs.io/";
maintainers = with maintainers; [ lovek323 lethalman ]; maintainers = teams.gnome.members ++ (with maintainers; [ lovek323 ]);
platforms = platforms.unix; platforms = platforms.unix;
license = with licenses; [ gpl2 lgpl2 ]; license = with licenses; [ gpl2 lgpl2 ];
longDescription = '' longDescription = ''

View File

@ -1,43 +0,0 @@
--- a/tests/scanner/test_shlibs.py
+++ b/tests/scanner/test_shlibs.py
@@ -7,6 +7,30 @@ from giscanner.shlibs import resolve_from_ldd_output, sanitize_shlib_path
class TestLddParser(unittest.TestCase):
+ def test_resolve_from_ldd_output_nix(self):
+ output = '''\
+ libglib-2.0.so.0 => @nixStoreDir@/gmrf09y7sfxrr0mcx90dba7w41jj2kzk-glib-2.58.1/lib/libglib-2.0.so.0 (0x00007f0ee1b28000)
+ libgobject-2.0.so.0 => @nixStoreDir@/gmrf09y7sfxrr0mcx90dba7w41jj2kzk-glib-2.58.1/lib/libgobject-2.0.so.0 (0x00007f0ee18cf000)
+ libgio-2.0.so.0 => @nixStoreDir@/gmrf09y7sfxrr0mcx90dba7w41jj2kzk-glib-2.58.1/lib/libgio-2.0.so.0 (0x00007f0ee1502000)
+ libxml2.so.2 => @nixStoreDir@/72mxkk74cv266snkjpz1kwl1i2rg8rpc-libxml2-2.9.8/lib/libxml2.so.2 (0x00007f0ee119c000)
+ libsqlite3.so.0 => @nixStoreDir@/ck5ay23hsmlc67pg3m34kzd1k2hhvww0-sqlite-3.24.0/lib/libsqlite3.so.0 (0x00007f0ee0e98000)
+ libpsl.so.5 => @nixStoreDir@/qn3l2gn7m76f318676wflrs2z6d4rrkj-libpsl-0.20.2-list-2017-02-03/lib/libpsl.so.5 (0x00007f0ee0c88000)
+ libc.so.6 => @nixStoreDir@/g2yk54hifqlsjiha3szr4q3ccmdzyrdv-glibc-2.27/lib/libc.so.6 (0x00007f0ee08d4000)
+ libpcre.so.1 => @nixStoreDir@/hxbq8lpc53qsf1bc0dfcsm47wmcxzjvh-pcre-8.42/lib/libpcre.so.1 (0x00007f0ee0662000)
+ @nixStoreDir@/g2yk54hifqlsjiha3szr4q3ccmdzyrdv-glibc-2.27/lib64/ld-linux-x86-64.so.2 (0x00007f0ee20ff000)
+ libblkid.so.1 => @nixStoreDir@/q0kgnq21j0l2yd77gdlld371246cwghh-util-linux-2.32.1/lib/libblkid.so.1 (0x00007f0edd0cd000)
+ libuuid.so.1 => @nixStoreDir@/q0kgnq21j0l2yd77gdlld371246cwghh-util-linux-2.32.1/lib/libuuid.so.1 (0x00007f0edcec5000)
+ librt.so.1 => @nixStoreDir@/g2yk54hifqlsjiha3szr4q3ccmdzyrdv-glibc-2.27/lib/librt.so.1 (0x00007f0edccbd000)
+ libstdc++.so.6 => @nixStoreDir@/3v5r7fkrbkw2qajadvjbf6p6qriz9p1i-gcc-7.3.0-lib/lib/libstdc++.so.6 (0x00007f0edc936000)
+ libgcc_s.so.1 => @nixStoreDir@/g2yk54hifqlsjiha3szr4q3ccmdzyrdv-glibc-2.27/lib/libgcc_s.so.1 (0x00007f0edc720000)
+ '''
+ libraries = ['glib-2.0', 'gio-2.0']
+
+ self.assertEqual(
+ ['@nixStoreDir@/gmrf09y7sfxrr0mcx90dba7w41jj2kzk-glib-2.58.1/lib/libglib-2.0.so.0',
+ '@nixStoreDir@/gmrf09y7sfxrr0mcx90dba7w41jj2kzk-glib-2.58.1/lib/libgio-2.0.so.0'],
+ resolve_from_ldd_output(libraries, output))
+
def test_resolve_from_ldd_output(self):
output = '''\
libglib-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007fbe12d68000)
@@ -40,7 +64,8 @@ class TestLddParser(unittest.TestCase):
self.assertEqual(
sanitize_shlib_path('/foo/bar'),
- '/foo/bar' if sys.platform == 'darwin' else 'bar')
+ # NixOS always want the absolute path
+ '/foo/bar')
def test_unresolved_library(self):
output = ''

View File

@ -117,7 +117,7 @@ in stdenv.mkDerivation rec {
makeFlags = [ makeFlags = [
"prefix=${placeholder "out"}" "prefix=${placeholder "out"}"
"PKG_CONFIG=${pkgconfig}/bin/pkg-config" "PKG_CONFIG=${pkgconfig}/bin/${pkgconfig.targetPrefix}pkg-config"
]; ];
# The .pc files does not declare an `includedir=`, so the multiple # The .pc files does not declare an `includedir=`, so the multiple

View File

@ -2,11 +2,11 @@
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "iso-codes"; pname = "iso-codes";
version = "4.4"; version = "4.5.0";
src = fetchurl { src = fetchurl {
url = "https://salsa.debian.org/iso-codes-team/iso-codes/-/archive/${pname}-${version}/${pname}-${pname}-${version}.tar.bz2"; url = "https://salsa.debian.org/iso-codes-team/iso-codes/-/archive/${pname}-${version}/${pname}-${pname}-${version}.tar.bz2";
sha256 = "02x0wcz783ammkdrmrh31wsmww481xbkbz70vf766ivbnn5sfxn6"; sha256 = "17nnyx07q8vbyqsxbvp4m5s2nrc4fxl3dvgbgmkqww2wl4x1fv9y";
}; };
patchPhase = '' patchPhase = ''

View File

@ -1,11 +1,11 @@
{stdenv, fetchurl}: {stdenv, fetchurl}:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "jansson-2.12"; name = "jansson-2.13.1";
src = fetchurl { src = fetchurl {
url = "http://www.digip.org/jansson/releases/${name}.tar.gz"; url = "http://www.digip.org/jansson/releases/${name}.tar.gz";
sha256 = "1jfj4xq3rdgnkxval1x2gqwhaam34qdxbplsj5fsrvs8a1vfr3az"; sha256 = "0ks7gbs0j8p4dmmi2sq129mxy5gfg0z6220i1jk020mi2zd7gwzl";
}; };
meta = with stdenv.lib; { meta = with stdenv.lib; {

View File

@ -2,14 +2,16 @@
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "libaom"; pname = "libaom";
version = "1.0.0-errata1"; version = "2.0.0";
src = fetchgit { src = fetchgit {
url = "https://aomedia.googlesource.com/aom"; url = "https://aomedia.googlesource.com/aom";
rev = "v${version}"; rev = "v${version}";
sha256 = "090phh4jl9z6m2pwpfpwcjh6iyw0byngb2n112qxkg6a3gsaa62f"; sha256 = "1616xjhj6770ykn82ml741h8hx44v507iky3s9h7a5lnk9d4cxzy";
}; };
patches = [ ./outputs.patch ];
nativeBuildInputs = [ nativeBuildInputs = [
yasm perl cmake pkgconfig python3 yasm perl cmake pkgconfig python3
]; ];
@ -24,10 +26,30 @@ stdenv.mkDerivation rec {
export PATH=$NIX_BUILD_TOP:$PATH export PATH=$NIX_BUILD_TOP:$PATH
''; '';
# Configuration options:
# https://aomedia.googlesource.com/aom/+/refs/heads/master/build/cmake/aom_config_defaults.cmake
cmakeFlags = [
"-DBUILD_SHARED_LIBS=ON"
"-DENABLE_TESTS=OFF"
];
postFixup = ''
moveToOutput lib/libaom.a "$static"
'';
outputs = [ "out" "bin" "dev" "static" ];
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "AV1 Bitstream and Decoding Library"; description = "Alliance for Open Media AV1 codec library";
longDescription = ''
Libaom is the reference implementation of the AV1 codec from the Alliance
for Open Media. It contains an AV1 library as well as applications like
an encoder (aomenc) and a decoder (aomdec).
'';
homepage = "https://aomedia.org/av1-features/get-started/"; homepage = "https://aomedia.org/av1-features/get-started/";
maintainers = with maintainers; [ kiloreux ]; changelog = "https://aomedia.googlesource.com/aom/+/refs/tags/v${version}/CHANGELOG";
maintainers = with maintainers; [ primeos kiloreux ];
platforms = platforms.all; platforms = platforms.all;
license = licenses.bsd2; license = licenses.bsd2;
}; };

View File

@ -0,0 +1,45 @@
--- a/build/cmake/aom_install.cmake
+++ b/build/cmake/aom_install.cmake
@@ -45,2 +45,2 @@ macro(setup_aom_install_targets)
- -DCMAKE_INSTALL_INCLUDEDIR=${CMAKE_INSTALL_INCLUDEDIR}
- -DCMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}
+ -DCMAKE_INSTALL_FULL_INCLUDEDIR=${CMAKE_INSTALL_FULL_INCLUDEDIR}
+ -DCMAKE_INSTALL_FULL_LIBDIR=${CMAKE_INSTALL_FULL_LIBDIR}
@@ -82,14 +82,14 @@ macro(setup_aom_install_targets)
install(
FILES ${AOM_INSTALL_INCS}
- DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/aom")
+ DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}/aom")
install(
FILES "${AOM_PKG_CONFIG_FILE}"
- DESTINATION "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/pkgconfig")
+ DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig")
install(TARGETS ${AOM_INSTALL_LIBS} DESTINATION
- "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
+ "${CMAKE_INSTALL_FULL_LIBDIR}")
if(ENABLE_EXAMPLES)
install(TARGETS ${AOM_INSTALL_BINS} DESTINATION
- "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}")
+ "${CMAKE_INSTALL_FULL_BINDIR}")
endif()
endif()
--- a/build/cmake/pkg_config.cmake
+++ b/build/cmake/pkg_config.cmake
@@ -14,2 +14,2 @@
- "CMAKE_INSTALL_BINDIR" "CMAKE_INSTALL_INCLUDEDIR"
- "CMAKE_INSTALL_LIBDIR" "CMAKE_PROJECT_NAME"
+ "CMAKE_INSTALL_BINDIR" "CMAKE_INSTALL_FULL_INCLUDEDIR"
+ "CMAKE_INSTALL_FULL_LIBDIR" "CMAKE_PROJECT_NAME"
@@ -38,4 +38,4 @@ endif()
-set(prefix "${CMAKE_INSTALL_PREFIX}")
-set(bindir "${CMAKE_INSTALL_BINDIR}")
-set(includedir "${CMAKE_INSTALL_INCLUDEDIR}")
-set(libdir "${CMAKE_INSTALL_LIBDIR}")
+get_filename_component(prefix "${CMAKE_INSTALL_FULL_INCLUDEDIR}" DIRECTORY)
+get_filename_component(exec_prefix "${CMAKE_INSTALL_FULL_LIBDIR}" DIRECTORY)
+get_filename_component(includedir "${CMAKE_INSTALL_FULL_INCLUDEDIR}" NAME)
+get_filename_component(libdir "${CMAKE_INSTALL_FULL_LIBDIR}" NAME)
@@ -46 +46 @@ file(APPEND "${pkgconfig_file}" "prefix=${prefix}\n")
-file(APPEND "${pkgconfig_file}" "exec_prefix=\${prefix}\n")
+file(APPEND "${pkgconfig_file}" "exec_prefix=${exec_prefix}\n")

View File

@ -10,13 +10,13 @@ assert xarSupport -> libxml2 != null;
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "libarchive"; pname = "libarchive";
version = "3.4.2"; version = "3.4.3";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "libarchive"; owner = "libarchive";
repo = "libarchive"; repo = "libarchive";
rev = "v${version}"; rev = "v${version}";
sha256 = "0mjm77wbqs8sbn9j44lj39nwbg6anmgz6pkyfxsww54a4rs0p3iz"; sha256 = "1y0v03p6zyv6plr2p0pid1qfgmk8hd427spj8xa93mcdmq5yc3s0";
}; };
outputs = [ "out" "lib" "dev" ]; outputs = [ "out" "lib" "dev" ];

View File

@ -4,7 +4,7 @@
}: }:
let let
version = "2.2"; version = "2.3";
in stdenv.mkDerivation rec { in stdenv.mkDerivation rec {
pname = "libbytesize"; pname = "libbytesize";
inherit version; inherit version;
@ -13,7 +13,7 @@ in stdenv.mkDerivation rec {
owner = "storaged-project"; owner = "storaged-project";
repo = "libbytesize"; repo = "libbytesize";
rev = version; rev = version;
sha256 = "0n4gmn68ypsk3gcw6akcghlgk3aj3wskwg3mlg93cw5y3a33nbhm"; sha256 = "1nrlmn63k0ix1yzn8v4lni5n5b4c0b6w9f33p1ig113ymmdvcc0h";
}; };
outputs = [ "out" "dev" "devdoc" ]; outputs = [ "out" "dev" "devdoc" ];

View File

@ -4,5 +4,5 @@
# See pkgs/build-support/setup-hooks/role.bash # See pkgs/build-support/setup-hooks/role.bash
if [ -z "${dontAddExtraLibs-}" ]; then if [ -z "${dontAddExtraLibs-}" ]; then
getHostRole getHostRole
export NIX_${role_pre}LDFLAGS+=" -liconv" export NIX_LDFLAGS${role_post}+=" -liconv"
fi fi

View File

@ -2,11 +2,11 @@
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "libqmi"; pname = "libqmi";
version = "1.24.10"; version = "1.24.12";
src = fetchurl { src = fetchurl {
url = "https://www.freedesktop.org/software/libqmi/${pname}-${version}.tar.xz"; url = "https://www.freedesktop.org/software/libqmi/${pname}-${version}.tar.xz";
sha256 = "1rzxapr6hb18ccvqh5fizx7zk63l47bs0p3gizycz2ysnm1i44n2"; sha256 = "0scb8a2kh0vnzx6kxanfy2s2slnfppvrwg202rxv30m8p2i92frd";
}; };
outputs = [ "out" "dev" "devdoc" ]; outputs = [ "out" "dev" "devdoc" ];

View File

@ -1,14 +1,14 @@
{ stdenv, lib, fetchFromGitHub, autoconf, automake, libtool, pkgconfig, ApplicationServices, CoreServices }: { stdenv, lib, fetchFromGitHub, autoconf, automake, libtool, pkgconfig, ApplicationServices, CoreServices }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
version = "1.37.0"; version = "1.38.0";
pname = "libuv"; pname = "libuv";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = pname; owner = pname;
repo = pname; repo = pname;
rev = "v${version}"; rev = "v${version}";
sha256 = "0iy25w4wy9f5y7i7aqidhqz93qi00lv7vhx6s521n0kphvaj8ijz"; sha256 = "04598jglikma5plfiprnw4pcxwp7b6aqxphxs65pdd5xira6dz0s";
}; };
postPatch = let postPatch = let

View File

@ -1,5 +1,5 @@
{ stdenv, fetchFromGitHub, pkgconfig { stdenv, fetchFromGitHub, meson, ninja, pkg-config
, libdrm, libva, libX11, libXext, libXfixes, wayland, meson, ninja , libdrm, libva, libX11, libXext, libXfixes, wayland
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
@ -13,18 +13,10 @@ stdenv.mkDerivation rec {
sha256 = "13a0dccphi4cpr2cx45kg4djxsssi3d1fcjrkx27b16xiayp5lx9"; sha256 = "13a0dccphi4cpr2cx45kg4djxsssi3d1fcjrkx27b16xiayp5lx9";
}; };
nativeBuildInputs = [ meson ninja pkgconfig ]; nativeBuildInputs = [ meson ninja pkg-config ];
buildInputs = [ libdrm libva libX11 libXext libXfixes wayland ]; buildInputs = [ libdrm libva libX11 libXext libXfixes wayland ];
mesonFlags = [
"-Ddrm=true"
"-Dx11=true"
"-Dwayland=true"
];
enableParallelBuilding = true;
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "A collection of utilities and examples for VA-API"; description = "A collection of utilities and examples for VA-API";
longDescription = '' longDescription = ''

View File

@ -1,8 +1,8 @@
{ stdenv, lib, fetchFromGitHub, autoreconfHook, pkgconfig { stdenv, lib, fetchFromGitHub, fetchpatch, meson, pkg-config, ninja, wayland
, libXext, libdrm, libXfixes, wayland, libffi, libX11 , libdrm
, libGL, mesa
, minimal ? false, libva-minimal , minimal ? false, libva-minimal
, buildPackages , libX11, libXext, libXfixes, libffi, libGL
, mesa
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
@ -17,24 +17,30 @@ stdenv.mkDerivation rec {
sha256 = "0ywasac7z3hwggj8szp83sbxi2naa0a3amblx64y7i1hyyrn0csq"; sha256 = "0ywasac7z3hwggj8szp83sbxi2naa0a3amblx64y7i1hyyrn0csq";
}; };
patches = [
(fetchpatch { # meson: Allow for libdir and includedir to be absolute paths
url = "https://github.com/intel/libva/commit/de902e2905abff635f3bb151718cc52caa3f669c.patch";
sha256 = "1lpc8qzvsxnlsh9g0ab5lja204zxz8rr2p973pfihcw7dcxc3gia";
})
];
postPatch = ''
# Remove the execute bit from all source code files
# https://github.com/intel/libva/commit/dbd2cd635f33af1422cbc2079af0a7e68671c102
chmod -x va/va{,_dec_av1,_trace,_vpp}.h
'';
outputs = [ "dev" "out" ]; outputs = [ "dev" "out" ];
nativeBuildInputs = [ autoreconfHook pkgconfig wayland ]; nativeBuildInputs = [ meson pkg-config ninja wayland ];
buildInputs = [ libdrm ] buildInputs = [ libdrm ]
++ lib.optionals (!minimal) [ libva-minimal libX11 libXext libXfixes wayland libffi libGL ]; ++ lib.optionals (!minimal) [ libva-minimal libX11 libXext libXfixes wayland libffi libGL ];
# TODO: share libs between minimal and !minimal - perhaps just symlink them # TODO: share libs between minimal and !minimal - perhaps just symlink them
enableParallelBuilding = true; mesonFlags = [
# Add FHS paths for non-NixOS applications:
configureFlags = [ "-Ddriverdir=${mesa.drivers.driverLink}/lib/dri:/usr/lib/dri:/usr/lib32/dri"
# Add FHS paths for non-NixOS applications.
"--with-drivers-path=${mesa.drivers.driverLink}/lib/dri:/usr/lib/dri:/usr/lib32/dri"
"ac_cv_path_WAYLAND_SCANNER=${buildPackages.wayland}/bin/wayland-scanner"
] ++ lib.optionals (!minimal) [ "--enable-glx" ];
installFlags = [
"dummy_drv_video_ladir=$(out)/lib/dri"
]; ];
meta = with stdenv.lib; { meta = with stdenv.lib; {

View File

@ -1,4 +1,4 @@
{ stdenv, lib, fetchurl, fetchpatch { stdenv, lib, fetchurl, fetchpatch, buildPackages
, pkgconfig, intltool, ninja, meson , pkgconfig, intltool, ninja, meson
, file, flex, bison, expat, libdrm, xorg, wayland, wayland-protocols, openssl , file, flex, bison, expat, libdrm, xorg, wayland, wayland-protocols, openssl
, llvmPackages, libffi, libomxil-bellagio, libva-minimal , llvmPackages, libffi, libomxil-bellagio, libva-minimal
@ -73,6 +73,12 @@ stdenv.mkDerivation {
}) })
]; ];
postPatch = ''
substituteInPlace meson.build --replace \
"find_program('pkg-config')" \
"find_program('${buildPackages.pkg-config.targetPrefix}pkg-config')"
'';
outputs = [ "out" "dev" "drivers" "osmesa" ]; outputs = [ "out" "dev" "drivers" "osmesa" ];
# TODO: Figure out how to enable opencl without having a runtime dependency on clang # TODO: Figure out how to enable opencl without having a runtime dependency on clang
@ -112,10 +118,14 @@ stdenv.mkDerivation {
++ lib.optionals stdenv.isLinux [ libomxil-bellagio libva-minimal ] ++ lib.optionals stdenv.isLinux [ libomxil-bellagio libva-minimal ]
++ lib.optional withValgrind valgrind-light; ++ lib.optional withValgrind valgrind-light;
depsBuildBuild = [ pkgconfig ];
nativeBuildInputs = [ nativeBuildInputs = [
pkgconfig meson ninja pkgconfig meson ninja
intltool bison flex file intltool bison flex file
python3Packages.python python3Packages.Mako python3Packages.python python3Packages.Mako
] ++ lib.optionals (elem "wayland" eglPlatforms) [
wayland # For wayland-scanner during the build
]; ];
propagatedBuildInputs = with xorg; [ propagatedBuildInputs = with xorg; [

View File

@ -53,7 +53,9 @@ in stdenv.mkDerivation rec {
preConfigure = "cd nss"; preConfigure = "cd nss";
makeFlags = let makeFlags = let
cpu = stdenv.hostPlatform.parsed.cpu.name; # NSS's build systems expects aarch32 to be called arm; if we pass in armv6l/armv7l, it
# fails with a linker error
cpu = if stdenv.hostPlatform.isAarch32 then "arm" else stdenv.hostPlatform.parsed.cpu.name;
in [ in [
"NSPR_INCLUDE_DIR=${nspr.dev}/include" "NSPR_INCLUDE_DIR=${nspr.dev}/include"
"NSPR_LIB_DIR=${nspr.out}/lib" "NSPR_LIB_DIR=${nspr.out}/lib"
@ -64,9 +66,11 @@ in stdenv.mkDerivation rec {
"USE_SYSTEM_ZLIB=1" "USE_SYSTEM_ZLIB=1"
"NSS_USE_SYSTEM_SQLITE=1" "NSS_USE_SYSTEM_SQLITE=1"
"NATIVE_CC=${buildPackages.stdenv.cc}/bin/cc" "NATIVE_CC=${buildPackages.stdenv.cc}/bin/cc"
] ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [ # Pass in CPU even if we're not cross compiling, because otherwise it tries to guess with
# uname, which can be wrong if e.g. we're compiling for aarch32 on aarch64
"OS_TEST=${cpu}" "OS_TEST=${cpu}"
"CPU_ARCH=${cpu}" "CPU_ARCH=${cpu}"
] ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) [
"CROSS_COMPILE=1" "CROSS_COMPILE=1"
"NSS_DISABLE_GTESTS=1" # don't want to build tests when cross-compiling "NSS_DISABLE_GTESTS=1" # don't want to build tests when cross-compiling
] ++ stdenv.lib.optional stdenv.is64bit "USE_64=1" ] ++ stdenv.lib.optional stdenv.is64bit "USE_64=1"

View File

@ -67,6 +67,11 @@ let
./qtbase.patch.d/0010-qtbase-qtpluginpath.patch ./qtbase.patch.d/0010-qtbase-qtpluginpath.patch
./qtbase.patch.d/0011-qtbase-assert.patch ./qtbase.patch.d/0011-qtbase-assert.patch
./qtbase.patch.d/0012-fix-header_module.patch ./qtbase.patch.d/0012-fix-header_module.patch
# Ensure -I${includedir} is added to Cflags in pkg-config files.
# See https://github.com/NixOS/nixpkgs/issues/52457
./qtbase.patch.d/0014-qtbase-pkg-config.patch
# https://bugreports.qt.io/browse/QTBUG-81715 # https://bugreports.qt.io/browse/QTBUG-81715
# remove after updating to qt > 5.12.7 # remove after updating to qt > 5.12.7
(fetchpatch { (fetchpatch {

View File

@ -0,0 +1,14 @@
diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -3390,8 +3390,7 @@ MakefileGenerator::writePkgConfigFile()
<< varGlue("QMAKE_PKGCONFIG_CFLAGS", "", " ", " ")
// << varGlue("DEFINES","-D"," -D"," ")
;
- if (!project->values("QMAKE_DEFAULT_INCDIRS").contains(includeDir))
- t << "-I${includedir}";
+ t << "-I${includedir}";
if (target_mode == TARG_MAC_MODE && project->isActiveConfig("lib_bundle")
&& libDir != QLatin1String("/Library/Frameworks")) {
t << " -F${libdir}";

View File

@ -2,11 +2,11 @@
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "serd"; pname = "serd";
version = "0.30.2"; version = "0.30.4";
src = fetchurl { src = fetchurl {
url = "https://download.drobilla.net/${pname}-${version}.tar.bz2"; url = "https://download.drobilla.net/${pname}-${version}.tar.bz2";
sha256 = "00kjjgs5a8r72khgpya14scvl3n58wqwl5927y14z03j25q04ccx"; sha256 = "168rn3m32c59qbar120f83ibcnnd987ij9p053kybgl7cmm6358c";
}; };
nativeBuildInputs = [ pkgconfig python3 wafHook ]; nativeBuildInputs = [ pkgconfig python3 wafHook ];

View File

@ -2,7 +2,7 @@
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "wavpack"; pname = "wavpack";
version = "5.2.0"; version = "5.3.0";
enableParallelBuilding = true; enableParallelBuilding = true;
@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
src = fetchurl { src = fetchurl {
url = "http://www.wavpack.com/${pname}-${version}.tar.bz2"; url = "http://www.wavpack.com/${pname}-${version}.tar.bz2";
sha256 = "062f97bvm466ygvix3z0kbgffvvrc5cg2ak568jaq8r56v28q8rw"; sha256 = "00baiag7rlkzc6545dqdp4p5sr7xc3n97n7qdkgx58c544x0pw5n";
}; };
meta = with stdenv.lib; { meta = with stdenv.lib; {

View File

@ -23,16 +23,17 @@ in stdenv.mkDerivation rec {
mesonFlags = [ "-Ddocumentation=${lib.boolToString withDocumentation}" ]; mesonFlags = [ "-Ddocumentation=${lib.boolToString withDocumentation}" ];
patches = lib.optional isCross ./fix-wayland-cross-compilation.patch;
postPatch = lib.optionalString withDocumentation '' postPatch = lib.optionalString withDocumentation ''
patchShebangs doc/doxygen/gen-doxygen.py patchShebangs doc/doxygen/gen-doxygen.py
'' + lib.optionalString isCross ''
substituteInPlace egl/meson.build --replace \ substituteInPlace egl/meson.build --replace \
"find_program('nm').path()" \ "find_program('nm').path()" \
"find_program('${stdenv.cc.targetPrefix}nm').path()" "find_program('${stdenv.cc.targetPrefix}nm').path()"
''; '';
depsBuildBuild = [
pkgconfig
];
nativeBuildInputs = [ nativeBuildInputs = [
meson pkgconfig ninja meson pkgconfig ninja
] ++ lib.optionals isCross [ ] ++ lib.optionals isCross [

View File

@ -1,14 +0,0 @@
diff --git a/src/meson.build b/src/meson.build
index 3e8c9bf..75241cb 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -55,8 +55,7 @@ pkgconfig.generate(
)
if meson.is_cross_build()
- scanner_dep = dependency('wayland-scanner', native: true, version: '>=1.14.0')
- wayland_scanner_for_build = find_program(scanner_dep.get_pkgconfig_variable('wayland_scanner'))
+ wayland_scanner_for_build = find_program('wayland-scanner', native: true, version: '>=1.14.0')
else
wayland_scanner_for_build = wayland_scanner
endif

View File

@ -5,7 +5,7 @@
, fetchpatch , fetchpatch
, python , python
, glibcLocales , glibcLocales
, pkgconfig , pkg-config
, gdb , gdb
, numpy , numpy
, ncurses , ncurses
@ -34,7 +34,7 @@ in buildPythonPackage rec {
}; };
nativeBuildInputs = [ nativeBuildInputs = [
pkgconfig pkg-config
]; ];
checkInputs = [ checkInputs = [
numpy ncurses numpy ncurses

View File

@ -4,7 +4,13 @@ buildPythonPackage rec {
pname = "pkgconfig"; pname = "pkgconfig";
version = "1.5.1"; version = "1.5.1";
setupHook = pkgconfig.setupHook; inherit (pkgconfig)
setupHooks
wrapperName
suffixSalt
targetPrefix
baseBinName
;
src = fetchPypi { src = fetchPypi {
inherit pname version; inherit pname version;
@ -21,7 +27,7 @@ buildPythonPackage rec {
patches = [ ./executable.patch ]; patches = [ ./executable.patch ];
postPatch = '' postPatch = ''
substituteInPlace pkgconfig/pkgconfig.py --replace 'PKG_CONFIG_EXE = "pkg-config"' 'PKG_CONFIG_EXE = "${pkgconfig}/bin/pkg-config"' substituteInPlace pkgconfig/pkgconfig.py --replace 'PKG_CONFIG_EXE = "pkg-config"' 'PKG_CONFIG_EXE = "${pkgconfig}/bin/${pkgconfig.targetPrefix}pkg-config"'
''; '';
meta = with lib; { meta = with lib; {

View File

@ -23,7 +23,7 @@ buildPythonPackage rec {
sha256 = "02cadqfdmw4vc94px18dh4hcybpsa2lr6jz6j5phwc0jjaavh3wr"; sha256 = "02cadqfdmw4vc94px18dh4hcybpsa2lr6jz6j5phwc0jjaavh3wr";
}; };
buildInputs = [ setuptools_scm pkgconfig pytestrunner ]; nativeBuildInputs = [ setuptools_scm pkgconfig pytestrunner ];
checkInputs = [ pytest pytestcov psutil ]; checkInputs = [ pytest pytestcov psutil ];
propagatedBuildInputs = lib.optionals (!isPy3k) [ future ]; propagatedBuildInputs = lib.optionals (!isPy3k) [ future ];

View File

@ -0,0 +1,37 @@
From 21563405d6e2348ee457187f7fb61beb102bb367 Mon Sep 17 00:00:00 2001
From: Frederik Rietdijk <fridh@fridh.nl>
Date: Sun, 24 May 2020 09:33:13 +0200
Subject: [PATCH] Check base_prefix and base_exec_prefix for Python 2
This is a Nixpkgs-specific change so it can support virtualenvs from Nix envs.
---
src/virtualenv/discovery/py_info.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/virtualenv/discovery/py_info.py b/src/virtualenv/discovery/py_info.py
index 6f12128..74e9218 100644
--- a/src/virtualenv/discovery/py_info.py
+++ b/src/virtualenv/discovery/py_info.py
@@ -51,13 +51,17 @@ class PythonInfo(object):
self.version = u(sys.version)
self.os = u(os.name)
+ config_vars = {} if sys.version_info.major is not 2 else sysconfig._CONFIG_VARS
+ base_prefix = config_vars.get("prefix")
+ base_exec_prefix = config_vars.get("exec_prefix")
+
# information about the prefix - determines python home
self.prefix = u(abs_path(getattr(sys, "prefix", None))) # prefix we think
- self.base_prefix = u(abs_path(getattr(sys, "base_prefix", None))) # venv
+ self.base_prefix = u(abs_path(getattr(sys, "base_prefix", base_prefix))) # venv
self.real_prefix = u(abs_path(getattr(sys, "real_prefix", None))) # old virtualenv
# information about the exec prefix - dynamic stdlib modules
- self.base_exec_prefix = u(abs_path(getattr(sys, "base_exec_prefix", None)))
+ self.base_exec_prefix = u(abs_path(getattr(sys, "base_exec_prefix", base_exec_prefix)))
self.exec_prefix = u(abs_path(getattr(sys, "exec_prefix", None)))
self.executable = u(abs_path(sys.executable)) # the executable we were invoked via
--
2.25.1

View File

@ -43,6 +43,10 @@ buildPythonPackage rec {
importlib-metadata importlib-metadata
]; ];
patches = lib.optionals (isPy27) [
./0001-Check-base_prefix-and-base_exec_prefix-for-Python-2.patch
];
meta = { meta = {
description = "A tool to create isolated Python environments"; description = "A tool to create isolated Python environments";
homepage = "http://www.virtualenv.org"; homepage = "http://www.virtualenv.org";

View File

@ -12,7 +12,7 @@ buildPythonPackage rec {
postPatch = '' postPatch = ''
substituteInPlace setup.py \ substituteInPlace setup.py \
--replace "/usr/bin/pkg-config" "${pkgconfig}/bin/pkg-config" --replace "/usr/bin/pkg-config" "${pkgconfig}/bin/${pkgconfig.targetPrefix}pkg-config"
''; '';
nativeBuildInputs = [ pkgconfig ]; nativeBuildInputs = [ pkgconfig ];

Some files were not shown because too many files have changed in this diff Show More