X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=nmh.spec;h=08a0b915d0ed4d6315e954ff9333367f5d370b2f;hb=7565efea3b91264fb6055b2ecb8980807c2da677;hp=858db2bfed7ccde7d95be63a99196beff68c3dfc;hpb=d7f717307ce81d8372f00cf3b11cb54a81cc5337;p=mmh diff --git a/nmh.spec b/nmh.spec index 858db2b..08a0b91 100644 --- a/nmh.spec +++ b/nmh.spec @@ -1,24 +1,54 @@ -# Assumes that rpmbuild was invoked in main nmh directory using "make -# rpm". Therefore, configure must already have been run. "make rpm" -# uses an RPM directory below the current directory. +# This spec supports two methods of RPM creation: # -# This file is intended to be zero maintenance, that's why it relies -# on the Makefile (and specifically on the nmhdist target). If you -# really want to start with rpmbuild from a clean distribution, look -# at the rpm target in the main Makefile.in to see what it does. +# 1) Start from an nmh workspace, run configure as desired and then "make rpm". +# For example: +# $ git clone git://git.savannah.nongnu.org/nmh.git +# $ cd nmh +# $ ./autogen.sh +# $ ./configure --with-cyrus-sasl --with-locking=fcntl && make rpm +# +# 2) Start with a source RPM and use rpmbuild. Configure options are hard +# coded below, but they can be overridden on the rpmbuild command line +# with --define 'configure_opts --opt=value [...]'. +# For example: +# $ rpm -i nmh-1.4-0.fc16.src.rpm +# $ rpmbuild --rmsource --rmspec \ +# --define '_sysconfdir /usr/local/nmh/etc' \ +# --define 'configure_opts --with-cyrus-sasl --with-locking=fcntl' \ +# --bb ~/lib/rpmbuild/SPECS/nmh.spec +# +# If configure has previously been run successfully in the workspace, +# it will not be invoked again, even if configure_opts is defined. +# +# Note that "make rpm" sets _sysconfdir. If configuring to install +# anyplace other than the default _sysconfdir, typically /etc, and +# you're not using this through "make rpm", be sure to set _sysconfdir. +# +# With kernel (fcntl, flock, or lockf) locking, or with dot locking +# and a lockdir that's writable by the user, bin/inc does not need to +# be setgid. This spec assumes that. But if needed, add something +# like this to the %files section to make bin/inc setgid: +# %attr(2755,-,mail) /usr/local/nmh/bin/inc # # Note that Version cannot contain any dashes. +# +# The description, summary, and a few other tags were taken from the +# nmh.spec used to build the Fedora 15 nmh rpm. + +Name: nmh +Version: %(sed "s/-/_/g" VERSION) +%define rawversion %(cat VERSION) +Release: 1%{?dist} +Summary: A capable mail handling system with a command line interface +Group: Applications/Internet +License: BSD +URL: http://savannah.nongnu.org/projects/nmh +BuildRequires: gdbm-devel ncurses-devel +%define tarfile nmh-%rawversion.tar.gz +Source0: %tarfile +Source1: VERSION +%define srcdir %(pwd) -Name: nmh -Version: %version -Release: 0%{?dist} -Summary: A capable mail handling system with a command line interface. -Group: Applications/Internet -License: BSD -URL: http://savannah.nongnu.org/projects/nmh -Source: %tarfile -# This should already be defined in /usr/lib/rpm/macros: -# BuildRoot: %{_buildrootdir}/%{name}-%{version}-%{release}.%{_arch} %description Nmh is an email system based on the MH email system and is intended to @@ -31,34 +61,53 @@ scripts which utilize nmh commands. If you want to use nmh as a true email user agent, you'll want to also install exmh to provide a user interface for it--nmh only has a command line interface. + %prep -#### The tarfile is only needed for the source rpm. -cp -p %srcdir/%tarfile $RPM_SOURCE_DIR +if [ ! -f $RPM_SOURCE_DIR/%tarfile ]; then + #### The tarfile wasn't already installed and we started with a + #### workspace (using make rpm), so get it from there. + [ -f %srcdir/%tarfile ] || (cd %srcdir && make dist) + cp -p %srcdir/%tarfile $RPM_SOURCE_DIR/%tarfile +fi +[ -f $RPM_SOURCE_DIR/VERSION ] || cp -p %srcdir/VERSION $RPM_SOURCE_DIR +%setup -q -n %name-%rawversion %build +if [ -f %srcdir/config.status ]; then + echo reusing existing configuration + cp -pf %srcdir/config.status . + ./config.status +else + %if %{undefined configure_opts} + %define configure_opts --enable-pop --with-cyrus-sasl --with-locking=fcntl + %endif + %configure %configure_opts +fi +make all dist %install rm -rf $RPM_BUILD_ROOT -(cd %srcdir && make install DESTDIR=$RPM_BUILD_ROOT SETGID_MAIL=) -find $RPM_BUILD_ROOT ! -type d -print | sed "s#^$RPM_BUILD_ROOT##g" > nmh_files +make install DESTDIR=$RPM_BUILD_ROOT SETGID_MAIL= + +gz_manpages='-e ' + +if find $RPM_BUILD_ROOT -name 'inc.1*' | \ + egrep -q '/usr(/lib|/share)?/man/([^/]+/)?man'; then + #### brp-compress will gzip the man pages, so account for that. + gz_manpages='-e s#\(/man/man./.*\)#\1.gz#' +fi -#### Should do the following with an install target in docs/Makefile. -#### These are excluded from nmh_files above because they're added -#### with doc's in the %files section below. -mkdir -p docs -cp -p %srcdir/VERSION %srcdir/COPYRIGHT . -for i in COMPLETION-* DIFFERENCES FAQ MAIL.FILTERING README* TODO; do - cp -p %srcdir/docs/$i docs -done +#### etc is brought into files using %config{noreplace} +find $RPM_BUILD_ROOT -name etc -prune -o ! -type d -print | \ + sed -e "s#^$RPM_BUILD_ROOT##" "$gz_manpages" > nmh_files %clean -rm -rf $RPM_BUILD_ROOT $RPM_SOURCE_DIR/%tarfile nmh_files docs COPYRIGHT VERSION +rm -rf $RPM_BUILD_ROOT $RPM_BUILD_DIR/%buildsubdir %files -f nmh_files %defattr(-,root,root,-) -%doc docs/COMPLETION-* docs/DIFFERENCES docs/FAQ docs/MAIL.FILTERING -%doc docs/README* docs/TODO COPYRIGHT VERSION +%config(noreplace) %_sysconfdir/*