#!/bin/sh
## Starting point for Debian & Ubuntu packages ...

CONF=$1
CONFIRM=
[ -n "$CONF" ] && CONFIRM=-y


## ************* FIRST make sure you're current *********************
apt update && apt full-upgrade
## ************* Otherwise, bad stuff may happen ********************

apt $CONFIRM install libgdl-3-dev \
    libchamplain-gtk-0.12-dev \
    libchamplain-0.12-dev \
    libclutter-1.0-dev \
    libclutter-gtk-1.0-dev \
    libgtk-3-dev \
    valac \
    pkg-config \
    build-essential \
    meson \
    ninja-build \
    libbluetooth-dev \
    libespeak-dev \
    libgudev-1.0-dev \
    libgstreamer1.0-dev \
    libgstreamer-plugins-base1.0-dev \
    libvte-2.91-dev

# vanity, prettier terminal progress bars (fcset, flashdl)
apt $CONFIRM install libncurses5-dev

# To build go based components, golang
apt $CONFIRM install golang-go

## and for replay_bbox_ltm.rb
## ruby version 2 or later

apt $CONFIRM install ruby ruby-json

## For some ARM boards, without full OpenGL, you may need

# apt $CONFIRM install libegl1-mesa-dev
## (or something like that)

## if you want to use speech-dispatcher instead of espeak for voice
## synthesis (or have a choice of either)
## gsettings set org.mwptools.planner speech-api 'speechd'
## or (default)
## gsettings set org.mwptools.planner speech-api 'espeak'

# apt $CONFIRM install libspeechd-dev

## for flite as the text to speech API
# apt $CONFIRM install flite flite1-dev

## for MQTT (BulletGCSS) protocol
# apt $CONFIRM install libpaho-mqtt-dev
## *OR* for MQTT (BulletGCSS) protocol
# apt $CONFIRM install libmosquitto-dev

## For plot-elevation.rb
apt $CONFIRM install gnuplot ruby-nokogiri

## To use KMZ as an overlay format, you need 'unzip
#apt $CONFIRM install unzip

## Shallow clone mwp ....
# git clone --depth 1 https://github.com/stronnag/mwptools
## Follow build instructions
## https://github.com/stronnag/mwptools/wiki/Building-with-meson-and-ninja"
## cd mwptools
## meson build --buildtype=release --strip --prefix ~/.local
## cd build
## ninja install

## You must install the blackbox utilities
## https://github.com/iNavFlight/blackbox-tools in order to replay
## blackbox logs.
# git clone --depth 1  https://github.com/iNavFlight/blackbox-tools
# cd blackbox-tools
# make && sudo make install

## and you can use this file to install everything:)
#
## cp ubuntu-deps.txt /tmp/ubuntu-deps.sh
## chmod +x /tmp/ubuntu-deps.sh
## sudo /tmp/ubuntu-deps.sh # interactive confirmation required, or
## sudo /tmp/ubuntu-deps.sh Y # no confirmation required.
##
## The default instruction only set up the master branch (in order in
## minimise the initial setup) .
## In order to access other branches:
# git remote set-branches origin '*'
# git fetch -v
## Then:
## $ git branch
##   development
## * master
### And one can checkout development
#  git checkout development
## Switched to branch 'development'
## Your branch is up to date with 'origin/development'.

## Note: If you change a dependency (e.g. add addtional text to speech
## modules) then you may need to force a rebuild for mwp to recognise the
## change:
##
## cd mwptools/build
## ninja clean
## ninja install
##
