#!/bin/bash


# slackbuild script for libgphoto2
# Author: Mark Tucker
# Created: Aug 29, 2005
# Changes:
#        Aug 29, 2005 - initial creation

#
#----------------------------------------------------------------------
umask 0022

#----------------------------------------
# include the common functions
#----------------------------------------
if [ -r ./sbuild.functions ]; then
    . ./sbuild.functions
else
    echo Cannot read file `pwd`/sbuild.functions
    echo Exiting....
    echo
    exit
fi

#----------------------------------------
# Set locations for temp directories
#----------------------------------------
# location of source code archive
srcdir=`pwd`/SRC
workdir=`pwd`


#----------------------------------------
# Package variables
#----------------------------------------
source="libgphoto2-2.1.6.tar.gz"
pkgname="libgphoto2"
pkgver="2.1.6"
release="1mht"
package="$pkgname-$pkgver-i486-$release.tgz"
realname="Mark Tucker"
echo Package: $package

#----------------------------------------
# setup path variables
#----------------------------------------
set_workdir

# unpack the source
echo Unpacking the source...
tar -xzf $srcdir/$source


cd $builddir

#----------------------------------------
# setup the build environment
#----------------------------------------
export CFLAGS="-O2 -march=i486 -mcpu=i686"
export CPPFLAGS="-O2 -march=i486 -mcpu=i686"
export CXXFLAGS=$CPPFLAGS



#----------------------------------------
# Build the package and install
#----------------------------------------
# configure 
conf_opts="--prefix=/usr --sysconfdir=/etc --localstatedir=/var"
#    > $workdir/config.output 2>&1
run_configure $conf_opts

# make
run_make

# Set target directory
set_target

# install
run_makeinstall


echo finishing install...


# create install dir
mkdir $target/install

#----------------------------------------
# create slack-desc file to install
#----------------------------------------
cat > $target/install/slack-desc << END
       |-----handy-ruler------------------------------------------------------|
$pkgname: $pkgname $pkgver
$pkgname:
$pkgname: Libgphoto2 is a library that can be used by applications to access 
$pkgname: various digital cameras.
$pkgname:
$pkgname: 
$pkgname: 
$pkgname: 
$pkgname: http://www.gphoto.org/
$pkgname: 
$pkgname: Packaged by $realname for $slackver 
END

# create documentation directory
create_docdir

# fix group on bin directories.
fix_bingrp

# strip  bin files
strip_bin

# strip lib files
strip_libs

# check for uncompressed man pages
compr_man

# makepkg
create_pkg

exit