From bc872c5d156be6d2544e3eae736c100e688a1bb1 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Sat, 17 Aug 2019 14:44:02 +0200 Subject: [PATCH] --- lldb-experimental.spec | 189 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 189 insertions(+) create mode 100644 lldb-experimental.spec diff --git a/lldb-experimental.spec b/lldb-experimental.spec new file mode 100644 index 0000000..3f6f45a --- /dev/null +++ b/lldb-experimental.spec @@ -0,0 +1,189 @@ +%global fast 0 +%global use_jankratochvil_dwz 1 +%global use_jankratochvil_rust 0 +%global pkg_prefix /opt/%{name} +%global _unpackaged_files_terminate_build 0 +# dwz: Couldn't find DIE referenced by DW_OP_GNU_parameter_ref +%global _find_debuginfo_dwz_opts %{nil} +# *** ERROR: ambiguous python shebang in /opt/lldb-experimental/...: #!/usr/bin/env python. Change it to python3 (or python2) explicitly. +%global __brp_mangle_shebangs %{nil} +%if %{fast} +%global debug_package %{nil} +%endif +Name: lldb-experimental +Version: 10.0.0 +Release: 0.20190817snap2%{?dist} +Summary: Next generation high-performance debugger - experimental trunk snapshot +License: NCSA +URL: http://lldb.llvm.org/ +ExclusiveArch: x86_64 +BuildRequires: gcc-c++ git libedit-devel swig libatomic ninja-build libxml2-devel zlib-devel valgrind-devel libpfm-devel epydoc +%if 0%{?rhel:1} && 0%{?rhel} <= 7 +BuildRequires: llvm-toolset-7-cmake devtoolset-8-gcc-c++ python-devel python2-pyyaml +# https://bugzilla.redhat.com/show_bug.cgi?id=1511892 +%global __cmake /opt/rh/llvm-toolset-7/root/usr/bin/cmake3 +%global ninjabuild ninja-build +%else +BuildRequires: cmake z3-devel +BuildRequires: python3-devel python3-pygments python3-pyyaml +# removed in F31+ +#BuildRequires: xar-devel +%global ninjabuild ninja +%endif + +%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. +This package is an experimental trunk snapshot. +%if %{use_jankratochvil_dwz} +This package contains off-trunk DWZ support for Fedora debuginfos such as: + unsupported DW_FORM values: 0x1f20 0x1f21 +%endif +%if %{use_jankratochvil_rust} +This package contains off-trunk Rust support: + https://github.com/rust-lang-nursery/lldb +%endif + +%package devel +Summary: Development header files for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description devel +The package contains header files for %{name}. + +{-L,"-Wl,-rpath,"}%{pkg_prefix}/%{_lib} -I%{pkg_prefix}/include -llldb -lLLVMSupport -ltinfo -pthread + +%ldconfig_scriptlets + +%prep +%setup -q -c -T +git clone --depth 1 --no-tags --single-branch --reference-if-able reference https://github.com/llvm/llvm-project.git . +%if %{use_jankratochvil_dwz} || %{use_jankratochvil_rust} +git remote remove jankratochvil || : +git remote add jankratochvil git://git.jankratochvil.net/lldb +git fetch jankratochvil +git config user.email jankratochvil@copr.fedorainfracloud.org +git config user.name jankratochvil +%endif +%if %{use_jankratochvil_dwz} +git merge jankratochvil/dwz +%endif +%if %{use_jankratochvil_rust} +# '-c merge.renames=false' is F-29+. +# '-c merge.renameLimit=0' has no effect. +git -c merge.renameLimit=1 merge jankratochvil/rust +%endif + +%build +mkdir build-release +cd build-release + +FLAGS="%{optflags}" + +# lldb/scripts/LLDBWrapPython.cpp:23699:70: error: format not a string literal and no format arguments [-Werror=format-security] +FLAGS="$FLAGS -Wno-error=format-security" + +%if (0%{?rhel:1} && 0%{?rhel} <= 7) +. /opt/rh/devtoolset-8/enable +# -gsplit-dwarf: LLVM: internal compiler error: in output_index_string, at dwarf2out.c:21891 +# https://bugzilla.redhat.com/show_bug.cgi?id=1590678 +# Set %%{fast} only after %%debug_package above. +%global fast 1 +%endif +%if %{fast} +FLAGS="$FLAGS -g0" +%else +# -fno-reorder-blocks-and-partition: +# -gsplit-dwarf: Error: can't resolve `.text.unlikely' - `.LVL414' +# https://bugzilla.redhat.com/show_bug.cgi?id=1573647 +FLAGS="$FLAGS -gsplit-dwarf -fno-reorder-blocks-and-partition" +%endif + +CFLAGS="$FLAGS" +CXXFLAGS="$FLAGS" + +# This is default - changing it breaks the testsuite: -DLLVM_LINK_LLVM_DYLIB=OFF +# It does not work: -DDCMAKE_EXECUTABLE_SUFFIX=-experimental +# -fdebug-types-section && -DLLVM_USE_LINKER=gold: +# ../../../../lib64/libclangLex.a(PreprocessingRecord.cpp.o)(.debug_types+0xfe): error: undefined reference to 'clang::SourceRange::getBegin() const' +%cmake ../llvm \ + -GNinja \ + -DCMAKE_INSTALL_PREFIX=%{buildroot}%{pkg_prefix} \ + -DBUILD_SHARED_LIBS=OFF \ +%if %{fast} + -DCMAKE_BUILD_TYPE=Release \ +%else + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ +%endif + -DLLVM_ENABLE_PROJECTS="lldb;clang;lld" \ + -DLLVM_TARGETS_TO_BUILD=X86 \ + -DLLVM_BUILD_TOOLS=OFF \ + -DLLVM_USE_LINKER=gold \ + $(: file INSTALL cannot find build-release/lib/python3.6 ) \ +%if 0%{?__isa_bits} == 64 + -DLLVM_LIBDIR_SUFFIX=64 \ +%else + -DLLVM_LIBDIR_SUFFIX= \ +%endif + -DLLDB_DISABLE_CURSES=OFF \ + -DLLDB_DISABLE_LIBEDIT=OFF \ + -DLLDB_DISABLE_PYTHON=OFF \ + # +%{ninjabuild} -v + +%install +mkdir -p %{buildroot}%{pkg_prefix} +(function revline { + echo "$(cd $1;git rev-parse ${2:-origin/master}) ${2:-$1}" + } + revline . +%if %{use_jankratochvil_dwz} + revline . jankratochvil/dwz +%endif +%if %{use_jankratochvil_rust} + revline . jankratochvil/rust +%endif +) >%{buildroot}%{pkg_prefix}/HEAD +cd build-release +%{ninjabuild} -v install +mkdir -p %{buildroot}%{_bindir} +# lldb-mi +for i in lldb;do + echo >%{buildroot}%{_bindir}/${i}-experimental -e '#! /bin/bash\nexec %{pkg_prefix}/bin/'$i' "$@"' + chmod +x %{buildroot}%{_bindir}/${i}-experimental +done + +# remove static libraries +rm -fv %{buildroot}%{_libdir}/*.a + +### python: fix liblldb.so -> liblldb.so.7 symlink target +(cd %{buildroot}%{pkg_prefix}/%{_lib}/python*/site-packages/lldb/ + ln -vsf "$(dirname $(readlink _lldb.so))/$(readlink $(readlink _lldb.so))" _lldb.so +) + +# FIXME: Port it to Python 3: remove bundled six.py - Python 2<->3 +rm -f %{buildroot}%{pkg_prefix}/%{_lib}/python*/site-packages/six.py* + +%files +%{_bindir}/lldb-experimental +#{_bindir}/lldb-mi-experimental +%{pkg_prefix}/HEAD +%{pkg_prefix}/bin/lldb +%{pkg_prefix}/bin/lldb-server +#{pkg_prefix}/bin/lldb-mi +%{pkg_prefix}/bin/lldb-argdumper +# RHEL-7: File not found by glob: .../lib{lldb,clang,LLVM}*.so.* +%{pkg_prefix}/%{_lib}/libl*.so.* +%{pkg_prefix}/%{_lib}/python* + +%files devel +%{pkg_prefix}/include +%{pkg_prefix}/%{_lib}/lib[^l]*.so.* +%{pkg_prefix}/%{_lib}/*.so +%{pkg_prefix}/%{_lib}/*.a + +%changelog +* Thu Apr 5 2018 Jan Kratochvil - 7.0.0-0.1 +- Initial import for COPR, based on Fedora package 'lldb'. -- 1.8.3.1