aboutsummaryrefslogtreecommitdiff
path: root/cmake/install.sh
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/install.sh')
-rwxr-xr-xcmake/install.sh18
1 files changed, 15 insertions, 3 deletions
diff --git a/cmake/install.sh b/cmake/install.sh
index 384ad5d..595fd26 100755
--- a/cmake/install.sh
+++ b/cmake/install.sh
@@ -1,12 +1,24 @@
-#!/usr/bin/env bash
+#!/bin/sh
set -e
+case "$(uname -s)" in
+ Linux*) machine="Linux" ;;
+ Darwin*) machine="Mac" ;;
+ *) echo "The install file can only be run on linux and mac" && exit 1 ;;
+esac
+
scriptpath="$(dirname "$0")"
mkdir -p "$scriptpath/build/release"
cd "$scriptpath/build/release"
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release ../../../
ninja
-sudo cp sibs /usr/bin/
-echo "Copied $scriptpath/build/release/sibs to /usr/bin/sibs"
+
+case $machine in
+ Linux) bin_dir="/usr/bin" ;;
+ Mac) bin_dir="/usr/local/bin" ;;
+esac
+
+sudo cp sibs "$bin_dir"
+echo "Copied $scriptpath/build/release/sibs to $bin_dir/sibs"
echo "Installation successful!"