#!/bin/bash 

# Copyright (C) 2011 by Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
#
# Python X2go is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# Python X2go is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the
# Free Software Foundation, Inc.,
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.

LIB_PACKAGES_HEULER="
nxcomp heuler master
nxcompext heuler master
nxcompshad heuler master
python-x2go heuler master
"
LIB_PACKAGES_MAIN="
nxcomp main build-main
nxcompext main build-main
nxcompshad main build-main
python-x2go main build-main
"

APP_PACKAGES_HEULER="
x2goserver heuler master
x2goagent heuler master
x2goclient heuler master
nxproxy heuler master
cups-x2go heuler master
x2godesktopsharing heuler master
x2gognomebindings heuler master
pyhoca-gui heuler master
"
APP_PACKAGES_MAIN="
x2goserver main build-main
x2goagent main build-main
x2goclient main build-main
nxproxy main build-main
cups-x2go main build-main
x2godesktopsharing main build-main
x2gognomebindings main build-main
pyhoca-gui main build-main
x2gothinclient main heuler tmpfs
"

COMPONENT=${1:-""}

# build the newest code... (nightly-builds)
[ "x$COMPONENT" = "xheuler" ] || [ -z $COMPONENT ] && {
    for pkg comp checkout in $LIB_PACKAGES_HEULER + $APP_PACKAGES_HEULER; do
        x2go-buildpackage $pkg $comp $checkout
    done
}

# build all packages tagged as ,,build-main'Ä
[ "x$COMPONENT" = "xmain" ] || [ -z $COMPONENT ] && {
    for pkg comp checkout in $LIB_PACKAGES_MAIN + $APP_PACKAGES_MAIN; do
        x2go-buildpackage $pkg $comp $checkout
    done
}
