# get system ready
sudo apt-get update && sudo apt-get upgrade
sudo apt install build-essential
sudo /media/andreasbuhr/VBox_GAs_6.1.10/VBoxLinuxAdditions.run
sudo apt-get install build-essential perl python git
sudo apt-get install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev
sudo apt install cmake git
sudo software-properties-gtk
sudo apt-get build-dep qt5-default
sudo apt install meson
sudo apt install python3-setuptools
sudo shutdown -r now

export BUILDPATH=~/development
mkdir $BUILDPATH

# build glib
cd $BUILDPATH
git clone https://gitlab.gnome.org/GNOME/glib.git
cd glib
git checkout 2.66.1
meson --debug --prefix $BUILDPATH/glib-install _build
cd _build
ninja
ninja install
export PKG_CONFIG_PATH=$BUILDPATH/glib-install/lib/x86_64-linux-gnu/pkgconfig:$PKG_CONFIG_PATH
export LD_LIBRARY_PATH=$BUILDPATH/glib-install/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH


# build atk
cd $BUILDPATH
git clone https://gitlab.gnome.org/GNOME/atk.git
cd atk

meson --debug --prefix $BUILDPATH/atk-install _build
cd _build
ninja
ninja install
export PKG_CONFIG_PATH=$BUILDPATH/atk-install/lib/x86_64-linux-gnu/pkgconfig:$PKG_CONFIG_PATH
export LD_LIBRARY_PATH=$BUILDPATH/atk-install/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH

# build at-spi2-atk
cd $BUILDPATH
git clone https://gitlab.gnome.org/GNOME/at-spi2-atk.git
cd at-spi2-atk

meson --debug --prefix $BUILDPATH/at-spi2-atk-install _build
cd _build
ninja
ninja install
export PKG_CONFIG_PATH=$BUILDPATH/at-spi2-atk-install/lib/x86_64-linux-gnu/pkgconfig:$PKG_CONFIG_PATH
export LD_LIBRARY_PATH=$BUILDPATH/at-spi2-atk-install/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH

# build gtk
sudo apt-get build-dep libgtk-3-dev
cd $BUILDPATH
git clone https://gitlab.gnome.org/GNOME/gtk.git
cd gtk
git checkout 3.24.23
meson --debug -Dwayland_backend=false --prefix $BUILDPATH/gtk-install _build
cd _build
ninja
ninja install
export PKG_CONFIG_PATH=$BUILDPATH/gtk-install/lib/x86_64-linux-gnu/pkgconfig:$PKG_CONFIG_PATH
export LD_LIBRARY_PATH=$BUILDPATH/gtk-install/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH

# build qtbase
cd $BUILDPATH
git clone git://code.qt.io/qt/qtbase.git
cd qtbase
git fetch "https://codereview.qt-project.org/qt/qtbase" refs/changes/53/317853/2 && git cherry-pick FETCH_HEAD
cd ..
mkdir qtbase-build
cd qtbase-build
cmake -GNinja -DCMAKE_BUILD_TYPE=Debug -DFEATURE_developer_build=ON -DCMAKE_CXX_FLAGS=-Wfatal-errors ../qtbase
cmake --build . --parallel

`find -name tst_qguitimer` zeroTimer
~/Qt/Tools/QtCreator/bin/qtcreator
# happy debugging
