##
# buildserver.library - source this from scripts
##

result=0
if [ -z "$JENKINS" ]; then export JENKINS=http://exiv2.dyndns.org:8080; fi
if [ -z "$DAILY"   ]; then export DAILY=userContent/builds/Daily       ; fi

##
# osName - print 'macosx' or 'cygwin' or 'mingw' or 'linux'
osName () {
    if   [ "$(uname)"    == Darwin ]; then
         echo macosx
    elif [ "$(uname -o)" == Cygwin ]; then
         echo cygwin
    elif [ "$(uname -o)" == Msys   ]; then
         echo mingw
    else
         echo linux
    fi
}

##
# which PLATFORM
# PLATFORM must be defined as msvc or ming when called from ssh
if [ "$PLATFORM" == "" ]; then
    if   [ "$(uname)"    == Darwin ]; then
         export PLATFORM=macosx
    elif [ "$(uname -o)" == Cygwin ]; then
         export PLATFORM=cygwin
    elif [ "$(uname -o)" == Msys   ]; then
         export PLATFORM=mingw
    else
         export PLATFORM=linux
    fi
    if [ "$PLATFORM" == "cygwin" ]; then
        # tweak path to ensure the correct version of perl and expr for autotools
        export "PATH=/bin:$PATH"
    fi
fi

##
# thePath - echo full path to file
thepath () {
    if [ -d $1 ]; then
        ( cd $1;
        pwd );
    else
        ( cd $(dirname $1);
        echo $(pwd)/$(basename $1) );
    fi
}

# That's all Folks!
##
