(no commit message)
[lldb-experimental.git] / lldb-experimental.spec
1 # https://download.copr.fedorainfracloud.org/results/jankratochvil/lldb/fedora-rawhide-x86_64/01574351-lldb-experimental/builder-live.log.gz
2 # No space left on device.
3 %global fast 1
4 %global use_jankratochvil_dwz 1
5 %global use_jankratochvil_rust 0
6 %global pkg_prefix /opt/%{name}
7 %global _unpackaged_files_terminate_build 0
8 # dwz: Couldn't find DIE referenced by DW_OP_GNU_parameter_ref
9 %global _find_debuginfo_dwz_opts %{nil}
10 # *** ERROR: ambiguous python shebang in /opt/lldb-experimental/...: #!/usr/bin/env python. Change it to python3 (or python2) explicitly.
11 %global __brp_mangle_shebangs %{nil}
12 %if %{fast}
13 %global debug_package %{nil}
14 %endif
15 Name: lldb-experimental
16 Version: 12.0.0
17 Release: 0.20200805snap1%{?dist}
18 Summary: Next generation high-performance debugger - experimental trunk snapshot
19 License: NCSA
20 URL: http://lldb.llvm.org/
21 ExclusiveArch: x86_64
22 BuildRequires: gcc-c++ git libedit-devel libatomic libxml2-devel zlib-devel valgrind-devel libpfm-devel
23 # https://src.fedoraproject.org/rpms/epydoc
24 #BuildRequires: epydoc
25 %if 0%{?rhel:1} && 0%{?rhel} <= 7
26 BuildRequires: devtoolset-8-gcc-c++
27 # swig on rhel7: /builddir/build/BUILD/lldb-experimental-11.0.0/lldb/bindings/./python/python-typemaps.swig:496: Error: Syntax error in input(3).
28 BuildRequires: swig3
29 BuildRequires: rh-git218-git-core
30 BuildRequires: rh-python38-python-devel rh-python38-python-pyyaml
31 # https://bugzilla.redhat.com/show_bug.cgi?id=1511892
32 BuildRequires: cmake3
33 %global cmake %{cmake3}
34 %global cmake_build %{cmake3_build}
35 %global cmake_install %{cmake3_install}
36 %else
37 # FIXME: CentOS-8:
38 # CMake Error at CMakeLists.txt:3 (cmake_minimum_required):
39 #   CMake 3.13.4 or higher is required.  You are running version 3.11.4
40 BuildRequires: cmake swig
41 BuildRequires: python3-devel python3-pygments python3-pyyaml
42 # removed in F31+
43 #BuildRequires: xar-devel
44 %if !0%{?rhel:1} || 0%{?rhel} > 8
45 BuildRequires: z3-devel
46 %endif
47 %endif
48
49 %description
50 LLDB is a next generation, high-performance debugger. It is built as a set
51 of reusable components which highly leverage existing libraries in the
52 larger LLVM Project, such as the Clang expression parser and LLVM
53 disassembler.
54 This package is an experimental trunk snapshot.
55 %if %{use_jankratochvil_dwz}
56 This package contains off-trunk DWZ support for Fedora debuginfos such as:
57   unsupported DW_FORM values: 0x1f20 0x1f21
58 %endif
59 %if %{use_jankratochvil_rust}
60 This package contains off-trunk Rust support:
61   https://github.com/rust-lang-nursery/lldb
62 %endif
63
64 %package devel
65 Summary: Development header files for %{name}
66 Requires: %{name}%{?_isa} = %{version}-%{release}
67
68 %description devel
69 The package contains header files for %{name}.
70
71 {-L,"-Wl,-rpath,"}%{pkg_prefix}/%{_lib} -I%{pkg_prefix}/include -llldb -lLLVMSupport -ltinfo -pthread
72
73 %ldconfig_scriptlets
74
75 %prep
76 %if 0%{?rhel:1} && 0%{?rhel} <= 7
77 # git clone --depth 10000 --single-branch --reference ../reference https://github.com/llvm/llvm-project.git .
78 # fatal: git fetch-pack: expected shallow list
79 . /opt/rh/rh-git218/enable
80 # CMake Warning at ../lldb/cmake/modules/FindPythonInterpAndLibs.cmake:10 (find_package):
81 #   By not providing "FindPython3.cmake" in CMAKE_MODULE_PATH this project has
82 #   asked CMake to find a package configuration file provided by "Python3", but
83 #   CMake did not find one.
84 #   Could not find a package configuration file provided by "Python3" with any
85 #   of the following names:
86 #     Python3Config.cmake
87 #     python3-config.cmake
88 #   Add the installation prefix of "Python3" to CMAKE_PREFIX_PATH or set
89 #   "Python3_DIR" to a directory containing one of the above files.  If
90 #   "Python3" provides a separate development package or SDK, be sure it has
91 #   been installed.
92 # Call Stack (most recent call first):
93 #   ../lldb/cmake/modules/FindPythonInterpAndLibs.cmake:71 (FindPython3)
94 #   ../lldb/cmake/modules/LLDBConfig.cmake:48 (find_package)
95 #   ../lldb/cmake/modules/LLDBConfig.cmake:59 (add_optional_dependency)
96 #   ../lldb/CMakeLists.txt:28 (include)
97 . /opt/rh/rh-python38/enable
98 %endif
99 %setup -q -c -T
100 OPTS="--depth 10000"
101 %if !0%{?rhel:1} || 0%{?rhel} > 7
102   OPTS="$OPTS --no-tags"
103 %endif
104 REF="reference"
105 # RHEL-7 does not support: --reference-if-able
106 CLONEOPTS="--single-branch"
107 test -d ../$REF/ && CLONEOPTS="$CLONEOPTS --reference ../$REF"
108 # 2500 = 1 month in 2019
109 git clone $OPTS $CLONEOPTS https://github.com/llvm/llvm-project.git .
110 %if %{use_jankratochvil_dwz} || %{use_jankratochvil_rust}
111 git remote remove jankratochvil || :
112 #git remote add jankratochvil git://git.jankratochvil.net/lldb
113 git remote add jankratochvil https://github.com/jankratochvil/llvm-project.git
114 git fetch $OPTS jankratochvil
115 git config user.email jankratochvil@copr.fedorainfracloud.org
116 git config user.name jankratochvil
117 %endif
118 %if %{use_jankratochvil_dwz}
119 git merge jankratochvil/dwz
120 %endif
121 %if %{use_jankratochvil_rust}
122 # '-c merge.renames=false' is F-29+.
123 # '-c merge.renameLimit=0' has no effect.
124 git -c merge.renameLimit=1 merge jankratochvil/rust
125 %endif
126
127 %build
128 FLAGS="%{optflags}"
129
130 # lldb/scripts/LLDBWrapPython.cpp:23699:70: error: format not a string literal and no format arguments [-Werror=format-security]
131 FLAGS="$FLAGS -Wno-error=format-security"
132
133 %if (0%{?rhel:1} && 0%{?rhel} <= 7)
134 . /opt/rh/devtoolset-8/enable
135 # -gsplit-dwarf: LLVM: internal compiler error: in output_index_string, at dwarf2out.c:21891
136 # https://bugzilla.redhat.com/show_bug.cgi?id=1590678
137 # Set %%{fast} only after %%debug_package above.
138 %global fast 1
139 %endif
140 %if %{fast}
141 FLAGS="$FLAGS -g0"
142 %else
143 # -fno-reorder-blocks-and-partition:
144 # -gsplit-dwarf: Error: can't resolve `.text.unlikely' - `.LVL414'
145 # https://bugzilla.redhat.com/show_bug.cgi?id=1573647
146 FLAGS="$FLAGS -fdebug-types-section"
147 %endif
148
149 CFLAGS="$FLAGS"
150 CXXFLAGS="$FLAGS"
151
152 # This is default - changing it breaks the testsuite: -DLLVM_LINK_LLVM_DYLIB=OFF
153 # It does not work: -DDCMAKE_EXECUTABLE_SUFFIX=-experimental
154 # -fdebug-types-section && -DLLVM_USE_LINKER=gold:
155 # ../../../../lib64/libclangLex.a(PreprocessingRecord.cpp.o)(.debug_types+0xfe): error: undefined reference to 'clang::SourceRange::getBegin() const'
156 %cmake llvm \
157   -DCMAKE_INSTALL_PREFIX=%{pkg_prefix} \
158   -DBUILD_SHARED_LIBS=OFF \
159 %if %{fast}
160   -DCMAKE_BUILD_TYPE=Release \
161 %else
162   -DCMAKE_BUILD_TYPE=RelWithDebInfo \
163 %endif
164   -DLLVM_ENABLE_PROJECTS="lldb;clang;lld" \
165   -DLLVM_TARGETS_TO_BUILD=X86 \
166   -DLLVM_BUILD_TOOLS=OFF \
167   -DLLVM_USE_LINKER=gold \
168   $(: file INSTALL cannot find build-release/lib/python3.6 ) \
169 %if 0%{?__isa_bits} == 64
170   -DLLVM_LIBDIR_SUFFIX=64 \
171 %else
172   -DLLVM_LIBDIR_SUFFIX= \
173 %endif
174   -DLLDB_DISABLE_CURSES=OFF \
175   -DLLDB_DISABLE_LIBEDIT=OFF \
176   -DLLDB_DISABLE_PYTHON=OFF \
177   #
178 %cmake_build
179
180 %install
181 mkdir -p %{buildroot}%{pkg_prefix}
182 (function revline {
183    echo "$(cd $1;git rev-parse ${2:-origin/master}) ${2:-$1}"
184  }
185  revline .
186 %if %{use_jankratochvil_dwz}
187  revline . jankratochvil/dwz
188 %endif
189 %if %{use_jankratochvil_rust}
190  revline . jankratochvil/rust
191 %endif
192 ) >%{buildroot}%{pkg_prefix}/HEAD
193 %cmake_install
194 mkdir -p %{buildroot}%{_bindir}
195 # lldb-mi
196 for i in lldb;do
197   echo >%{buildroot}%{_bindir}/${i}-experimental -e '#! /bin/bash\nexec %{pkg_prefix}/bin/'$i' "$@"'
198   chmod +x %{buildroot}%{_bindir}/${i}-experimental
199 done
200
201 # remove static libraries
202 rm -fv %{buildroot}%{_libdir}/*.a
203
204 ### python: fix liblldb.so -> liblldb.so.7 symlink target
205 (cd %{buildroot}%{pkg_prefix}/%{_lib}/python*/site-packages/lldb/
206  ln -vsf "$(dirname $(readlink _lldb.so))/$(readlink $(readlink _lldb.so))" _lldb.so
207 )
208
209 %files
210 %{_bindir}/lldb-experimental
211 #{_bindir}/lldb-mi-experimental
212 %{pkg_prefix}/HEAD
213 %{pkg_prefix}/bin/lldb
214 %{pkg_prefix}/bin/lldb-server
215 #{pkg_prefix}/bin/lldb-mi
216 %{pkg_prefix}/bin/lldb-argdumper
217 # RHEL-7: File not found by glob: .../lib{lldb,clang,LLVM}*.so.*
218 %{pkg_prefix}/%{_lib}/libl*.so.*
219 %{pkg_prefix}/%{_lib}/python*
220
221 %files devel
222 %{pkg_prefix}/include
223 %{pkg_prefix}/%{_lib}/lib[^l]*.so.*
224 %{pkg_prefix}/%{_lib}/*.so
225 %{pkg_prefix}/%{_lib}/*.a
226
227 %changelog
228 * Thu Apr  5 2018 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.0.0-0.1
229 - Initial import for COPR, based on Fedora package 'lldb'.