• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2
3set -u
4set -e
5trap onexit INT
6trap onexit TERM
7trap onexit EXIT
8
9TMPDIR=
10
11onexit()
12{
13	if [ ! "$TMPDIR" = "" ]; then
14		rm -rf $TMPDIR
15	fi
16}
17
18if [ -f @PKGNAME@-@VERSION@.@RPMARCH@.rpm ]; then
19	rm -f @PKGNAME@-@VERSION@.@RPMARCH@.rpm
20fi
21
22umask 022
23TMPDIR=`mktemp -d /tmp/@CMAKE_PROJECT_NAME@-build.XXXXXX`
24
25mkdir -p $TMPDIR/RPMS
26ln -fs `pwd` $TMPDIR/BUILD
27rpmbuild -bb --define "_blddir $TMPDIR/buildroot" --define "_topdir $TMPDIR" \
28	--target @RPMARCH@ pkgscripts/rpm.spec; \
29cp $TMPDIR/RPMS/@RPMARCH@/@PKGNAME@-@VERSION@-@BUILD@.@RPMARCH@.rpm \
30	@PKGNAME@-@VERSION@.@RPMARCH@.rpm
31