Merge #234 DRAFT: Add lldb to big-merge

This commit is contained in:
Konrad Kleine 2024-07-03 11:06:19 +00:00
commit 26fc541eba
9 changed files with 177 additions and 62 deletions

View file

@ -5,7 +5,7 @@ SPEC=llvm.spec
BUILDDIR=$(shell pwd)/BUILD BUILDDIR=$(shell pwd)/BUILD
BUILDROOTDIR=$(shell pwd)/BUILD BUILDROOTDIR=$(shell pwd)/BUILD
SOURCEDIR=$(shell pwd) SOURCEDIR=$(shell pwd)
FEDORA_RELEASE=f39 FEDORA_RELEASE=f40
.PHONY: setup .PHONY: setup
setup: setup:
@ -15,6 +15,7 @@ setup:
mkdir -pv $(SOURCEDIR) mkdir -pv $(SOURCEDIR)
YYYYMMDD=$(YYYYMMDD) ./.copr/snapshot-info.sh > $(SOURCEDIR)/version.spec.inc YYYYMMDD=$(YYYYMMDD) ./.copr/snapshot-info.sh > $(SOURCEDIR)/version.spec.inc
spectool -g --define "_sourcedir $(SOURCEDIR)" llvm.spec
.PHONY: local-srpm .PHONY: local-srpm
local-srpm: setup local-srpm: setup
@ -22,7 +23,6 @@ local-srpm: setup
--define "yyyymmdd $(YYYYMMDD)" \ --define "yyyymmdd $(YYYYMMDD)" \
--define "_srcrpmdir $(OUTDIR)" \ --define "_srcrpmdir $(OUTDIR)" \
--define "_sourcedir $(SOURCEDIR)" \ --define "_sourcedir $(SOURCEDIR)" \
--define "_disable_source_fetch 0" \
-bs $(SPEC) -bs $(SPEC)
.PHONY: local-rpm .PHONY: local-rpm
@ -32,8 +32,7 @@ local-rpm: setup
--builddir $(BUILDDIR) \ --builddir $(BUILDDIR) \
--buildrootdir $(BUILDROOTDIR) \ --buildrootdir $(BUILDROOTDIR) \
--define "yyyymmdd $(YYYYMMDD)" \ --define "yyyymmdd $(YYYYMMDD)" \
--define "_disable_source_fetch 0" \ -- $(SPEC) --noclean
-- $(SPEC)
.PHONY: local-clean .PHONY: local-clean
local-clean: local-clean:
@ -55,7 +54,6 @@ local-list-check: setup
--builddir $(BUILDDIR) \ --builddir $(BUILDDIR) \
--buildrootdir $(BUILDROOTDIR) \ --buildrootdir $(BUILDROOTDIR) \
--define "yyyymmdd $(YYYYMMDD)" \ --define "yyyymmdd $(YYYYMMDD)" \
--define "_disable_source_fetch 0" \
-- $(SPEC) -bl -- $(SPEC) -bl
.PHONY: local-prep .PHONY: local-prep
@ -65,7 +63,6 @@ local-prep: setup
--builddir $(BUILDDIR) \ --builddir $(BUILDDIR) \
--buildrootdir $(BUILDROOTDIR) \ --buildrootdir $(BUILDROOTDIR) \
--define "yyyymmdd $(YYYYMMDD)" \ --define "yyyymmdd $(YYYYMMDD)" \
--define "_disable_source_fetch 0" \
-- $(SPEC) -- $(SPEC)

View file

@ -38,7 +38,7 @@ cd llvm
# TODO: Override LIBOMP_INSTALL_LIBDIR, because otherwise the libraries # TODO: Override LIBOMP_INSTALL_LIBDIR, because otherwise the libraries
# are installed to /usr/lib64/$TRIPLE and clang can't find them. # are installed to /usr/lib64/$TRIPLE and clang can't find them.
%cmake -G Ninja \ %cmake -G Ninja \
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lld" \ -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lld;lldb" \
\ \
\ \
-DCLANG_DEFAULT_PIE_ON_LINUX=OFF \ -DCLANG_DEFAULT_PIE_ON_LINUX=OFF \
@ -187,6 +187,15 @@ cd llvm
-DLLVM_COMMON_CMAKE_UTILS=%{install_datadir}/llvm/cmake \ -DLLVM_COMMON_CMAKE_UTILS=%{install_datadir}/llvm/cmake \
\ \
\ \
\
-DLLDB_DISABLE_CURSES:BOOL=OFF \
-DLLDB_DISABLE_LIBEDIT:BOOL=OFF \
-DLLDB_DISABLE_PYTHON:BOOL=OFF \
-DPYTHON_VERSION_MAJOR:STRING=$(%{__python3} -c "import sys; print(sys.version_info.major)") \
-DPYTHON_VERSION_MINOR:STRING=$(%{__python3} -c "import sys; print(sys.version_info.minor)") \
\
\
\
%ifarch x86_64 %ifarch x86_64
-DCMAKE_SHARED_LINKER_FLAGS="$LDFLAGS -Wl,-z,cet-report=error" \ -DCMAKE_SHARED_LINKER_FLAGS="$LDFLAGS -Wl,-z,cet-report=error" \
%endif %endif

