From ae7b38799c386edbed3e1dcd4b6414087c6f49e6 Mon Sep 17 00:00:00 2001 From: William Hesse Date: Wed, 10 Aug 2016 16:04:03 +0200 Subject: [PATCH] Add tools to build Dart with Chromium's sysroot. This downloads and uses the Debian Wheezy sysroot used by chromium, when building Dart. The resulting dart runtime requires libc version 2.14, and building without the sysroot requires libc version 2.16 BUG=https://github.com/dart-lang/sdk/issues/27048 R=sgjesse@google.com Review URL: https://codereview.chromium.org/2230083005 . --- tools/download_chromium_sysroot.sh | 23 +++++++++++++++++++++++ tools/set_ia32_sysroot.sh | 19 +++++++++++++++++++ tools/set_x64_sysroot.sh | 19 +++++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100755 tools/download_chromium_sysroot.sh create mode 100755 tools/set_ia32_sysroot.sh create mode 100755 tools/set_x64_sysroot.sh diff --git a/tools/download_chromium_sysroot.sh b/tools/download_chromium_sysroot.sh new file mode 100755 index 00000000000..75b3744e15d --- /dev/null +++ b/tools/download_chromium_sysroot.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# +# Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file +# for details. All rights reserved. Use of this source code is governed by a +# BSD-style license that can be found in the LICENSE file. + +# Downloads the ia32 and x64 Debian wheezy sysroot that chromium uses, +# Only tested and used on Ubuntu trusty linux. Used to keep glibc version low. +# Creates directories called "build" and "tools" in the current directory. +# After running this, source set_ia32_sysroot.sh or set_x64_sysroot.sh, in +# the same working directory, to set the compilation environment variables. +# Sourcing a script means running the script with a '.', so that it runs +# in the current shell, not a subshell, as in: +# . sdk/tools/set_ia32_sysroot.sh + +git clone https://chromium.googlesource.com/chromium/src/build +mkdir tools +cd tools +git clone https://chromium.googlesource.com/external/gyp +cd .. + +build/linux/sysroot_scripts/install-sysroot.py --arch i386 +build/linux/sysroot_scripts/install-sysroot.py --arch amd64 diff --git a/tools/set_ia32_sysroot.sh b/tools/set_ia32_sysroot.sh new file mode 100755 index 00000000000..c7156cea27b --- /dev/null +++ b/tools/set_ia32_sysroot.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# +# Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file +# for details. All rights reserved. Use of this source code is governed by a +# BSD-style license that can be found in the LICENSE file. + +# Sets the compiler environment variables to use a downloaded wheezy sysroot +# when building Dart with architecture ia32. +# Run this in the same working directory that you have run +# sdk/tools/download_chromium_sysroot.sh in. +# Must be sourced, not run in a subshell, to modify the environment. +# Run with the command ". sdk/tools/set_ia32_sysroot.sh" +# Only tested and used on Ubuntu trusty linux. Used to build dart with +# no requirement for glibc greater than version 2.14. + +export CXXFLAGS="--sysroot=$PWD/build/linux/debian_wheezy_i386-sysroot -I=/usr/include/c++/4.6 -I=/usr/include/c++/4.6/i486-linux-gnu" + +export LDFLAGS=--sysroot=$PWD/build/linux/debian_wheezy_i386-sysroot +export CFLAGS=--sysroot=$PWD/build/linux/debian_wheezy_i386-sysroot diff --git a/tools/set_x64_sysroot.sh b/tools/set_x64_sysroot.sh new file mode 100755 index 00000000000..bc28961ce60 --- /dev/null +++ b/tools/set_x64_sysroot.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# +# Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file +# for details. All rights reserved. Use of this source code is governed by a +# BSD-style license that can be found in the LICENSE file. + +# Sets the compiler environment variables to use a downloaded wheezy sysroot +# when building Dart with architecture x64. +# Run this in the same working directory that you have run +# sdk/tools/download_chromium_sysroot.sh in. +# Must be sourced, not run in a subshell, to modify the environment. +# Run with the command ". sdk/tools/set_x64_sysroot.sh" +# Only tested and used on Ubuntu trusty linux. Used to build dart with +# no requirement for glibc greater than version 2.14. + +export CXXFLAGS="--sysroot=$PWD/build/linux/debian_wheezy_amd64-sysroot -I=/usr/include/c++/4.6 -I=/usr/include/c++/4.6/x86_64-linux-gnu" + +export LDFLAGS=--sysroot=$PWD/build/linux/debian_wheezy_amd64-sysroot +export CFLAGS=--sysroot=$PWD/build/linux/debian_wheezy_amd64-sysroot