File alpine.spec of Package alpine

#
# spec file for package alpine (Version 2.00)
#
# Copyright (c) 2009 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/
#



Name:           alpine
#
# Package configuration:
#
%if %{suse_version} > 1030
%define		obsolete_pine		1
%define		provide_pico_and_pilot	1
%else
%define		obsolete_pine		0
%define		provide_pico_and_pilot	0
%endif
#
# For debugging only:
%define		use_mudflap		0
%define		build_vanilla		0
#
Summary:        Alpine mail user agent (formerly pine)
BuildRequires:  imap-devel krb5-devel libgssapi ncurses-devel
BuildRequires:  openldap2-devel openssl-devel pam-devel update-desktop-files
%if %{use_mudflap}
BuildRequires:  libmudflap
%endif
# pgp4pine requires pine:
Provides:       pine
#
%if %obsolete_pine
Obsoletes:      pine4
Provides:       pine4
%else
Conflicts:      pine4
%endif
#
Version:        2.00
Release:        7
License:        Apache Software License ..
Group:          Productivity/Networking/Email/Clients
AutoReqProv:    on
Url:            http://www.washington.edu/alpine/
Source:         %{name}-%{version}.tar.bz2
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Source1:        %name.png
Source2:        %name.desktop
Patch1:         pine-nonvoid-function.patch
Patch2:         make-use-of-strncat-safer.diff
Patch3:         operation-may-be-undefined-warning.diff
Patch4:         fix-implicit.patch
Patch5:         alpine-gcc44.diff
Patch6:         alpine-2.00-as_needed.patch
Patch10:        pico-fix-spurious-undef-warnings.diff
Patch20:        pine-expression-warnings.diff
Patch40:        pico-stripwhitespace.diff
Patch60:        signal-and-panic-improvements.diff
#
# Eduardo Chappa's patches.
# http://staff.washington.edu/chappa/alpine/patches
#
Patch600:       chappa-colortext.patch.gz
Patch601:       chappa-fancy.patch.gz
Patch602:       chappa-ignoresize.patch.gz
Patch603:       chappa-insertpat.patch.gz
Patch604:       chappa-maildir.patch.gz
Patch605:       chappa-searchheader.patch.gz
Patch606:       chappa-WrtAcc.patch.gz
Patch607:       chappa-replacebug.patch.gz
Patch608:       chappa-unixnullbug.patch.gz
Patch609:       chappa-streamlock.patch.gz
Patch610:       chappa-filterflagbug.patch.gz
Patch611:       chappa-nlinfobug.patch.gz
Patch612:       chappa-unverified.patch.gz

%description
Though originally designed for inexperienced email users, Alpine
supports many advanced features, and an ever-growing number of
configuration and personal-preference options.

Alpine (formerly Pine) features improved support for UTF-8 and the code
is licensed under the Apache License.

Despite many improvements "under the hood" (the bugs which were
introduced by them were ironed out during more than a full year of
public beta testing), the user interface stays the same, so pine users
can switch painlessly to alpine and notice no change at all.

It uses the same configuration files as pine, so it's a clean update.

The biggest user-visible change are the new animations which are shown
when operations take a long time.



%package -n pico
License:        Apache Software License ..
Summary:        A small, easy to use editor
Group:          Productivity/Editors/Other
AutoReqProv:    on

%description -n pico
Pico is a simple, display-oriented text editor based on the Pine
message system composer. As with Pine, commands are displayed at the
bottom of the screen, and context-sensitive help is provided.
Characters are inserted into the text as they are typed.



%package -n pilot
License:        Apache Software License ..
Summary:        Simple file system browser
Group:          Productivity/File utilities
AutoReqProv:    on

%description -n pilot
Pilot is a simple, display-oriented file system browser based on the
Pine message system composer. As with Pine, commands are displayed at
the bottom of the screen, and context-sensitive help is provided.



%prep
%setup -q
%if !%{build_vanilla}
#
# This is here to support checking if any patches add new warnings:
#
if [ ! -s %{_sourcedir}/compile-warnings-%{suse_version}-%{_arch}.log ]; then
	echo "No warnings check possible, set build_vanilla to 1 and"
	echo "add compile-warnings-%{suse_version}-%{_arch}.log from"
	echo "that build to the rpm build process so that it's found here".
else
	sed 's/:[0-9]*//' %{_sourcedir}/compile-warnings-%{suse_version}-%{_arch}.log \
		>compile-warnings-allowed.log 