View file

@ -189,6 +189,48 @@ export LIT_XFAIL="$LIT_XFAIL;worksharing/for/omp_collapse_one_int.c"
#endregion #endregion
#region LLDB
# The following test is actually reported as lldb-unit :: Expression/./ExpressionTests/ClangHostTest/ComputeClangResourceDirectory
# It is a unit test and therefore must be filtered out using GTEST_FILTER.
# Filtering it out using LIT would mean to use a number that is not future proof:
#filter_out_tests+=("lldb-unit :: Expression/./ExpressionTests/0/47")
# NOTE: Replace slashes with dots and beware that anything behind the "-" will be filtered out.
export GTEST_FILTER="-*ClangHostTest.ComputeClangResourceDirectory*"
# Flaky tests:
filter_out_tests+=("lldb-shell :: SymbolFile/DWARF/x86/dwp-foreign-type-units.cpp")
filter_out_tests+=("lldb-api :: functionalities/data-formatter/data-formatter-stl/libstdcpp/variant/TestDataFormatterLibStdcxxVariant.py")
filter_out_tests+=("lldb-api :: functionalities/fork/concurrent_vfork/TestConcurrentVFork.py")
# TODO(kkleine): I think I saw this test hanging at least once. Comment back in if needed.
#filter_out_tests+=("lldb-api :: commands/process/attach/TestProcessAttach.py")
# Filter out unresolved tests:
filter_out_tests+=("lldb-api :: api/multiple-debuggers/TestMultipleDebuggers.py")
filter_out_tests+=("lldb-api :: commands/expression/multiline-completion/TestMultilineCompletion.py")
filter_out_tests+=("lldb-api :: commands/expression/multiline-navigation/TestMultilineNavigation.py")
filter_out_tests+=("lldb-api :: commands/gui/basic/TestGuiBasic.py")
filter_out_tests+=("lldb-api :: commands/gui/breakpoints/TestGuiBreakpoints.py")
filter_out_tests+=("lldb-api :: commands/gui/spawn-threads/TestGuiSpawnThreads.py")
filter_out_tests+=("lldb-api :: commands/gui/viewlarge/TestGuiViewLarge.py")
filter_out_tests+=("lldb-api :: driver/batch_mode/TestBatchMode.py")
filter_out_tests+=("lldb-api :: driver/job_control/TestJobControl.py")
filter_out_tests+=("lldb-api :: driver/quit_speed/TestQuitWithProcess.py")
filter_out_tests+=("lldb-api :: functionalities/breakpoint/breakpoint_callback_command_source/TestBreakpointCallbackCommandSource.py")
filter_out_tests+=("lldb-api :: functionalities/progress_reporting/TestTrimmedProgressReporting.py")
filter_out_tests+=("lldb-api :: functionalities/rerun_and_expr/TestRerunAndExpr.py")
filter_out_tests+=("lldb-api :: iohandler/autosuggestion/TestAutosuggestion.py")
filter_out_tests+=("lldb-api :: iohandler/completion/TestIOHandlerCompletion.py")
filter_out_tests+=("lldb-api :: iohandler/resize/TestIOHandlerResize.py")
filter_out_tests+=("lldb-api :: iohandler/sigint/TestIOHandlerPythonREPLSigint.py")
filter_out_tests+=("lldb-api :: iohandler/sigint/TestProcessIOHandlerInterrupt.py")
filter_out_tests+=("lldb-api :: iohandler/stdio/TestIOHandlerProcessSTDIO.py")
filter_out_tests+=("lldb-api :: iohandler/unicode/TestUnicode.py")
filter_out_tests+=("lldb-api :: repl/clang/TestClangREPL.py")
filter_out_tests+=("lldb-api :: terminal/TestEditline.py")
filter_out_tests+=("lldb-api :: terminal/TestSTTYBeforeAndAfter.py")
#endregion
# Prepare LIT_FILTER_OUT regex from index bash array # Prepare LIT_FILTER_OUT regex from index bash array
# Join each element with a pipe symbol (regex for "or") # Join each element with a pipe symbol (regex for "or")
filter_out_tests=$(printf "|%s" "${filter_out_tests[@]}") filter_out_tests=$(printf "|%s" "${filter_out_tests[@]}")
@ -204,7 +246,7 @@ export LIT_OPTS="-vv"
export LD_LIBRARY_PATH="%{buildroot}/%{install_libdir}:%{buildroot}/%{_libdir}"; export LD_LIBRARY_PATH="%{buildroot}/%{install_libdir}:%{buildroot}/%{_libdir}";
cd llvm cd llvm
%cmake_build --target check-llvm check-clang check-lld %cmake_build --target check-llvm check-clang check-lld check-lldb
%endif %endif

