Added patch to improve RPM building
authormicah <micah@758a04ac-41e6-0310-8a23-8373a73cc35d>
Sun, 6 Aug 2006 18:01:28 +0000 (18:01 +0000)
committermicah <micah@758a04ac-41e6-0310-8a23-8373a73cc35d>
Sun, 6 Aug 2006 18:01:28 +0000 (18:01 +0000)
git-svn-id: http://code.autistici.org/svn/backupninja/trunk@421 758a04ac-41e6-0310-8a23-8373a73cc35d

AUTHORS
ChangeLog
Makefile.am
configure.in

diff --git a/AUTHORS b/AUTHORS
index 2b2ad03b56778101fed0ff216b434491d13abf8b..a4888345424b6a478484aec7f8f9dce7dc981ae2 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -19,3 +19,4 @@ garcondumonde@riseup.net
 Martin Krafft madduck@debian.org -- admingroup patch
 Anarcat
 rhatto
+Robert Napier -- improved RPM build
index 4fece0db5a1d5e4dcfdc0405eba8273827b492eb..b1b9b99f6e258c8f3e6ca5ab5d86295caa611b3c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -67,6 +67,8 @@ version 0.9.4 -- unreleased
            symlinks for $configdirectory
     changed cron permissions to 644
     minor documentation fixes
+    improved RPM build process allowing 'make rpm-package' and 'make
+    srpm-package' targets (thanks Robert Napier)
 
 version 0.9.3 -- February 1st, 2006
     autotools fixes
index 8f706df40f41b36235f941695d6e1288a0121cb1..34ab32ab3588c40547638032d29852f9cc6c06b3 100644 (file)
@@ -5,3 +5,35 @@ EXTRA_DIST = README COPYING AUTHORS INSTALL NEWS ChangeLog \
              backupninja.spec backupninja.spec.in autogen.sh
 
 SUBDIRS = etc examples handlers lib man src
+
+rpm_topdir=`cd $(top_srcdir) && pwd`/rpm
+rpm-package: dist
+       if test x$(HAVE_RPM) = xyes ; then \
+               mkdir -p $(rpm_topdir) ; \
+               cd $(rpm_topdir) ; \
+               mkdir -p BUILD RPMS SOURCES SPECS ; \
+               cd SOURCES ; \
+               ln -sf ../../$(distdir).tar.gz ; \
+               cd .. ; \
+               cd SPECS ; \
+               ln -sf ../../backupninja.spec . ; \
+               cd .. ; \
+               rpmbuild --define "_topdir `cd . && pwd`" -bb SPECS/backupninja.spec && \
+               echo "Package successfully built in `pwd`/RPMS." ; \
+       else \
+               echo "Error: RPM executable and/or source directory not found." ; \
+       fi
+srpm-package: dist
+       if test x$(HAVE_RPM) = xyes ; then \
+               cd $(rpm_topdir) ; \
+               mkdir -p BUILD SRPMS SOURCES SPECS ; \
+               cd SOURCES ; \
+               ln -s ../../$(distdir).tar.gz ; \
+               cd .. ; \
+               cd SPECS ; \
+               ln -sf ../../backupninja.spec .
+               rpmbuild --define "_topdir `cd . && pwd`" -bs SPECS/backupninja.spec && \
+               echo "Package successfully built in `pwd`/SRPMS." ; \
+       else \
+               echo "Error: RPM executable and/or source directory not found." ; \
+       fi 
index 5781ce7d0f2be1458cd4203ab5c4368c5382ea53..99ebdeed582304d764c57f66cbb9ebb7d2afa5bb 100644 (file)
@@ -26,6 +26,19 @@ AC_CHECK_PROGS(AWK, awk)
 if test x$AWK = "x"; then
     AC_MSG_ERROR([awk is required])
 fi
+AC_CHECK_PROG(ac_cv_have_rpm, rpm, "yes", "no")
+if test "x$ac_cv_have_rpm" = "xyes"; then
+        rpm --define '_topdir /tmp' > /dev/null 2>&1
+        AC_MSG_CHECKING(to see if we can redefine _topdir)
+        if test $? -eq 0 ; then
+                AC_MSG_RESULT(yes)
+                HAVE_RPM=yes
+        else
+                AC_MSG_RESULT(no.  You'll have to build packages manually.)
+                HAVE_RPM=no
+        fi
+fi
+AC_SUBST(HAVE_RPM)
 
 AC_SUBST([CFGDIR], "${sysconfdir}")