From b11f1955e4408e47dcc7b01605e3754852cca3ba Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Sun, 20 Jan 2002 23:05:25 +0000 Subject: [PATCH] Revamp the RPM building process. For versions of rpm that support "--define", we now build the RPM and SRPM packages in packages/rpm. As a result, one need not be root to build RPM-based packages. Move the specfile to packaging/rpm/SPECS. Update the INSTALL document to include the various packaging makefile targets. svn path=/trunk/; revision=4581 --- INSTALL | 25 +++++++++++--- Makefile.am | 30 +++++++++------- acinclude.m4 | 22 +++++++++++- configure.in | 40 +++------------------- packaging/rpm/Makefile.am | 4 ++- packaging/rpm/SPECS/Makefile.am | 1 + packaging/rpm/{ => SPECS}/ethereal.spec.in | 0 7 files changed, 68 insertions(+), 54 deletions(-) create mode 100644 packaging/rpm/SPECS/Makefile.am rename packaging/rpm/{ => SPECS}/ethereal.spec.in (100%) diff --git a/INSTALL b/INSTALL index feb9c3ba5d..1f5927940c 100644 --- a/INSTALL +++ b/INSTALL @@ -49,10 +49,10 @@ Installation Checklist You won't be able to capture packets, but you can read traces that have already been captured to disk by other programs. - You can build or not build ethereal, tethereal, editcap, and - mergecap with the appropriate --enable-XXX or --disable-XXX flags. - The default is to build everything. If GTK+ is not detected - on the system, then ethereal won't be built. + You can build or not build ethereal, tethereal, editcap, and + mergecap with the appropriate --enable-XXX or --disable-XXX + flags. The default is to build everything. If GTK+ is not + detected on the system, then ethereal won't be built. [ ] 4. Run 'make'. Hopefully, you won't run into any problems. @@ -60,4 +60,19 @@ Installation Checklist have root privileges in order to capture live data. [ ] 6. Run 'make install'. If you wish to install the man page, run - 'make install-man'. You're done. + 'make install-man'. If you're running a system that supports + the Apt, RPM, or System V Release 4 packaging systems, you can + run one of + + make debian-package # Builds a binary package using dpkg + make rpm-package # Builds a binary package using rpm + make srpm-package # Builds a source package using rpm + make svr4-package # Builds a source package using pkgmk + make solaris-package # Same as "make svr4-package" + + to make an installable package for your system. + +If you have trouble with the build or installation process, you can +find assistance on the ethereal-users and ethereal-dev mailing lists. +See http://www.ethereal.com/lists/ for details. + diff --git a/Makefile.am b/Makefile.am index 0002a5cfd2..6ff3cfd98a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ # Makefile.am # Automake file for Ethereal # -# $Id: Makefile.am,v 1.404 2002/01/10 01:28:43 guy Exp $ +# $Id: Makefile.am,v 1.405 2002/01/20 23:05:22 gerald Exp $ # # Ethereal - Network traffic analyzer # By Gerald Combs @@ -969,24 +969,30 @@ svr4-package: $(bin_SCRIPTS) $(lib_LTLIBRARIES) solaris-package: svr4-package -specfile=$(top_srcdir)/packaging/rpm/ethereal.spec - +rpm_topdir=`cd $(top_srcdir) && pwd`/packaging/rpm rpm-package: dist - if test x$(HAVE_RPM_PACKAGING) = xyes ; then \ - cp $(top_srcdir)/$(distdir).tar.gz $(RPM_SOURCEDIR) ; \ - rpm -bb --clean --rmsource $(specfile) ; \ + if test x$(HAVE_RPM) = xyes ; then \ + cd $(rpm_topdir) ; \ + mkdir BUILD RPMS SOURCES ; \ + cd SOURCES ; \ + ln -s ../../../$(distdir).tar.gz ; \ + cd .. ; \ + rpm --define "_topdir `cd . && pwd`" -bb SPECS/ethereal.spec && \ + echo "Package successfully built in `pwd`/RPMS." ; \ else \ echo "Error: RPM executable and/or source directory not found." ; \ - echo "Package build abandoned." ; \ fi - srpm-package: dist - if test x$(HAVE_RPM_PACKAGING) = xyes ; then \ - cp $(top_srcdir)/$(distdir).tar.gz $(RPM_SOURCEDIR) ; \ - rpm -bs --clean --rmsource $(specfile) ; \ + if test x$(HAVE_RPM) = xyes ; then \ + cd $(rpm_topdir) ; \ + mkdir BUILD SRPMS SOURCES ; \ + cd SOURCES ; \ + ln -s ../../../$(distdir).tar.gz ; \ + cd .. ; \ + rpm --define "_topdir `cd . && pwd`" -bs SPECS/ethereal.spec && \ + echo "Package successfully built in `pwd`/SRPMS." ; \ else \ echo "Error: RPM executable and/or source directory not found." ; \ - echo "Package build abandoned." ; \ fi debian-package: debian/rules diff --git a/acinclude.m4 b/acinclude.m4 index b8141da6cc..ddb168c512 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -2,7 +2,7 @@ dnl Macros that test for specific features. dnl This file is part of the Autoconf packaging for Ethereal. dnl Copyright (C) 1998-2000 by Gerald Combs. dnl -dnl $Id: acinclude.m4,v 1.37 2002/01/18 08:28:22 guy Exp $ +dnl $Id: acinclude.m4,v 1.38 2002/01/20 23:05:22 gerald Exp $ dnl dnl This program is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by @@ -492,3 +492,23 @@ AC_DEFUN(AC_ETHEREAL_SSL_CHECK, AC_MSG_RESULT(not required) fi ]) + +# +# AC_ETHEREAL_RPM_CHECK +# Looks for the rpm program, and checks to see if we can redefine "_topdir". +# +AC_DEFUN(AC_ETHEREAL_RPM_CHECK, +[ + AC_CHECK_PROG(ac_cv_ethereal_have_rpm, rpm, "yes", "no") + if test "x$ac_cv_ethereal_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 +]) diff --git a/configure.in b/configure.in index f7d359e535..24eba41710 100644 --- a/configure.in +++ b/configure.in @@ -1,4 +1,4 @@ -# $Id: configure.in,v 1.144 2002/01/09 23:21:54 gram Exp $ +# $Id: configure.in,v 1.145 2002/01/20 23:05:22 gerald Exp $ dnl dnl Process this file with autoconf 2.13 or later to produce a dnl configure script; 2.12 doesn't generate a "configure" script that @@ -38,7 +38,6 @@ AC_SUBST(PYTHON) AC_CHECK_PROG(HAVE_PKGPROTO, pkgproto, "yes", "no") AC_CHECK_PROG(HAVE_PKGMK, pkgmk, "yes", "no") AC_CHECK_PROG(HAVE_PKGTRANS, pkgtrans, "yes", "no") -AC_CHECK_PROG(HAVE_RPM, rpm, "yes", "no") if test x$HAVE_PKGPROTO = xyes -a x$HAVE_PKGMK = xyes \ -a x$HAVE_PKGTRANS = xyes ; then @@ -48,38 +47,8 @@ else fi AC_SUBST(HAVE_SVR4_PACKAGING) -# Grr. Rpm 2.x has a nifty "--showrc" flag that lists all of the current -# configuration values. Version 3.x took the niftiness away by returning -# the values in their raw, unexpanded, macro-embedded form. We can either -# try to expand the values we get from 3.x, or poke around for popular build -# directories. -HAVE_RPM_PACKAGING=no -if test x$HAVE_RPM = xyes ; then - AC_MSG_CHECKING(for rpm build directories) - RPM_SOURCESDIR=`rpm --showrc | grep "^sourcedir" | \ - sed -e 's/.*: //' 2> /dev/null` - if test x$RPM_SPECDIR = x ; then - # Red Hat : /usr/src/redhat - # Mandrake : /usr/scr/rpm - # SuSE : /usr/src/packages - for TEST_DIR in /usr/src/redhat /usr/src/rpm /usr/src/packages ; do - if test -d $TEST_DIR/SPECS -a -d $TEST_DIR/SOURCES -a \ - -d $TEST_DIR/RPMS -a -d $TEST_DIR/SRPMS -a \ - -d $TEST_DIR/BUILD ; then - RPM_SOURCESDIR=$TEST_DIR/SOURCES - fi - done - fi - if test x$RPM_SOURCESDIR = x ; then - AC_MSG_RESULT(not found) - RPM_SOURCESDIR="" - else - AC_MSG_RESULT(found) - HAVE_RPM_PACKAGING=yes - fi -fi -AC_SUBST(HAVE_RPM_PACKAGING) - +AC_ETHEREAL_RPM_CHECK +AC_SUBST(HAVE_RPM) # If we're running gcc, add '-Wall' to CFLAGS. AC_MSG_CHECKING(to see if we can add '-Wall' to CFLAGS) @@ -698,7 +667,8 @@ AC_OUTPUT( packaging/Makefile packaging/nsis/Makefile packaging/rpm/Makefile - packaging/rpm/ethereal.spec + packaging/rpm/SPECS/Makefile + packaging/rpm/SPECS/ethereal.spec packaging/svr4/Makefile packaging/svr4/checkinstall packaging/svr4/pkginfo diff --git a/packaging/rpm/Makefile.am b/packaging/rpm/Makefile.am index 28b04012e9..787d5848e8 100644 --- a/packaging/rpm/Makefile.am +++ b/packaging/rpm/Makefile.am @@ -1 +1,3 @@ -EXTRA_DIST = ethereal.spec.in +SUBDIRS = SPECS +clean-local: + rm -rf BUILD RPMS SOURCES SRPMS diff --git a/packaging/rpm/SPECS/Makefile.am b/packaging/rpm/SPECS/Makefile.am new file mode 100644 index 0000000000..28b04012e9 --- /dev/null +++ b/packaging/rpm/SPECS/Makefile.am @@ -0,0 +1 @@ +EXTRA_DIST = ethereal.spec.in diff --git a/packaging/rpm/ethereal.spec.in b/packaging/rpm/SPECS/ethereal.spec.in similarity index 100% rename from packaging/rpm/ethereal.spec.in rename to packaging/rpm/SPECS/ethereal.spec.in