View file

@ -600,3 +600,20 @@
%{install_libdir}/liblld*.so.* %{install_libdir}/liblld*.so.*
#endregion #endregion
#region LLDB files
%files -n %{pkg_name_lldb}
%license lldb/LICENSE.TXT
%{install_bindir}/lldb*
# Usually, *.so symlinks are kept in devel subpackages. However, the python
# bindings depend on this symlink at runtime.
%{install_libdir}/liblldb*.so
%{install_libdir}/liblldb.so.*
%{install_libdir}/liblldbIntelFeatures.so.*
%files -n %{pkg_name_lldb}-devel
%{install_includedir}/lldb
%files -n python3-lldb
%{python3_sitearch}/lldb
#endregion

View file

@ -154,3 +154,7 @@
%global pkg_name_lld lld %global pkg_name_lld lld
%endif %endif
#endregion #endregion
#region LLDB globals
%global pkg_name_lldb lldb
#endregion

View file

@ -280,3 +280,18 @@ fi
%endif %endif
#endregion #endregion
#region LLDB installation
%multilib_fix_c_header --file %{install_includedir}/lldb/Host/Config.h
# remove static libraries
rm -fv %{buildroot}%{_libdir}/liblldb*.a
# python: fix binary libraries location
liblldb=$(basename $(readlink -e %{buildroot}%{_libdir}/liblldb.so))
ln -vsf "../../../${liblldb}" %{buildroot}%{python3_sitearch}/lldb/_lldb.so
%py_byte_compile %{__python3} %{buildroot}%{python3_sitearch}/lldb
# remove bundled six.py
rm -f %{buildroot}%{python3_sitearch}/six.*
#endregion

View file

@ -45,9 +45,54 @@ BuildRequires: libedit-devel
BuildRequires: python3-devel BuildRequires: python3-devel
BuildRequires: python3-setuptools BuildRequires: python3-setuptools
# For origin certification # For gpg source verification
BuildRequires: gnupg2 BuildRequires: gnupg2
BuildRequires: python3-rpm-macros
BuildRequires: python3-lit
BuildRequires: swig
BuildRequires: libxml2-devel
BuildRequires: doxygen
# For clang-offload-packager
BuildRequires: elfutils-libelf-devel
BuildRequires: perl
BuildRequires: perl-Data-Dumper
BuildRequires: perl-Encode
BuildRequires: libffi-devel
BuildRequires: python3
BuildRequires: perl-generators
# According to https://fedoraproject.org/wiki/Packaging:Emacs a package
# should BuildRequires: emacs if it packages emacs integration files.
BuildRequires: emacs
BuildRequires: libatomic
# scan-build uses these perl modules so they need to be installed in order
# to run the tests.
BuildRequires: perl(Digest::MD5)
BuildRequires: perl(File::Copy)
BuildRequires: perl(File::Find)
BuildRequires: perl(File::Path)
BuildRequires: perl(File::Temp)
BuildRequires: perl(FindBin)
BuildRequires: perl(Hash::Util)
BuildRequires: perl(lib)
BuildRequires: perl(Term::ANSIColor)
BuildRequires: perl(Text::ParseWords)
BuildRequires: perl(Sys::Hostname)
BuildRequires: graphviz
%if %{without compat_build}
# For reproducible pyc file generation
# See https://docs.fedoraproject.org/en-US/packaging-guidelines/Python_Appendix/#_byte_compilation_reproducibility
BuildRequires: /usr/bin/marshalparser
%global py_reproducible_pyc_path %{buildroot}%{python3_sitelib}
%endif
Requires: %{pkg_name_llvm}-libs%{?_isa} = %{version}-%{release} Requires: %{pkg_name_llvm}-libs%{?_isa} = %{version}-%{release}
Provides: llvm(major) = %{maj_ver} Provides: llvm(major) = %{maj_ver}

View file

