| 1 | # Wedge definition for bloaty
 | 
| 2 | #
 | 
| 3 | # Loaded by deps/wedge.sh.
 | 
| 4 | 
 | 
| 5 | set -o nounset
 | 
| 6 | set -o pipefail
 | 
| 7 | set -o errexit
 | 
| 8 | 
 | 
| 9 | WEDGE_NAME='bloaty'
 | 
| 10 | WEDGE_VERSION='1.1'
 | 
| 11 | WEDGE_IS_ABSOLUTE=1  # TODO: try relaxing
 | 
| 12 | 
 | 
| 13 | wedge-make() {
 | 
| 14 |   local src_dir=$1
 | 
| 15 |   local build_dir=$2
 | 
| 16 |   local install_dir=$3
 | 
| 17 | 
 | 
| 18 |   pushd $build_dir
 | 
| 19 | 
 | 
| 20 |   # It's much slower without -G Ninja!
 | 
| 21 |   # TODO: Ninja is not in the wedge-makeer
 | 
| 22 |   # time cmake -G Ninja -DCMAKE_INSTALL_PREFIX=$install_dir $src_dir
 | 
| 23 | 
 | 
| 24 |   # Limit parallelism.  This build is ridiculously expensive?
 | 
| 25 |   # time ninja -j 4
 | 
| 26 | 
 | 
| 27 |   time cmake -DCMAKE_INSTALL_PREFIX=$install_dir $src_dir
 | 
| 28 | 
 | 
| 29 |   time make -j 4
 | 
| 30 | 
 | 
| 31 |   popd
 | 
| 32 | }
 | 
| 33 | 
 | 
| 34 | wedge-install() {
 | 
| 35 |   local build_dir=$1
 | 
| 36 |   local install_dir=$2
 | 
| 37 | 
 | 
| 38 |   pushd $build_dir
 | 
| 39 | 
 | 
| 40 |   # Uh, this includes 500 MB of the bloated protobuf compiler, as static
 | 
| 41 |   # libraries and binaries
 | 
| 42 |   # time make install
 | 
| 43 | 
 | 
| 44 |   # So let's just copy the executable
 | 
| 45 |   mkdir -p $install_dir
 | 
| 46 | 
 | 
| 47 |   # 45 MB without stripping
 | 
| 48 |   # cp -v $build_dir/bloaty $install_dir/bloaty
 | 
| 49 | 
 | 
| 50 |   # 6 MB after stripping
 | 
| 51 |   strip -o $install_dir/bloaty \
 | 
| 52 |     $build_dir/bloaty 
 | 
| 53 | 
 | 
| 54 |   popd
 | 
| 55 | }
 | 
| 56 | 
 | 
| 57 | wedge-smoke-test() {
 | 
| 58 |   local install_dir=$1
 | 
| 59 | 
 | 
| 60 |   $install_dir/bloaty --help
 | 
| 61 | }
 |