Summary:     The /bin/mail program, which is used to send mail via shell scripts.
Summary(ja): シェルスクリプトからメールを送る /bin/mail プログラム
Name:        mailx
Version:     8.1.1
Release:     35%{?_dist_release}
License:     BSD
Group:       Applications/Internet
Source:      ftp://ftp.debian.org/pub/debian/hamm/source/mail/mailx-8.1.1.tar.gz
Source1:     flock.c
Patch0:      mailx-8.1.1.debian.patch
Patch1:      mailx-8.1.1.security.patch
Patch2:      mailx-8.1.1.nolock.patch
Patch3:      mailx-8.1.1.debian2.patch
Patch4:      mailx-noroot.patch
Patch5:      mailx-nopanic.patch
Patch6:      mailx-nullchar.patch
Patch7:      mailx-8.1.1-fhs.patch
Patch8:      mailx-8.1.1-environ.patch
Patch9:      mailx-8.1.1-siglj.patch
Patch10:     mailx-8.1.1-bug15728.patch
Patch11:     mailx-8.1.1-bug10074.patch
Patch12:     mailx-8.1.1-uidcheck.patch
Patch13:     mailx-8.1.1-flock.patch
Patch14:     mailx-8.1.1-nostrip.patch
Patch15:     mailx-8.1.1-ctime.patch
# bug fix for environ patch for Vine Linux
#Patch9:    mailx-fio.patch

BuildRoot:   %{_tmppath}/%{name}-%{version}-root


%description
The mailx package installs the /bin/mail program, which is used to
send quick email messages (i.e., without opening up a full-featured
mail user agent). Mail is often used in shell scripts.

You should install mailx because of its quick email sending ability,
which is especially useful if you're planning on writing any shell
scripts.

%description -l ja
mailx パッケージは /bin/mail プログラムをインストールします．
/bin/mail は，多機能のメールクライアントを起動すること無く迅速に
メールを送信するのに使われます．/bin/mail はシェルスクリプトから
よく使われています．

メール送信が関係するシェルスクリプト作成を検討しているのならば，
迅速なメール送信機能を備えた mailx パッケージを是非インストールして下さい．


%prep
%setup -q
cp %{SOURCE1} .
%patch0 -p1 -b .debian
%patch1 -p1 -b .security
%patch2 -p1 -b .nolock
%patch3 -p1 -b .debian2
%patch4 -p1 -b .noroot
%patch5 -p1 -b .nopanic
%patch6 -p1 -b .nullchar
%patch7 -p1 -b .fhs
%patch8 -p1 -b .environ
%patch9 -p1 -b .siglj
%patch10 -p1 -b .bug15728
%patch11 -p1 -b .bug10074
%patch12 -p1 -b .uidcheck
%patch13 -p1 -b .flock
%patch14 -p1
%patch15 -p1

#%patch9 -p0 -b .fio


%build
make CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE"


%install
rm -rf ${RPM_BUILD_ROOT}
mkdir -p ${RPM_BUILD_ROOT}/{bin,etc}
mkdir -p ${RPM_BUILD_ROOT}%{_bindir}
mkdir -p ${RPM_BUILD_ROOT}%{_prefix}/lib
mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man1

make DESTDIR=${RPM_BUILD_ROOT} bindir=%{_bindir} mandir=%{_mandir} install

( cd ${RPM_BUILD_ROOT}
  mv .%{_bindir}/mail ./bin/mail
  chmod g-s ./bin/mail
  ln -sf ../../bin/mail .%{_bindir}/Mail
  ln -sf mail.1 .%{_mandir}/man1/Mail.1
)


%clean
rm -rf ${RPM_BUILD_ROOT}


%files
%defattr(-,root,root)
%attr(755,root,mail)	/bin/mail
%{_bindir}/Mail
%{_prefix}/lib/mail.help
%{_prefix}/lib/mail.tildehelp
%config(noreplace) /etc/mail.rc
%{_mandir}/man1/mail.1*
%{_mandir}/man1/Mail.1*


%changelog
* Sun Oct 18 2009 Shu KONNO <owa@bg.wakwak.com> 8.1.1-35
- applied vine5 updates
	* Wed Sep 09 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 8.1.1-35
	- use %%{_prefix}/lib to build on x86_64

