File crash.spec of Package crash

#
# spec file for package crash (Version 4.1.0)
#
# 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/
#

# norootforbuild

%define crash_version		4.1.0
%define whitepaper_version 2003
%define scripts_version  2008-02-08

Name:           crash
%ifarch ppc
%define build_sial 0
%else
%define build_sial 1
%endif
Url:            http://people.redhat.com/anderson/
Summary:        Crash utility for live systems; netdump, diskdump, LKCD or mcore dumpfiles
Version:        %{crash_version}
Release:        1
License:        GPL v2 only ; GPL v2 or later ; LGPL v2.1 or later
Group:          Development/Tools/Debuggers
Source:         %{name}-%{crash_version}.tar.bz2
Source2:        crash_whitepaper-%{whitepaper_version}.tar.bz2
Source3:        README.SUSE
Source4:        sial-scripts-%{scripts_version}.tar.bz2
Source99:       rpmlintrc
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Patch0:         %{name}-Makefile-ADD_CFLAGS
Patch1:         %{name}-make-emacs-default.diff
Patch2:         %{name}-sles9-quirk.patch
Patch4:         %{name}-sles9-time.patch
Patch5:         %{name}-compressed-kernel
Patch6:         %{name}-crosscrash-hint.diff
BuildRequires:  bison flex ncurses-devel zlib-devel
Requires:       /usr/bin/nm
ExcludeArch:    ppc

%description
The core analysis suite is a self-contained tool that can be used to
investigate either live systems, kernel core dumps created from the
netdump and diskdump packages from Red Hat Linux, the mcore kernel
patch offered by Mission Critical Linux, or the LKCD kernel patch.



Authors:
--------
    David Anderson <anderson@redhat.com>

%package doc
License:        GFDL v1.2
Requires:       %{name} = %{version}
Summary:        Documentation for Crash
Group:          Development/Tools/Debuggers

%description doc
This subpackage contains the crash whitepaper from Dave Anderson.



Authors:
--------
    David Anderson <anderson@redhat.com>

%package devel
License:        LGPL v2.1 or later
Requires:       %{name} = %{version}
Summary:        Development files for crash
Group:          Development/Tools/Debuggers

%description devel
This files are required to build extensions for crash.

Crash is the core analysis suite that can be used to investigate either
live systems, kernel core dumps created from the netdump and diskdump
packages from Red Hat Linux, the mcore kernel patch offered by Mission
Critical Linux, or the LKCD kernel patch.



Authors:
--------
    David Anderson <anderson@redhat.com>

%if %build_sial

%package sial
License:        GPL v2 or later ; LGPL v2.1 or later
Requires:       %{name} = %{version}
Summary:        SIAL extension for crash
Group:          Development/Tools/Debuggers

%description sial
This module is a prerequisite for the loading of SIAL scripts.

Upon loading the sial.so object file with extend, any SIAL scripts
located in the /usr/share/sial/crash or $HOME/.sial directories will be
loaded automatically.



Authors:
--------
    David Anderson <anderson@redhat.com>

%endif

%prep
%setup -q -n %{name}-%{crash_version} -a 2 -a 4
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
## SIAL patches
# cd sial-scripts-%{scripts_version}
## Patch here
# cd -
cp %{S:3} .

%build
#export CFLAGS="$RPM_OPT_FLAGS -fno-builtin-memset -fno-strict-aliasing"
make ADD_CFLAGS="$RPM_OPT_FLAGS -fno-builtin-memset -fno-strict-aliasing -fno-builtin-memset" \
        RPMPKG="`cat .rh_rpm_package`" %{?jobs:-j%jobs}
make ADD_CFLAGS="$RPM_OPT_FLAGS -fno-builtin-memset -fno-strict-aliasing -fno-builtin-memset" \
        extensions %{?jobs:-j%jobs}

%install
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_libdir}
make DESTDIR=%{buildroot} install
mkdir -p %{buildroot}%{_mandir}/man8
install -m 0644 crash.8 %{buildroot}%{_mandir}/man8/crash.8
# devel files
mkdir -p $RPM_BUILD_ROOT/%{_includedir}/crash
install -m 0644 defs.h $RPM_BUILD_ROOT/%{_includedir}/crash
# permissions
chmod 644 COPYING
# extensions
%if %build_sial
mkdir -p $RPM_BUILD_ROOT/%{_libdir}/crash/extensions
install -m 0644 extensions/sial.so $RPM_BUILD_ROOT/%{_libdir}/crash/extensions
# scripts
mkdir -p $RPM_BUILD_ROOT/%{_datadir}/sial/crash
install -m 0644 sial-scripts-%{scripts_version}/*.c \
                $RPM_BUILD_ROOT/%{_datadir}/sial/crash
%endif

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root)
%{_bindir}/crash
%{_mandir}/man8/crash.8*
%doc README README.SUSE COPYING

%files devel
%defattr(-,root,root)
%{_includedir}/*

%files doc
%defattr(-,root,root)
%doc crash_whitepaper/*
%if %build_sial

%files sial
%defattr(-,root,root)
%doc extensions/libsial/README
%{_libdir}/crash/extensions/sial.so
%{_datadir}/sial/crash
%dir %{_datadir}/sial
%dir %{_libdir}/crash
%dir %{_libdir}/crash/extensions
%endif

%changelog
openSUSE Build Service is sponsored by