build.sh 1.16 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
#!/usr/bin/env bash
#
# Environment variables:
#
# SOURCE_DIR: Set to the directory of the libgit2 source (optional)
#     If not set, it will be derived relative to this script.

set -e

SOURCE_DIR=${SOURCE_DIR:-$( cd "$( dirname "${BASH_SOURCE[0]}" )" && dirname $( pwd ) )}
BUILD_DIR=$(pwd)
12
CC=${CC:-cc}
13 14 15 16 17 18 19 20 21 22 23

indent() { sed "s/^/    /"; }

echo "Source directory: ${SOURCE_DIR}"
echo "Build directory:  ${BUILD_DIR}"
echo ""
echo "Operating system version:"
uname -a 2>&1 | indent
echo "CMake version:"
cmake --version 2>&1 | indent
echo "Compiler version:"
24
$CC --version 2>&1 | indent
25 26 27 28 29 30
echo ""

echo "##############################################################################"
echo "## Configuring build environment"
echo "##############################################################################"

31 32
echo cmake ${SOURCE_DIR} -DENABLE_WERROR=ON -DBUILD_EXAMPLES=ON ${CMAKE_OPTIONS}
cmake ${SOURCE_DIR} -DENABLE_WERROR=ON -DBUILD_EXAMPLES=ON ${CMAKE_OPTIONS}
33 34 35 36 37 38 39

echo ""
echo "##############################################################################"
echo "## Building libgit2"
echo "##############################################################################"

cmake --build .