
freerdp=1
remmina=1

if [ "$freerdp" = "1" ]; then
    [ ! -e FreeRDP ] && git clone https://github.com/FreeRDP/FreeRDP.git
    # FreeRDP
    cd FreeRDP
    rm -f CMakeCache.txt
    git stash && git pull
    make clean
    DESTDIR=/tmp/freerdp cmake -DCMAKE_BUILD_TYPE=Release -DWITH_SSE2=ON -DCMAKE_INSTALL_PREFIX=/opt/remmina/ .
    DESTDIR=/tmp/freerdp make -j4
    make install
    cd ..
fi

if [ "$remmina" = "1" ]; then
    [ ! -e Remmina ] && git clone https://github.com/FreeRDP/Remmina.git
    # Remmina
    cd Remmina
    git stash && git pull
    rm -f CMakeCache.txt
    make clean
    DESTDIR=/tmp/remmina cmake -DCMAKE_BUILD_TYPE=Release -DWINPR_INCLUDE_DIR=/opt/remmina/include/winpr2 -DWITH_SSE2=ON -DCMAKE_C_FLAGS="-I/opt/remmina/include/winpr2 -I/opt/remmina/include -I/opt/remmina/include/freerdp2 "  -DCMAKE_INSTALL_PREFIX=/opt/remmina/ -DFREERDP_INCLUDE_DIR=/opt/remmina/include -DFREERDP_LIBRARY=/opt/remmina/lib64/libfreerdp2.so -DWITH_APPINDICATOR=OFF -DWITH_TELEPATHY=OFF .
    DESTDIR=/tmp/remmina make -j4
    make install
fi

