From a39a88b90c35b66f7b018edf123cd7bf7af6c20d Mon Sep 17 00:00:00 2001 From: klzgrad Date: Wed, 12 Dec 2018 10:04:29 -0500 Subject: [PATCH] Add build scripts on Macos --- build-mac.sh | 76 ++++++++++++++++++++++++++++++++++++++++++++++++ get-clang-mac.sh | 9 ++++++ 2 files changed, 85 insertions(+) create mode 100755 build-mac.sh create mode 100755 get-clang-mac.sh diff --git a/build-mac.sh b/build-mac.sh new file mode 100755 index 0000000000..69e77c9bc9 --- /dev/null +++ b/build-mac.sh @@ -0,0 +1,76 @@ +#!/bin/sh +set -e + +export TMPDIR="$PWD/tmp" +mkdir -p "$TMPDIR" + +if [ "$1" = debug ]; then + out=out/Debug + flags=' + is_debug=true + is_component_build=true + exclude_unwind_tables=false + remove_webcore_debug_symbols=false + use_thin_lto=false + use_lld=false' +else + out=out/Release + flags=' + is_debug=false + is_component_build=false + exclude_unwind_tables=true + remove_webcore_debug_symbols=true + use_thin_lto=true + use_lld=true' +fi + +if which -s ccache; then + export CCACHE_SLOPPINESS=time_macros + export CCACHE_BASEDIR="$PWD" + export CCACHE_CPP2=yes + flags="$flags"' + cc_wrapper="ccache"' +fi + +flags="$flags"' + is_clang=true + linux_use_bundled_binutils=false + + fatal_linker_warnings=false + treat_warnings_as_errors=false + use_sysroot=false + + fieldtrial_testing_like_official_build=true + + use_cups=false + use_dbus=false + use_gio=false + enable_extensions=true + use_platform_icu_alternatives=true + + disable_file_support=true + enable_websockets=false + disable_ftp_support=true + use_kerberos=false + disable_brotli_filter=true + enable_mdns=false + enable_reporting=false + include_transport_security_state_preload_list=false +' + +rm -rf "./$out" +mkdir -p out + +if [ ! -f out/gn ]; then + rm -rf gn + git clone https://gn.googlesource.com/gn + cd gn + CC=gcc CXX=g++ python build/gen.py + CCACHE_CPP2= ninja -C out gn + cp out/gn ../out + cd .. +fi + +./out/gn gen "$out" --args="$flags" + +ninja -C "$out" naive diff --git a/get-clang-mac.sh b/get-clang-mac.sh new file mode 100755 index 0000000000..194b591081 --- /dev/null +++ b/get-clang-mac.sh @@ -0,0 +1,9 @@ +#!/bin/sh +set -ex + +CLANG_REVISION=$(grep -m1 CLANG_REVISION tools/clang/scripts/update.py | cut -d"'" -f2) +CLANG_SUB_REVISION=$(grep -m1 CLANG_SUB_REVISION tools/clang/scripts/update.py | cut -d= -f2) +url="https://commondatastorage.googleapis.com/chromium-browser-clang/Mac/clang-$CLANG_REVISION-$CLANG_SUB_REVISION.tgz" +mkdir -p third_party/llvm-build/Release+Asserts +cd third_party/llvm-build/Release+Asserts +curl "$url" -o- | tar xzf -