tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

prepare_build (1568B)


      1 #!/bin/bash
      2 # Copyright 2022 The Chromium Authors.
      3 # Use of this source code is governed by a BSD-style license that can be
      4 # found in the LICENSE file.
      5 
      6 # This script is meant to be run once to setup the example demo agent.
      7 # Run it with one command line argument: the path to a directory where the
      8 # demo agent will be built. This should be a directory outside the SDK
      9 # directory tree. By default, if no directory is supplied, a directory
     10 # named `build` in the project root will be used.
     11 #
     12 # Once the build is prepared, the demo binary is built using the command
     13 # `cmake --build <build-dir>`, where <build-dir> is the same argument given
     14 # to this script.
     15 
     16 set -euo pipefail
     17 
     18 export ROOT_DIR=$(realpath $(dirname $0))
     19 export DEMO_DIR=$(realpath $ROOT_DIR/demo)
     20 export PROTO_DIR=$(realpath  $ROOT_DIR/proto)
     21 # Defaults to $ROOT_DIR/build if no argument is provided.
     22 export BUILD_DIR=$(realpath ${1:-$ROOT_DIR/build})
     23 
     24 echo Root dir:   $ROOT_DIR
     25 echo Build dir:  $BUILD_DIR
     26 echo Demo dir:   $DEMO_DIR
     27 echo Proto dir:  $PROTO_DIR
     28 
     29 # Prepare build directory
     30 mkdir -p $BUILD_DIR
     31 # Prepare protobuf out directory
     32 mkdir -p $BUILD_DIR/gen
     33 # Enter build directory
     34 cd $BUILD_DIR
     35 
     36 # Install vcpkg and use it to install Google Protocol Buffers.
     37 test -d vcpkg || (
     38   git clone https://github.com/microsoft/vcpkg
     39   ./vcpkg/bootstrap-vcpkg.sh -disableMetrics
     40 )
     41 # Install any packages we want from vcpkg.
     42 ./vcpkg/vcpkg install protobuf
     43 ./vcpkg/vcpkg install gtest
     44 
     45 # Generate the build files.
     46 export CMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake
     47 cmake $ROOT_DIR
     48