Skip to content

Commit 9803465

Browse files
committedJul 8, 2017
Merge branch 'staging' into master
2 parents 800d449 + 7e3a1a5 commit 9803465

File tree

34 files changed

+247
-102
lines changed

34 files changed

+247
-102
lines changed
 

‎pkgs/applications/audio/sisco.lv2/default.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
2525
inherit name;
2626

2727
srcs = [ src robtkSrc ];
28-
sourceRoot = "sisco.lv2-${src.rev}-src";
28+
sourceRoot = src.name;
2929

3030
buildInputs = [ pkgconfig lv2 pango cairo libjack2 mesa ];
3131

‎pkgs/build-support/cc-wrapper/default.nix

+16-2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
, zlib ? null, extraPackages ? [], extraBuildCommands ? ""
1111
, dyld ? null # TODO: should this be a setup-hook on dyld?
1212
, isGNU ? false, isClang ? cc.isClang or false, gnugrep ? null
13+
, buildPackages ? {}, hostPlatform, targetPlatform
1314
, runCommand ? null
1415
}:
1516

@@ -121,6 +122,17 @@ let
121122
null)
122123
else "";
123124

125+
expand-response-params = if buildPackages.stdenv.cc or null != null && buildPackages.stdenv.cc != "/dev/null"
126+
then buildPackages.stdenv.mkDerivation {
127+
name = "expand-response-params";
128+
src = ./expand-response-params.c;
129+
buildCommand = ''
130+
# Work around "stdenv-darwin-boot-2 is not allowed to refer to path /nix/store/...-expand-response-params.c"
131+
cp "$src" expand-response-params.c
132+
"$CC" -std=c99 -O3 -o "$out" expand-response-params.c
133+
'';
134+
} else "";
135+
124136
in
125137

