#!/bin/sh
#
# All portions of code are copyright by their respective author/s.
# Copyright (c) 2004     Patrick Volkerding <volkerdi@slackware.com>
# Copyright (c) 2004     Jingmin Zhou <jimmyzhou@users.sourceforge.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
# $Id: mrxvt.SlackBuild,v 1.17 2005/02/07 04:49:08 cvs Exp $
#
#
# Sample SlackBuild script to build mrxvt for Slackware Linux
# based on rxvt's SlackBuild from slackware.com. Thanks to
# Slackware Linux! Without you, mrxvt may not exist...


VERSION=0.4.0
ARCH=i486
BUILD=1

# directories
TMP=/tmp
CWD=`pwd`
PKG=$TMP/package-mrxvt
DOC=$PKG/usr/doc/mrxvt-$VERSION
IMG=$PKG/usr/share/pixmaps

# clean temporary files
rm -rf $PKG
mkdir -p $PKG

# uncompress source code
cd $TMP
rm -rf mrxvt-$VERSION
tar zxvf $CWD/mrxvt-$VERSION.tar.gz

# build package
cd mrxvt-$VERSION
chown -R root.root .
if [ ! -r configure ]; then
	./bootstrap.sh
fi
CFLAGS="-O2 -march=i486 -mcpu=i686" \
	./configure \
		--prefix=/usr/X11R6 \
		--enable-everything \
		--with-save-lines=600 \
		--with-encoding=noenc \
		--disable-ourstrings \
		--disable-debug \
		$ARCH-slackware-linux
make
make install DESTDIR=$PKG

# strip binary
strip --strip-unneeded $PKG/usr/X11R6/bin/*
# chown directory
chown -R root.bin $PKG/usr/X11R6/bin

# copy documents
rm -rf $PKG/usr/X11R6/share
mkdir -p $DOC
cp -a \
	AUTHORS COPYING CREDITS ChangeLog FAQ INSTALL README* \
	doc/README.* doc/TIPS doc/xdefaults-sample.txt doc/xterm.seq \
	$DOC

# copy icons
mkdir -p $IMG
cp -a doc/mrxvt*.png doc/mrxvt*.xpm $IMG


# compress man page
gzip -9 $PKG/usr/X11R6/man/man1/*

# copy description file
mkdir -p $PKG/install
cat $CWD/mrxvt.slack-desc > $PKG/install/slack-desc

# create package
cd $PKG
makepkg -l y -c n $TMP/mrxvt-$VERSION-$ARCH-$BUILD.tgz
