#!/bin/sh
cd ./../3rdparty/

unamestr=$(uname)

if [ "$unamestr" = 'Linux' ]; then
    sudo apt-get install automake subversion libtool libssl-dev g++ libgl1-mesa-dev -y	

    if [ ! -f "/usr/local/lib/libssh2.a" ]; then 
	chmod -R 755 libssh2
        cd ./libssh2
        touch ./src/libssh2_config.h
        touch ./example/libssh2_config.h.in
        libtoolize --force
        aclocal
	autoheader
        automake --force-missing --add-missing
        autoconf
        ./configure  --with-openssl --with-libz --disable-examples-build
        make
        sudo make install
        cd ./../
    fi
    
    # Sync breakpad deps
    export PATH=`pwd`/depot_tools:$PATH
    cd ./breakpad/
    gclient config https://chromium.googlesource.com/external/google-breakpad.git
    gclient sync --nohooks --noprehooks
    rsync -av ./src/src ./src

else
    chmod -R 755 breakpad
    cd ./breakpad/
    xcodebuild -sdk macosx10.9 -project src/client/mac/Breakpad.xcodeproj -configuration Release -target Breakpad ARCHS=x86_64 ONLY_ACTIVE_ARCH=YES MACOSX_DEPLOYMENT_TARGET=10.9 GCC_VERSION=com.apple.compilers.llvm.clang.1_0
fi