fi
#
# "Chappa" patches
#
%patch600 -p1
%patch601 -p1
%patch602 -p1
%patch603 -p1
%patch604 -p1
%patch605 -p1
%patch606 -p1
%patch607 -p1
%patch608 -p1
%patch609 -p1
%patch610 -p1
%patch611 -p1
%patch612 -p1
#
# SuSE patches - warning fixes, etc:
#
%patch1
%patch2 -p1
%patch3 -p1
%patch4 -p0
%patch5 -p0
%patch6 -p0
%patch10 -p1
%patch20 -p1
%patch40 -p1
%patch60 -p1
%endif # End of "if !{build_vanilla}"

%build
# Needed because of alpine-2.00-as_needed.patch
autoreconf -fi
# Workaround for older distros which slashed the gnu:
%if %{suse_version} <= 1010
%define _host_os %{_os}%{?_gnu}
%define _host	 %{_host_cpu}-%{_host_vendor}-%{_host_os}
%endif
#
# Comment on disabled warnings: The disabled warnings are rather harmless
# and disabling them allows to focus on the really serious warnings:
#
export CFLAGS="${RPM_OPT_FLAGS/-O2/-Os} \
%if %{suse_version} >= 1010
		-Wno-unused-value -fno-strict-aliasing -Wno-pointer-sign -Wno-unused \
%endif
%if %{suse_version} >= 1030
		-Wno-address \
%endif
%if %{use_mudflap}
		-fmudflap \
%endif
"
#
# On -Waddress:
#
# Added with gcc-4.2: It warns when the address of a variable (not a pointer)
# is used in an expression. Since addresses of variables are # always non-zero,
# they are always true and can be safely removed from the expression,
# but the code is safe nontheless.
#
# -Waddress generates >100 warnings in alpine and we disabled them to 
# concentrate on the really important warnings which could be real bugs better.
#
:
#
# Used in conjunction with signal-and-panic-improvements.diff:
#
export LDFLAGS="-rdynamic" # -rdynamic is used for backtrace_symbols:
:
#
# In case one wants to compile alpine with libmudflap to instrument all risky
# pointer/array dereferencing operations, some standard library string/heap
# functions, and some other associated constructs with range/validity tests.
# Modules so instrumented should be immune to buffer overflows, invalid heap
# use, and some other classes of C/C++ programming errors. Disabled by default,
# but may be used for debugging issues which are otherwise hard to catch:
#-fmudflap -fmudflapir \
%if %{use_mudflap}
export EXTRALDFLAGS="-lmudflap"
# Silences warnings at startup (faster, could be used for production builds):
#export EXTRALDFLAGS="-lmudflapir"
LDFLAGS="$LDFLAGS $EXTRALDFLAGS"
%endif
:
%configure \
%if %{use_mudflap}
	%( : 'mudflap(th) does not work with with threads:' )\
	--without-pthread				\
%endif
	--with-smtp-msa=/usr/sbin/sendmail		\
	--with-password-prog=/usr/bin/passwd		\
	--with-npa=/usr/bin/inews			\
	--with-spellcheck-prog="please set Speller to eg. 'aspell -c' in SETUP/Configuration"\
	--with-system-pinerc=%_sysconfdir/pine.conf		\
	--with-system-fixed-pinerc=%_sysconfdir/pine.conf.fixed \
	--with-debug-level=0				\
	--with-debug-files=2				\
	--with-file=.alpine-debug			\
	--with-default-mail-directory=Mail		\
	--with-web-bin=%_libdir/%name                   \
	--with-passfile=.pinepw || {
	grep -B9 -A20 'failed program was' config.log | grep -A24 checking
	exit 5
}
#
# imap does not use CFLAGS from configure, needs EXTRACFLAGS/EXTRALDFLAGS:
#
make %{?jobs:-j%jobs} EXTRACFLAGS="$CFLAGS" EXTRALDFLAGS="$EXTRALDFLAGS"

