git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #20174 from zraexy/qtwebengine

qt56.qtwebengine: chromium clang update.py patch

commiteea7af1f054f4df61afdde24f7122876f02e65d9 authorThomas Tuegel <ttuegel@gmail.com> dateSat 5 Nov 2016, 10:12 (10 years ago) parent2d18cf7bd0ffa5
3 files changed+878−1
pkgs/development/libraries/qt-5/5.6/default.nix+1−1 pkgs/development/libraries/qt-5/5.6/qtwebengine/chromium-clang-update-py.patch+874 pkgs/development/libraries/qt-5/5.6/qtwebengine.nix → pkgs/development/libraries/qt-5/5.6/qtwebengine/default.nix+3
pkgs/development/libraries/qt-5/5.6/default.nix+1−1
@@ -94,7 +94,7 @@ let
9494 qttranslations = callPackage ./qttranslations.nix {};
9595 qtwayland = callPackage ./qtwayland.nix {};
9696 qtwebchannel = callPackage ./qtwebchannel.nix {};
97− qtwebengine = callPackage ./qtwebengine.nix {};
97+ qtwebengine = callPackage ./qtwebengine {};
9898 qtwebkit = callPackage ./qtwebkit {};
9999 qtwebsockets = callPackage ./qtwebsockets.nix {};
100100 /* qtwinextras = not packaged */
pkgs/development/libraries/qt-5/5.6/qtwebengine/chromium-clang-update-py.patchnew file+874
@@ -0,0 +1,874 @@
1+--- a/src/3rdparty/chromium/tools/clang/scripts/update.py 2016-05-26 04:58:54.000000000 -0800
2++++ b/src/3rdparty/chromium/tools/clang/scripts/update.py 2016-11-04 08:35:34.956154012 -0800
3+@@ -3,12 +3,12 @@
4+ # Use of this source code is governed by a BSD-style license that can be
5+ # found in the LICENSE file.
6+
7+-"""Windows can't run .sh files, so this is a Python implementation of
8+-update.sh. This script should replace update.sh on all platforms eventually."""
9++"""This script is used to download prebuilt clang binaries.
10++
11++It is also used by package.py to build the prebuilt clang binaries."""
12+
13+ import argparse
14+-import contextlib
15+-import cStringIO
16++import distutils.spawn
17+ import glob
18+ import os
19+ import pipes
20+@@ -18,6 +18,7 @@
21+ import stat
22+ import sys
23+ import tarfile
24++import tempfile
25+ import time
26+ import urllib2
27+ import zipfile
28+@@ -25,19 +26,16 @@
29+ # Do NOT CHANGE this if you don't know what you're doing -- see
30+ # https://code.google.com/p/chromium/wiki/UpdatingClang
31+ # Reverting problematic clang rolls is safe, though.
32+-# Note: this revision is only used for Windows. Other platforms use update.sh.
33+-# TODO(thakis): Use the same revision on Windows and non-Windows.
34+-# TODO(thakis): Remove update.sh, use update.py everywhere.
35+-LLVM_WIN_REVISION = '239674'
36++CLANG_REVISION = '239674'
37+
38+ use_head_revision = 'LLVM_FORCE_HEAD_REVISION' in os.environ
39+ if use_head_revision:
40+- LLVM_WIN_REVISION = 'HEAD'
41++ CLANG_REVISION = 'HEAD'
42+
43+ # This is incremented when pushing a new build of Clang at the same revision.
44+ CLANG_SUB_REVISION=1
45+
46+-PACKAGE_VERSION = "%s-%s" % (LLVM_WIN_REVISION, CLANG_SUB_REVISION)
47++PACKAGE_VERSION = "%s-%s" % (CLANG_REVISION, CLANG_SUB_REVISION)
48+
49+ # Path constants. (All of these should be absolute paths.)
50+ THIS_DIR = os.path.abspath(os.path.dirname(__file__))
51+@@ -50,17 +48,26 @@
52+ CHROME_TOOLS_SHIM_DIR = os.path.join(LLVM_DIR, 'tools', 'chrometools')
53+ LLVM_BUILD_DIR = os.path.join(CHROMIUM_DIR, 'third_party', 'llvm-build',
54+ 'Release+Asserts')
55+-COMPILER_RT_BUILD_DIR = os.path.join(LLVM_BUILD_DIR, '32bit-compiler-rt')
56++COMPILER_RT_BUILD_DIR = os.path.join(LLVM_BUILD_DIR, 'compiler-rt')
57+ CLANG_DIR = os.path.join(LLVM_DIR, 'tools', 'clang')
58+ LLD_DIR = os.path.join(LLVM_DIR, 'tools', 'lld')
59+-COMPILER_RT_DIR = os.path.join(LLVM_DIR, 'projects', 'compiler-rt')
60++# compiler-rt is built as part of the regular LLVM build on Windows to get
61++# the 64-bit runtime, and out-of-tree elsewhere.
62++# TODO(thakis): Try to unify this.
63++if sys.platform == 'win32':
64++ COMPILER_RT_DIR = os.path.join(LLVM_DIR, 'projects', 'compiler-rt')
65++else:
66++ COMPILER_RT_DIR = os.path.join(LLVM_DIR, 'compiler-rt')
67+ LIBCXX_DIR = os.path.join(LLVM_DIR, 'projects', 'libcxx')
68+ LIBCXXABI_DIR = os.path.join(LLVM_DIR, 'projects', 'libcxxabi')
69+ LLVM_BUILD_TOOLS_DIR = os.path.abspath(
70+ os.path.join(LLVM_DIR, '..', 'llvm-build-tools'))
71+-STAMP_FILE = os.path.join(LLVM_DIR, '..', 'llvm-build', 'cr_build_revision')
72++STAMP_FILE = os.path.normpath(
73++ os.path.join(LLVM_DIR, '..', 'llvm-build', 'cr_build_revision'))
74+ BINUTILS_DIR = os.path.join(THIRD_PARTY_DIR, 'binutils')
75+-VERSION = '3.7.0'
76++VERSION = '3.8.0'
77++ANDROID_NDK_DIR = os.path.join(
78++ CHROMIUM_DIR, 'third_party', 'android_tools', 'ndk')
79+
80+ # URL for pre-built binaries.
81+ CDS_URL = 'https://commondatastorage.googleapis.com/chromium-browser-clang'
82+@@ -74,40 +81,75 @@
83+ """Download url into output_file."""
84+ CHUNK_SIZE = 4096
85+ TOTAL_DOTS = 10
86+- sys.stdout.write('Downloading %s ' % url)
87+- sys.stdout.flush()
88+- response = urllib2.urlopen(url)
89+- total_size = int(response.info().getheader('Content-Length').strip())
90+- bytes_done = 0
91+- dots_printed = 0
92++ num_retries = 3
93++ retry_wait_s = 5 # Doubled at each retry.
94++
95+ while True:
96+- chunk = response.read(CHUNK_SIZE)
97+- if not chunk:
98+- break
99+- output_file.write(chunk)
100+- bytes_done += len(chunk)
101+- num_dots = TOTAL_DOTS * bytes_done / total_size
102+- sys.stdout.write('.' * (num_dots - dots_printed))
103+- sys.stdout.flush()
104+- dots_printed = num_dots
105+- print ' Done.'
106++ try:
107++ sys.stdout.write('Downloading %s ' % url)
108++ sys.stdout.flush()
109++ response = urllib2.urlopen(url)
110++ total_size = int(response.info().getheader('Content-Length').strip())
111++ bytes_done = 0
112++ dots_printed = 0
113++ while True:
114++ chunk = response.read(CHUNK_SIZE)
115++ if not chunk:
116++ break
117++ output_file.write(chunk)
118++ bytes_done += len(chunk)
119++ num_dots = TOTAL_DOTS * bytes_done / total_size
120++ sys.stdout.write('.' * (num_dots - dots_printed))
121++ sys.stdout.flush()
122++ dots_printed = num_dots
123++ if bytes_done != total_size:
124++ raise urllib2.URLError("only got %d of %d bytes" %
125++ (bytes_done, total_size))
126++ print ' Done.'
127++ return
128++ except urllib2.URLError as e:
129++ sys.stdout.write('\n')
130++ print e
131++ if num_retries == 0 or isinstance(e, urllib2.HTTPError) and e.code == 404:
132++ raise e
133++ num_retries -= 1
134++ print 'Retrying in %d s ...' % retry_wait_s
135++ time.sleep(retry_wait_s)
136++ retry_wait_s *= 2
137++
138++
139++def EnsureDirExists(path):
140++ if not os.path.exists(path):
141++ print "Creating directory %s" % path
142++ os.makedirs(path)
143++
144++
145++def DownloadAndUnpack(url, output_dir):
146++ with tempfile.TemporaryFile() as f:
147++ DownloadUrl(url, f)
148++ f.seek(0)
149++ EnsureDirExists(output_dir)
150++ if url.endswith('.zip'):
151++ zipfile.ZipFile(f).extractall(path=output_dir)
152++ else:
153++ tarfile.open(mode='r:gz', fileobj=f).extractall(path=output_dir)
154+
155+
156+ def ReadStampFile():
157+ """Return the contents of the stamp file, or '' if it doesn't exist."""
158+ try:
159+ with open(STAMP_FILE, 'r') as f:
160+- return f.read()
161++ return f.read().rstrip()
162+ except IOError:
163+ return ''
164+
165+
166+ def WriteStampFile(s):
167+ """Write s to the stamp file."""
168+- if not os.path.exists(os.path.dirname(STAMP_FILE)):
169+- os.makedirs(os.path.dirname(STAMP_FILE))
170++ EnsureDirExists(os.path.dirname(STAMP_FILE))
171+ with open(STAMP_FILE, 'w') as f:
172+ f.write(s)
173++ f.write('\n')
174+
175+
176+ def GetSvnRevision(svn_repo):
177+@@ -129,6 +171,13 @@
178+ shutil.rmtree(dir, onerror=ChmodAndRetry)
179+
180+
181++def RmCmakeCache(dir):
182++ """Delete CMakeCache.txt files under dir recursively."""
183++ for dirpath, _, files in os.walk(dir):
184++ if 'CMakeCache.txt' in files:
185++ os.remove(os.path.join(dirpath, 'CMakeCache.txt'))
186++
187++
188+ def RunCommand(command, msvc_arch=None, env=None, fail_hard=True):
189+ """Run command and return success (True) or failure; or if fail_hard is
190+ True, exit on failure. If msvc_arch is set, runs the command in a
191+@@ -170,8 +219,8 @@
192+ def CopyDirectoryContents(src, dst, filename_filter=None):
193+ """Copy the files from directory src to dst
194+ with an optional filename filter."""
195+- if not os.path.exists(dst):
196+- os.makedirs(dst)
197++ dst = os.path.realpath(dst) # realpath() in case dst ends in /..
198++ EnsureDirExists(dst)
199+ for root, _, files in os.walk(src):
200+ for f in files:
201+ if filename_filter and not re.match(filename_filter, f):
202+@@ -181,9 +230,9 @@
203+
204+ def Checkout(name, url, dir):
205+ """Checkout the SVN module at url into dir. Use name for the log message."""
206+- print "Checking out %s r%s into '%s'" % (name, LLVM_WIN_REVISION, dir)
207++ print "Checking out %s r%s into '%s'" % (name, CLANG_REVISION, dir)
208+
209+- command = ['svn', 'checkout', '--force', url + '@' + LLVM_WIN_REVISION, dir]
210++ command = ['svn', 'checkout', '--force', url + '@' + CLANG_REVISION, dir]
211+ if RunCommand(command, fail_hard=False):
212+ return
213+
214+@@ -195,120 +244,9 @@
215+ RunCommand(command)
216+
217+
218+-def RevertPreviouslyPatchedFiles():
219+- print 'Reverting previously patched files'
220+- files = [
221+- '%(clang)s/test/Index/crash-recovery-modules.m',
222+- '%(clang)s/unittests/libclang/LibclangTest.cpp',
223+- '%(compiler_rt)s/lib/asan/asan_rtl.cc',
224+- '%(compiler_rt)s/test/asan/TestCases/Linux/new_array_cookie_test.cc',
225+- '%(llvm)s/test/DebugInfo/gmlt.ll',
226+- '%(llvm)s/lib/CodeGen/SpillPlacement.cpp',
227+- '%(llvm)s/lib/CodeGen/SpillPlacement.h',
228+- '%(llvm)s/lib/Transforms/Instrumentation/MemorySanitizer.cpp',
229+- '%(clang)s/test/Driver/env.c',
230+- '%(clang)s/lib/Frontend/InitPreprocessor.cpp',
231+- '%(clang)s/test/Frontend/exceptions.c',
232+- '%(clang)s/test/Preprocessor/predefined-exceptions.m',
233+- '%(llvm)s/test/Bindings/Go/go.test',
234+- '%(clang)s/lib/Parse/ParseExpr.cpp',
235+- '%(clang)s/lib/Parse/ParseTemplate.cpp',
236+- '%(clang)s/lib/Sema/SemaDeclCXX.cpp',
237+- '%(clang)s/lib/Sema/SemaExprCXX.cpp',
238+- '%(clang)s/test/SemaCXX/default2.cpp',
239+- '%(clang)s/test/SemaCXX/typo-correction-delayed.cpp',
240+- '%(compiler_rt)s/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc',
241+- '%(compiler_rt)s/test/tsan/signal_segv_handler.cc',
242+- '%(compiler_rt)s/lib/sanitizer_common/sanitizer_coverage_libcdep.cc',
243+- '%(compiler_rt)s/cmake/config-ix.cmake',
244+- '%(compiler_rt)s/CMakeLists.txt',
245+- '%(compiler_rt)s/lib/ubsan/ubsan_platform.h',
246+- ]
247+- for f in files:
248+- f = f % {
249+- 'clang': CLANG_DIR,
250+- 'compiler_rt': COMPILER_RT_DIR,
251+- 'llvm': LLVM_DIR,
252+- }
253+- if os.path.exists(f):
254+- os.remove(f) # For unversioned files.
255+- RunCommand(['svn', 'revert', f])
256+-
257+-
258+-def ApplyLocalPatches():
259+- # There's no patch program on Windows by default. We don't need patches on
260+- # Windows yet, and maybe this not working on Windows will motivate us to
261+- # remove patches over time.
262+- assert sys.platform != 'win32'
263+-
264+- # Apply patch for tests failing with --disable-pthreads (llvm.org/PR11974)
265+- clang_patches = [ r"""\
266+---- test/Index/crash-recovery-modules.m (revision 202554)
267+-+++ test/Index/crash-recovery-modules.m (working copy)
268+-@@ -12,6 +12,8 @@
269+-
270+- // REQUIRES: crash-recovery
271+- // REQUIRES: shell
272+-+// XFAIL: *
273+-+// (PR11974)
274+-
275+- @import Crash;
276+-""", r"""\
277+---- unittests/libclang/LibclangTest.cpp (revision 215949)
278+-+++ unittests/libclang/LibclangTest.cpp (working copy)
279+-@@ -431,7 +431,7 @@
280+- EXPECT_EQ(0U, clang_getNumDiagnostics(ClangTU));
281+- }
282+-
283+--TEST_F(LibclangReparseTest, ReparseWithModule) {
284+-+TEST_F(LibclangReparseTest, DISABLED_ReparseWithModule) {
285+- const char *HeaderTop = "#ifndef H\n#define H\nstruct Foo { int bar;";
286+- const char *HeaderBottom = "\n};\n#endif\n";
287+- const char *MFile = "#include \"HeaderFile.h\"\nint main() {"
288+-"""
289+- ]
290+-
291+- # This Go bindings test doesn't work after bootstrap on Linux, PR21552.
292+- llvm_patches = [ r"""\
293+---- test/Bindings/Go/go.test (revision 223109)
294+-+++ test/Bindings/Go/go.test (working copy)
295+-@@ -1,3 +1,3 @@
296+--; RUN: llvm-go test llvm.org/llvm/bindings/go/llvm
297+-+; RUN: true
298+-
299+- ; REQUIRES: shell
300+-"""
301+- ]
302+-
303+- # The UBSan run-time, which is now bundled with the ASan run-time, doesn't
304+- # work on Mac OS X 10.8 (PR23539).
305+- compiler_rt_patches = [ r"""\
306+---- CMakeLists.txt (revision 241602)
307+-+++ CMakeLists.txt (working copy)
308+-@@ -305,6 +305,7 @@
309+- list(APPEND SANITIZER_COMMON_SUPPORTED_OS iossim)
310+- endif()
311+- endif()
312+-+ set(SANITIZER_MIN_OSX_VERSION "10.7")
313+- if(SANITIZER_MIN_OSX_VERSION VERSION_LESS "10.7")
314+- message(FATAL_ERROR "Too old OS X version: ${SANITIZER_MIN_OSX_VERSION}")
315+- endif()
316+-"""
317+- ]
318+-
319+- for path, patches in [(LLVM_DIR, llvm_patches),
320+- (CLANG_DIR, clang_patches),
321+- (COMPILER_RT_DIR, compiler_rt_patches)]:
322+- print 'Applying patches in', path
323+- for patch in patches:
324+- print patch
325+- p = subprocess.Popen( ['patch', '-p0', '-d', path], stdin=subprocess.PIPE)
326+- (stdout, stderr) = p.communicate(input=patch)
327+- if p.returncode != 0:
328+- raise RuntimeError('stdout %s, stderr %s' % (stdout, stderr))
329+-
330+-
331+ def DeleteChromeToolsShim():
332++ OLD_SHIM_DIR = os.path.join(LLVM_DIR, 'tools', 'zzz-chrometools')
333++ shutil.rmtree(OLD_SHIM_DIR, ignore_errors=True)
334+ shutil.rmtree(CHROME_TOOLS_SHIM_DIR, ignore_errors=True)
335+
336+
337+@@ -337,6 +275,25 @@
338+ f.write('endif (CHROMIUM_TOOLS_SRC)\n')
339+
340+
341++def MaybeDownloadHostGcc(args):
342++ """Downloads gcc 4.8.2 if needed and makes sure args.gcc_toolchain is set."""
343++ if not sys.platform.startswith('linux') or args.gcc_toolchain:
344++ return
345++
346++ if subprocess.check_output(['gcc', '-dumpversion']).rstrip() < '4.7.0':
347++ # We need a newer gcc version.
348++ gcc_dir = os.path.join(LLVM_BUILD_TOOLS_DIR, 'gcc482precise')
349++ if not os.path.exists(gcc_dir):
350++ print 'Downloading pre-built GCC 4.8.2...'
351++ DownloadAndUnpack(
352++ CDS_URL + '/tools/gcc482precise.tgz', LLVM_BUILD_TOOLS_DIR)
353++ args.gcc_toolchain = gcc_dir
354++ else:
355++ # Always set gcc_toolchain; llvm-symbolizer needs the bundled libstdc++.
356++ args.gcc_toolchain = \
357++ os.path.dirname(os.path.dirname(distutils.spawn.find_executable('gcc')))
358++
359++
360+ def AddCMakeToPath():
361+ """Download CMake and add it to PATH."""
362+ if sys.platform == 'win32':
363+@@ -345,20 +302,10 @@
364+ 'cmake-3.2.2-win32-x86', 'bin')
365+ else:
366+ suffix = 'Darwin' if sys.platform == 'darwin' else 'Linux'
367+- zip_name = 'cmake310_%s.tgz' % suffix
368+- cmake_dir = os.path.join(LLVM_BUILD_TOOLS_DIR, 'cmake310', 'bin')
369++ zip_name = 'cmake322_%s.tgz' % suffix
370++ cmake_dir = os.path.join(LLVM_BUILD_TOOLS_DIR, 'cmake322', 'bin')
371+ if not os.path.exists(cmake_dir):
372+- if not os.path.exists(LLVM_BUILD_TOOLS_DIR):
373+- os.makedirs(LLVM_BUILD_TOOLS_DIR)
374+- # The cmake archive is smaller than 20 MB, small enough to keep in memory:
375+- with contextlib.closing(cStringIO.StringIO()) as f:
376+- DownloadUrl(CDS_URL + '/tools/' + zip_name, f)
377+- f.seek(0)
378+- if zip_name.endswith('.zip'):
379+- zipfile.ZipFile(f).extractall(path=LLVM_BUILD_TOOLS_DIR)
380+- else:
381+- tarfile.open(mode='r:gz', fileobj=f).extractall(path=
382+- LLVM_BUILD_TOOLS_DIR)
383++ DownloadAndUnpack(CDS_URL + '/tools/' + zip_name, LLVM_BUILD_TOOLS_DIR)
384+ os.environ['PATH'] = cmake_dir + os.pathsep + os.environ.get('PATH', '')
385+
386+ vs_version = None
387+@@ -383,37 +330,61 @@
388+
389+ def UpdateClang(args):
390+ print 'Updating Clang to %s...' % PACKAGE_VERSION
391+- if ReadStampFile() == PACKAGE_VERSION:
392+- print 'Already up to date.'
393+- return 0
394++
395++ need_gold_plugin = 'LLVM_DOWNLOAD_GOLD_PLUGIN' in os.environ or (
396++ sys.platform.startswith('linux') and
397++ 'buildtype=Official' in os.environ.get('GYP_DEFINES', '') and
398++ 'branding=Chrome' in os.environ.get('GYP_DEFINES', ''))
399++
400++ if ReadStampFile() == PACKAGE_VERSION and not args.force_local_build:
401++ print 'Clang is already up to date.'
402++ if not need_gold_plugin or os.path.exists(
403++ os.path.join(LLVM_BUILD_DIR, "lib/LLVMgold.so")):
404++ return 0
405+
406+ # Reset the stamp file in case the build is unsuccessful.
407+ WriteStampFile('')
408+
409+ if not args.force_local_build:
410+ cds_file = "clang-%s.tgz" % PACKAGE_VERSION
411+- cds_full_url = CDS_URL + '/Win/' + cds_file
412++ if sys.platform == 'win32':
413++ cds_full_url = CDS_URL + '/Win/' + cds_file
414++ elif sys.platform == 'darwin':
415++ cds_full_url = CDS_URL + '/Mac/' + cds_file
416++ else:
417++ assert sys.platform.startswith('linux')
418++ cds_full_url = CDS_URL + '/Linux_x64/' + cds_file
419+
420+- # Check if there's a prebuilt binary and if so just fetch that. That's
421+- # faster, and goma relies on having matching binary hashes on client and
422+- # server too.
423+- print 'Trying to download prebuilt clang'
424+-
425+- # clang packages are smaller than 50 MB, small enough to keep in memory.
426+- with contextlib.closing(cStringIO.StringIO()) as f:
427+- try:
428+- DownloadUrl(cds_full_url, f)
429+- f.seek(0)
430+- tarfile.open(mode='r:gz', fileobj=f).extractall(path=LLVM_BUILD_DIR)
431+- print 'clang %s unpacked' % PACKAGE_VERSION
432+- WriteStampFile(PACKAGE_VERSION)
433+- return 0
434+- except urllib2.HTTPError:
435+- print 'Did not find prebuilt clang %s, building locally' % cds_file
436++ print 'Downloading prebuilt clang'
437++ if os.path.exists(LLVM_BUILD_DIR):
438++ RmTree(LLVM_BUILD_DIR)
439++ try:
440++ DownloadAndUnpack(cds_full_url, LLVM_BUILD_DIR)
441++ print 'clang %s unpacked' % PACKAGE_VERSION
442++ # Download the gold plugin if requested to by an environment variable.
443++ # This is used by the CFI ClusterFuzz bot, and it's required for official
444++ # builds on linux.
445++ if need_gold_plugin:
446++ RunCommand(['python', CHROMIUM_DIR+'/build/download_gold_plugin.py'])
447++ WriteStampFile(PACKAGE_VERSION)
448++ return 0
449++ except urllib2.URLError:
450++ print 'Failed to download prebuilt clang %s' % cds_file
451++ print 'Use --force-local-build if you want to build locally.'
452++ print 'Exiting.'
453++ return 1
454++
455++ if args.with_android and not os.path.exists(ANDROID_NDK_DIR):
456++ print 'Android NDK not found at ' + ANDROID_NDK_DIR
457++ print 'The Android NDK is needed to build a Clang whose -fsanitize=address'
458++ print 'works on Android. See '
459++ print 'http://code.google.com/p/chromium/wiki/AndroidBuildInstructions'
460++ print 'for how to install the NDK, or pass --without-android.'
461++ return 1
462+
463++ MaybeDownloadHostGcc(args)
464+ AddCMakeToPath()
465+
466+- RevertPreviouslyPatchedFiles()
467+ DeleteChromeToolsShim()
468+
469+ Checkout('LLVM', LLVM_REPO_URL + '/llvm/trunk', LLVM_DIR)
470+@@ -429,10 +400,24 @@
471+ # into it too (since OS X 10.6 doesn't have libc++abi.dylib either).
472+ Checkout('libcxxabi', LLVM_REPO_URL + '/libcxxabi/trunk', LIBCXXABI_DIR)
473+
474+- if args.with_patches and sys.platform != 'win32':
475+- ApplyLocalPatches()
476+-
477+ cc, cxx = None, None
478++ libstdcpp = None
479++ if args.gcc_toolchain: # This option is only used on Linux.
480++ # Use the specified gcc installation for building.
481++ cc = os.path.join(args.gcc_toolchain, 'bin', 'gcc')
482++ cxx = os.path.join(args.gcc_toolchain, 'bin', 'g++')
483++
484++ if not os.access(cc, os.X_OK):
485++ print 'Invalid --gcc-toolchain: "%s"' % args.gcc_toolchain
486++ print '"%s" does not appear to be valid.' % cc
487++ return 1
488++
489++ # Set LD_LIBRARY_PATH to make auxiliary targets (tablegen, bootstrap
490++ # compiler, etc.) find the .so.
491++ libstdcpp = subprocess.check_output(
492++ [cxx, '-print-file-name=libstdc++.so.6']).rstrip()
493++ os.environ['LD_LIBRARY_PATH'] = os.path.dirname(libstdcpp)
494++
495+ cflags = cxxflags = ldflags = []
496+
497+ # LLVM uses C++11 starting in llvm 3.5. On Linux, this means libstdc++4.7+ is
498+@@ -462,8 +447,7 @@
499+
500+ if args.bootstrap:
501+ print 'Building bootstrap compiler'
502+- if not os.path.exists(LLVM_BOOTSTRAP_DIR):
503+- os.makedirs(LLVM_BOOTSTRAP_DIR)
504++ EnsureDirExists(LLVM_BOOTSTRAP_DIR)
505+ os.chdir(LLVM_BOOTSTRAP_DIR)
506+ bootstrap_args = base_cmake_args + [
507+ '-DLLVM_TARGETS_TO_BUILD=host',
508+@@ -473,11 +457,16 @@
509+ ]
510+ if cc is not None: bootstrap_args.append('-DCMAKE_C_COMPILER=' + cc)
511+ if cxx is not None: bootstrap_args.append('-DCMAKE_CXX_COMPILER=' + cxx)
512++ RmCmakeCache('.')
513+ RunCommand(['cmake'] + bootstrap_args + [LLVM_DIR], msvc_arch='x64')
514+ RunCommand(['ninja'], msvc_arch='x64')
515+ if args.run_tests:
516+ RunCommand(['ninja', 'check-all'], msvc_arch='x64')
517+ RunCommand(['ninja', 'install'], msvc_arch='x64')
518++ if args.gcc_toolchain:
519++ # Copy that gcc's stdlibc++.so.6 to the build dir, so the bootstrap
520++ # compiler can start.
521++ CopyFile(libstdcpp, os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'lib'))
522+
523+ if sys.platform == 'win32':
524+ cc = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'clang-cl.exe')
525+@@ -489,6 +478,12 @@
526+ else:
527+ cc = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'clang')
528+ cxx = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'clang++')
529++
530++ if args.gcc_toolchain:
531++ # Tell the bootstrap compiler to use a specific gcc prefix to search
532++ # for standard library headers and shared object files.
533++ cflags = ['--gcc-toolchain=' + args.gcc_toolchain]
534++ cxxflags = ['--gcc-toolchain=' + args.gcc_toolchain]
535+ print 'Building final compiler'
536+
537+ if sys.platform == 'darwin':
538+@@ -543,7 +538,7 @@
539+ binutils_incdir = os.path.join(BINUTILS_DIR, 'Linux_x64/Release/include')
540+
541+ # If building at head, define a macro that plugins can use for #ifdefing
542+- # out code that builds at head, but not at LLVM_WIN_REVISION or vice versa.
543++ # out code that builds at head, but not at CLANG_REVISION or vice versa.
544+ if use_head_revision:
545+ cflags += ['-DLLVM_FORCE_HEAD_REVISION']
546+ cxxflags += ['-DLLVM_FORCE_HEAD_REVISION']
547+@@ -555,8 +550,15 @@
548+ deployment_env = os.environ.copy()
549+ deployment_env['MACOSX_DEPLOYMENT_TARGET'] = deployment_target
550+
551+- cmake_args = base_cmake_args + [
552++ cmake_args = []
553++ # TODO(thakis): Unconditionally append this to base_cmake_args instead once
554++ # compiler-rt can build with clang-cl on Windows (http://llvm.org/PR23698)
555++ cc_args = base_cmake_args if sys.platform != 'win32' else cmake_args
556++ if cc is not None: cc_args.append('-DCMAKE_C_COMPILER=' + cc)
557++ if cxx is not None: cc_args.append('-DCMAKE_CXX_COMPILER=' + cxx)
558++ cmake_args += base_cmake_args + [
559+ '-DLLVM_BINUTILS_INCDIR=' + binutils_incdir,
560++ '-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly',
561+ '-DCMAKE_C_FLAGS=' + ' '.join(cflags),
562+ '-DCMAKE_CXX_FLAGS=' + ' '.join(cxxflags),
563+ '-DCMAKE_EXE_LINKER_FLAGS=' + ' '.join(ldflags),
564+@@ -565,35 +567,44 @@
565+ '-DCMAKE_INSTALL_PREFIX=' + LLVM_BUILD_DIR,
566+ '-DCHROMIUM_TOOLS_SRC=%s' % os.path.join(CHROMIUM_DIR, 'tools', 'clang'),
567+ '-DCHROMIUM_TOOLS=%s' % ';'.join(args.tools)]
568+- # TODO(thakis): Unconditionally append this to base_cmake_args instead once
569+- # compiler-rt can build with clang-cl on Windows (http://llvm.org/PR23698)
570+- cc_args = base_cmake_args if sys.platform != 'win32' else cmake_args
571+- if cc is not None: cc_args.append('-DCMAKE_C_COMPILER=' + cc)
572+- if cxx is not None: cc_args.append('-DCMAKE_CXX_COMPILER=' + cxx)
573+
574+- if not os.path.exists(LLVM_BUILD_DIR):
575+- os.makedirs(LLVM_BUILD_DIR)
576++ EnsureDirExists(LLVM_BUILD_DIR)
577+ os.chdir(LLVM_BUILD_DIR)
578++ RmCmakeCache('.')
579+ RunCommand(['cmake'] + cmake_args + [LLVM_DIR],
580+ msvc_arch='x64', env=deployment_env)
581+- RunCommand(['ninja'], msvc_arch='x64')
582++
583++ if args.gcc_toolchain:
584++ # Copy in the right stdlibc++.so.6 so clang can start.
585++ if not os.path.exists(os.path.join(LLVM_BUILD_DIR, 'lib')):
586++ os.mkdir(os.path.join(LLVM_BUILD_DIR, 'lib'))
587++ libstdcpp = subprocess.check_output(
588++ [cxx] + cxxflags + ['-print-file-name=libstdc++.so.6']).rstrip()
589++ CopyFile(libstdcpp, os.path.join(LLVM_BUILD_DIR, 'lib'))
590++
591++ # TODO(thakis): Remove "-d explain" once http://crbug.com/569337 is fixed.
592++ RunCommand(['ninja', '-d', 'explain'], msvc_arch='x64')
593+
594+ if args.tools:
595+ # If any Chromium tools were built, install those now.
596+ RunCommand(['ninja', 'cr-install'], msvc_arch='x64')
597+
598+ if sys.platform == 'darwin':
599+- CopyFile(os.path.join(LLVM_BUILD_DIR, 'libc++.1.dylib'),
600++ CopyFile(os.path.join(libcxxbuild, 'libc++.1.dylib'),
601+ os.path.join(LLVM_BUILD_DIR, 'bin'))
602+ # See http://crbug.com/256342
603+ RunCommand(['strip', '-x', os.path.join(LLVM_BUILD_DIR, 'bin', 'clang')])
604+ elif sys.platform.startswith('linux'):
605+ RunCommand(['strip', os.path.join(LLVM_BUILD_DIR, 'bin', 'clang')])
606+
607+- # Do an x86 build of compiler-rt to get the 32-bit ASan run-time.
608++ # Do an out-of-tree build of compiler-rt.
609++ # On Windows, this is used to get the 32-bit ASan run-time.
610+ # TODO(hans): Remove once the regular build above produces this.
611+- if not os.path.exists(COMPILER_RT_BUILD_DIR):
612+- os.makedirs(COMPILER_RT_BUILD_DIR)
613++ # On Mac and Linux, this is used to get the regular 64-bit run-time.
614++ # Do a clobbered build due to cmake changes.
615++ if os.path.isdir(COMPILER_RT_BUILD_DIR):
616++ RmTree(COMPILER_RT_BUILD_DIR)
617++ os.makedirs(COMPILER_RT_BUILD_DIR)
618+ os.chdir(COMPILER_RT_BUILD_DIR)
619+ # TODO(thakis): Add this once compiler-rt can build with clang-cl (see
620+ # above).
621+@@ -606,11 +617,17 @@
622+ '-DCMAKE_CXX_FLAGS=' + ' '.join(cxxflags)]
623+ if sys.platform != 'win32':
624+ compiler_rt_args += ['-DLLVM_CONFIG_PATH=' +
625+- os.path.join(LLVM_BUILD_DIR, 'bin', 'llvm-config')]
626+- RunCommand(['cmake'] + compiler_rt_args + [LLVM_DIR],
627+- msvc_arch='x86', env=deployment_env)
628++ os.path.join(LLVM_BUILD_DIR, 'bin', 'llvm-config'),
629++ '-DSANITIZER_MIN_OSX_VERSION="10.7"']
630++ # compiler-rt is part of the llvm checkout on Windows but a stand-alone
631++ # directory elsewhere, see the TODO above COMPILER_RT_DIR.
632++ RmCmakeCache('.')
633++ RunCommand(['cmake'] + compiler_rt_args +
634++ [LLVM_DIR if sys.platform == 'win32' else COMPILER_RT_DIR],
635++ msvc_arch='x86', env=deployment_env)
636+ RunCommand(['ninja', 'compiler-rt'], msvc_arch='x86')
637+
638++ # Copy select output to the main tree.
639+ # TODO(hans): Make this (and the .gypi and .isolate files) version number
640+ # independent.
641+ if sys.platform == 'win32':
642+@@ -620,17 +637,35 @@
643+ else:
644+ assert sys.platform.startswith('linux')
645+ platform = 'linux'
646+- asan_rt_lib_src_dir = os.path.join(COMPILER_RT_BUILD_DIR, 'lib', 'clang',
647+- VERSION, 'lib', platform)
648++ asan_rt_lib_src_dir = os.path.join(COMPILER_RT_BUILD_DIR, 'lib', platform)
649++ if sys.platform == 'win32':
650++ # TODO(thakis): This too is due to compiler-rt being part of the checkout
651++ # on Windows, see TODO above COMPILER_RT_DIR.
652++ asan_rt_lib_src_dir = os.path.join(COMPILER_RT_BUILD_DIR, 'lib', 'clang',
653++ VERSION, 'lib', platform)
654+ asan_rt_lib_dst_dir = os.path.join(LLVM_BUILD_DIR, 'lib', 'clang',
655+ VERSION, 'lib', platform)
656+- CopyDirectoryContents(asan_rt_lib_src_dir, asan_rt_lib_dst_dir,
657+- r'^.*-i386\.lib$')
658+- CopyDirectoryContents(asan_rt_lib_src_dir, asan_rt_lib_dst_dir,
659+- r'^.*-i386\.dll$')
660++ # Blacklists:
661++ CopyDirectoryContents(os.path.join(asan_rt_lib_src_dir, '..', '..'),
662++ os.path.join(asan_rt_lib_dst_dir, '..', '..'),
663++ r'^.*blacklist\.txt$')
664++ # Headers:
665++ if sys.platform != 'win32':
666++ CopyDirectoryContents(
667++ os.path.join(COMPILER_RT_BUILD_DIR, 'include/sanitizer'),
668++ os.path.join(LLVM_BUILD_DIR, 'lib/clang', VERSION, 'include/sanitizer'))
669++ # Static and dynamic libraries:
670++ CopyDirectoryContents(asan_rt_lib_src_dir, asan_rt_lib_dst_dir)
671++ if sys.platform == 'darwin':
672++ for dylib in glob.glob(os.path.join(asan_rt_lib_dst_dir, '*.dylib')):
673++ # Fix LC_ID_DYLIB for the ASan dynamic libraries to be relative to
674++ # @executable_path.
675++ # TODO(glider): this is transitional. We'll need to fix the dylib
676++ # name either in our build system, or in Clang. See also
677++ # http://crbug.com/344836.
678++ subprocess.call(['install_name_tool', '-id',
679++ '@executable_path/' + os.path.basename(dylib), dylib])
680+
681+- CopyFile(os.path.join(asan_rt_lib_src_dir, '..', '..', 'asan_blacklist.txt'),
682+- os.path.join(asan_rt_lib_dst_dir, '..', '..'))
683+
684+ if sys.platform == 'win32':
685+ # Make an extra copy of the sanitizer headers, to be put on the include path
686+@@ -640,22 +675,67 @@
687+ aux_sanitizer_include_dir = os.path.join(LLVM_BUILD_DIR, 'lib', 'clang',
688+ VERSION, 'include_sanitizer',
689+ 'sanitizer')
690+- if not os.path.exists(aux_sanitizer_include_dir):
691+- os.makedirs(aux_sanitizer_include_dir)
692++ EnsureDirExists(aux_sanitizer_include_dir)
693+ for _, _, files in os.walk(sanitizer_include_dir):
694+ for f in files:
695+ CopyFile(os.path.join(sanitizer_include_dir, f),
696+ aux_sanitizer_include_dir)
697+
698++ if args.with_android:
699++ make_toolchain = os.path.join(
700++ ANDROID_NDK_DIR, 'build', 'tools', 'make-standalone-toolchain.sh')
701++ for target_arch in ['aarch64', 'arm', 'i686']:
702++ # Make standalone Android toolchain for target_arch.
703++ toolchain_dir = os.path.join(
704++ LLVM_BUILD_DIR, 'android-toolchain-' + target_arch)
705++ RunCommand([
706++ make_toolchain,
707++ '--platform=android-' + ('21' if target_arch == 'aarch64' else '19'),
708++ '--install-dir="%s"' % toolchain_dir,
709++ '--system=linux-x86_64',
710++ '--stl=stlport',
711++ '--toolchain=' + {
712++ 'aarch64': 'aarch64-linux-android-4.9',
713++ 'arm': 'arm-linux-androideabi-4.9',
714++ 'i686': 'x86-4.9',
715++ }[target_arch]])
716++ # Android NDK r9d copies a broken unwind.h into the toolchain, see
717++ # http://crbug.com/357890
718++ for f in glob.glob(os.path.join(toolchain_dir, 'include/c++/*/unwind.h')):
719++ os.remove(f)
720++
721++ # Build ASan runtime for Android in a separate build tree.
722++ build_dir = os.path.join(LLVM_BUILD_DIR, 'android-' + target_arch)
723++ if not os.path.exists(build_dir):
724++ os.mkdir(os.path.join(build_dir))
725++ os.chdir(build_dir)
726++ cflags = ['--target=%s-linux-androideabi' % target_arch,
727++ '--sysroot=%s/sysroot' % toolchain_dir,
728++ '-B%s' % toolchain_dir]
729++ android_args = base_cmake_args + [
730++ '-DCMAKE_C_COMPILER=' + os.path.join(LLVM_BUILD_DIR, 'bin/clang'),
731++ '-DCMAKE_CXX_COMPILER=' + os.path.join(LLVM_BUILD_DIR, 'bin/clang++'),
732++ '-DLLVM_CONFIG_PATH=' + os.path.join(LLVM_BUILD_DIR, 'bin/llvm-config'),
733++ '-DCMAKE_C_FLAGS=' + ' '.join(cflags),
734++ '-DCMAKE_CXX_FLAGS=' + ' '.join(cflags),
735++ '-DANDROID=1']
736++ RmCmakeCache('.')
737++ RunCommand(['cmake'] + android_args + [COMPILER_RT_DIR])
738++ RunCommand(['ninja', 'libclang_rt.asan-%s-android.so' % target_arch])
739++
740++ # And copy it into the main build tree.
741++ runtime = 'libclang_rt.asan-%s-android.so' % target_arch
742++ for root, _, files in os.walk(build_dir):
743++ if runtime in files:
744++ shutil.copy(os.path.join(root, runtime), asan_rt_lib_dst_dir)
745++
746+ # Run tests.
747+ if args.run_tests or use_head_revision:
748+ os.chdir(LLVM_BUILD_DIR)
749+- RunCommand(GetVSVersion().SetupScript('x64') +
750+- ['&&', 'ninja', 'cr-check-all'])
751++ RunCommand(['ninja', 'cr-check-all'], msvc_arch='x64')
752+ if args.run_tests:
753+ os.chdir(LLVM_BUILD_DIR)
754+- RunCommand(GetVSVersion().SetupScript('x64') +
755+- ['&&', 'ninja', 'check-all'])
756++ RunCommand(['ninja', 'check-all'], msvc_arch='x64')
757+
758+ WriteStampFile(PACKAGE_VERSION)
759+ print 'Clang update was successful.'
760+@@ -663,31 +743,6 @@
761+
762+
763+ def main():
764+- if not sys.platform in ['win32', 'cygwin']:
765+- # For non-Windows, fall back to update.sh.
766+- # TODO(hans): Make update.py replace update.sh completely.
767+-
768+- # This script is called by gclient. gclient opens its hooks subprocesses
769+- # with (stdout=subprocess.PIPE, stderr=subprocess.STDOUT) and then does
770+- # custom output processing that breaks printing '\r' characters for
771+- # single-line updating status messages as printed by curl and wget.
772+- # Work around this by setting stderr of the update.sh process to stdin (!):
773+- # gclient doesn't redirect stdin, and while stdin itself is read-only, a
774+- # dup()ed sys.stdin is writable, try
775+- # fd2 = os.dup(sys.stdin.fileno()); os.write(fd2, 'hi')
776+- # TODO: Fix gclient instead, http://crbug.com/95350
777+- if '--no-stdin-hack' in sys.argv:
778+- sys.argv.remove('--no-stdin-hack')
779+- stderr = None
780+- else:
781+- try:
782+- stderr = os.fdopen(os.dup(sys.stdin.fileno()))
783+- except:
784+- stderr = sys.stderr
785+- return subprocess.call(
786+- [os.path.join(os.path.dirname(__file__), 'update.sh')] + sys.argv[1:],
787+- stderr=stderr)
788+-
789+ parser = argparse.ArgumentParser(description='Build Clang.')
790+ parser.add_argument('--bootstrap', action='store_true',
791+ help='first build clang with CC, then with itself.')
792+@@ -695,26 +750,24 @@
793+ help="run only if the script thinks clang is needed")
794+ parser.add_argument('--force-local-build', action='store_true',
795+ help="don't try to download prebuild binaries")
796++ parser.add_argument('--gcc-toolchain', help='set the version for which gcc '
797++ 'version be used for building; --gcc-toolchain=/opt/foo '
798++ 'picks /opt/foo/bin/gcc')
799+ parser.add_argument('--print-revision', action='store_true',
800+ help='print current clang revision and exit.')
801++ parser.add_argument('--print-clang-version', action='store_true',
802++ help='print current clang version (e.g. x.y.z) and exit.')
803+ parser.add_argument('--run-tests', action='store_true',
804+ help='run tests after building; only for local builds')
805+ parser.add_argument('--tools', nargs='*',
806+ help='select which chrome tools to build',
807+ default=['plugins', 'blink_gc_plugin'])
808+- parser.add_argument('--without-patches', action='store_false',
809+- help="don't apply patches (default)", dest='with_patches',
810+- default=True)
811+-
812+- # For now, these flags are only used for the non-Windows flow, but argparser
813+- # gets mad if it sees a flag it doesn't recognize.
814+- parser.add_argument('--no-stdin-hack', action='store_true')
815+-
816++ parser.add_argument('--without-android', action='store_false',
817++ help='don\'t build Android ASan runtime (linux only)',
818++ dest='with_android',
819++ default=sys.platform.startswith('linux'))
820+ args = parser.parse_args()
821+
822+- if re.search(r'\b(make_clang_dir)=', os.environ.get('GYP_DEFINES', '')):
823+- print 'Skipping Clang update (make_clang_dir= was set in GYP_DEFINES).'
824+- return 0
825+ if args.if_needed:
826+ is_clang_required = False
827+ # clang is always used on Mac and Linux.
828+@@ -730,8 +783,16 @@
829+ is_clang_required = True
830+ if not is_clang_required:
831+ return 0
832++ if re.search(r'\b(make_clang_dir)=', os.environ.get('GYP_DEFINES', '')):
833++ print 'Skipping Clang update (make_clang_dir= was set in GYP_DEFINES).'
834++ return 0
835++
836++ if use_head_revision:
837++ # TODO(hans): Remove after the next roll.
838++ global VERSION
839++ VERSION = '3.9.0'
840+
841+- global LLVM_WIN_REVISION, PACKAGE_VERSION
842++ global CLANG_REVISION, PACKAGE_VERSION
843+ if args.print_revision:
844+ if use_head_revision:
845+ print GetSvnRevision(LLVM_DIR)
846+@@ -739,6 +800,10 @@
847+ print PACKAGE_VERSION
848+ return 0
849+
850++ if args.print_clang_version:
851++ sys.stdout.write(VERSION)
852++ return 0
853++
854+ # Don't buffer stdout, so that print statements are immediately flushed.
855+ # Do this only after --print-revision has been handled, else we'll get
856+ # an error message when this script is run from gn for some reason.
857+@@ -747,12 +812,13 @@
858+ if use_head_revision:
859+ # Use a real revision number rather than HEAD to make sure that the stamp
860+ # file logic works.
861+- LLVM_WIN_REVISION = GetSvnRevision(LLVM_REPO_URL)
862+- PACKAGE_VERSION = LLVM_WIN_REVISION + '-0'
863++ CLANG_REVISION = GetSvnRevision(LLVM_REPO_URL)
864++ PACKAGE_VERSION = CLANG_REVISION + '-0'
865+
866+ args.force_local_build = True
867+- # Skip local patches when using HEAD: they probably don't apply anymore.
868+- args.with_patches = False
869++ if 'OS=android' not in os.environ.get('GYP_DEFINES', ''):
870++ # Only build the Android ASan rt on ToT bots when targetting Android.
871++ args.with_android = False
872+
873+ return UpdateClang(args)
874+
pkgs/development/libraries/qt-5/5.6/qtwebengine.nix → pkgs/development/libraries/qt-5/5.6/qtwebengine/default.nixrenamed+3
@@ -53,6 +53,9 @@ qtSubmodule {
5353 libcap
5454 pciutils
5555 ];
56+ patches = [
57+ ./chromium-clang-update-py.patch
58+ ];
5659 postInstall = ''
5760 cat > $out/libexec/qt.conf <<EOF
5861 [Paths]