File lldb.spec of Package llvm

#
# spec file for package lldb
#
# Copyright (c) 2015 SUSE LINUX 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/
#


%define _revision 246586

Name:           lldb
Version:        3.7.0
Release:        0
Summary:        The LLDB Debugger
License:        NCSA
Group:          Development/Languages
Url:            http://lldb.llvm.org/
Source:         http://llvm.org/releases/%{version}/lldb-%{version}.src.tar.xz
Patch1:         lldb-cmake.patch
BuildRequires:  cmake
BuildRequires:  libedit-devel
BuildRequires:  llvm-clang-devel = %{version}
BuildRequires:  llvm-devel = %{version}
BuildRequires:  ncurses-devel
BuildRequires:  ninja
BuildRequires:  python-devel
BuildRequires:  swig
BuildRequires:  zlib-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires:       libLLVM = %{version}
Requires:       libclang = %{version}
Requires:       python-base
ExclusiveArch:  arm x86_64

%define py_major $(python -c "import sys; print sys.version_info[0];")
%define py_minor $(python -c "import sys; print sys.version_info[1];")

%description
LLDB is a next generation, high-performance debugger. It is built as a set
of reusable components which highly leverage existing libraries in the
larger LLVM Project, such as the Clang expression parser and LLVM
disassembler.

%package devel
Summary:        Next generation high-performance debugger (devel package)
Group:          Development/Languages
Requires:       libedit-devel
Requires:       lldb = %{version}
Requires:       zlib-devel

%description devel
LLDB is a next generation, high-performance debugger. It is built as a set
of reusable components which highly leverage existing libraries in the
larger LLVM Project, such as the Clang expression parser and LLVM
disassembler.

%prep
%setup -q -n %{name}-%{version}.src
%patch1 -p1

sed -i s,LLDB_REVISION,\"%{_revision}\",g source/lldb.cpp

%build
mkdir build
pushd build

cmake -DCMAKE_C_COMPILER=clang \
      -DCMAKE_CXX_COMPILER=clang++ \
      -DBUILD_SHARED_LIBS=OFF \
      -DCMAKE_INSTALL_PREFIX=%{_prefix} \
      -DCMAKE_BUILD_TYPE=Release \
%if "%{_lib}" == "lib64"
      -DLLVM_LIBDIR_SUFFIX=64 \
%endif
      -DLLDB_PATH_TO_LLVM_BUILD=%{_prefix} \
      -DLLDB_PATH_TO_CLANG_BUILD=%{_prefix} \
      -DLLVM_RUNTIME_OUTPUT_INTDIR=$PWD/bin \
      -DLLVM_LIBRARY_OUTPUT_INTDIR=$PWD/%{_lib} \
      -DPYTHON_VERSION_MAJOR=%{py_major} \
      -DPYTHON_VERSION_MINOR=%{py_minor} \
      -G "Ninja" \
      ..
ninja

%install
pushd build
DESTDIR=%{buildroot} ninja install

# Fix the lldb.so link
rm %{buildroot}%{py_sitedir}/lldb/_lldb.so
ln -sf %{_libdir}/liblldb.so.%{version} %{buildroot}%{py_sitedir}/lldb/_lldb.so

# Fix the lib link
rm %{buildroot}%{py_sitedir}/lib
ln -sf %{libdir} %{buildroot}%{py_sitedir}/lib

rm %{buildroot}%{_libdir}/liblldb*.a

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root,-)
%{_libdir}/liblldb.so.*
%{_bindir}/argdumper
%{_bindir}/lldb*
%{py_sitedir}/readline.so
%{py_sitedir}/lib
%{py_sitedir}/lldb

%files devel
%defattr(-,root,root,-)
%{_includedir}/lldb
%{_libdir}/liblldb.so

%changelog
openSUSE Build Service is sponsored by