126138
stdenv.mkDerivation {
@@ -369,11 +381,13 @@ stdenv.mkDerivation {
369381
+ ''
370382
substituteAll ${preWrap ./add-flags.sh} $out/nix-support/add-flags.sh
371383
substituteAll ${preWrap ./add-hardening.sh} $out/nix-support/add-hardening.sh
372-
cp -p ${preWrap ./utils.sh} $out/nix-support/utils.sh
384+
substituteAll ${preWrap ./utils.sh} $out/nix-support/utils.sh
373385
''
374386
+ extraBuildCommands;
375387

376-
inherit dynamicLinker;
388+
inherit dynamicLinker expand-response-params;
389+
390+
expandResponseParams = expand-response-params; # for substitution in utils.sh
377391

378392
crossAttrs = {
379393
shell = shell.crossDrv + shell.crossDrv.shellPath;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
#include <assert.h>
2+
#include <ctype.h>
3+
#include <stdio.h>
4+
#include <stdlib.h>
5+
#include <string.h>
6+
7+
typedef struct { char *data; size_t len, cap; } String;
8+
9+
void resize(String *s, size_t len) {
10+
s->len = len;
11+
if (s->cap < s->len) {
12+
s->cap = s->len * 2;
13+
s->data = (char *)realloc(s->data, s->cap);
14+
assert(s->data);
15+
}
16+
}
17+
18+
void append(String *s, const char *data, size_t len) {
19+
resize(s, s->len + len);
20+
memcpy(s->data + s->len - len, data, len);
21+
}
22+
23+
typedef enum { space = 0, other = 1, backslash = 2, apostrophe = 3, quotation_mark = 4 } CharClass;
24+
typedef enum { outside, unq, unq_esc, sq, sq_esc, dq, dq_esc } State;
25+
26+
// current State -> CharClass -> next State
27+
const State transitions[][5] = {
28+
[outside] = {outside, unq, unq_esc, sq, dq},
29+
[unq] = {outside, unq, unq_esc, sq, dq},
30+
[unq_esc] = {unq, unq, unq, unq, unq},
31+
[sq] = {sq, sq, sq_esc, unq, sq},
32+
[sq_esc] = {sq, sq, sq, sq, sq},
33+
[dq] = {dq, dq, dq_esc, dq, unq},
34+
[dq_esc] = {dq, dq, dq, dq, dq},
35+
};
36+
37+
CharClass charClass(int c) {
38+
return c == '\\' ? backslash : c == '\'' ? apostrophe : c == '"' ? quotation_mark :
39+
isspace(c) ? space : other;
40+
}
41+
42+
// expandArg writes NULL-terminated expansions of `arg', a NULL-terminated
43+
// string, to stdout. If arg does not begin with `@' or does not refer to a
44+
// file, it is written as is. Otherwise the contents of the file are
45+
// recursively expanded. On unexpected EOF in malformed response files an
46+
// incomplete final argument is written, even if it is empty, to parse like GCC.
47+
void expandArg(String *arg) {
48+
FILE *f;
49+
if (arg->data[0] != '@' || !(f = fopen(&arg->data[1], "r"))) {
50+
fwrite(arg->data, 1, arg->len, stdout);
51+
return;
52+
}
53+
54+
resize(arg, 0);
55+
State cur = outside;
56+
int c;
57+
do {
58+
c = fgetc(f);
59+
State next = transitions[cur][charClass(c)];
60+
if ((cur == unq && next == outside) || (cur != outside && c == EOF)) {
61+
append(arg, "", 1);
62+
expandArg(arg);
63+
resize(arg, 0);
64+
} else if (cur == unq_esc || cur == sq_esc || cur == dq_esc ||
65+
(cur == outside ? next == unq : cur == next)) {
66+
char s = c;
67+
append(arg, &s, 1);
68+
}
69+
cur = next;
70+
} while (c != EOF);
71+
72+
fclose(f);
73+
}
74+
75+
int main(int argc, char **argv) {
76+
String arg = { 0 };
77+
while (*++argv) {
78+
resize(&arg, 0);
79+
append(&arg, *argv, strlen(*argv) + 1);
80+
expandArg(&arg);
81+
}
82+
free(arg.data);
83+
return EXIT_SUCCESS;
84+
}

‎pkgs/build-support/cc-wrapper/utils.sh

+11-45
Original file line numberDiff line numberDiff line change
@@ -23,52 +23,18 @@ badPath() {
2323
"${p:0:${#NIX_BUILD_TOP}}" != "$NIX_BUILD_TOP"
2424
}
2525

26-
# @args.rsp parser.
27-
# Char classes: space, other, backslash, single quote, double quote.
28-
# States: 0 - outside, 1/2 - unquoted arg/slash, 3/4 - 'arg'/slash, 5/6 - "arg"/slash.
29-
# State transitions:
30-
rspT=(01235 01235 11111 33413 33333 55651 55555)
31-
# Push (a) arg or (c) char on transition:
32-
rspP[10]=a rspP[01]=c rspP[11]=c rspP[21]=c rspP[33]=c rspP[43]=c rspP[55]=c rspP[65]=c
33-
34-
rspParse() {
35-
rsp=()
36-
local state=0
37-
local arg=''
38-
local c
39-
40-
while read -r -N1 c; do
41-
local cls=1
42-
case "$c" in
43-
' ' | $'\t' | $'\r' | $'\n') cls=0 ;;
44-
'\') cls=2 ;;
45-
"'") cls=3 ;;
46-
'"') cls=4 ;;
47-
esac
48-
local nextstates="${rspT[$state]}"
49-
local nextstate="${nextstates:$cls:1}"
50-
case "${rspP[$state$nextstate]}" in
51-
'c') arg+="$c" ;;
52-
'a') rsp+=("$arg"); arg='' ;;
53-
esac
54-
state="$nextstate"
55-
done
56-
57-
if [ "$state" -ne 0 ]; then
58-
rsp+=("$arg")
59-
fi
60-
}
61-
6226
expandResponseParams() {
63-
params=()
64-
while [ $# -gt 0 ]; do
65-
local p="$1"
66-
shift
67-
if [ "${p:0:1}" = '@' -a -e "${p:1}" ]; then
68-
rspParse <"${p:1}"
69-
set -- "${rsp[@]}" "$@"
70-
else
71-
params+=("$p")
27+
params=("$@")
28+
local arg
29+
for arg in "$@"; do
30+
if [[ "$arg" == @* ]]; then
31+
if [ -n "@expandResponseParams@" ]; then
32+
readarray -d '' params < <("@expandResponseParams@" "$@")
33+
return 0
34+
else
35+
echo "Response files aren't supported during bootstrapping" >&2
36+
return 1
37+
fi
7238
fi
7339
done
7440
}

‎pkgs/build-support/fetchgit/default.nix

+2-14
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,9 @@
1-
{stdenv, git, cacert}: let
2-
urlToName = url: rev: let
3-
inherit (stdenv.lib) removeSuffix splitString last;
4-
base = last (splitString ":" (baseNameOf (removeSuffix "/" url)));
1+
{stdenv, git, cacert, gitRepoToName}:
52

6-
matched = builtins.match "(.*).git" base;
7-
8-
short = builtins.substring 0 7 rev;
9-
10-
appendShort = if (builtins.match "[a-f0-9]*" rev) != null
11-
then "-${short}"
12-
else "";
13-
in "${if matched == null then base else builtins.head matched}${appendShort}";
14-
in
153
{ url, rev ? "HEAD", md5 ? "", sha256 ? "", leaveDotGit ? deepClone
164
, fetchSubmodules ? true, deepClone ? false
175
, branchName ? null
18-
, name ? urlToName url rev
6+
, name ? gitRepoToName url rev
197
, # Shell code executed after the file has been fetched
208
# successfully. This can do things like check or transform the file.
219
postFetch ? ""
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{ lib }:
2+
3+
urlOrRepo: rev: let
4+
inherit (lib) removeSuffix splitString last;
5+
base = last (splitString ":" (baseNameOf (removeSuffix "/" urlOrRepo)));
6+
7+
matched = builtins.match "(.*).git" base;
8+
9+
short = builtins.substring 0 7 rev;
10+
11+
appendShort = if (builtins.match "[a-f0-9]*" rev) != null
12+
then "-${short}"
13+
else "";
14+
in "${if matched == null then base else builtins.head matched}${appendShort}"

‎pkgs/build-support/fetchgit/nix-prefetch-git

+2-2
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,8 @@ _clone_user_rev() {
283283
if test -z "$(echo "$rev" | tr -d 0123456789abcdef)"; then
284284
clone "$dir" "$url" "$rev" "" 1>&2
285285
else
286-
echo 1>&2 "Bad commit hash or bad reference."
287-
exit 1
286+
# if revision is not hexadecimal it might be a tag
287+
clone "$dir" "$url" "" "refs/tags/$rev" 1>&2
288288
fi;;
289289
esac
290290

‎pkgs/development/compilers/llvm/4/clang/default.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ let
99
name = "clang-${version}";
1010

1111
unpackPhase = ''
12-
unpackFile ${fetch "cfe" "12n99m60aa680cir3ql56s1jsv6lp61hq4w9rabf4c6vpn7gi9ff"}
12+
unpackFile ${fetch "cfe" "16vnv3msnvx33dydd17k2cq0icndi1a06bg5vcxkrhjjb1rqlwv1"}
1313
mv cfe-${version}* clang
1414
sourceRoot=$PWD/clang
1515
unpackFile ${clang-tools-extra_src}

‎pkgs/development/compilers/llvm/4/default.nix

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
let
33
callPackage = newScope (self // { inherit stdenv cmake libxml2 python2 isl release_version version fetch; });
44

5-
release_version = "4.0.0";
5+
release_version = "4.0.1";
66
version = release_version; # differentiating these is important for rc's
77

88
fetch = name: sha256: fetchurl {
99
url = "http://llvm.org/releases/${release_version}/${name}-${version}.src.tar.xz";
1010
inherit sha256;
1111
};
1212

13-
compiler-rt_src = fetch "compiler-rt" "059ipqq27gd928ay06f1ck3vw6y5h5z4zd766x8k0k7jpqimpwnk";
14-
clang-tools-extra_src = fetch "clang-tools-extra" "16bwckgcxfn56mbqjlxi7fxja0zm9hjfa6s3ncm3dz98n5zd7ds1";
13+
compiler-rt_src = fetch "compiler-rt" "0h5lpv1z554szi4r4blbskhwrkd78ir50v3ng8xvk1s86fa7gj53";
14+
clang-tools-extra_src = fetch "clang-tools-extra" "1dhmp7ccfpr42bmvk3kp37ngjpf3a9m5d4kkpsn7d00hzi7fdl9m";
1515

1616
# Add man output without introducing extra dependencies.
1717
overrideManOutput = drv:

‎pkgs/development/compilers/llvm/4/libc++/default.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
stdenv.mkDerivation rec {
44
name = "libc++-${version}";
55

6-
src = fetch "libcxx" "15ngfcjc3pjakpwfq7d4n546jj0rgfdv5rpb1qv9xgv9mp236kag";
6+
src = fetch "libcxx" "0k6cmjcxnp2pyl8xwy1wkyyckkmdrjddim94yf1gzjbjy9qi22jj";
77

88
postUnpack = ''
99
unpackFile ${libcxxabi.src}

‎pkgs/development/compilers/llvm/4/libc++abi.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
stdenv.mkDerivation {
44
name = "libc++abi-${version}";
55

6-
src = fetch "libcxxabi" "1n416kv27anabg9jsw6331r28ic30xk46p381lx2vbb2jrhwpafw";
6+
src = fetch "libcxxabi" "0cqvzallxh0nwiijsf6i4d5ds9m5ijfzywg7376ncv50i64if24g";
77

88
nativeBuildInputs = [ cmake ];
99
buildInputs = stdenv.lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD) libunwind;

‎pkgs/development/compilers/llvm/4/lld.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
stdenv.mkDerivation {
1111
name = "lld-${version}";
1212

13-
src = fetch "lld" "00km1qawk146pyjqa6aphcdzgkzrmg6cgk0ikg4661ffp5bn9q1k";
13+
src = fetch "lld" "1v9nkpr158j4yd4zmi6rpnfxkp78r1fapr8wji9s6v176gji1kk3";
1414

1515
nativeBuildInputs = [ cmake ];
1616
buildInputs = [ llvm ];

‎pkgs/development/compilers/llvm/4/lldb.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
stdenv.mkDerivation {
1818
name = "lldb-${version}";
1919

20-
src = fetch "lldb" "0g83hbw1r4gd0z8hlph9i34xs6dlcc69vz3h2bqwkhb2qq2qzg9d";
20+
src = fetch "lldb" "0yy43a27zx3r51b6gkv3v2mdiqcq3mf0ngki47ya0i30v3gx4cl4";
2121

2222
patches = [ ./lldb-libedit.patch ];
2323
postPatch = ''

‎pkgs/development/compilers/llvm/4/llvm.nix

+1-8
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
}:
2323

2424
let
25-
src = fetch "llvm" "1giklnw71wzsgbqg9wb5x7dxnbj39m6zpfvskvzvhwvfz4fm244d";
25+
src = fetch "llvm" "0l9bf7kdwhlj0kq1hawpyxhna1062z3h7qcz2y8nfl9dz2qksy6s";
2626
shlib = if stdenv.isDarwin then "dylib" else "so";
2727

2828
# Used when creating a version-suffixed symlink of libLLVM.dylib
@@ -64,13 +64,6 @@ in stdenv.mkDerivation rec {
6464
+ stdenv.lib.optionalString (enableSharedLibraries) ''
6565
substitute '${./llvm-outputs.patch}' ./llvm-outputs.patch --subst-var lib
6666
patch -p1 < ./llvm-outputs.patch
67-
''
68-
# Remove broken tests: (https://bugs.llvm.org//show_bug.cgi?id=31610)
69-
+ ''
70-
rm test/CodeGen/AMDGPU/invalid-opencl-version-metadata1.ll
71-
rm test/CodeGen/AMDGPU/invalid-opencl-version-metadata2.ll
72-
rm test/CodeGen/AMDGPU/invalid-opencl-version-metadata3.ll
73-
rm test/CodeGen/AMDGPU/runtime-metadata.ll
7467
'';
7568

7669
# hacky fix: created binaries need to be run before installation

‎pkgs/development/compilers/llvm/4/openmp.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
stdenv.mkDerivation {
1111
name = "openmp-${version}";
1212

13-
src = fetch "openmp" "09kf41zgv551fnv628kqhlwgqkd2bkiwii9gqi6q12djgdddhmfv";
13+
src = fetch "openmp" "195dykamd39yhi5az7nqj3ksqhb3wq30l93jnfkxl0061qbknsgc";
1414

1515
nativeBuildInputs = [ cmake perl ];
1616
buildInputs = [ llvm ];

‎pkgs/development/interpreters/ruby/default.nix

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ let
5959
srcs = [ rubySrc rubygemsSrc ];
6060
sourceRoot =
6161
if useRailsExpress then
62-
"ruby-${tag}-src"
62+
rubySrc.name
6363
else
6464
unpackdir rubySrc;
6565

‎pkgs/development/libraries/aws-sdk-cpp/default.nix

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ in stdenv.mkDerivation rec {
2626
# FIXME: might be nice to put different APIs in different outputs
2727
# (e.g. libaws-cpp-sdk-s3.so in output "s3").
2828
outputs = [ "out" "dev" ];
29+
separateDebugInfo = stdenv.isLinux;
2930

3031
buildInputs = [ cmake curl ];
3132

‎pkgs/development/libraries/boehm-gc/default.nix

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ stdenv.mkDerivation rec {
1414
nativeBuildInputs = [ pkgconfig ];
1515

1616
outputs = [ "out" "dev" "doc" ];
17+
separateDebugInfo = stdenv.isLinux;
1718

1819
configureFlags =
1920
[ "--enable-cplusplus" ]

‎pkgs/development/libraries/glibc/common.nix

+2-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ stdenv.mkDerivation ({
6868
++ lib.optionals stdenv.isi686 [
6969
./fix-i686-memchr.patch
7070
./i686-fix-vectorized-strcspn.patch
71-
];
71+
]
72+
++ lib.optional stdenv.isx86_64 ./fix-x64-abi.patch;
7273

7374
postPatch =
7475
# Needed for glibc to build with the gnumake 3.82

0 commit comments

Comments
 (0)
Please sign in to comment.