makesrpm.in 915 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/sh
  2. set -u
  3. set -e
  4. trap onexit INT
  5. trap onexit TERM
  6. trap onexit EXIT
  7. TMPDIR=
  8. onexit()
  9. {
  10. if [ ! "$TMPDIR" = "" ]; then
  11. rm -rf $TMPDIR
  12. fi
  13. }
  14. PKGNAME=@PKGNAME@
  15. PROJECT=@CMAKE_PROJECT_NAME@
  16. VERSION=@VERSION@
  17. BUILD=@BUILD@
  18. if [ -f $PKGNAME-$VERSION.src.rpm ]; then
  19. rm -f $PKGNAME-$VERSION.src.rpm
  20. fi
  21. umask 022
  22. TMPDIR=`mktemp -d /tmp/$PKGNAME-build.XXXXXX`
  23. mkdir -p $TMPDIR/RPMS
  24. mkdir -p $TMPDIR/SRPMS
  25. mkdir -p $TMPDIR/BUILD
  26. mkdir -p $TMPDIR/SOURCES
  27. mkdir -p $TMPDIR/SPECS
  28. if [ ! -f $PROJECT-$VERSION.tar.gz ]; then
  29. echo "ERROR: $PROJECT-$VERSION.tar.gz does not exist."
  30. fi
  31. cp $PROJECT-$VERSION.tar.gz $TMPDIR/SOURCES/$PROJECT-$VERSION.tar.gz
  32. cat pkgscripts/rpm.spec | sed s/%{_blddir}/%{_tmppath}/g \
  33. | sed s/#--\>//g > $TMPDIR/SPECS/$PKGNAME.spec
  34. rpmbuild -bs --define "_topdir $TMPDIR" $TMPDIR/SPECS/$PKGNAME.spec
  35. mv $TMPDIR/SRPMS/$PKGNAME-$VERSION-$BUILD.src.rpm $PKGNAME-$VERSION.src.rpm
  36. exit