From 3a786e6bb09dbf2e1e3450cef6f07baa7a49a806 Mon Sep 17 00:00:00 2001 From: klzgrad Date: Tue, 2 Apr 2019 23:16:57 +0800 Subject: [PATCH] Support win32 build Also use sccache releases instead of building with cargo. --- .appveyor.yml | 8 +++++--- src/build.sh | 8 ++++---- src/get-clang.sh | 11 +++-------- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 6737217647..f3aeb99589 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -2,19 +2,21 @@ branches: except: - dev version: '{build}' +platform: + - x64 + - x86 image: Visual Studio 2017 install: - cinst ninja cache: - - '%USERPROFILE%\.cargo\bin' - '%LOCALAPPDATA%\Mozilla\sccache' build_script: - bash ./tools/import-upstream.sh - bash -c 'cd src; ./get-clang.sh' - bash -c '~/.cargo/bin/sccache -s' - - bash -c 'cd src; ./build.sh' + - bash -c 'cd src; EXTRA_FLAGS=target_cpu=\"$PLATFORM\" ./build.sh' - bash -c '~/.cargo/bin/sccache -s' - - ps: $env:BUILD_NAME="naiveproxy-$env:APPVEYOR_REPO_TAG_NAME-win64" + - ps: $env:BUILD_NAME="naiveproxy-$env:APPVEYOR_REPO_TAG_NAME-win-$env:PLATFORM" - bash -c 'mkdir $BUILD_NAME' - bash -c 'cp src/out/Release/naive.exe src/config.json LICENSE USAGE.txt $BUILD_NAME' - bash -c '7z a $BUILD_NAME.zip $BUILD_NAME' diff --git a/src/build.sh b/src/build.sh index 6d26318199..bd2f5394df 100755 --- a/src/build.sh +++ b/src/build.sh @@ -6,16 +6,16 @@ mkdir -p "$TMPDIR" if [ "$1" = debug ]; then out=out/Debug - flags=' + flags="$EXTRA_FLAGS is_debug=true - is_component_build=true' + is_component_build=true" else out=out/Release - flags=' + flags="$EXTRA_FLAGS is_official_build=true use_jumbo_build=true exclude_unwind_tables=true - symbol_level=0' + symbol_level=0" fi if which ccache >/dev/null 2>&1; then diff --git a/src/get-clang.sh b/src/get-clang.sh index 1d3396f743..d5ba13b9ca 100755 --- a/src/get-clang.sh +++ b/src/get-clang.sh @@ -31,14 +31,9 @@ fi # sccache (Windows) if [ "$ARCH" = Windows ]; then - export PATH="$PATH:$HOME/.cargo/bin" - if ! which cargo >/dev/null 2>&1; then - curl -OJ https://win.rustup.rs/ - ./rustup-init.exe -y -v --no-modify-path - fi - if ! which sccache >/dev/null 2>&1; then - cargo install --git https://github.com/mozilla/sccache.git - fi + sccache_url="https://github.com/mozilla/sccache/releases/download/0.2.8/sccache-0.2.8-x86_64-pc-windows-msvc.tar.gz" + mkdir -p ~/.cargo/bin + curl -L "$sccache_url" | tar xzf - --strip=1 -C ~/.cargo/bin fi # gn