@ -32,7 +32,6 @@ programs that use the LLVM infrastructure.
%package -n %{pkg_name_llvm}-doc %package -n %{pkg_name_llvm}-doc
Summary: Documentation for LLVM Summary: Documentation for LLVM
BuildArch: noarch BuildArch: noarch
BuildRequires: graphviz
Requires: %{pkg_name_llvm} = %{version}-%{release} Requires: %{pkg_name_llvm} = %{version}-%{release}
%description -n %{pkg_name_llvm}-doc %description -n %{pkg_name_llvm}-doc
@ -95,36 +94,6 @@ Statistics for the RPM build. Only available in snapshot builds.
%package -n %{pkg_name_clang} %package -n %{pkg_name_clang}
Summary: A C language family front-end for LLVM Summary: A C language family front-end for LLVM
BuildRequires: libxml2-devel
BuildRequires: perl-generators
# According to https://fedoraproject.org/wiki/Packaging:Emacs a package
# should BuildRequires: emacs if it packages emacs integration files.
BuildRequires: emacs
BuildRequires: libatomic
%if %{without compat_build}
# For reproducible pyc file generation
# See https://docs.fedoraproject.org/en-US/packaging-guidelines/Python_Appendix/#_byte_compilation_reproducibility
BuildRequires: /usr/bin/marshalparser
%global py_reproducible_pyc_path %{buildroot}%{python3_sitelib}
%endif
# scan-build uses these perl modules so they need to be installed in order
# to run the tests.
BuildRequires: perl(Digest::MD5)
BuildRequires: perl(File::Copy)
BuildRequires: perl(File::Find)
BuildRequires: perl(File::Path)
BuildRequires: perl(File::Temp)
BuildRequires: perl(FindBin)
BuildRequires: perl(Hash::Util)
BuildRequires: perl(lib)
BuildRequires: perl(Term::ANSIColor)
BuildRequires: perl(Text::ParseWords)
BuildRequires: perl(Sys::Hostname)
Requires: %{pkg_name_clang}-libs%{?_isa} = %{version}-%{release} Requires: %{pkg_name_clang}-libs%{?_isa} = %{version}-%{release}
# clang requires gcc, clang++ requires libstdc++-devel # clang requires gcc, clang++ requires libstdc++-devel
@ -246,8 +215,6 @@ Summary: LLVM "compiler-rt" runtime libraries
License: Apache-2.0 WITH LLVM-exception OR NCSA OR MIT License: Apache-2.0 WITH LLVM-exception OR NCSA OR MIT
BuildRequires: python3
Requires: clang-resource-filesystem%{?isa} = %{version} Requires: clang-resource-filesystem%{?isa} = %{version}
%description -n %{pkg_name_compiler_rt} %description -n %{pkg_name_compiler_rt}
@ -269,13 +236,6 @@ Summary: OpenMP runtime for clang
URL: http://openmp.llvm.org URL: http://openmp.llvm.org
# For clang-offload-packager
BuildRequires: elfutils-libelf-devel
BuildRequires: perl
BuildRequires: perl-Data-Dumper
BuildRequires: perl-Encode
BuildRequires: libffi-devel
Requires: elfutils-libelf%{?isa} Requires: elfutils-libelf%{?isa}
%description -n %{pkg_name_libomp} %description -n %{pkg_name_libomp}
@ -302,19 +262,6 @@ URL: http://openmp.llvm.org
%package -n %{pkg_name_lld} %package -n %{pkg_name_lld}
Summary: The LLVM Linker Summary: The LLVM Linker
BuildRequires: clang
BuildRequires: cmake
BuildRequires: ninja-build
BuildRequires: ncurses-devel
BuildRequires: zlib-devel
# For make check:
BuildRequires: python3-rpm-macros
BuildRequires: python3-lit
# For gpg source verification
BuildRequires: gnupg2
Requires(post): %{_sbindir}/update-alternatives Requires(post): %{_sbindir}/update-alternatives
Requires(preun): %{_sbindir}/update-alternatives Requires(preun): %{_sbindir}/update-alternatives
@ -344,3 +291,37 @@ Summary: LLD shared libraries
Shared libraries for LLD. Shared libraries for LLD.
#endregion #endregion
#region LLDB packages
%package -n %{pkg_name_lldb}
Summary: Next generation high-performance debugger
License: Apache-2.0 WITH LLVM-exception OR NCSA
URL: http://lldb.llvm.org/
Requires: python3-lldb
%description -n %{pkg_name_lldb}
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 %{pkg_name_lldb}-devel
Summary: Development header files for LLDB
Requires: %{pkg_name_lldb}%{?_isa} = %{version}-%{release}
%description -n %{pkg_name_lldb}-devel
The package contains header files for the LLDB debugger.
%package -n python3-lldb
%{?python_provide:%python_provide python3-lldb}
Summary: Python module for LLDB
Requires: python3-six
Requires: %{pkg_name_lldb}%{?_isa} = %{version}-%{release}
%description -n python3-lldb
The package contains the LLDB Python module.
#endregion

View file

@ -56,3 +56,8 @@
%endif %endif
#endregion #endregion
#region LLDB preparation
# Empty lldb/docs/CMakeLists.txt because we cannot build it
echo "" > lldb/docs/CMakeLists.txt
#endregion