1 # This spec supports two methods of RPM creation:
3 # 1) Start from an nmh workspace, run configure as desired and then "make rpm".
5 # $ git clone git://git.savannah.nongnu.org/nmh.git
8 # $ ./configure --with-cyrus-sasl --with-locking=fcntl && make rpm
10 # 2) Start with a source RPM and use rpmbuild. Configure options are hard
11 # coded below, but they can be overridden on the rpmbuild command line
12 # with --define 'configure_opts --opt=value [...]'.
14 # $ rpm -i nmh-1.4-0.fc16.src.rpm
15 # $ rpmbuild --rmsource --rmspec \
16 # --define 'configure_opts --with-cyrus-sasl --with-locking=fcntl' \
17 # --bb ~/lib/rpmbuild/SPECS/nmh.spec
19 # If configure has previously been run successfully in the workspace,
20 # it will not be invoked again, even if configure_opts is defined.
22 # Note that "make rpm" sets _sysconfdir. If configuring to install
23 # anyplace other than the default _sysconfdir, typically /etc, and
24 # you're not using this through "make rpm", be sure to set _sysconfdir.
26 # With kernel (fcntl, flock, or lockf) locking, or with dot locking
27 # and a lockdir that's writable by the user, bin/inc does not need to
28 # be setgid. This spec assumes that. But if needed, add something
29 # like this to the %files section to make bin/inc setgid:
30 # %attr(2755,-,mail) /usr/local/nmh/bin/inc
32 # Note that Version cannot contain any dashes.
34 # The description, summary, and a few other tags were taken from the
35 # nmh.spec used to build the Fedora 15 nmh rpm.
38 Version: %(sed "s/-/_/g" VERSION)
39 %define rawversion %(cat VERSION)
41 Summary: A capable mail handling system with a command line interface
42 Group: Applications/Internet
44 URL: http://savannah.nongnu.org/projects/nmh
45 BuildRequires: gdbm-devel ncurses-devel
46 %define tarfile nmh-%rawversion.tar.gz
53 Nmh is an email system based on the MH email system and is intended to
54 be a (mostly) compatible drop-in replacement for MH. Nmh isn't a
55 single comprehensive program. Instead, it consists of a number of
56 fairly simple single-purpose programs for sending, receiving, saving,
57 retrieving and otherwise manipulating email messages. You can freely
58 intersperse nmh commands with other shell commands or write custom
59 scripts which utilize nmh commands. If you want to use nmh as a true
60 email user agent, you'll want to also install exmh to provide a user
61 interface for it--nmh only has a command line interface.
65 if [ ! -f $RPM_SOURCE_DIR/%tarfile ]; then
66 #### The tarfile wasn't already installed and we started with a
67 #### workspace (using make rpm), so get it from there.
68 [ -f %srcdir/%tarfile ] || (cd %srcdir && make dist)
69 cp -p %srcdir/%tarfile $RPM_SOURCE_DIR/%tarfile
71 [ -f $RPM_SOURCE_DIR/VERSION ] || cp -p %srcdir/VERSION $RPM_SOURCE_DIR
72 %setup -q -n %name-%rawversion
76 if [ -f %srcdir/config.status ]; then
77 echo reusing existing configuration
78 cp -pf %srcdir/config.status .
81 %if %{undefined configure_opts}
82 %define configure_opts --enable-pop --with-cyrus-sasl --with-locking=fcntl
84 %configure %configure_opts
90 rm -rf $RPM_BUILD_ROOT
91 make install DESTDIR=$RPM_BUILD_ROOT SETGID_MAIL=
95 if find $RPM_BUILD_ROOT -name 'inc.1*' | \
96 egrep -q '/usr(/lib|/share)?/man/([^/]+/)?man'; then
97 #### brp-compress will gzip the man pages, so account for that.
98 gz_manpages='-e s#\(/man/man./.*\)#\1.gz#'
101 #### etc is brought into files using %config{noreplace}
102 find $RPM_BUILD_ROOT -name etc -prune -o ! -type d -print | \
103 sed -e "s#^$RPM_BUILD_ROOT##" "$gz_manpages" > nmh_files
107 rm -rf $RPM_BUILD_ROOT $RPM_BUILD_DIR/%buildsubdir
111 %defattr(-,root,root,-)
112 %config(noreplace) %_sysconfdir/