#!/bin/sh
#
# source: http://ftp.gnome.org/pub/gnome/sources/libbonobo/2.32/libbonobo-2.32.1.tar.bz2
#
# maintainer: package seek a maintainer
#

CWD=`pwd`
PKG=/tmp/package-libbonobo

VERSION=2.32.1
ARCH=i486
BUILD=72.1

SLKCFLAGS="-O2 -march=i486 -mtune=i686"

rm -rf $PKG
mkdir -p $PKG
cd /tmp
rm -rf libbonobo-$VERSION
tar xjvf $CWD/libbonobo-$VERSION.tar.bz2
cd libbonobo-$VERSION
chown -R root:root .
find . \
 \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
 -exec chmod 755 {} \; -o \
 \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
 -exec chmod 644 {} \;
CFLAGS="$SLKCFLAGS" \
./configure \
  --prefix=/usr \
  --sysconfdir=/etc \
  --localstatedir=/var/lib \
  --enable-static=no \
  --mandir=/usr/man \
  --enable-gtk-doc=no

make -j4
make install DESTDIR=$PKG

find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
  | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null


mkdir -p $PKG/usr/doc/libbonobo-$VERSION/bonobo-activation
cp -a \
  AUTHORS COPYING COPYING.LIB NEWS README TODO \
  $PKG/usr/doc/libbonobo-$VERSION
( cd $PKG/usr/doc/libbonobo-$VERSION ; ln -s /usr/share/gtk-doc/html/libbonobo html )
( cd $PKG/usr/doc/libbonobo-$VERSION/bonobo-activation ; ln -s /usr/share/gtk-doc/html/bonobo-activation html)

gzip -9 $PKG/usr/man/man?/*.?

mkdir -p $PKG/usr/src/libbonobo-$VERSION
cp $CWD/build-libbonobo.sh $PKG/usr/src/libbonobo-$VERSION/

mkdir -p $PKG/install
cat <<"EOF" > $PKG/install/slack-desc
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.  Line
# up the first '|' above the ':' following the base package name, and the '|' on
# the right side marks the last column you can put a character in.  You must make
# exactly 11 lines for the formatting to be correct.  It's also customary to
# leave one space after the ':'.

         |-----handy-ruler------------------------------------------------------|
libbonobo: libbonobo
libbonobo:
libbonobo: The bonobo library supports independant CORBA interfaces for creating
libbonobo: reusable components.  It provides GNOME with a framework for handling
libbonobo: compound documents, such as embedding a spreadsheet in a word
libbonobo: processor document.
libbonobo:
libbonobo:
libbonobo:
libbonobo:
libbonobo:
EOF

cd $PKG
makepkg -l y -c n ../libbonobo-$VERSION-$ARCH-$BUILD.txz
cd ..
md5sum libbonobo-$VERSION-$ARCH-$BUILD.txz > libbonobo-$VERSION-$ARCH-$BUILD.md5