Date: Thu, 18 Apr 2002 16:26:53 +0200
Organization: http://freemail.web.de/
From: Jens Apel <jens.apel@web.de>
Subject: Solaris Package Build Script for xxdiff
Precedence: fm-user

Hello Martin,
thanks for writing xxdiff - a real cool tool.
Since I wanted to use it under Solaris, I had to build 
Solaris Packages for my company. 
I wrote the following script to do that.
It would be nice, if you would put it into the next distribution.
I think it is useful for other people too.

Best regards,
Jens

---8< snipp-----------------------------------------

#!/bin/sh
# Shell script for building a Solaris package of xxdiff
# Written by <jens.apel@web.de>
# 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.
# 
# Prerequisites:
# 1. I have build Qt 2.3 statically and linked it
#    statically with xxdiff. This is not good, but it works...
#    Compiling Qt 2.3 under Solaris took me half a day...
# 2. Make sure libstdc++.so.2.10.0 is in your LD_LIBRARY_PATH
# 
# Building the Package:
# 1. copy this script to 
#    xxdiff-2.5/adm/build_pkg.sh
# 2. chmod u+x build_pkg.sh
# 3. Run it
#    cd adm
#    ./build_pkg.sh
#    This will create the package xxdiff-2.5-sol8-sparc-local.pkg
# 4. Install it
#    pkgadd -d xxdiff-2.5-sol8-sparc-local.pkg 
#    This will install the files
#    /usr/local/bin/xxdiff
#    /usr/local/man/man1/xxdiff.1
# 5. Use it
#    /usr/local/bin/xxdiff file1 file2
# 6. Have Fun !!


PKGNAME=xxdiff

## Extract common info requires for the 'info' part of the package.
VERSION=`grep "^XX_VERSION" ../src/xxdiff.pro | sed -e 's/.*=\([0-9.]\)/\1/g'`
ARCH=`uname -p`

## Start by faking root install 
echo "Faking root install..."
START=`pwd`
FAKE_ROOT=$START/xxdiff
mkdir $FAKE_ROOT


## Setup our run level stuff while we are at it.
mkdir -p $FAKE_ROOT/bin
mkdir -p $FAKE_ROOT/man/man1

# copy the binary and the man page to their places
cp ../src/xxdiff $FAKE_ROOT/bin
cp ../src/xxdiff.1 $FAKE_ROOT/man/man1

## Build info file
echo "Building pkginfo file..."
cat > $FAKE_ROOT/pkginfo << _EOF
PKG=$PKGNAME
NAME=xxdiff for Solaris
DESC="Graphical tool for comparing and merging files using Qt and diff"
VENDOR="Martin Blais <blais@furius.ca"
BASEDIR=/usr/local
ARCH=$ARCH
VERSION=$VERSION
CATEGORY=application
CLASSES=none
_EOF

## Build copyright file
echo "Building copyright file..."
cat > $FAKE_ROOT/copyright << _EOF
Copyright (C) 1999-2002 Martin Blais <blais@furius.ca>

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.

_EOF

## Build prototype file
cat > $FAKE_ROOT/prototype << _EOF
i copyright=copyright
i pkginfo=pkginfo
d none bin 0755 bin bin
d none man 0755 bin bin
d none man/man1 0755 bin bin
f none bin/xxdiff 0755 bin bin
f none man/man1/xxdiff.1 0644 bin bin
_EOF

## And now build the package.
OUTPUTFILE=$PKGNAME-$VERSION-sol8-$ARCH-local.pkg
echo "Building package.."
echo FAKE_ROOT = $FAKE_ROOT
cd $FAKE_ROOT 
pkgmk -d . -r . -f ./prototype -o
echo | pkgtrans -os . $OUTPUTFILE
mv $OUTPUTFILE ..
cd ..
rm -rf $FAKE_ROOT