%install
make install DESTDIR=%buildroot
#
# When called as alpinef, alpine uses function keys instead of Control keys:
#
ln $RPM_BUILD_ROOT%{_bindir}/alpine $RPM_BUILD_ROOT%{_bindir}/alpinef
install    -m755 imap/mailutil/mailutil $RPM_BUILD_ROOT%{_bindir}
install -m644 imap/src/mailutil/mailutil.1	$RPM_BUILD_ROOT%{_mandir}/man1/
install -D -m644 %{SOURCE1} $RPM_BUILD_ROOT/usr/share/pixmaps/%name.png
install -D -m644 %{SOURCE2} $RPM_BUILD_ROOT/usr/share/applications/%name.desktop
%suse_update_desktop_file %name
:
%if %obsolete_pine
ln -sf		 alpine			$RPM_BUILD_ROOT%{_bindir}/pine
%endif
:
%if %provide_pico_and_pilot
install -m755 pico/{pico,pilot}		$RPM_BUILD_ROOT%{_bindir}
install -m644 doc/{pico.1,pilot.1}	$RPM_BUILD_ROOT%{_mandir}/man1/
%endif

%check
#since where are no logs in the package at the moment, there are no checks,
#but the warning logs can be recreated for regresstion tracking in warnings:
if [  -s %{_sourcedir}/compile-warnings-%{suse_version}-%{_arch}.log ]; then
    grep -e '^[a-z0-9_]*.[cho]:' -e 'Entering directory' make.log |
	sed "s/^make\[.\]: //;/Entering directory/s/[\`']//g;" \
	>compile-warnings-%{suse_version}-%{_arch}.log
    # Sort the combined allowed warnings:
    grep -v -e 'In function' -e 'Entering directory' \
	compile-warnings-allowed.log |
	    sort -u > compile-warnings-%{suse_version}-%{_arch}-reference.sort
    # Sort the warnings which occured now:
    grep -v -e 'In function' -e 'Entering directory' \
	compile-warnings-%{suse_version}-%{_arch}.log |
	    sed 's/:[0-9]*//' | sort -u \
		>compile-warnings-%{suse_version}-%{_arch}-thisbuild.sort
    # diff them:
    diff compile-warnings-%{suse_version}-%{_arch}-{reference,thisbuild}.sort |
	tee	  compile-warnings-%{suse_version}-%{_arch}-sorted.diff
    if test    -s compile-warnings-%{suse_version}-%{_arch}-sorted.diff; then
	grep '^>' compile-warnings-%{suse_version}-%{_arch}-sorted.diff >new-warnings ||:
	if [ -s new-warnings ]; then
		diff -u %{_sourcedir}/compile-warnings-%{suse_version}-%{_arch}.log \
			compile-warnings-%{suse_version}-%{_arch}.log ||
		echo "New warnings:"
		cat new-warnings
		sed 's/> //;s/:/:[0-9]*:/' new-warnings >new-warnings.pattern
		: diff:  %_builddir}/compile-warnings-%{suse_version}-%{_arch}-sorted.diff
		grep -B1 -f new-warnings.pattern compile-warnings-%{suse_version}-%{_arch}.log
		grep -e 'Entering directory' -f new-warnings.pattern \
			compile-warnings-%{suse_version}-%{_arch}.log |
				grep -B1 -f new-warnings.pattern |
					tee warnings.where
		while IFS='[: ]' read file line message; do
			if [ "$file" = Entering ]; then
				dir="${message#%_builddir/%buildsubdir/}"
			else
				path="$dir/$file"
				echo "$path:$line: $message"	>>warnings-with-code
				head -"$line" "$path"|tail -1	>>warnings-with-code
			fi
		done <warnings.where
		cat warnings-with-code
		exit 5
	else
		echo "Fixed warnings:"
		grep '^<' compile-warnings-%{suse_version}-%{_arch}-sorted.diff
	fi
    else
	echo "No fixed warnings and no new warnings"
    fi
fi

%clean
rm -rf %buildroot

%files
%defattr(-, root, root)
%doc %{_mandir}/man1/alpine.*
%doc %{_mandir}/man1/rpdump.*
%doc %{_mandir}/man1/rpload.*
%doc %{_mandir}/man1/mailutil.*
%doc README NOTICE LICENSE
%doc doc/mailcap.unx doc/mime.types doc/tech-notes.txt doc/tech-notes/*.html
%{_bindir}/*pine
%{_bindir}/alpinef
%{_bindir}/rp*
%{_bindir}/mailutil
/usr/share/applications/%name.desktop
/usr/share/pixmaps/%name.png
%if %provide_pico_and_pilot

%files -n pico
%defattr(-, root, root)
%{_bindir}/pico
%doc %{_mandir}/man1/pico.*

%files -n pilot
%defattr(-, root, root)
%{_bindir}/pilot
%doc %{_mandir}/man1/pilot.*
%endif

%changelog
openSUSE Build Service is sponsored by