Support arm64 and arm builds

This commit is contained in:
klzgrad 2019-10-05 16:32:10 +08:00
parent dec7c4ae10
commit eeee033f9d
4 changed files with 48 additions and 9 deletions

View File

@ -4,18 +4,27 @@ branches:
language: cpp language: cpp
matrix: matrix:
include: include:
- os: linux - name: "linux-x64"
dist: xenial os: linux
- os: osx 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 osx_image: xcode10.2
addons: addons:
apt: apt:
sources:
- sourceline: 'deb http://archive.ubuntu.com/ubuntu/ xenial-backports universe'
packages: packages:
- ninja-build=1.7.1-1~ubuntu16.04.1 - ninja-build
- pkg-config - pkg-config
- libnss3-dev - libnss3-dev
- qemu-user
homebrew: homebrew:
packages: packages:
- ninja - ninja
@ -28,7 +37,7 @@ script:
- ( cd src; ./build.sh ) - ( cd src; ./build.sh )
- ccache -s - ccache -s
- ./tests/basic.sh src/out/Release/naive - ./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 - mkdir $BUILD_NAME
- cp src/out/Release/naive src/config.json LICENSE USAGE.txt $BUILD_NAME - cp src/out/Release/naive src/config.json LICENSE USAGE.txt $BUILD_NAME
- tar cJf $BUILD_NAME.tar.xz $BUILD_NAME - tar cJf $BUILD_NAME.tar.xz $BUILD_NAME

View File

@ -37,7 +37,6 @@ flags="$flags"'
fatal_linker_warnings=false fatal_linker_warnings=false
treat_warnings_as_errors=false treat_warnings_as_errors=false
use_sysroot=false
fieldtrial_testing_like_official_build=true fieldtrial_testing_like_official_build=true

View File

@ -7,6 +7,29 @@ case "$ARCH" in
MSYS*) ARCH=Windows;; MSYS*) ARCH=Windows;;
esac 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 # Clang
python2=$(which python2 2>/dev/null || which python 2>/dev/null) python2=$(which python2 2>/dev/null || which python 2>/dev/null)
CLANG_REVISION=$($python2 tools/clang/scripts/update.py --print-revision) CLANG_REVISION=$($python2 tools/clang/scripts/update.py --print-revision)

View File

@ -2,10 +2,18 @@
[ "$1" ] || exit 1 [ "$1" ] || exit 1
naive="$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 set -ex
test_proxy() { 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() { test_naive() {