#!/bin/sh
## Advanced.PkgBuild script for: 	scite
##
## Amigo PkgBuild-0.3 - Gilbert Ashley <amigo@ibiblio.org>
##
##### ------------Standard Package Variables-------------------
# Most source code only needs these  4 variables set.
# Set  SRC_SUFFIX  to ".tar.gz" ".tgz" ".tar.bz2" or ".tbz"

BUILD="1"
NAME="scite"
VERSION="1.60"
SRC_SUFFIX=".tar.bz2"

#####--------Common Overrides and Options----------------------
# PRE_FIX=""
# EXTRA_CONFIGS=""
DOCLIST="License.txt README"
# GROUP_NAME=""
#######----------------Processing------------------------------
# Get functions and read in configuration files
source /usr/libexec/src2pkg/FUNCTIONS ;
# This template calls each process individually so you can add
# extra instructions between processes, or even leave out steps.

pre_process ;
find_source ;
make_dirs ;
unpack_source ;
fix_source_perms ;

# configure_source ;
# compile_source ;
# fake_install ;

cd $SRC_DIR/scintilla/gtk && GTK1=1  make ;

cd $SRC_DIR/scite/gtk && GTK1=1 make ;
cd $SRC_DIR/scite/gtk ;
mkdir  -p $PKG_DIR/usr/bin
cp $SRC_DIR/scite/bin/SciTE $PKG_DIR/usr/bin

fix_pkg_perms ;
strip_bins ;

# create_docs ;
mkdir  -p $PKG_DIR/usr/doc/$NAME-$VERSION
mkdir  -p $PKG_DIR/usr/share/$NAME
cp -a $SRC_DIR/scite/src/*.properties $PKG_DIR/usr/share/$NAME
rm -f $PKG_DIR/usr/share/$NAME/SciTEGlobal.properties
cp -a $CWD/resources/SciTEGlobal.properties $PKG_DIR/usr/share/$NAME

cp -a $SRC_DIR/scite/README $PKG_DIR/usr/doc/$NAME-$VERSION
cp -a $SRC_DIR/scite/License.txt $PKG_DIR/usr/doc/$NAME-$VERSION
cp -a $SRC_DIR/scite/doc/*.html $PKG_DIR/usr/doc/$NAME-$VERSION

mkdir  -p $PKG_DIR/usr/share/pixmaps
cp -a $SRC_DIR/scite/gtk/Sci48M.png $PKG_DIR/usr/share/pixmaps

mkdir -p $PKG_DIR/usr/man/man1
cp -a $SRC_DIR/scite/doc/scite.1 $PKG_DIR/usr/man/man1

compress_man_pages ;
make_description ;
make_doinst ;
make_package ;
post_process ;
exit 0

## See the Amigo PkgBuild documentation for help and examples.