From 40e704ff22bbc8de14a7c89c656161057a92efe9 Mon Sep 17 00:00:00 2001 From: klzgrad Date: Thu, 25 Jan 2018 10:06:30 -0500 Subject: [PATCH] Add Linux build scripts --- build.sh | 83 ++++++++++++++++++++++++++++++++++++++++++++++ get-clang.sh | 9 +++++ make-test-certs.sh | 32 ++++++++++++++++++ 3 files changed, 124 insertions(+) create mode 100755 build.sh create mode 100755 get-clang.sh create mode 100755 make-test-certs.sh diff --git a/build.sh b/build.sh new file mode 100755 index 0000000000..0faa4916f8 --- /dev/null +++ b/build.sh @@ -0,0 +1,83 @@ +#!/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 [ -d /usr/lib/ccache ]; then + export PATH="/usr/lib/ccache:$PATH" + 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_ozone=true + ozone_auto_platforms=false + ozone_platform="headless" + ozone_platform_headless=true + is_desktop_linux=false + + use_cups=false + use_dbus=false + use_gio=false + enable_extensions=false + 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++ python2 build/gen.py + CCACHE_CPP2= ninja -C out gn + cp out/gn ../out + cd .. +fi + +./out/gn gen "$out" --args="$flags" --script-executable=/usr/bin/python2 + +ninja -C "$out" naive_client diff --git a/get-clang.sh b/get-clang.sh new file mode 100755 index 0000000000..0d1c8974a0 --- /dev/null +++ b/get-clang.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/Linux_x64/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 - diff --git a/make-test-certs.sh b/make-test-certs.sh new file mode 100755 index 0000000000..b523ba1cfd --- /dev/null +++ b/make-test-certs.sh @@ -0,0 +1,32 @@ +#!/bin/sh +set -e + +name='example' + +echo " +[req] +prompt = no +distinguished_name = dn +[dn] +CN = $name +[san] +subjectAltName = DNS:$name" >site.cnf + +openssl genrsa -out ca.key 2048 +openssl req -x509 -new -nodes -key ca.key -days 365 -out ca.pem -subj '/CN=Test Root CA' + +openssl genrsa -out $name.key.rsa 2048 +openssl ecparam -genkey -name prime256v1 -out $name.key.ecdsa +for key in rsa ecdsa; do + openssl req -new -nodes -key $name.key.$key -out $name.csr.$key -reqexts san -config site.cnf + openssl x509 -req -in $name.csr.$key -CA ca.pem -CAkey ca.key -CAcreateserial -out $name.pem.$key -days 365 -extensions san -extfile site.cnf + cat $name.key.$key >>$name.pem.$key + rm $name.key.$key $name.csr.$key +done + +rm ca.key ca.srl site.cnf + +echo +echo 'To trust the test CA:' +echo ' certutil -d "sql:$HOME/.pki/nssdb" -A -t C,, -n 'Test Root CA' -i ca.pem' +echo