56 lines
1.5 KiB
Bash
Executable File
56 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
cd "$(dirname "$0")"
|
|
|
|
print_qt_install_hint() {
|
|
echo
|
|
echo "Qt6 bulunamadi. Ubuntu'da gerekli paketleri kurmak icin:"
|
|
echo " sudo apt update"
|
|
echo " sudo apt install build-essential cmake qt6-base-dev zlib1g-dev"
|
|
echo "veya dogrudan: ./setup-ubuntu.sh"
|
|
}
|
|
|
|
if [[ "$(uname -s)" != "Linux" ]]; then
|
|
echo "Bu calistirma betigi Linux icindir." >&2
|
|
exit 1
|
|
fi
|
|
|
|
project_dir="$(pwd -P)"
|
|
|
|
if [[ -f ./build/CMakeCache.txt ]]; then
|
|
cached_source="$(sed -n 's/^CMAKE_HOME_DIRECTORY:INTERNAL=//p' ./build/CMakeCache.txt)"
|
|
if [[ -n "$cached_source" && "$cached_source" != "$project_dir" ]]; then
|
|
echo "Build klasoru farkli bir proje yoluna ait. 'linux/build' klasorunu silip tekrar deneyin." >&2
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
if ! cmake -S . -B build; then
|
|
print_qt_install_hint
|
|
exit 1
|
|
fi
|
|
|
|
cmake --build build
|
|
|
|
missing_libs="$(ldd ./build/location_plotter 2>/dev/null | awk '/not found/ { print $1 }' || true)"
|
|
if [[ -n "$missing_libs" ]]; then
|
|
echo "Eksik paylasimli kutuphaneler:"
|
|
echo "$missing_libs" | sed 's/^/ /'
|
|
print_qt_install_hint
|
|
exit 1
|
|
fi
|
|
|
|
if id -nG | tr ' ' '\n' | grep -qx dialout; then
|
|
exec ./build/location_plotter "$@"
|
|
fi
|
|
|
|
if getent group dialout | tr ':' '\n' | tail -n 1 | tr ',' '\n' | grep -qx "$(id -un)"; then
|
|
exec sg dialout -c "$(printf '%q ' ./build/location_plotter "$@")"
|
|
fi
|
|
|
|
echo "Bu kullanici dialout grubunda degil. Eklemek icin:"
|
|
echo " sudo usermod -a -G dialout $(id -un)"
|
|
echo "Sonra oturumu kapatip ac veya bu scripti tekrar calistir."
|
|
exit 1
|