1#!/bin/sh 2# 3 4WEB=$1 5VERSION=$2 6RELEASE=$3 7 8SPEC=gpsbabel.spec 9TAR_IGNORE="--exclude CVS" 10 11if test -x /usr/bin/rpmbuild; then 12 RPM=rpmbuild 13else 14 RPM=rpm 15fi 16 17test -f gpsbabel.html || exit 1 18 19SRC=`pwd` 20TEMPDIR=/tmp/gpsbabel-rpm.$$ 21 22mkdir -p $TEMPDIR 23trap "rm -fr $TEMPDIR" 0 1 2 3 15 24 25mkdir -p $TEMPDIR/BUILD $TEMPDIR/RPMS $TEMPDIR/SPECS \ 26 $TEMPDIR/SOURCES $TEMPDIR/SRPMS $TEMPDIR/TMP $TEMPDIR/install 27 28echo "Generate rpm spec file..." 29sh $SRC/tools/mkspec "$WEB" "$VERSION" "$RELEASE" > "$TEMPDIR/SPECS/gpsbabel.spec" 30cp -apr ./ $TEMPDIR/TMP/gpsbabel-$VERSION 31 32# 33pushd $TEMPDIR/TMP/gpsbabel-$VERSION 34echo "Cleaning source..." 35make more-clean > /dev/null 2>&1 36find . -type d -name CVS -exec rm -rf \{\} \; > /dev/null 2>&1 37find . -type d -name "autom4*" -exec rm -rf \{\} \; > /dev/null 2>&1 38 39echo "Add needed files..." 40cp -ap $SRC/gpsbabel.html ./ 41cp -ap $SRC/CHANGELOG ./ 42 43echo "Create rpm source tarball..." 44cd .. 45# --verbose 46tar --owner=0 --group=0 -czf ../SOURCES/gpsbabel-$VERSION.tgz gpsbabel-$VERSION 47echo "And now create rpm packages..." 48${RPM} -ba \ 49 --define "_topdir $TEMPDIR" \ 50 --define "buildroot $TEMPDIR/install" \ 51 $TEMPDIR/SPECS/gpsbabel.spec 52find ../. -type f -name "*.rpm" -exec cp -apf \{\} /tmp/ \; 53