* Tue Sep  8 2009 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 8.1.1-34
- man files in the wrong location - fixed.

* Tue Aug  5 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 8.1.1-33
- applied new versioning policy
- spec in UTF-8

* Sat Sep 23 2006 Daisuke SUZUKI <daisuke@linux.or.jp> 8.1.1-32vl2
- rebuild to add gpg sign

* Fri Mar 26 2004 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 8.1.1-32vl1
- rebuilt with new toolchains
- s/Copyright/License/
- added Patch9--Patch15 from Fedora 8.1.1-32
  * Fri Aug 01 2003 Florian La Roche <Florian.LaRoche@redhat.de>
  - fix include file order #101251
  * Thu Aug 24 2000 Nalin Dahyabhai <nalin@redhat.com>
  - clean up flock() usage -- LOCK_EX shouldn't work on read-only descriptors
  * Mon Aug 21 2000 Nalin Dahyabhai <nalin@redhat.com>
  - patch to use fcntl() for locking instead of flock() (#15779)
  - patch to ignore ~/.mailrc if it's owned by anyone other than the owner of
    this process
  - clean up flock() emulation semantics
  * Thu Aug 17 2000 Jeff Johnson <jbj@redhat.com>
  - summaries from specspo.
  * Fri Aug 11 2000 Jeff Johnson <jbj@redhat.com>
  - time to use sigsetjmp/siglongjmp (#14010).
  - avoid indexing on NOSTR valued pointer (#15728).
  - ignore MAIL enviromment variable when invoked with -u (#10074).
- mailx-fio.patch dropped because it was merged Patch8

* Mon Jun 11 2001 MATSUBAYASHI 'Shaolin' Kohji <shaolin@vinelinux.org>
- 8.1.1-16vl2
- rebuilt for VineSeed, as well as adding Japanese summary/description
- define %%{_mandir} on the top of this spec file :-P

* Mon Sep 18 2000 Jun Nishii <jun@vinelinux.org>
- added fio-patch to fix bug for `mail -f`

* Mon Aug  7 2000 Nalin Dahyabhai <nalin@redhat.com>
- disable security-prone variables-inherited-from-environment behavior
- inherit only SHELL, DEAD, PAGER, LISTER, EDITOR, VISUAL, MBOX from environment
- document the environment variables that are used

* Wed Jul 12 2000 Prospector <bugzilla@redhat.com>
- automatic rebuild

* Wed Jun 21 2000 Preston Brown <pbrown@redhat.com>
- noreplace mail.rc

* Sun Jun 18 2000 Jeff Johnson <jbj@redhat.com>
- FHS packaging.

* Sun May  7 2000 Bill Nottingham <notting@redhat.com>
- fix explosions on ia64

* Thu Feb 03 2000 Elliot Lee <sopwith@redhat.com>
- Fix bug #8451
- Fix bug #8100

* Tue Aug 31 1999 Bill Nottingham <notting@redhat.com>
- fix pathnames
- take out makefile install crud

* Sun Mar 21 1999 Cristian Gafton <gafton@redhat.com> 
- auto rebuild in the new build environment (release 8)

* Thu Aug 27 1998 Alan Cox <alan@redhat.com>
- Synchronized with the Debian people (more small edge case cures)

* Tue Aug  4 1998 Jeff Johnson <jbj@redhat.com>
- build root

* Wed Jun 24 1998 Alan Cox <alan@redhat.com>
- Switched dotlocking off. This fits the Red Hat model of not having setgid
  mail agents and fixes the "lock" problem reported.

* Mon Jun 22 1998 Alan Cox <alan@redhat.com>
- Buffer overrun patches. These dont bite us when we don't run mailx setgid
  but do want to be in as mailx needs to be setgid

* Fri Jun 12 1998 Alan Cox <alan@redhat.com>
- Moved from 5.5 to the OpenBSD 8.1 release plus Debian patches

* Tue May 05 1998 Prospector System <bugs@redhat.com>
- translations modified for de, fr, tr

* Tue Oct 21 1997 Donnie Barnes <djb@redhat.com>
- spec file cleanups

* Thu Jun 12 1997 Erik Troan <ewt@redhat.com>
- built against glibc
