Support arm64 and arm builds

This commit is contained in:
klzgrad 2019-10-05 16:32:10 +08:00
parent 23533b1575
commit efd2e2cb07
3 changed files with 50 additions and 8 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" use_sysroot=true'
- name: "linux-arm"
os: linux
dist: bionic
env: EXTRA_FLAGS='target_cpu="arm" use_sysroot=true'
- 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

@ -7,6 +7,31 @@ case "$ARCH" in
MSYS*) ARCH=Windows;; MSYS*) ARCH=Windows;;
esac esac
eval "$EXTRA_FLAGS"
if [ "$use_sysroot" = true ]; then
ln -sfn / ./build/linux/debian_sid_amd64-sysroot
sudo mount --bind /usr/lib/x86_64-linux-gnu/pkgconfig /usr/lib/pkgconfig
case "$target_cpu" in
arm64)
rm -rf ./build/linux/debian_sid_arm64-sysroot
./build/linux/sysroot_scripts/sysroot-creator-sid-naive.sh BuildSysrootARM64
mkdir -p ./build/linux/debian_sid_arm64-sysroot
tar xf ./out/sysroot-build/sid/debian_sid_arm64_sysroot.tar.xz -C ./build/linux/debian_sid_arm64-sysroot
;;
arm)
rm -rf ./build/linux/debian_sid_arm-sysroot
./build/linux/sysroot_scripts/sysroot-creator-sid-naive.sh BuildSysrootARM
mkdir -p ./build/linux/debian_sid_arm-sysroot
tar xf ./out/sysroot-build/sid/debian_sid_arm_sysroot.tar.xz -C ./build/linux/debian_sid_arm-sysroot
rm -rf ./build/linux/debian_sid_i386-sysroot
./build/linux/sysroot_scripts/sysroot-creator-sid-naive.sh BuildSysrootI386
mkdir -p ./build/linux/debian_sid_i386-sysroot
tar xf ./out/sysroot-build/sid/debian_sid_i386_sysroot.tar.xz -C ./build/linux/debian_sid_i386-sysroot
;;
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 [ "$use_sysroot" = true ]; 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() {