#!/bin/sh
#
# Copyright 2007 Tiago Souza <ts.salvador@gmail.com>
# Available under the terms of the GNU GPL.
#

NAME="skype"
VERSION="2.1.0.81"
REVISION="1"

PKG_SOURCEURL='http://download.skype.com/linux/skype_static-$VERSION.tar.bz2'

. $DLG_ROOT/config
. $DLG_ROOT/SCRIPTS/dropline-functions.sh

DLG_PKGER="salv"

prepare

# Skype is, unfortunately, a closed source app, so all we have to do is move
# the files around to generate a package.
createdir "$PKG_STAGEROOT/usr/bin"
createdir "$PKG_STAGEROOT/usr/doc/$NAME-$VERSION"
createdir "$PKG_STAGEROOT/usr/share/skype"
createdir "$PKG_STAGEROOT/usr/share/skype/avatars"
createdir "$PKG_STAGEROOT/usr/share/skype/icons"
createdir "$PKG_STAGEROOT/usr/share/skype/lang"
createdir "$PKG_STAGEROOT/usr/share/skype/sounds"
createdir "$PKG_STAGEROOT/usr/share/applications"
createdir "$PKG_STAGEROOT/usr/share/pixmaps"
createdir "$PKG_STAGEROOT/etc/dbus-1/system.d"

spewdo "install -m555 $PKG_SRCROOT/skype $PKG_STAGEROOT/usr/bin"
spewdo "install -m644 $PKG_SRCROOT/{README,LICENSE} $PKG_STAGEROOT/usr/doc/$NAME-$VERSION/"
spewdo "install -m644 $PKG_SRCROOT/skype.desktop $PKG_STAGEROOT/usr/share/applications"
spewdo "install -m644 $PKG_SRCROOT/skype.conf $PKG_STAGEROOT/etc/dbus-1/system.d"

# I *HATE* files with spaces on their names. For some reason it just doesn't work with
# spewdo so let's make a quick "work-around" by toying with the Inter Field Separator
# (IFS) variable.
OLD_IFS="$IFS"
IFS="
"
spewdo "install -m644 $PKG_SRCROOT/avatars/*.png $PKG_STAGEROOT/usr/share/skype/avatars"
IFS="$OLD_IFS"
spewdo "install -m644 $PKG_SRCROOT/icons/* $PKG_STAGEROOT/usr/share/skype/icons"
spewdo "install -m644 $PKG_SRCROOT/lang/* $PKG_STAGEROOT/usr/share/skype/lang"
spewdo "install -m644 $PKG_SRCROOT/sounds/* $PKG_STAGEROOT/usr/share/skype/sounds"

# Default icon for the .desktop file
spewdo "install -m644 $PKG_SRCROOT/icons/SkypeBlue_32x32.png $PKG_STAGEROOT/usr/share/pixmaps/skype.png"

finalizepackage
packagize
cleanup
