summaryrefslogtreecommitdiff
path: root/script/build-libgit2.sh
diff options
context:
space:
mode:
authorlhchavez <[email protected]>2020-08-15 17:19:53 -0700
committerGitHub <[email protected]>2020-08-15 17:19:53 -0700
commit53149517592d613935e6bcbcea18f8ddb6bb546e (patch)
tree85874a8e442c509148b81323370e54dbea93a61f /script/build-libgit2.sh
parentfc6eaf36388841b16ff004e1d48e887d3f9613dc (diff)
Refresh the GitHub Actions CI (#632)
This change: * Builds the library with Go 1.14, too. * Builds the non-legacy tests with Ubuntu Focal (20.04). * Adds testing for system-wide libraries, both static and dynamic versions. * Fixes a typo in the README.
Diffstat (limited to 'script/build-libgit2.sh')
-rwxr-xr-xscript/build-libgit2.sh57
1 files changed, 39 insertions, 18 deletions
diff --git a/script/build-libgit2.sh b/script/build-libgit2.sh
index 7398cd9..98ff78b 100755
--- a/script/build-libgit2.sh
+++ b/script/build-libgit2.sh
@@ -6,33 +6,54 @@
set -e
-if [ "$#" -eq "0" ]; then
- echo "Usage: $0 <--dynamic|--static>">&2
+usage() {
+ echo "Usage: $0 <--dynamic|--static> [--system]">&2
exit 1
+}
+
+if [ "$#" -eq "0" ]; then
+ usage
fi
ROOT="$(cd "$(dirname "$0")/.." && echo "${PWD}")"
VENDORED_PATH="${ROOT}/vendor/libgit2"
+BUILD_SYSTEM=OFF
+
+while [ $# -gt 0 ]; do
+ case "$1" in
+ --static)
+ BUILD_PATH="${ROOT}/static-build"
+ BUILD_SHARED_LIBS=OFF
+ ;;
-case "$1" in
- --static)
- BUILD_PATH="${ROOT}/static-build"
- BUILD_SHARED_LIBS=OFF
- ;;
+ --dynamic)
+ BUILD_PATH="${ROOT}/dynamic-build"
+ BUILD_SHARED_LIBS=ON
+ ;;
- --dynamic)
- BUILD_PATH="${ROOT}/dynamic-build"
- BUILD_SHARED_LIBS=ON
- ;;
+ --system)
+ BUILD_SYSTEM=ON
+ ;;
- *)
- echo "Usage: $0 <--dynamic|--static>">&2
- exit 1
- ;;
-esac
+ *)
+ usage
+ ;;
+ esac
+ shift
+done
-mkdir -p "${BUILD_PATH}/build" "${BUILD_PATH}/install/lib"
+if [ -z "${BUILD_SHARED_LIBS}" ]; then
+ usage
+fi
+
+if [ "${BUILD_SYSTEM}" = "ON" ]; then
+ BUILD_INSTALL_PREFIX="/usr"
+else
+ BUILD_INSTALL_PREFIX="${BUILD_PATH}/install"
+ mkdir -p "${BUILD_PATH}/install/lib"
+fi
+mkdir -p "${BUILD_PATH}/build" &&
cd "${BUILD_PATH}/build" &&
cmake -DTHREADSAFE=ON \
-DBUILD_CLAR=OFF \
@@ -40,7 +61,7 @@ cmake -DTHREADSAFE=ON \
-DREGEX_BACKEND=builtin \
-DCMAKE_C_FLAGS=-fPIC \
-DCMAKE_BUILD_TYPE="RelWithDebInfo" \
- -DCMAKE_INSTALL_PREFIX="${BUILD_PATH}/install" \
+ -DCMAKE_INSTALL_PREFIX="${BUILD_INSTALL_PREFIX}" \
-DCMAKE_INSTALL_LIBDIR="lib" \
"${VENDORED_PATH}" &&