Move definition of LINK to mh header file, and garbage collect ATTVIBUG code.
[mmh] / nmh.spec
1 # This spec supports two methods of RPM creation:
2 #
3 # 1) Start from an nmh workspace, run configure as desired and then "make rpm".
4 #    For example:
5 #      $ git clone git://git.savannah.nongnu.org/nmh.git
6 #      $ cd nmh
7 #      $ ./autogen.sh
8 #      $ ./configure --with-cyrus-sasl --with-locking=fcntl  &&  make rpm
9 #
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 [...]'.
13 #    For example:
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
18 #
19 # If configure has previously been run successfully in the workspace,
20 # it will not be invoked again, even if configure_opts is defined.
21 #
22 # With kernel (fcntl, flock, or lockf) locking, or with dot locking
23 # and a lockdir that's writable by the user, bin/inc does not need to
24 # be setgid.  This spec assumes that.  But if needed, add something
25 # like this to the %files section to make bin/inc setgid:
26 #   %attr(2755,-,mail) /usr/local/nmh/bin/inc
27 #
28 # Note that Version cannot contain any dashes.
29 #
30 # The description, summary, and a few other tags were taken from the
31 # nmh.spec used to build the Fedora 15 nmh rpm.
32
33 Name:          nmh
34 Version:       %(sed "s/-/_/g" $RPM_SOURCE_DIR/VERSION)
35 %define        rawversion %(cat $RPM_SOURCE_DIR/VERSION)
36 Release:       0%{?dist}
37 Summary:       A capable mail handling system with a command line interface.
38 Group:         Applications/Internet
39 License:       BSD
40 URL:           http://savannah.nongnu.org/projects/nmh
41 BuildRequires: gdbm-devel ncurses-devel
42 %define        tarfile nmh-%rawversion.tar.gz
43 Source0:       %tarfile
44 Source1:       VERSION
45 %define        srcdir %(pwd)
46 # This should already be defined in /usr/lib/rpm/macros:
47 # BuildRoot:     %{_buildrootdir}/%{name}-%{version}-%{release}.%{_arch}
48
49 %description
50 Nmh is an email system based on the MH email system and is intended to
51 be a (mostly) compatible drop-in replacement for MH.  Nmh isn't a
52 single comprehensive program.  Instead, it consists of a number of
53 fairly simple single-purpose programs for sending, receiving, saving,
54 retrieving and otherwise manipulating email messages.  You can freely
55 intersperse nmh commands with other shell commands or write custom
56 scripts which utilize nmh commands.  If you want to use nmh as a true
57 email user agent, you'll want to also install exmh to provide a user
58 interface for it--nmh only has a command line interface.
59
60
61 %prep
62 if [ ! -f $RPM_SOURCE_DIR/%tarfile ]; then
63   #### The tarfile wasn't already installed and we started with a
64   #### workspace (using make rpm), so get it from there.
65   [ -f %srcdir/%tarfile ]  ||  (cd %srcdir  &&  make nmhdist)
66   cp -p %srcdir/%tarfile $RPM_SOURCE_DIR/%tarfile
67 fi
68 [ -f $RPM_SOURCE_DIR/VERSION ]  ||  cp -p %srcdir/VERSION $RPM_SOURCE_DIR
69 %setup -q -n %name-%rawversion
70
71
72 %build
73 if [ -f %srcdir/config.status ]; then
74   echo reusing existing configuration
75   cp -pf %srcdir/config.status .
76   ./config.status
77 else
78   %if %{undefined configure_opts}
79     %define configure_opts --enable-pop --with-cyrus-sasl --with-locking=fcntl
80   %endif
81   %configure %configure_opts
82 fi
83 make all nmhdist
84
85
86 %install
87 rm -rf $RPM_BUILD_ROOT doc
88 make install DESTDIR=$RPM_BUILD_ROOT SETGID_MAIL=
89 #### Exclude docs from nmh_files because its files are added with the
90 #### %doc directive in the %files section below.
91 mv `find $RPM_BUILD_ROOT -type d -name doc` .
92
93 gz_manpages='-e '
94
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#'
99 fi
100 find $RPM_BUILD_ROOT ! -type d -print | \
101   sed -e "s#^$RPM_BUILD_ROOT##" "$gz_manpages" > nmh_files
102
103
104 %clean
105 rm -rf $RPM_BUILD_ROOT doc $RPM_BUILD_DIR/%name-%rawversion
106
107
108 %files -f nmh_files
109 %defattr(-,root,root,-)
110 %doc doc/*