From eeee033f9d4678ac11b5f8ca722021480b5be59c Mon Sep 17 00:00:00 2001 From: klzgrad Date: Sat, 5 Oct 2019 16:32:10 +0800 Subject: [PATCH] Support arm64 and arm builds --- .travis.yml | 23 ++++++++++++++++------- src/build.sh | 1 - src/get-clang.sh | 23 +++++++++++++++++++++++ tests/basic.sh | 10 +++++++++- 4 files changed, 48 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1a3c1d602f..46df6dcdef 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,18 +4,27 @@ branches: language: cpp matrix: include: - - os: linux - dist: xenial - - os: osx + - name: "linux-x64" + os: linux + dist: bionic + - name: "linux-arm64" + os: linux + dist: bionic + env: EXTRA_FLAGS='target_cpu="arm64"' + - name: "linux-arm" + os: linux + dist: bionic + env: EXTRA_FLAGS='target_cpu="arm"' + - name: "osx" + os: osx osx_image: xcode10.2 addons: apt: - sources: - - sourceline: 'deb http://archive.ubuntu.com/ubuntu/ xenial-backports universe' packages: - - ninja-build=1.7.1-1~ubuntu16.04.1 + - ninja-build - pkg-config - libnss3-dev + - qemu-user homebrew: packages: - ninja @@ -28,7 +37,7 @@ script: - ( cd src; ./build.sh ) - ccache -s - ./tests/basic.sh src/out/Release/naive - - export BUILD_NAME="naiveproxy-$TRAVIS_BRANCH-$TRAVIS_OS_NAME" + - export BUILD_NAME="naiveproxy-$TRAVIS_BRANCH-$TRAVIS_JOB_NAME" - mkdir $BUILD_NAME - cp src/out/Release/naive src/config.json LICENSE USAGE.txt $BUILD_NAME - tar cJf $BUILD_NAME.tar.xz $BUILD_NAME diff --git a/src/build.sh b/src/build.sh index 5f496a5560..4824ea364d 100755 --- a/src/build.sh +++ b/src/build.sh @@ -37,7 +37,6 @@ flags="$flags"' fatal_linker_warnings=false treat_warnings_as_errors=false - use_sysroot=false fieldtrial_testing_like_official_build=true diff --git a/src/get-clang.sh b/src/get-clang.sh index 8e00f34e86..807c85ed41 100755 --- a/src/get-clang.sh +++ b/src/get-clang.sh @@ -7,6 +7,29 @@ case "$ARCH" in MSYS*) ARCH=Windows;; esac +eval "$EXTRA_FLAGS" + +build_sysroot() { + local lower="$(echo "$1" | tr '[:upper:]' '[:lower:]')" + ./build/linux/sysroot_scripts/sysroot-creator-sid-naive.sh "BuildSysroot$1" + rm -rf "./build/linux/debian_sid_$lower-sysroot" + mkdir "./build/linux/debian_sid_$lower-sysroot" + tar xf "./out/sysroot-build/sid/debian_sid_${lower}_sysroot.tar.xz" -C "./build/linux/debian_sid_$lower-sysroot" +} + +if [ "$ARCH" = Linux ]; then + build_sysroot Amd64 + case "$target_cpu" in + arm64) + build_sysroot ARM64 + ;; + arm) + build_sysroot I386 + build_sysroot ARM + ;; + esac +fi + # Clang python2=$(which python2 2>/dev/null || which python 2>/dev/null) CLANG_REVISION=$($python2 tools/clang/scripts/update.py --print-revision) diff --git a/tests/basic.sh b/tests/basic.sh index 69de22b615..b813b88992 100755 --- a/tests/basic.sh +++ b/tests/basic.sh @@ -2,10 +2,18 @@ [ "$1" ] || exit 1 naive="$1" +eval "$EXTRA_FLAGS" +if [ "$(uname)" = Linux ]; then + case "$target_cpu" in + arm64) naive="qemu-aarch64 -L src/build/linux/debian_sid_arm64-sysroot $naive";; + arm) naive="qemu-arm -L src/build/linux/debian_sid_arm-sysroot $naive";; + esac +fi + set -ex test_proxy() { - curl -v --proxy "$1" https://www.google.com/humans.txt | grep '^Google is built' + curl -v --proxy "$1" https://www.microsoft.com/robots.txt | grep 'www.microsoft.com' } test_naive() {