File imap.spec of Package imap

#
# spec file for package imap (Version 2007e_suse)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild


Name:           imap
Summary:        IMAP4, POP2, and POP3 Mail Server
Version:        2007e_suse
Release:        1
License:        Apache Software License ..
Group:          Productivity/Networking/Email/Servers
Url:            http://www.washington.edu/imap/
Source0:        %{name}-2007e.tar.bz2
Source1:        README.SuSE
# pam config
Source2:        %{name}.pamd
Source3:        pop.pamd
# xinetd config
Source4:        %{name}.xinetd
# c-client config
Source5:        c-client.cf
Source6:        %name.firewall
Source100:      %{name}.rpmlintrc
Patch0:         %{name}-2001a-include.diff
Patch1:         %{name}-2004a-doc.diff
Patch2:         %{name}-2002e-ssl.diff
Patch3:         %{name}-2004-cflags.diff
Patch4:         %{name}-2001a-overflow.diff
#Patch5:         %{name}-2002c-c++.patch
Patch5:         %{name}-2007e-c++.patch
#Patch6:         %{name}-2006c1.diff
Patch6:         %{name}-2007e.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
PreReq:         bash /bin/echo /bin/mv
BuildRequires:  openssl-devel pam-devel
%if 0%{?suse_version} >= 1100
BuildRequires:  fdupes
%endif
Requires:       pam inet-daemon

%description
This package contains IMAP4, POP2, and POP3 mail servers.

After installation, activate the servers in the file /etc/inetd.conf.



Authors:
--------
    Mark Crispin <mrc@cac.washington.edu>

%package -n libc-client2007e_suse
Summary:        IMAP4rev1/c-client Development Environment
License:        BSD3c(or similar)
Group:          Development/Libraries/C and C++
Provides:       %{name}-devel:/usr/lib/libc-client.so

%description -n libc-client2007e_suse
This package contains the libraries for IMAP client programs.



Authors:
--------
    Mark Crispin <mrc@cac.washington.edu>

%package devel
Summary:        IMAP4rev1/c-client Development Environment
License:        BSD3c(or similar)
Group:          Development/Libraries/C and C++
#Requires:       %{name}-lib = %version
Requires:       libc-client2007e_suse = %{version}

%description devel
This package contains the libraries and header files for IMAP client
programs.



Authors:
--------
    Mark Crispin <mrc@cac.washington.edu>

%prep
%setup -n %{name}-2007e
%patch0
%patch1
%patch2
%patch3
%patch4
%patch5 -p1
%patch6 -p1

%build
export CFLAGS="$RPM_OPT_FLAGS -DDISABLE_POP_PROXY=1 -fPIC -fno-strict-aliasing -fstack-protector"
make lnp MYCFLAGS="$CFLAGS" SSLTYPE=nopwd IP=6
make lnp c-client
gcc -shared -Wl,-soname,libc-client.so.%{version} -o libc-client.so.%{version} c-client/*.o

%install
mkdir -p $RPM_BUILD_ROOT/usr/{sbin,share/man/man8,share/doc/packages/imap}
mkdir -p $RPM_BUILD_ROOT/etc/pam.d
install -m 755 imapd/imapd ipopd/ipop2d ipopd/ipop3d mtest/mtest $RPM_BUILD_ROOT/usr/sbin/
install -m 644 $RPM_SOURCE_DIR/%{name}.pamd ${RPM_BUILD_ROOT}/etc/pam.d/%{name}
install -m 644 $RPM_SOURCE_DIR/pop.pamd ${RPM_BUILD_ROOT}/etc/pam.d/pop
install -m 644 -D $RPM_SOURCE_DIR/%{name}.xinetd $RPM_BUILD_ROOT/etc/xinetd.d/%{name}
install -m 644 $RPM_SOURCE_DIR/c-client.cf ${RPM_BUILD_ROOT}/etc/c-client.cf
install -m 644 src/imapd/imapd.8 $RPM_BUILD_ROOT/usr/share/man/man8/imapd.8
install -m 644 src/ipopd/ipopd.8 $RPM_BUILD_ROOT/usr/share/man/man8/ipopd.8
install -m 644 $RPM_SOURCE_DIR/README.SuSE $RPM_BUILD_ROOT/usr/share/doc/packages/%{name}/
install -m 644 CONTENTS README docs/RELNOTES $RPM_BUILD_ROOT/usr/share/doc/packages/%{name}/
install -m 644 docs/{FAQ,bugs,imaprc,md5,naming,drivers}.txt $RPM_BUILD_ROOT/usr/share/doc/packages/%{name}/
mkdir -p $RPM_BUILD_ROOT/%{_includedir}/%{name}
cp src/osdep/tops-20/*.h $RPM_BUILD_ROOT/%{_includedir}/%{name}
cp src/osdep/unix/*.h $RPM_BUILD_ROOT/%{_includedir}/%{name}
cp src/c-client/*.h $RPM_BUILD_ROOT/%{_includedir}/%{name}
cp c-client/linkage.{h,c} $RPM_BUILD_ROOT/%{_includedir}/%{name}
cp c-client/osdep.h $RPM_BUILD_ROOT/%{_includedir}/%{name}
mkdir -p $RPM_BUILD_ROOT/%{_libdir}
install -m 644 c-client/c-client.a $RPM_BUILD_ROOT/%{_libdir}/libc-client.a
ln -sf libc-client.a $RPM_BUILD_ROOT/%{_libdir}/c-client.a
install -m 755 libc-client.so.%{version} $RPM_BUILD_ROOT/%{_libdir}/
ln -sf libc-client.so.%{version} $RPM_BUILD_ROOT/%{_libdir}/libc-client.so
ln -sf ../usr/sbin/imapd $RPM_BUILD_ROOT/etc/rimapd
ln -sf ../usr/sbin/ipop3d $RPM_BUILD_ROOT/etc/rpop3d
ln -sf ../usr/sbin/ipop2d $RPM_BUILD_ROOT/etc/rpop2d
install -d $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/
install -m 644 %{S:6} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/%{name}
# rpmlint
%if 0%{?suse_version} >= 1100
%fdupes $RPM_BUILD_ROOT%{_includedir}
%endif

%post
if [ -f /usr/share/ssl/certs/imapd.pem ] ; then
    if [ ! -f /etc/ssl/certs/imapd.pem ] ; then
	echo "moving imapd certificate to /etc/ssl/certs"
	mv /usr/share/ssl/certs/imapd.pem /etc/ssl/certs/
    fi
fi
if [ -f /usr/share/ssl/certs/ipop3d.pem ] ; then
    if [ ! -f /etc/ssl/certs/ipop3d.pem ] ; then
	echo "moving ipop3d certificate to /etc/ssl/certs"
	mv /usr/share/ssl/certs/ipop3d.pem /etc/ssl/certs/
    fi
fi

%post -n libc-client2007e_suse -p /sbin/ldconfig

%postun -n libc-client2007e_suse -p /sbin/ldconfig

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr (-,root,root)
/usr/sbin/*
/usr/share/man/man8/*
%config /etc/pam.d/*
%config(noreplace) /etc/xinetd.d/%{name}
/etc/rimapd
/etc/rpop3d
/etc/rpop2d
%doc /usr/share/doc/packages/%{name}

%files -n libc-client2007e_suse
%defattr (-,root,root)
%config(noreplace) /etc/c-client.cf
%{_libdir}/*.so
%{_libdir}/*.so.*
%config %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/%{name}

%files devel
%defattr (-,root,root)
%{_libdir}/*.a
%{_includedir}/%{name}

%changelog