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