···
13
+
transform = flags: concatStringsSep ";" (map (subst: subst + flags) [
14
+
"s,^[^/]+(.*)$,$main\\1,"
15
+
"s,$main/(build|tools)(/.*)?$,$out/\\1\\2,"
16
+
"s,$main/third_party(/.*)?$,$bundled\\1,"
17
+
"s,$main/sandbox(/.*)?$,$sandbox\\1,"
pre42 = versionOlder version "42.0.0.0";
name = "chromium-source-${version}";
···
buildInputs = [ python ]; # cannot patch shebangs otherwise
21
-
phases = [ "unpackPhase" "patchPhase" "installPhase" ];
30
+
phases = [ "unpackPhase" "patchPhase" ];
31
+
outputs = [ "out" "sandbox" "bundled" "main" ];
34
+
tar xf "$src" -C / \
35
+
--transform="${transform "xS"}" \
37
+
--no-wildcards-match-slash \
38
+
--exclude='*/tools/gyp' \
opensslPatches = optional useOpenSSL openssl.patches;
25
-
prePatch = "patchShebangs .";
45
+
for i in $outputs; do
46
+
eval patchShebangs "\$$i"
patches = if pre42 then [
./sandbox_userns_36.patch ./nix_plugin_paths.patch
···
./nix_plugin_paths_42.patch
57
+
diffmod = sym: "/^${sym} /{s/^${sym} //;${transform ""};s/^/${sym} /}";
58
+
allmods = "${diffmod "---"};${diffmod "\\+\\+\\+"}";
59
+
sedexpr = "/^(---|\\+\\+\\+) *\\/dev\\/null/b;${allmods}";
62
+
for i in $patches; do
63
+
header "applying patch $i" 3
64
+
sed -r -e "${sedexpr}" "$i" | patch -d / -p0
-e 's/-f(stack-protector)(-all)?/-fno-\1/' \
-e "/python_arch/s/: *'[^']*'/: '""'/" \
38
-
build/common.gypi chrome/chrome_tests.gypi
75
+
"$out/build/common.gypi" "$main/chrome/chrome_tests.gypi"
'' + optionalString useOpenSSL ''
40
-
cat $opensslPatches | patch -p1 -d third_party/openssl/openssl
77
+
cat $opensslPatches | patch -p1 -d "$bundled/openssl/openssl"
'' + optionalString (!pre42) ''
sed -i -e '/LOG.*no_suid_error/d' \
"$main/content/browser/browser_main_loop.cc"
46
-
outputs = [ "out" "sandbox" "bundled" "main" ];
48
-
mkdir -p "$out" "$sandbox" "$bundled" "$main"
50
-
header "copying browser main sources to $main"
51
-
find . -mindepth 1 -maxdepth 1 \
52
-
\! -path ./sandbox \
53
-
\! -path ./third_party \
57
-
-print | xargs cp -rt "$main"
60
-
header "copying sandbox components to $sandbox"
61
-
cp -rt "$sandbox" sandbox/*
64
-
header "copying third party sources to $bundled"
65
-
cp -rt "$bundled" third_party/*
68
-
header "copying build requisites to $out"
69
-
cp -rt "$out" build tools
72
-
rm -rf "$out/tools/gyp" # XXX: Don't even copy it in the first place.