23 lines
625 B
Bash
Executable File
23 lines
625 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# build_geographiclib.sh
|
|
# Build and install GeographicLib from source into /usr/local
|
|
|
|
GIT_REPO=${1:-https://github.com/GeographicLib/GeographicLib.git}
|
|
INSTALL_PREFIX=${2:-/usr/local}
|
|
|
|
echo "Cloning GeographicLib from $GIT_REPO"
|
|
TMP=$(mktemp -d)
|
|
trap 'rm -rf "$TMP"' EXIT
|
|
|
|
git clone --depth 1 "$GIT_REPO" "$TMP/GeographicLib"
|
|
mkdir -p "$TMP/GeographicLib/build"
|
|
pushd "$TMP/GeographicLib/build" >/dev/null
|
|
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$INSTALL_PREFIX"
|
|
make -j$(nproc)
|
|
sudo make install
|
|
popd >/dev/null
|
|
|
|
echo "GeographicLib installed to $INSTALL_PREFIX"
|