diff options
| author | Emīls <emils@mullvad.net> | 2018-06-18 14:43:03 +0100 |
|---|---|---|
| committer | Emīls Piņķis <emils@mullvad.net> | 2018-06-21 16:02:50 +0100 |
| commit | 676ffcdfc67700b2e14acbec23371d8a4ef9bfad (patch) | |
| tree | 1a8374a796c90e9f2f96f6bdc0c1adb101522a0d | |
| parent | d242d584bb9d0fed09e4f5b6138cf9e84197ec6a (diff) | |
| download | mullvadvpn-676ffcdfc67700b2e14acbec23371d8a4ef9bfad.tar.xz mullvadvpn-676ffcdfc67700b2e14acbec23371d8a4ef9bfad.zip | |
Improve windows library buildscript
| -rw-r--r-- | build_winfw.sh | 58 |
1 files changed, 12 insertions, 46 deletions
diff --git a/build_winfw.sh b/build_winfw.sh index 521fe007fa..2726170c75 100644 --- a/build_winfw.sh +++ b/build_winfw.sh @@ -1,7 +1,8 @@ set -eu # List of solutions to build -CPP_SOLUTIONS=${CPP_SOLUTIONS:-"winfw"} +WINFW_SOLUTIONS=${WINFW_SOLUTIONS:-"winfw"} +WINDNS_SOLUTIONS=${WINDNS_SOLUTIONS:-"windns"} # Override this variable to set your own list of build configurations for # wfpctl @@ -12,20 +13,19 @@ CPP_BUILD_TARGETS=${CPP_BUILD_TARGETS:-"x86 x64"} CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-"./target/"} -# Builds all 4 variations of the wfpctl.dll library. Takes an argument that is -# the root of the WFP repository. -function build_wfpctl +# Builds visual studio projects +function build_project { local path="$1" + local solutions="$2" # Sometimes the build output needs to be cleaned up rm -r $path/bin/* || true - + set -x for mode in $CPP_BUILD_MODES; do for target in $CPP_BUILD_TARGETS; do - cmd.exe "/c msbuild.exe $(to_win_path $path/winfw.sln) /p:Configuration=$mode /p:Platform=$target /t:$CPP_SOLUTIONS" - + cmd.exe "/c msbuild.exe $(to_win_path $path) /p:Configuration=$mode /p:Platform=$target /t:$solutions" done done set +x @@ -37,7 +37,7 @@ function to_win_path # if it's a relative path and starts with a dot (.), don't transform the # drive prefix (/c/ -> C:\) if echo $unixpath | grep '^\.' >/dev/null; then - echo $unixpath | sed -e 's/^\///' -e 's/\//\\/g' + echo $unixpath | sed -e 's/^\///' -e 's/\//\\/g' # if it's an absolute path, transform the drive prefix else # remove the cygrdive prefix if it's there @@ -46,21 +46,6 @@ function to_win_path fi } -function copy_outputs -{ - local wfp_root_path=$1 - - for mode in $CPP_BUILD_MODES; do - for target in $CPP_BUILD_TARGETS; do - local dll_path=$(get_wfp_output_path $wfp_root_path $target $mode) - local cargo_target=$(get_cargo_target_dir $target $mode) - mkdir -p $cargo_target - cp "$dll_path/winfw.dll" $cargo_target - done - done - -} - function get_wfp_output_path { local wfp_root=$1 @@ -102,26 +87,6 @@ function get_cargo_target_dir echo "$CARGO_TARGET_DIR/$platform_triplet/${build_mode,,}" } -# Rust isn't internally consistent w.r.t. architecture names - for build -# targets 32 bit x86 is calles i686, for hosts, it's x86. Hence these need to -# be converted. -function host_arch_to_target_arch -{ - local host_arch=$1 - - case $host_arch in - "x86") - echo "i686" - ;; - "x64") - echo "x86_64" - ;; - *) - echo $build_target - ;; - esac -} - # Since Microsoft likes to name their architectures differently from Rust, this # function tries to match microsoft names to Rust names. function arch_from_build_target @@ -153,10 +118,11 @@ function rustc_host_arch function main { - local wfp_root_path=${CPP_ROOT_PATH:-"./windows/winfw"} + local winfw_root_path=${CPP_ROOT_PATH:-"./windows/winfw"} + local windns_root_path=${CPP_ROOT_PATH:-"./windows/windns"} - build_wfpctl $wfp_root_path - copy_outputs $wfp_root_path + build_project "$winfw_root_path/winfw.sln" "$WINFW_SOLUTIONS" + build_project "$windns_root_path/windns.sln" "$WINDNS_SOLUTIONS" } main |
