File google-breakpad.spec of Package google-breakpad

%define toolsdir src/tools/linux
%define procdir src/processor
%define includedir %{_includedir}/google_breakpad

Summary: A multi-platform crash reporting system
Name: google-breakpad
Version: r913
License: BSD
Release: 1
Group: Development/Tools/Debuggers
Source: %{name}-%{version}.tar.bz2
BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: gcc-c++ glibc-devel
Url: http://code.google.com/p/google-breakpad

%description
Breakpad is a library and tool suite that allows you to distribute an
application to users with compiler-provided debugging information
removed, record crashes in compact "minidump" files, send them back to
your server, and produce C and C++ stack traces from these minidumps.
Breakpad can also write minidumps on request for programs that have not
crashed.

Breakpad is currently used by Google Chrome, Firefox, Google Picasa,
Camino, Google Earth, and other projects.

%package        devel
Summary:        Development package google-breakpad
Group:          Development/Libraries/C and C++

%description    devel
This package contains all that is needed to develop/compile
applications that use the google breakpad libraries.

%prep
%setup -n %{name}

%build
LIBS='-ldl' configure \
    --bindir=%{_bindir} \
    --libdir=%{_libdir} \
    --datadir=%{_datadir}
make

%install
mkdir -p $RPM_BUILD_ROOT%{_bindir}
mkdir -p $RPM_BUILD_ROOT%{_libdir}
mkdir -p $RPM_BUILD_ROOT%{includedir}

cp %{toolsdir}/core2md/core2md $RPM_BUILD_ROOT/%{_bindir}/breakpad-core2md
cp %{toolsdir}/dump_syms/dump_syms $RPM_BUILD_ROOT/%{_bindir}/breakpad-dumpsyms
cp %{toolsdir}/md2core/minidump-2-core $RPM_BUILD_ROOT/%{_bindir}/breakpad-md2core
cp %{toolsdir}/symupload/minidump_upload $RPM_BUILD_ROOT/%{_bindir}/breakpad-mdupload
cp %{toolsdir}/symupload/sym_upload $RPM_BUILD_ROOT/%{_bindir}/breakpad-symupload
cp %{procdir}/minidump_stackwalk $RPM_BUILD_ROOT/%{_bindir}/breakpad-stackwalk
cp %{procdir}/minidump_dump $RPM_BUILD_ROOT/%{_bindir}/breakpad-dump

cp src/client/linux/libbreakpad_client.a $RPM_BUILD_ROOT%{_libdir}

copy_headers()
{
    srcdir=$1

    for i in $(find $srcdir -name "*.h");
    do
	destdir=$(echo $RPM_BUILD_ROOT%{includedir}/$(dirname $i) | sed "s|\./||")
	mkdir -p $destdir
	cp $i $destdir
    done
}

cd src
copy_headers ./client/linux
copy_headers ./processor
cd google_breakpad
copy_headers ./


%clean
make clean

%files
%defattr(-,root,root)
%{_bindir}/breakpad-*

%files devel
%defattr(-,root,root)
%{_libdir}/libbreakpad_client.a
%dir %{includedir}
%{includedir}/*

%changelog