aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMicah Anderson <micah@riseup.net>2006-08-06 18:01:28 +0000
committerMicah Anderson <micah@riseup.net>2006-08-06 18:01:28 +0000
commit8e154d59efdbbb95fd4e46623a735a7049cea754 (patch)
tree3d2239bb15b4c284693195a81fab68c27ddbbb08
parent32e13d4c6573fecca4964b1a9f77254823d2e589 (diff)
downloadbackupninja-8e154d59efdbbb95fd4e46623a735a7049cea754.tar.gz
backupninja-8e154d59efdbbb95fd4e46623a735a7049cea754.tar.bz2
Added patch to improve RPM building
-rw-r--r--AUTHORS1
-rw-r--r--ChangeLog2
-rw-r--r--Makefile.am32
-rw-r--r--configure.in13
4 files changed, 48 insertions, 0 deletions
diff --git a/AUTHORS b/AUTHORS
index 2b2ad03..a488834 100644
--- 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
diff --git a/ChangeLog b/ChangeLog
index 4fece0d..b1b9b99 100644
--- 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
diff --git a/Makefile.am b/Makefile.am
index 8f706df..34ab32a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -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
diff --git a/configure.in b/configure.in
index 5781ce7..99ebdee 100644
--- a/configure.in
+++ b/configure.in
@@ -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}")