#!/bin/sh
#
# source: http://ftp.gnome.org/pub/gnome/sources/libbonoboui/2.24/libbonoboui-2.24.4.tar.bz2
#
# maintainer: (package seek maintainer)
#

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

VERSION=2.24.4
ARCH=i486
BUILD=66.1

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

rm -rf $PKG
mkdir -p $PKG
cd /tmp
rm -rf libbonoboui-$VERSION
tar xjvf $CWD/libbonoboui-$VERSION.tar.bz2
cd libbonoboui-$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

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/libbonoboui-$VERSION
cp -a \
  ChangeLog COPYING* MAINTAINERS NEWS README \
  $PKG/usr/doc/libbonoboui-$VERSION
( cd $PKG/usr/doc/libbonoboui-$VERSION ; ln -s /usr/share/gtk-doc/html/libbonoboui html )
#remove bonobo component browser from menu
rm -f $PKG/usr/share/applications/bonobo-browser.desktop

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------------------------------------------------------|
libbonoboui: libbonoboui - is  User Interface part of libbonobo
libbonoboui:
libbonoboui: The bonobo library supports independant CORBA interfaces for creating
libbonoboui: reusable components.  It provides GNOME with a framework for handling
libbonoboui: compound documents, such as embedding a spreadsheet in a word
libbonoboui: processor document.
libbonoboui:
libbonoboui:
libbonoboui:
libbonoboui:
libbonoboui:
EOF

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

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