Repositories / ocaml-git.git
scripts/gen-libgit2-static-link-sexp.sh
Clone (read-only): git clone http://git.guha-anderson.com/git/ocaml-git.git
#!/usr/bin/env sh
set -eu
if test "$#" -gt 0; then
root="$1"
else
root="$(CDPATH= cd -- "$(dirname "$0")/.." && pwd)"
fi
if ! test -d "$root/vendor/libgit2-install/lib"; then
case "$(pwd)" in
*/_build/*)
workspace_root="${PWD%%/_build/*}"
if test -d "$workspace_root/vendor/libgit2-install/lib"; then
root="$workspace_root"
fi
;;
esac
fi
printf '('
printf ' "-L%s/vendor/libgit2-install/lib"' "$root"
if test -n "${OPAM_SWITCH_PREFIX:-}"; then
printf ' "-L%s/lib/ocaml-git"' "$OPAM_SWITCH_PREFIX"
elif command -v opam >/dev/null 2>&1; then
libdir="$(opam var lib 2>/dev/null || true)"
if test -n "$libdir"; then
printf ' "-L%s/ocaml-git"' "$libdir"
fi
fi
printf ' "-Wl,--start-group" "-l:libgit2.a" "-Wl,--end-group" "-lrt" "-pthread"'
printf ' )\n'