]> git.proxmox.com Git - libgit2.git/blob - azure-pipelines/build.sh
Drop patch that has been merged upstream
[libgit2.git] / azure-pipelines / build.sh
1 #!/usr/bin/env bash
2 #
3 # Environment variables:
4 #
5 # SOURCE_DIR: Set to the directory of the libgit2 source (optional)
6 # If not set, it will be derived relative to this script.
7
8 set -e
9
10 SOURCE_DIR=${SOURCE_DIR:-$( cd "$( dirname "${BASH_SOURCE[0]}" )" && dirname $( pwd ) )}
11 BUILD_DIR=$(pwd)
12 BUILD_PATH=${BUILD_PATH:=$PATH}
13 CMAKE=$(which cmake)
14 CMAKE_GENERATOR=${CMAKE_GENERATOR:-Unix Makefiles}
15
16 if [[ "$(uname -s)" == MINGW* ]]; then
17 BUILD_PATH=$(cygpath "$BUILD_PATH")
18 fi
19
20 indent() { sed "s/^/ /"; }
21
22 echo "Source directory: ${SOURCE_DIR}"
23 echo "Build directory: ${BUILD_DIR}"
24 echo ""
25
26 if [ "$(uname -s)" = "Darwin" ]; then
27 echo "macOS version:"
28 sw_vers | indent
29 fi
30
31 if [ -f "/etc/debian_version" ]; then
32 echo "Debian version:"
33 (source /etc/lsb-release && echo "${DISTRIB_DESCRIPTION}") | indent
34 fi
35
36 echo "Kernel version:"
37 uname -a 2>&1 | indent
38
39 echo "CMake version:"
40 env PATH="${BUILD_PATH}" "${CMAKE}" --version 2>&1 | indent
41
42 if test -n "${CC}"; then
43 echo "Compiler version:"
44 "${CC}" --version 2>&1 | indent
45 fi
46 echo "Environment:"
47 if test -n "${CC}"; then
48 echo "CC=${CC}" | indent
49 fi
50 if test -n "${CFLAGS}"; then
51 echo "CFLAGS=${CFLAGS}" | indent
52 fi
53 echo ""
54
55 echo "##############################################################################"
56 echo "## Configuring build environment"
57 echo "##############################################################################"
58
59 echo cmake -DENABLE_WERROR=ON -DBUILD_EXAMPLES=ON -DBUILD_FUZZERS=ON -DUSE_STANDALONE_FUZZERS=ON -G \"${CMAKE_GENERATOR}\" ${CMAKE_OPTIONS} -S \"${SOURCE_DIR}\"
60 env PATH="${BUILD_PATH}" "${CMAKE}" -DENABLE_WERROR=ON -DBUILD_EXAMPLES=ON -DBUILD_FUZZERS=ON -DUSE_STANDALONE_FUZZERS=ON -G "${CMAKE_GENERATOR}" ${CMAKE_OPTIONS} -S "${SOURCE_DIR}"
61
62 echo ""
63 echo "##############################################################################"
64 echo "## Building libgit2"
65 echo "##############################################################################"
66
67 env PATH="${BUILD_PATH}" "${CMAKE}" --build .