summaryrefslogtreecommitdiff
path: root/script/build-libgit2-static.sh
diff options
context:
space:
mode:
authorlhchavez <[email protected]>2019-01-05 20:13:01 +0000
committerlhchavez <[email protected]>2019-01-05 20:28:35 +0000
commitf3c487966d53ad78e25d2e6750414009f5606dbb (patch)
treeacce726fe9695d32eedb1c4f65ea11c98f4a7ef7 /script/build-libgit2-static.sh
parent7ae106611c9cabe9c3c30343139efbb5d7d6fc27 (diff)
Improve the static build script
This change: * Uses the installed version of both the library and the pkgconfig file, which fixes path resolution on Ubuntu Xenial. * Uses quoting liberally so that paths with spaces in them are correctly handled. * Moves the build+install directories to static-build/ in the git2go repository to avoid having a dirty vendor/libgit2 checkout.
Diffstat (limited to 'script/build-libgit2-static.sh')
-rwxr-xr-xscript/build-libgit2-static.sh15
1 files changed, 8 insertions, 7 deletions
diff --git a/script/build-libgit2-static.sh b/script/build-libgit2-static.sh
index 1568ece..680dd93 100755
--- a/script/build-libgit2-static.sh
+++ b/script/build-libgit2-static.sh
@@ -2,18 +2,19 @@
set -ex
-VENDORED_PATH=vendor/libgit2
+ROOT="$(cd "$0/../.." && echo "${PWD}")"
+BUILD_PATH="${ROOT}/static-build"
+VENDORED_PATH="${ROOT}/vendor/libgit2"
-cd $VENDORED_PATH &&
-mkdir -p install/lib &&
-mkdir -p build &&
-cd build &&
+mkdir -p "${BUILD_PATH}/build" "${BUILD_PATH}/install/lib"
+
+cd "${BUILD_PATH}/build" &&
cmake -DTHREADSAFE=ON \
-DBUILD_CLAR=OFF \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_C_FLAGS=-fPIC \
-DCMAKE_BUILD_TYPE="RelWithDebInfo" \
- -DCMAKE_INSTALL_PREFIX=../install \
- .. &&
+ -DCMAKE_INSTALL_PREFIX="${BUILD_PATH}/install" \
+ "${VENDORED_PATH}" &&
cmake --build . --target install