llvm/lldb.spec

180 lines
5.4 KiB
RPMSpec

#
# spec file for package lldb
#
# Copyright (c) 2016 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/
#
Name: lldb
Version: 3.8.1
Release: 0
%define _sonum 3_8
%define _revsn 273405
Summary: Software debugger built using LLVM libraries
License: NCSA
Group: Development/Tools/Debuggers
Url: http://lldb.llvm.org
Source: http://llvm.org/releases/%{version}/lldb-%{version}.src.tar.xz
# PATCH-FIX-OPENSUSE lldb-cmake.patch -- Let us set LLDB_REVISION and fix ncurses include path.
Patch0: lldb-cmake.patch
# PATCH-FIX-UPSTREAM D15067.id41365.diff -- Patch from upstream review system to fix out of tree build (http://reviews.llvm.org/D15067)
Patch1: D15067.id41365.diff
# PATCH-FIX-OPENSUSE lldb-add-pthread-dl-libs.patch -- Add -lpthread and -ldl options to the end of LDFLAGS to fix linking problems.
Patch2: lldb-add-pthread-dl-libs.patch
BuildRequires: cmake
BuildRequires: fdupes
BuildRequires: ncurses-devel
BuildRequires: ninja
BuildRequires: swig
BuildRequires: cmake(Clang) = %{version}
BuildRequires: cmake(LLVM) = %{version}
BuildRequires: pkgconfig(libedit)
BuildRequires: pkgconfig(libffi)
BuildRequires: pkgconfig(libxml-2.0)
BuildRequires: pkgconfig(python2)
BuildRequires: pkgconfig(zlib)
Requires: python
Requires: python-six
# Avoid multiple provider errors
Requires: liblldb%{_sonum} = %{version}
ExclusiveArch: arm x86_64
%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 -n liblldb%{_sonum}
Summary: LLDB software debugger runtime library
Group: System/Libraries
# Avoid multiple provider errors
Requires: libLLVM%{_sonum} = %{version}
Requires: libclang%{_sonum} = %{version}
%description -n liblldb%{_sonum}
This subpackage contains the main LLDB component.
%package devel
Summary: Development files for LLDB
Group: Development/Languages/Other
Requires: cmake
Requires: liblldb%{_sonum} = %{version}
Requires: ncurses-devel
Requires: swig
Requires: cmake(Clang) = %{version}
Requires: cmake(LLVM) = %{version}
Requires: pkgconfig(libedit)
Requires: pkgconfig(libffi)
Requires: pkgconfig(libxml-2.0)
Requires: pkgconfig(zlib)
%description devel
This package contains the development files for LLDB.
%package -n python-lldb
Summary: Python bindings for liblldb
Group: Development/Languages/Python
Requires: liblldb%{_sonum} = %{version}
Requires: python
%description -n python-lldb
This package contains the Python bindings to clang (C language) frontend for LLVM.
%prep
%setup -q -n %{name}-%{version}.src
%patch0 -p1
%patch1
%patch2 -p1
# Set LLDB revision
sed -i s,LLDB_REVISION,\"%{_revsn}\",g source/lldb.cpp #"
%build
%define __builder ninja
%cmake \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DLLVM_LINK_LLVM_DYLIB:BOOL=ON \
-DBUILD_SHARED_LIBS=OFF \
%if "%{_lib}" == "lib64"
-DLLVM_LIBDIR_SUFFIX=64 \
%endif
-DLLVM_RUNTIME_OUTPUT_INTDIR=$PWD/bin \
-DLLVM_LIBRARY_OUTPUT_INTDIR=$PWD/%{_lib} \
-DPYTHON_VERSION_MAJOR=%{py_major} \
-DPYTHON_VERSION_MINOR=%{py_minor}
%make_jobs
%install
%cmake_install
# Python: fix binary libraries location.
rm %{buildroot}%{python_sitearch}/lldb/_lldb.so
liblldb=$(basename $(readlink -e %{buildroot}%{_libdir}/liblldb.so))
ln -vsf "../../../${liblldb}" %{buildroot}%{python_sitearch}/lldb/_lldb.so
ln -vsf "../../${liblldb}" %{buildroot}%{python_sitearch}/_lldb.so
# Remove bundled six.py.
rm -f %{buildroot}%{python_sitearch}/six.*
# Remove static libraries.
rm %{buildroot}%{_libdir}/liblldb*.a
# Fix duplicated files.
%fdupes %{_includedir}/%{name}/Host/
mkdir -p %{buildroot}%{_libdir}/cmake/lldb/
cp cmake/modules/*.cmake %{buildroot}%{_libdir}/cmake/lldb/
# Make consistent with the rest of the executables
mv %{buildroot}%{_bindir}/lldb-argdumper %{buildroot}%{_bindir}/lldb-argdumper-%{version}
ln -s %{_bindir}/lldb-argdumper-%{version} %{buildroot}%{_bindir}/lldb-argdumper
%post -n liblldb%{_sonum} -p /sbin/ldconfig
%postun -n liblldb%{_sonum} -p /sbin/ldconfig
%files
%defattr(-,root,root,-)
%{_bindir}/lldb
%{_bindir}/lldb-argdumper
%{_bindir}/lldb-mi
%{_bindir}/lldb-server
%{_bindir}/lldb-%{version}
%{_bindir}/lldb-argdumper-%{version}
%{_bindir}/lldb-mi-%{version}
%{_bindir}/lldb-server-%{version}
%files -n python-lldb
%defattr(-,root,root)
%{python_sitearch}/_lldb.so
%{python_sitearch}/lldb/
%{python_sitearch}/readline.so
%files -n liblldb%{_sonum}
%defattr(-,root,root)
%{_libdir}/liblldb.so.*
%files devel
%defattr(-,root,root,-)
%{_libdir}/cmake/lldb/
%{_includedir}/lldb/
%{_libdir}/liblldb.so
%changelog