3 # polly & lldb aren't enabled for every platform
4 PROJECTS
= clang
;clang-tools-extra
;lld
;cross-project-tests
;mlir
5 # openmp & libunwind aren't enabled for every platform
6 RUNTIMES
= compiler-rt
;libcxx
;libcxxabi
8 TARGET_BUILD
:= build-llvm
9 TARGET_BUILD_STAGE2
:= $(TARGET_BUILD
)/tools
/clang
/stage2-bins
10 DEB_INST
:= $(CURDIR
)/debian
/tmp
/
12 GXX_VERSIONED_PACKAGE
:= $(shell dpkg-query
-W
-f
'$${Depends}' g
++ | grep
-o
'g++-[0-9][0-9.]*' | tail
-n1
)
13 GXX_VERSIONED_EXECUTABLE
:= $(shell dpkg
-L
$(GXX_VERSIONED_PACKAGE
) | grep
'/usr/bin/g++-[0-9][0-9.]*' | xargs ls
-d | tail
-n1
)
14 GCC_VERSION
:= $(subst /usr
/bin
/g
++-,,$(GXX_VERSIONED_EXECUTABLE
))
16 LLVM_VERSION
:= $(shell dpkg-parsechangelog | sed
-rne
"s,^Version: 1:([0-9]+).*,\1,p")
17 LLVM_VERSION_FULL
:= $(shell dpkg-parsechangelog | sed
-rne
"s,^Version: 1:([0-9.]+)(~|-)(.*),\1,p")
18 LLVM_VERSION_SNAPSHOT
:= $(shell dpkg-parsechangelog | sed
-rne
"s,^Version: 1:(.*),\1,p")
19 ifeq ($(LLVM_VERSION
),$(LLVM_VERSION_FULL
))
20 LLVM_VERSION_FULL
:= $(LLVM_VERSION
).0.0
24 # clang soname has started with llvm-toolchain-13.
25 # it is normal that 13 is what is seen in 14 or later version as
26 # it is bumped only with abi changes
29 # Manage the case when the version is 3.5~svn213052-1~exp1 or 3.4.2-1
30 DEBIAN_REVISION
:= $(shell dpkg-parsechangelog | sed
-rne
"s,^Version: 1:([0-9.]+)(~|-)(.*),\3,p")
31 ifneq (,$(filter parallel
=%,$(subst $(COMMA
), ,$(DEB_BUILD_OPTIONS
))))
32 NJOBS
:= -j
$(subst parallel
=,,$(filter parallel
=%,$(subst $(COMMA
), ,$(DEB_BUILD_OPTIONS
))))
34 NJOBS
:= -j
$(shell nproc
)
37 VENDOR
=$(shell lsb_release
-is
)
38 DISTRO
=$(shell lsb_release
-sc
)
40 DH_VERSION
:= $(shell dpkg
-s debhelper | grep
'^Version' | awk
'{print $$2}')
42 include /usr
/share
/dpkg
/architecture.mk
46 # dpkg-buildflags support
47 # disable fixfilepath in favor of the llvm-project supplied flavor, disable lto
48 export DEB_BUILD_MAINT_OPTIONS
= reproducible
=-fixfilepath
,-fixdebugpath optimize
=-lto
49 # these are handled on a per stage / build basis
50 export DEB_CFLAGS_MAINT_STRIP
= -g
-O2
51 export DEB_CXXFLAGS_MAINT_STRIP
= -g
-O2
53 include /usr
/share
/dpkg
/buildflags.mk
55 # We use a stage2 build. It means that a first clang is built using gcc,
56 # a second clang is built with the first
57 # And the various compoments are built using the second clang.
58 # See https://llvm.org/docs/AdvancedBuilds.html
60 # collect additional flags for all stages all builds
61 CFLAGS_EXTRA
= -Wno-unused-command-line-argument
62 CXXFLAGS_EXTRA
= -Wno-unused-command-line-argument
63 LDFLAGS_EXTRA
= -Wl
,--build-id
65 # collect all flags for stage 1 toolchain build only
66 STAGE_1_CFLAGS
= $(CFLAGS
) $(CFLAGS_EXTRA
) $(CPPFLAGS
)
67 STAGE_1_CXXFLAGS
= $(CXXFLAGS
) $(CXXFLAGS_EXTRA
) $(CPPFLAGS
)
68 STAGE_1_LDFLAGS
= $(LDFLAGS
) $(LDFLAGS_EXTRA
)
70 # collect all flags for stage 2 toolchain and stand-alone builds
71 STAGE_2_CFLAGS
= $(CFLAGS
) $(CFLAGS_EXTRA
) $(CPPFLAGS
)
72 STAGE_2_CXXFLAGS
= $(CXXFLAGS
) $(CXXFLAGS_EXTRA
) $(CPPFLAGS
)
73 STAGE_2_LDFLAGS
= $(LDFLAGS
) $(LDFLAGS_EXTRA
)
75 # collect additional cmake options for toolchain build configuration
78 STAGE_ALL_CMAKE_EXTRA
=
79 # toolchain config-only var combining all stage 1 cmake options
80 CMAKE_EXTRA
= $(STAGE_1_CMAKE_EXTRA
) $(STAGE_ALL_CMAKE_EXTRA
)
81 # toolchain config-only var prepending BOOTSTRAP_ to all stage 2 cmake options
82 BOOTSTRAP_CMAKE_EXTRA
= $(foreach extra
,$(STAGE_2_CMAKE_EXTRA
) $(STAGE_ALL_CMAKE_EXTRA
), $(subst -D
,-DBOOTSTRAP_
,$(extra
)))
84 BASE_PATH
:= $(CURDIR
)
85 STAGE_1_BIN_DIR
:= $(BASE_PATH
)/$(TARGET_BUILD
)/bin
86 STAGE_1_LIB_DIR
:= $(BASE_PATH
)/$(TARGET_BUILD
)/lib
87 STAGE_2_BIN_DIR
:= $(BASE_PATH
)/$(TARGET_BUILD_STAGE2
)/bin
88 STAGE_2_LIB_DIR
:= $(BASE_PATH
)/$(TARGET_BUILD_STAGE2
)/lib
91 COMPILER_RT_USE_BUILTINS_LIBRARY
:= ON
92 LIBCXX_EXCEPTIONS
:= ON
93 LIBCXX_USE_COMPILER_RT
:= ON
95 ifneq (,$(filter $(DEB_HOST_ARCH
),sparc sparc64
))
96 STAGE_1_CMAKE_EXTRA
+= -DLLVM_PARALLEL_LINK_JOBS
=4
99 ifneq (,$(filter $(DEB_HOST_ARCH
),i386 hurd-i386 kfreebsd-i386 armel mipsel powerpc powerpcspe riscv64
))
100 # For some reason, in the stage2 build, when clang is used to compile
101 # itself. The atomic detection is failing on armel and riscv64. Forcing the inclusion
102 # everywhere and in all stages
103 LDFLAGS_EXTRA
+= -latomic
106 ifeq ($(shell dpkg
--compare-versions
$(shell dpkg-query
-W
-f
'$${Version}' g
++-$(GCC_VERSION
)) lt
4.9-20140411-1~
; echo
$$?
),0)
107 # Too old version of gcc. Force 4.9
111 Z3_FLAG
= -DLLVM_ENABLE_Z3_SOLVER
=OFF
112 ifeq ($(shell dpkg
--compare-versions
$(shell dpkg-query
-W
-f
'$${Version}' libz3-dev
) gt
4.7.0; echo
$$?
),0)
113 # no ocaml support in main for Ubuntu
114 ifneq ($(shell dpkg-vendor
--derives-from Ubuntu
&& echo yes
),yes
)
115 Z3_FLAG
= -DLLVM_ENABLE_Z3_SOLVER
=ON
118 STAGE_2_CMAKE_EXTRA
+= $(Z3_FLAG
)
120 # Change the default CPU for s390x
122 ifeq ($(shell dpkg-vendor
--derives-from Ubuntu
&& echo yes
),yes
)
125 STAGE_2_CMAKE_EXTRA
+= -DCLANG_SYSTEMZ_DEFAULT_ARCH
=$(ZARCH
)
127 # clangd remote index support requires GRPC & protobuf.
128 # Enable if minimum tested versions are available.
129 CLANGD_GRPC_INSTALLED
=no
130 ifeq ($(shell dpkg
--compare-versions
$(shell dpkg-query
-W
-f
'$${Version}' libgrpc
++-dev
) gt
1.30.0; echo
$$?
),0)
131 ifeq ($(shell dpkg
--compare-versions
$(shell dpkg-query
-W
-f
'$${Version}' protobuf-compiler-grpc
) gt
1.30.0; echo
$$?
),0)
132 ifeq ($(shell dpkg
--compare-versions
$(shell dpkg-query
-W
-f
'$${Version}' libprotobuf-dev
) gt
3.12.0; echo
$$?
),0)
133 ifeq ($(shell dpkg
--compare-versions
$(shell dpkg-query
-W
-f
'$${Version}' protobuf-compiler
) gt
3.12.0; echo
$$?
),0)
134 CLANGD_GRPC_INSTALLED
=yes
135 STAGE_2_CMAKE_EXTRA
+= -DCLANGD_ENABLE_REMOTE
=ON
141 export CC
=gcc-
$(GCC_VERSION
)
142 export CXX
=g
++-$(GCC_VERSION
)
144 opt_flags
= -O2
-DNDEBUG
-g1
146 ifneq (,$(findstring $(DEB_HOST_ARCH
),armel
))
147 STAGE_ALL_CMAKE_EXTRA
+= -DLLVM_HOST_TRIPLE
=arm-linux-gnueabi
148 STAGE_ALL_CMAKE_EXTRA
+= -DCOMPILER_RT_DEFAULT_TARGET_ONLY
=ON
149 # align arch profile with debian baseline
150 # https://wiki.debian.org/ArmEabiPort
151 CFLAGS_EXTRA
+= -march
=armv5t
152 CXXFLAGS_EXTRA
+= -march
=armv5t
153 # disable compiler-rt builtins (not supported for baseline armel arch: armv5t)
154 # See http://lists.llvm.org/pipermail/llvm-dev/2016-May/099761.html
155 STAGE_ALL_CMAKE_EXTRA
+= -DCOMPILER_RT_BUILD_BUILTINS
=OFF
156 COMPILER_RT_USE_BUILTINS_LIBRARY
:= OFF
157 LIBCXX_USE_COMPILER_RT
:= OFF
158 # disable scudo standalone (not supported for baseline armel arch: armv5t)
159 STAGE_ALL_CMAKE_EXTRA
+= -DCOMPILER_RT_BUILD_SCUDO_STANDALONE
=OFF
162 ifneq (,$(findstring $(DEB_HOST_ARCH
),armhf
))
163 STAGE_ALL_CMAKE_EXTRA
+= -DLLVM_HOST_TRIPLE
=arm-linux-gnueabihf
164 STAGE_ALL_CMAKE_EXTRA
+= -DCOMPILER_RT_DEFAULT_TARGET_ONLY
=ON
165 # align arch profile with debian baseline
166 # https://wiki.debian.org/ArmHardFloatPort#Minimum_CPU_.26_FPU
167 CFLAGS_EXTRA
+= -march
=armv7-a
-mfpu
=vfpv3-d16
168 CXXFLAGS_EXTRA
+= -march
=armv7-a
-mfpu
=vfpv3-d16
171 ifneq (,$(filter $(DEB_HOST_ARCH
),i386
))
172 # Sometimes, i386 needs help with the triple
173 STAGE_ALL_CMAKE_EXTRA
+= -DLLVM_HOST_TRIPLE
=i386-linux-gnu
176 ifneq (,$(filter $(DEB_HOST_ARCH
),i386
))
177 # Sometimes, i386 needs help with the triple
178 CMAKE_EXTRA
+= -DLLVM_HOST_TRIPLE
=i386-linux-gnu
183 ifneq (,$(filter $(DEB_HOST_ARCH
),mips64el
))
184 # avoid an issue with search path on mips64el
185 # https://bugs.llvm.org/show_bug.cgi?id=41204
186 STAGE_ALL_CMAKE_EXTRA
+= -DLLVM_HOST_TRIPLE
=mips64el-linux-gnuabi64
189 ifneq (,$(filter $(DEB_HOST_ARCH
),powerpc
))
190 STAGE_ALL_CMAKE_EXTRA
+= -DLLVM_HOST_TRIPLE
=powerpc-linux-gnu
191 STAGE_ALL_CMAKE_EXTRA
+= -DCOMPILER_RT_DEFAULT_TARGET_ONLY
=ON
194 ifneq (,$(filter $(DEB_HOST_ARCH
),s390x
))
195 STAGE_ALL_CMAKE_EXTRA
+= -DLLVM_HOST_TRIPLE
=s390x-linux-gnu
196 STAGE_ALL_CMAKE_EXTRA
+= -DCOMPILER_RT_DEFAULT_TARGET_ONLY
=ON
197 LIBCXX_EXCEPTIONS
:= OFF
198 # disable compiler-rt builtins (not supported for s390x)
199 STAGE_ALL_CMAKE_EXTRA
+= -DCOMPILER_RT_BUILD_BUILTINS
=OFF
200 COMPILER_RT_USE_BUILTINS_LIBRARY
:= OFF
201 LIBCXX_USE_COMPILER_RT
:= OFF
204 ifneq (,$(filter $(DEB_HOST_ARCH
),x32
))
205 STAGE_ALL_CMAKE_EXTRA
+= -DLLVM_HOST_TRIPLE
=x86_64-linux-gnux32
206 STAGE_ALL_CMAKE_EXTRA
+= -DLLVM_DEFAULT_TARGET_TRIPLE
=x86_64-linux-gnux32
207 STAGE_ALL_CMAKE_EXTRA
+= -DCOMPILER_RT_BUILD_BUILTINS
=OFF
208 COMPILER_RT_USE_BUILTINS_LIBRARY
:= OFF
209 LIBCXX_USE_COMPILER_RT
:= OFF
212 ifneq (,$(filter $(DEB_HOST_ARCH
),hurd-i386
))
213 STAGE_ALL_CMAKE_EXTRA
+= -DCOMPILER_RT_DEFAULT_TARGET_ONLY
=ON
216 ifeq ($(shell dpkg
--compare-versions
$(shell dpkg-query
-W
-f
'$${Version}' g
++-$(GCC_VERSION
)) ge
4.8-20121128-1~
; echo
$$?
),0)
217 control_vars
= '-Vdep:devlibs=libstdc++-$(GCC_VERSION)-dev, libgcc-$(GCC_VERSION)-dev' \
218 '-Vdep:devlibs-objc=libobjc-$(GCC_VERSION)-dev'
219 else ifeq ($(shell dpkg
--compare-versions
$(shell dpkg-query
-W
-f
'$${Version}' g
++-$(GCC_VERSION
)) ge
4.7.2-10~
; echo
$$?
),0)
220 control_vars
= '-Vdep:devlibs=libstdc++6-$(GCC_VERSION)-dev, libgcc-$(GCC_VERSION)-dev' \
221 '-Vdep:devlibs-objc=libobjc-$(GCC_VERSION)-dev'
223 control_vars
= '-Vdep:devlibs=libstdc++6-$(GCC_VERSION)-dev'
226 ifeq ($(shell command
-v llvm-spirv
),)
227 LLVM_SPIRV_INSTALLED
= no
229 ifeq ($(shell dpkg
--compare-versions
$(shell dpkg-query
-W
-f
'$${Version}' llvm-spirv
) gt
10.0.0 ; echo
$$?
),0)
230 # Too old llvm-spirv version are failing. See #52200
231 LLVM_SPIRV_INSTALLED
= yes
233 LLVM_SPIRV_INSTALLED
= no
237 LIBCLC_TARGETS_TO_BUILD
="amdgcn--;amdgcn--amdhsa;amdgcn-mesa-mesa3d;r600--;nvptx--;nvptx64--;nvptx--nvidiacl;nvptx64--nvidiacl"
238 ifeq ($(LLVM_SPIRV_INSTALLED
),yes
)
239 LIBCLC_TARGETS_TO_BUILD
:= $(LIBCLC_TARGETS_TO_BUILD
)";spirv-mesa3d-;spirv64-mesa3d-"
242 BINUTILS_GOLD_ARCHS
:= amd64 arm64 armhf i386 ppc64 ppc64el x32 s390x hurd-i386 kfreebsd-amd64 kfreebsd-i386
243 ifeq ($(shell dpkg
--compare-versions
$(shell dpkg-query
-W
-f
'$${Version}' binutils
) ge
2.23.1-1~exp3
; echo
$$?
),0)
244 ifneq (,$(filter $(DEB_HOST_ARCH
),$(BINUTILS_GOLD_ARCHS
)))
245 STAGE_ALL_CMAKE_EXTRA
+= -DLLVM_USE_LINKER
=gold
246 STAGE_ALL_CMAKE_EXTRA
+= -DLLVM_BINUTILS_INCDIR
=/usr
/include/
251 ifneq (,$(filter codecoverage
,$(DEB_BUILD_OPTIONS
)))
252 # enable the code coverage
254 # for -fvisibility-inlines-hidden see http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20130729/183016.html
255 CXXFLAGS_EXTRA
+= -fprofile-arcs
-ftest-coverage
256 LDFLAGS_EXTRA
+= -coverage
-lgcov
258 # OpenMP doesn't respect LDFLAGS
259 STAGE_2_CMAKE_EXTRA
+= -DLIBOMP_LDFLAGS
="-coverage -lgcov" # don't pass LDFLAGS_EXTRA because it expects gcc arg
262 # Enable polly (or not)
264 ifneq (,$(filter $(DEB_HOST_ARCH
), powerpc powerpcspe
))
270 # Enable libunwind (or not)
272 ifneq (,$(filter $(DEB_HOST_ARCH
), s390x armel m68k mipsel hurd-i386 powerpc sparc sparc64 x32
))
274 # do not use compiler-rt builtins for libcxx (libcxxabi) when libunwind is
275 # disabled since the gnu implementation in libgcc_s will then be required
276 LIBCXX_USE_COMPILER_RT
:= OFF
278 RUNTIMES
+= ;libunwind
279 STAGE_ALL_CMAKE_EXTRA
+= -DLIBCXXABI_USE_LLVM_UNWINDER
=ON
282 # Enable openmp (or not)
284 ifneq (,$(filter $(DEB_HOST_ARCH
), m68k mipsel powerpc powerpcspe sparc64 s390x x32
))
288 STAGE_ALL_CMAKE_EXTRA
+= -DLIBOMP_LIBFLAGS
="-lm"
289 ifeq ($(LIBUNWIND_ENABLE
),yes
)
290 STAGE_ALL_CMAKE_EXTRA
+= -DOPENMP_USE_LLVM_UNWINDER
=ON
294 COMPILER_RT_WASM_ENABLE
=yes
296 ifneq (,$(filter $(DEB_HOST_ARCH
), arm64 armel mips64el mipsel ppc64el armhf
))
297 COMPILER_RT_WASM_ENABLE
=no
300 # Do not install objects
301 STAGE_ALL_CMAKE_EXTRA
+= -DMLIR_INSTALL_AGGREGATE_OBJECTS
=OFF
305 ifneq (,$(filter nocheck
,$(DEB_BUILD_OPTIONS
)))
308 ifeq ($(shell dpkg-vendor
--derives-from Ubuntu
&& echo yes
),yes
)
309 ifeq (riscv64
,$(DEB_HOST_ARCH
))
314 # llvm tests timeout, disable it on mipsel
315 ifeq (mipsel
,$(DEB_HOST_ARCH
))
320 ifneq (,$(filter scan-build
,$(DEB_BUILD_OPTIONS
)))
321 # enable the build using scan-build
322 # The package are installed through the variable declarations:
323 # OTHERMIRROR="deb http://llvm.org/apt/unstable/ llvm-toolchain main"
324 # EXTRAPACKAGES="clang-X"
327 PRE_PROCESS
=scan-build-
$(LLVM_VERSION
) --show-description
-analyzer-config stable-report-filename
=true
328 # -enable-checker optin.performance.Padding
329 PRE_PROCESS_CONF
=scan-build-
$(LLVM_VERSION
)
330 # no need to run tests in this case
332 CONFIGURE_EXTRA
+= --enable-assertions
333 STAGE_ALL_CMAKE_EXTRA
+= -DLLVM_ENABLE_ASSERTIONS
=ON
336 ifneq (,$(filter coverity
,$(DEB_BUILD_OPTIONS
)))
337 # enable the build using coverity
338 # pbuilder contains BINDMOUNTS="/opt/cov-analysis/"
339 # And we have some pbuilder hooks to configure and pack the result
340 # Where the binaries are installed on the jenkins instance
341 PRE_PROCESS
=PATH
=$$PATH:/opt
/cov-analysis
/bin
/ cov-build
--dir cov-int
342 # We don't want to check the temporary files produced by the configure
345 CONFIGURE_EXTRA
+= --enable-assertions
346 STAGE_ALL_CMAKE_EXTRA
+= -DLLVM_ENABLE_ASSERTIONS
=ON
347 # no need to run tests in this case
354 LLDB_DISABLE_ARCHS
:= hurd-i386 ia64 powerpc powerpcspe ppc64 riscv64 sparc64 mips64el mipsel
355 # hurd has threading issues
356 ifeq (,$(filter-out $(LLDB_DISABLE_ARCHS
), $(DEB_HOST_ARCH
)))
357 # Disable LLDB for this arch.
360 STAGE_ALL_CMAKE_EXTRA
+= -DLLDB_ENABLE_LUA
=OFF
364 ifneq (,$(filter $(DISTRO
),stretch
))
365 # Don't enable lld python for old distros
366 STAGE_ALL_CMAKE_EXTRA
+= -DLLDB_ENABLE_PYTHON
=OFF
372 ifneq (,$(filter $(DEB_HOST_ARCH_OS
),linux
))
374 STAGE_2_CMAKE_EXTRA
+= -DLLVM_USE_PERF
=ON
-DLLVM_ENABLE_LIBPFM
=ON
377 # Only enable it for archs supporting gold
378 ifneq (,$(filter $(DEB_HOST_ARCH
),$(BINUTILS_GOLD_ARCHS
)))
379 # armhf is not yet quite ready for Thin, it FTBFS
380 # see https://buildd.debian.org/status/fetch.php?pkg=llvm-toolchain-8&arch=armhf&ver=1%3A8.0.1%7E%2Brc2-1%7Eexp1&stamp=1560334266&raw=0
381 ifeq (,$(filter $(DEB_HOST_ARCH
), armhf
))
382 # Use BOOTSTRAP_LLVM_ENABLE_LTO to make sure that it isn't used
383 # when running stage1 with gcc
384 # For now, disable ThinLTO usage because:
385 # * LLVM_ENABLE_LTO doesn't work with gcc >= 9 (option not accepted)
386 # * BOOTSTRAP_LLVM_ENABLE_LTO is producing some large binary
387 # See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=943623
388 # STAGE_2_CMAKE_EXTRA += -DLLVM_ENABLE_LTO="Thin"
394 OCAML_ARCHS
:= amd64 arm64 armhf ppc64el riscv64 s390x
395 ifneq (,$(filter $(DEB_HOST_ARCH
),$(OCAML_ARCHS
)))
396 # Enable OCAML for this arch.
398 OCAML_STDLIB_DIR ?
= $(shell ocamlc
-where
)
399 DH_OPTIONS
=--with ocaml
403 ifeq (,$(filter $(DEB_HOST_ARCH_OS
),linux
))
407 ifneq (,$(filter $(DEB_HOST_ARCH
), mipsel
))
411 ifneq (,$(filter $(DEB_HOST_ARCH
), mips64 mips64el
))
415 # if cmake is installed in /tmp/cmake/ uses it
416 # Used to build llvm on old ubuntu (precise) on the llvm.org/apt/ ci
418 ifeq ($(shell test -e
/tmp
/cmake
/bin
/cmake
&& echo
-n yes
),yes
)
419 CMAKE_BIN
=/tmp
/cmake
/bin
/cmake
420 export LD_LIBRARY_PATH
=$$LD_LIBRARY_PATH:/tmp
/cmake
/bin
/
424 # if sccache is installed in the chroot, use it
425 ifeq ($(shell test -e
/opt
/sccache
/sccache
&& echo
-n yes
),yes
)
426 SCCACHE_CMAKE
= -DCMAKE_C_COMPILER_LAUNCHER
=/opt
/sccache
/sccache
-DCMAKE_CXX_COMPILER_LAUNCHER
=/opt
/sccache
/sccache
427 STAGE_1_CMAKE_EXTRA
+= $(SCCACHE_CMAKE
)
429 export LD_LIBRARY_PATH
=$$LD_LIBRARY_PATH:/opt
/sccache
434 # enables cmake build targets like stage2-[target_name]
435 ENABLED_STAGE2_CMAKE_BUILD_TARGETS
= check-all
;check-llvm
;check-clang
;check-clang-tools
;check-lld
;check-libcxx
;check-libcxxabi
;check-mlir
;check-sanitizer
;llvm-config
;test-suite
440 # For some reasons, some spaces are added, removing them
441 PROJECTS_LIST
:= $(shell echo
"$(PROJECTS)"|sed
-e
"s| ||g")
442 RUNTIMES_LIST
:= $(shell echo
"$(RUNTIMES)"|sed
-e
"s| ||g")
446 if
! grep
-qs
'/proc ' /proc
/mounts
; then \
447 echo
"/proc needs to be mounted"; \
451 @echo
"DEB_HOST_MULTIARCH=$(DEB_HOST_MULTIARCH)"
452 @echo
"DEB_HOST_GNU_TYPE=$(DEB_HOST_GNU_TYPE)"
453 @echo
"DEB_HOST_ARCH_BITS=$(DEB_HOST_ARCH_BITS)"
454 @echo
"DEB_HOST_ARCH=$(DEB_HOST_ARCH)"
455 @echo
"DEB_HOST_ARCH_OS=$(DEB_HOST_ARCH_OS)"
456 @echo
"DISTRO=$(DISTRO)"
457 @echo
"GCC_VERSION=$(GCC_VERSION)"
458 @echo
"PROJECTS=$(PROJECTS_LIST)"
459 @echo
"RUNTIMES=$(RUNTIMES_LIST)"
460 @echo
"LLVM_VERSION=$(LLVM_VERSION)"
461 @echo
"LLVM_VERSION_FULL=$(LLVM_VERSION_FULL)"
462 @echo
"LLVM_VERSION_SNAPSHOT=$(LLVM_VERSION_SNAPSHOT)"
464 @echo
"LD_LIBRARY_PATH=$(LD_LIBRARY_PATH)"
466 for f in debian
/*.in
; do \
467 f2
=$$(echo
$$f | sed
's/\.in$$//;s/X\.Y/$(LLVM_VERSION)/'); \
468 echo
"$$f => $$f2"; \
469 sed
-e
's|@DEB_HOST_MULTIARCH@|$(DEB_HOST_MULTIARCH)|g' \
470 -e
"s|@OCAML_STDLIB_DIR@|$(OCAML_STDLIB_DIR)|g" \
471 -e
"s|@LLVM_VERSION_FULL@|$(LLVM_VERSION_FULL)|g" \
472 -e
"s|@LLVM_VERSION@|$(LLVM_VERSION)|g" $$f > $$f2; \
475 # Make install file executable for dh-exec
477 debian
/clang-tools-
$(LLVM_VERSION
).
install \
478 debian
/libclang-
$(LLVM_VERSION
)-dev.
install \
479 debian
/libclang-common-
$(LLVM_VERSION
)-dev.
install \
480 debian
/libomp-
$(LLVM_VERSION
)-dev.
install \
481 debian
/llvm-
$(LLVM_VERSION
)-dev.
install \
482 debian
/llvm-
$(LLVM_VERSION
)-linker-tools.
install \
483 debian
/llvm-
$(LLVM_VERSION
)-linker-tools.links
485 # workaround the breaks/replaces/conflicts introduced with the omp-device-info move
486 # we update the version to make it work with apt.llvm.org
487 # Yeah, this is ugly but I don't know how to do better
488 if
test "$(LLVM_VERSION)" = "13"; then \
489 if echo
"$(LLVM_VERSION_SNAPSHOT)"|grep
-q
"++"; then \
490 sed
-i
-e
"s|(<< 1:13.0.0-4)|(<< 1:13.0.0~++20211013044936)|g" debian
/control
; \
494 # Conditionally enable *.spv files. Debian buster and Ubuntu 18.04
495 # don't have llvm-spirv to create the *.spv files.
496 if
test "$(LLVM_SPIRV_INSTALLED)" = "yes"; then \
497 sed
-i
-e
"s|#spv\ ||g" debian
/libclc-
$(LLVM_VERSION
).
install; \
499 if
test "$(DISTRO)" = "stretch"; then \
500 echo
"" > debian
/python3-lldb-
$(LLVM_VERSION
).
install; \
503 # Conditionally enable install clangd grpc files
504 if
test "$(CLANGD_GRPC_INSTALLED)" = "yes"; then \
505 sed
-i
-e
"s|#grpc\ ||g" debian
/libclang-
$(LLVM_VERSION
)-dev.
install; \
508 # Override this two targets. They are trying to manage the .in conversion for me
509 override_dh_ocamlinit
:
510 override_dh_ocamlclean
:
513 override_dh_auto_configure
: preconfigure
514 if
test -f
/opt
/sccache
/sccache
; then \
515 ls
-al
/opt
/sccache
/*; \
520 mkdir
-p
$(TARGET_BUILD
)
521 mkdir
-p clang
/include/clang
/Debian
522 sed
-e
"s|@DEB_PATCHSETVERSION@|$(DEBIAN_REVISION)|" \
523 debian
/debian_path.h
> clang
/include/clang
/Debian
/debian_path.h
524 if
test "$(SCAN_BUILD)" = "yes"; then \
525 patch
-f
-p1
< debian
/patches
/on-the-fly
/use-scan-build-runtimes.diff||true
; \
528 # Configure coverity (we need the compilers) + work around perf issues
529 -(if
test $(COVERITY_ENABLE
) -eq
1; then \
530 export PATH
=$$PATH:/opt
/cov-analysis
/bin
/; \
531 cov-configure
--compiler clang
--comptype clang
; \
532 cov-configure
--compiler gcc-
$(GCC_VERSION
) --comptype gcc
; \
533 cov-configure
--compiler g
++-$(GCC_VERSION
) --comptype gcc
; \
534 cov-configure
-co /usr
/bin
/g
++-$(GCC_VERSION
) --comptype gcc
-- -fPIC
-std
=c
++11; \
535 cov-configure
-co /usr
/bin
/gcc-
$(GCC_VERSION
) --comptype gcc
-- -fPIC
; \
536 cov-configure
-co /usr
/bin
/g
++-$(GCC_VERSION
) --comptype gcc
-- -fPIC
-std
=c
++11 -fno-exceptions
; \
537 cov-configure
-co /usr
/bin
/g
++-$(GCC_VERSION
) --comptype gcc
--template \
538 --xml-option append_arg
:"--ppp_translator" \
539 --xml-option append_arg
:"replace/llvm::AlignOf<PrevTy>::Alignment/(llvm::AlignOf<PrevTy>::Alignment)" \
540 --xml-option append_arg
:"--ppp_translator" \
541 --xml-option append_arg
:"replace/llvm::AlignOf<NextTy>::Alignment/(llvm::AlignOf<NextTy>::Alignment)"; \
542 cov-configure
--compiler c
++ --comptype g
++ --template \
543 --xml-option append_arg
:"--ppp_translator" \
544 --xml-option append_arg
:"replace/llvm::AlignOf<PrevTy>::Alignment/(llvm::AlignOf<PrevTy>::Alignment)" \
545 --xml-option append_arg
:"--ppp_translator" \
546 --xml-option append_arg
:"replace/llvm::AlignOf<NextTy>::Alignment/(llvm::AlignOf<NextTy>::Alignment)"; \
549 # Fails with No target "unwind_static"
550 # -DLIBCXXABI_ENABLE_STATIC_UNWINDER=ON \
551 # -DLIBCXXABI_STATICALLY_LINK_UNWINDER_IN_SHARED_LIBRARY=OFF \
552 # -DLIBCXXABI_STATICALLY_LINK_UNWINDER_IN_STATIC_LIBRARY=ON \
553 #- to libc++ when libunwind is built
554 #- Matches what is done on brew:
555 #- https://bit.ly/3kDNpC9
556 ifeq (${SCCACHE_ENABLE},yes
)
558 /opt
/sccache
/sccache
--stop-server||true
559 # Start the sccache server with the right set of options to use GCP
560 SCCACHE_LOG
=sccache
=debug SCCACHE_ERROR_LOG
=/opt
/sccache
/sccache.log SCCACHE_GCS_KEY_PATH
=/opt
/sccache
/secret-gcp-storage.json SCCACHE_GCS_BUCKET
=apt-llvm-org-sccache SCCACHE_GCS_RW_MODE
=READ_WRITE
/opt
/sccache
/sccache
--start-server
562 echo
"Running tests: $(RUN_TEST)"
563 echo
"Using cmake: $(CMAKE_BIN)"; \
564 LD_LIBRARY_PATH
=$$LD_LIBRARY_PATH \
565 $(PRE_PROCESS_CONF
) $(CMAKE_BIN
) -S llvm
/ -B
$(TARGET_BUILD
) \
567 -DCMAKE_INSTALL_PREFIX
=/usr
/lib
/llvm-
$(LLVM_VERSION
) \
568 -DLLVM_VERSION_SUFFIX
= \
569 -DCMAKE_SUPPRESS_REGENERATION
=ON \
570 -DCMAKE_BUILD_TYPE
=Release \
571 -DCMAKE_C_FLAGS
="$(STAGE_1_CFLAGS)" \
572 -DCMAKE_CXX_FLAGS
="$(STAGE_1_CXXFLAGS)" \
573 -DCMAKE_SHARED_LINKER_FLAGS
="$(STAGE_1_LDFLAGS)" \
574 -DCMAKE_MODULE_LINKER_FLAGS
="$(STAGE_1_LDFLAGS)" \
575 -DCMAKE_EXE_LINKER_FLAGS
="$(STAGE_1_LDFLAGS)" \
576 -DPACKAGE_VENDOR
=$(VENDOR
) \
577 -DENABLE_LINKER_BUILD_ID
=ON \
578 -DLLVM_TARGETS_TO_BUILD
=Native \
579 -DLLVM_ENABLE_PROJECTS
="$(PROJECTS_LIST)" \
580 -DLLVM_ENABLE_RUNTIMES
="$(RUNTIMES_LIST)" \
581 -DLLVM_ENABLE_PIC
=ON \
582 -DLLVM_ENABLE_RTTI
=ON \
583 -DLLVM_BUILD_DOCS
=OFF \
584 -DLLVM_INCLUDE_GO_TESTS
=OFF \
585 -DLLVM_USE_RELATIVE_PATHS_IN_FILES
=ON \
586 -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN
=ON \
587 -DCLANG_PLUGIN_SUPPORT
=OFF \
588 -DCLANG_BUILD_EXAMPLES
=OFF \
589 -DCLANG_DEFAULT_LINKER
=ld \
590 -DCLANG_DEFAULT_CXX_STDLIB
=libstdc
++ \
591 -DCLANG_DEFAULT_RTLIB
=libgcc \
592 -DCOMPILER_RT_BUILD_XRAY
=OFF \
593 -DCOMPILER_RT_INCLUDE_TESTS
=OFF \
594 -DCOMPILER_RT_USE_LIBCXX
=OFF \
595 -DCOMPILER_RT_USE_BUILTINS_LIBRARY
=$(COMPILER_RT_USE_BUILTINS_LIBRARY
) \
596 -DLIBUNWIND_USE_COMPILER_RT
=ON \
597 -DLIBUNWIND_INSTALL_LIBRARY
=OFF \
598 -DLIBCXXABI_ENABLE_EXCEPTIONS
=$(LIBCXX_EXCEPTIONS
) \
599 -DLIBCXXABI_USE_COMPILER_RT
=$(LIBCXX_USE_COMPILER_RT
) \
600 -DLIBCXXABI_INSTALL_LIBRARY
=OFF \
601 -DLIBCXX_ENABLE_EXCEPTIONS
=$(LIBCXX_EXCEPTIONS
) \
602 -DLIBCXX_USE_COMPILER_RT
=$(LIBCXX_USE_COMPILER_RT
) \
603 -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY
=ON \
604 -DLIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY
=ON \
605 -DLIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY
=OFF \
606 -DLIBCXX_INSTALL_LIBRARY
=OFF \
607 -DOPENMP_ENABLE_LIBOMP_PROFILING
=OFF \
608 -DOPENMP_ENABLE_LIBOMPTARGET_PROFILING
=OFF \
609 -DLIBOMP_ENABLE_RTTI
=OFF \
610 -DLIBOMP_OMPT_SUPPORT
=OFF \
612 -DBUILTINS_CMAKE_ARGS
="-DCMAKE_C_FLAGS=$(STAGE_1_CFLAGS);-DCMAKE_CXX_FLAGS=$(STAGE_1_CXXFLAGS);-DCMAKE_EXE_LINKER_FLAGS=$(STAGE_1_LDFLAGS);-DCMAKE_SHARED_LINKER_FLAGS=$(STAGE_1_LDFLAGS);-DCMAKE_MODULE_LINKER_FLAGS=$(STAGE_1_LDFLAGS);-DCMAKE_BUILD_TYPE=Release;-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF" \
613 -DRUNTIMES_CMAKE_ARGS
="-DCMAKE_C_FLAGS=$(STAGE_1_CFLAGS);-DCMAKE_CXX_FLAGS=$(STAGE_1_CXXFLAGS);-DCMAKE_EXE_LINKER_FLAGS=$(STAGE_1_LDFLAGS);-DCMAKE_SHARED_LINKER_FLAGS=$(STAGE_1_LDFLAGS);-DCMAKE_MODULE_LINKER_FLAGS=$(STAGE_1_LDFLAGS);-DCMAKE_BUILD_TYPE=Release;-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF" \
614 -DCLANG_ENABLE_BOOTSTRAP
=ON \
615 -DCLANG_BOOTSTRAP_TARGETS
="$(ENABLED_STAGE2_CMAKE_BUILD_TARGETS)" \
616 -DCLANG_BOOTSTRAP_PASSTHROUGH
="CMAKE_INSTALL_PREFIX;CMAKE_SUPPRESS_REGENERATION;ENABLE_LINKER_BUILD_ID;LLVM_ENABLE_PIC;LLVM_ENABLE_RTTI;LLVM_INCLUDE_GO_TESTS;LLVM_USE_RELATIVE_PATHS_IN_FILES;CLANG_DEFAULT_LINKER;CLANG_DEFAULT_CXX_STDLIB;CLANG_DEFAULT_RTLIB;COMPILER_RT_USE_LIBCXX;COMPILER_RT_USE_BUILTINS_LIBRARY;COMPILER_RT_INCLUDE_TESTS;LIBUNWIND_USE_COMPILER_RT;LIBCXXABI_ENABLE_EXCEPTIONS;LIBCXXABI_USE_COMPILER_RT;LIBCXX_USE_COMPILER_RT;LIBCXX_ENABLE_EXCEPTIONS;LIBCXX_ENABLE_STATIC_ABI_LIBRARY;LIBCXX_STATICALLY_LINK_ABI_IN_STATIC_LIBRARY;LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY;LIBOMP_ENABLE_RTTI" \
617 -DBOOTSTRAP_CMAKE_BUILD_TYPE
=RelWithDebInfo \
618 -DBOOTSTRAP_CMAKE_C_FLAGS_RELWITHDEBINFO
="$(opt_flags)" \
619 -DBOOTSTRAP_CMAKE_CXX_FLAGS_RELWITHDEBINFO
="$(opt_flags)" \
620 -DBOOTSTRAP_CMAKE_C_FLAGS
="$(STAGE_2_CFLAGS)" \
621 -DBOOTSTRAP_CMAKE_CXX_FLAGS
="$(STAGE_2_CXXFLAGS)" \
622 -DBOOTSTRAP_CMAKE_SHARED_LINKER_FLAGS
="$(STAGE_2_LDFLAGS)" \
623 -DBOOTSTRAP_CMAKE_MODULE_LINKER_FLAGS
="$(STAGE_2_LDFLAGS)" \
624 -DBOOTSTRAP_CMAKE_EXE_LINKER_FLAGS
="$(STAGE_2_LDFLAGS)" \
625 -DBOOTSTRAP_LLVM_ENABLE_FFI
=ON \
626 -DBOOTSTRAP_LLVM_ENABLE_DUMP
=ON \
627 -DBOOTSTRAP_LLVM_ENABLE_LIBPFM
=ON \
628 -DBOOTSTRAP_LLVM_ENABLE_SPHINX
=ON \
629 -DBOOTSTRAP_CLANG_DEFAULT_PIE_ON_LINUX
=ON \
630 -DBOOTSTRAP_SPHINX_WARNINGS_AS_ERRORS
=OFF \
631 -DBOOTSTRAP_LLVM_USE_RELATIVE_PATHS_IN_FILES
=ON \
632 -DBOOTSTRAP_LLVM_INSTALL_UTILS
=ON \
633 -DBOOTSTRAP_LLVM_VERSION_SUFFIX
= \
634 -DBOOTSTRAP_LLVM_POLLY_LINK_INTO_TOOLS
=ON \
635 -DBOOTSTRAP_LLVM_EXPERIMENTAL_TARGETS_TO_BUILD
="M68k" \
636 -DBOOTSTRAP_LLVM_LINK_LLVM_DYLIB
=ON \
637 -DBOOTSTRAP_LLVM_ENABLE_CURL
=ON \
638 -DBOOTSTRAP_CLANG_LINK_CLANG_DYLIB
=ON \
639 -DBOOTSTRAP_LIBCLANG_LIBRARY_VERSION
=$(SONAME_EXT
) \
640 -DBOOTSTRAP_LIBCXX_INSTALL_EXPERIMENTAL_LIBRARY
=ON \
641 -DBOOTSTRAP_PYTHON_EXECUTABLE
=/usr
/bin
/python3 \
642 $(BOOTSTRAP_CMAKE_EXTRA
) \
643 -DBOOTSTRAP_BUILTINS_CMAKE_ARGS
="-DCMAKE_C_FLAGS=$(STAGE_2_CFLAGS);-DCMAKE_CXX_FLAGS=$(STAGE_2_CXXFLAGS);-DCMAKE_EXE_LINKER_FLAGS=$(STAGE_2_LDFLAGS);-DCMAKE_SHARED_LINKER_FLAGS=$(STAGE_2_LDFLAGS);-DCMAKE_MODULE_LINKER_FLAGS=$(STAGE_2_LDFLAGS);-DCMAKE_BUILD_TYPE=RelWithDebInfo;-DCMAKE_C_FLAGS_RELWITHDEBINFO=$(opt_flags);-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=$(opt_flags);-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF" \
644 -DBOOTSTRAP_RUNTIMES_CMAKE_ARGS
="-DCMAKE_C_FLAGS=$(STAGE_2_CFLAGS);-DCMAKE_CXX_FLAGS=$(STAGE_2_CXXFLAGS);-DCMAKE_EXE_LINKER_FLAGS=$(STAGE_2_LDFLAGS) -L$(STAGE_1_LIB_DIR);-DCMAKE_SHARED_LINKER_FLAGS=$(STAGE_2_LDFLAGS) -L$(STAGE_1_LIB_DIR);-DCMAKE_MODULE_LINKER_FLAGS=$(STAGE_2_LDFLAGS) -L$(STAGE_1_LIB_DIR);-DCMAKE_BUILD_TYPE=RelWithDebInfo;-DCMAKE_C_FLAGS_RELWITHDEBINFO=$(opt_flags);-DCMAKE_CXX_FLAGS_RELWITHDEBINFO=$(opt_flags);-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF"
646 FOUND_VERSION
=`grep LLVM_VERSION_STRING build-llvm/include/llvm/Config/llvm-config.h|cut -d\" -f2`; \
647 if
! echo
"$(LLVM_VERSION_FULL)"|grep
"$$FOUND_VERSION"; then \
648 echo
"mismatch of version. Found: $$FOUND_VERSION / Expected: $(LLVM_VERSION_FULL)"; \
656 echo
"Using cmake: $(CMAKE_BIN)"
657 # linker hack so stage2 can link against stage1 libs at runtime
658 LD_LIBRARY_PATH
=$(STAGE_1_LIB_DIR
):$$LD_LIBRARY_PATH \
659 VERBOSE
=1 $(PRE_PROCESS
) $(CMAKE_BIN
) --build
$(TARGET_BUILD
) $(NJOBS
) --target stage2
661 # If we used sccache, shows stats
662 if
test -f
/opt
/sccache
/sccache
; then \
663 ls
-al
/opt
/sccache
/; \
664 cat
/opt
/sccache
/sccache.log
; \
665 /opt
/sccache
/sccache
--show-stats
; \
668 # Check the stage 2 build worked
669 if
! readelf
--string-dump .comment
$(TARGET_BUILD_STAGE2
)/bin
/clang
2>&1|grep
-q
"clang version"; then \
670 echo
"clang hasn't been built using clang. Bye bye. Check that the stage2 build has been done."; \
671 if
test "$(SCAN_BUILD)" = "no"; then \
675 if ldd
$(TARGET_BUILD_STAGE2
)/lib
/libclang-
$(LLVM_VERSION
).so
.1|grep
-q libclang-cpp-
$(LLVM_VERSION
); then \
676 echo
"libclang-$(LLVM_VERSION).so.1 depends on libclang-cpp. Should not be the case"; \
681 debian-libfuzzer-build
:
682 ifeq (${LIBFUZZER_ENABLE},yes
)
683 cd
$(TARGET_BUILD
); \
684 CFLAGS
="$(opt_flags) $(STAGE_2_CFLAGS)"; \
686 $(STAGE_2_BIN_DIR
)/clang
++ -c
$$CFLAGS -std
=c
++11 $(BASE_PATH
)/compiler-rt
/lib
/fuzzer
/*.
cpp -IFuzzer
; \
687 ar ruv libFuzzer.a Fuzzer
*.o
693 mkdir
-p libclc
/build
694 echo
"Using cmake: $(CMAKE_BIN)"
699 -DCMAKE_C_COMPILER
=$(STAGE_2_BIN_DIR
)/clang \
700 -DCMAKE_CXX_COMPILER
=$(STAGE_2_BIN_DIR
)/clang
++ \
701 -DCMAKE_C_FLAGS
="$(opt_flags) $(STAGE_2_CFLAGS)" \
702 -DCMAKE_CXX_FLAGS
="$(opt_flags) $(STAGE_2_CXXFLAGS)" \
703 -DCMAKE_SHARED_LINKER_FLAGS
="$(STAGE_2_LDFLAGS) -L$(STAGE_2_LIB_DIR)" \
704 -DCMAKE_MODULE_LINKER_FLAGS
="$(STAGE_2_LDFLAGS) -L$(STAGE_2_LIB_DIR)" \
705 -DCMAKE_EXE_LINKER_FLAGS
="$(STAGE_2_LDFLAGS) -L$(STAGE_2_LIB_DIR)" \
706 -DCMAKE_INSTALL_PREFIX
=/usr \
707 -DCMAKE_INSTALL_DATADIR
=lib \
708 -DCMAKE_INSTALL_INCLUDEDIR
=include \
709 -DLLVM_CONFIG
=$(STAGE_2_BIN_DIR
)/llvm-config \
710 -DLIBCLC_TARGETS_TO_BUILD
=$(LIBCLC_TARGETS_TO_BUILD
); \
711 ninja
$(NJOBS
) $(VERBOSE
)
714 debian-rtlib-wasm-build
:
715 ifeq (${COMPILER_RT_WASM_ENABLE},yes
)
716 echo
"Using cmake: $(CMAKE_BIN)"
717 for build in wasm32 wasm64
; do \
718 mkdir
-p build-compiler-rt-
$$build; \
719 $(CMAKE_BIN
) -B build-compiler-rt-
$$build -S compiler-rt
/lib
/builtins
/ \
722 -DCMAKE_C_COMPILER_TARGET
=$$build-unknown
-unknown \
723 -DCMAKE_CXX_COMPILER_TARGET
=$$build-unknown
-unknown \
724 -DCMAKE_ASM_COMPILER_TARGET
=$$build-unknown
-unknown \
725 -DCMAKE_C_COMPILER
=$(STAGE_2_BIN_DIR
)/clang \
726 -DCMAKE_CXX_COMPILER
=$(STAGE_2_BIN_DIR
)/clang
++ \
727 -DCMAKE_C_FLAGS
="$(opt_flags) $(STAGE_2_CFLAGS)" \
728 -DCMAKE_CXX_FLAGS
="$(opt_flags) $(STAGE_2_CXXFLAGS)" \
729 -DCMAKE_SHARED_LINKER_FLAGS
="$(STAGE_2_LDFLAGS) -L$(STAGE_2_LIB_DIR)" \
730 -DCMAKE_MODULE_LINKER_FLAGS
="$(STAGE_2_LDFLAGS) -L$(STAGE_2_LIB_DIR)" \
731 -DCMAKE_EXE_LINKER_FLAGS
="$(STAGE_2_LDFLAGS) -L$(STAGE_2_LIB_DIR)" \
732 -DCMAKE_INSTALL_PREFIX
=/usr
/lib
/llvm-
$(LLVM_VERSION
)/lib
/clang
/$(LLVM_VERSION_FULL
) \
733 -DCMAKE_INSTALL_DATADIR
=lib \
734 -DCMAKE_INSTALL_INCLUDEDIR
=include \
735 -DLLVM_CONFIG_PATH
=$(STAGE_2_BIN_DIR
)/llvm-config \
736 -DCOMPILER_RT_STANDALONE_BUILD
=ON \
737 -DCOMPILER_RT_BAREMETAL_BUILD
=ON \
738 -DCOMPILER_RT_INCLUDE_TESTS
=OFF \
739 -DCOMPILER_RT_USE_LIBCXX
=OFF \
740 -DCOMPILER_RT_USE_BUILTINS_LIBRARY
=ON \
741 -DCOMPILER_RT_DEFAULT_TARGET_TRIPLE
=$$build-unknown
-unknown \
742 -DCOMPILER_RT_OS_DIR
=wasi
; \
743 ninja
-C build-compiler-rt-
$$build $(NJOBS
) $(VERBOSE
); \
746 echo
"Skip on this arch"
750 override_dh_auto_build
: debian-full-build debian-libfuzzer-build debian-libclc-build debian-rtlib-wasm-build
752 override_dh_prep
: build_doc
757 ALLSPHINXOPTS
="-d $$BUILDDIR/doctrees ."; \
758 cd
$(CURDIR
)/llvm
/docs
&& \
759 sphinx-build
-b html
$$ALLSPHINXOPTS $$BUILDDIR/html
&& \
760 sphinx-build
-b man
$$ALLSPHINXOPTS $$BUILDDIR/man
&& \
762 cd
$(CURDIR
)/clang
/docs
&& \
763 sphinx-build
-b html
$$ALLSPHINXOPTS $$BUILDDIR/html
&& \
764 sphinx-build
-b man
$$ALLSPHINXOPTS $$BUILDDIR/man
766 -(if
test "$(OCAML_ENABLE)" = yes
; then \
767 ninja
-C
"$(TARGET_BUILD_STAGE2)" $(VERBOSE
) ocaml_doc
; \
770 ninja
-C
$(TARGET_BUILD_STAGE2
) $(VERBOSE
) docs-llvm-html docs-clang-html docs-clang-tools-html docs-clang-tools-man docs-clang-man docs-llvm-man
772 ifeq (${POLLY_ENABLE},yes
)
773 ninja
-C
$(TARGET_BUILD_STAGE2
) $(VERBOSE
) docs-polly-html docs-polly-man
777 d
=$(CURDIR
)/llvm
/docs
/_build
/man
/; \
778 if
test -d
$$d; then \
781 echo
"$$f"|grep
$(LLVM_VERSION
) || mv
$$f `echo $$f|sed "s|\.1|-$(LLVM_VERSION).1|"`; \
784 echo
"could not find $$d"; \
786 # the clang doc generation only generates clang manpage
787 # When it will do more, we should move that in the loop above
788 cd
$(CURDIR
)/clang
/docs
/_build
/man
/ && mv clang
.1 clang-
$(LLVM_VERSION
).1
790 # Remove the copy of jquery. See bug #701087
791 for d in
$(TARGET_BUILD_STAGE2
)/docs
/html
/_static
/ $(TARGET_BUILD_STAGE2
)/tools
/clang
/docs
/html
/_static
/ $(TARGET_BUILD_STAGE2
)/tools
/clang
/tools
/extra
/docs
/html
/_static
/; do \
792 cd
$$d && rm -f jquery.js
&& ln
-s
/usr
/share
/javascript
/jquery
/jquery.js
&& cd
-; \
793 cd
$$d && rm -f underscore.js
&& ln
-s
/usr
/share
/javascript
/underscore
/underscore.js
&& cd
-; \
797 ls
-al clang
/tools
/scan-view
/bin
/scan-view
798 clang
/tools
/scan-view
/bin
/scan-view
--help || true
799 help2man
--no-info
--version-string
=$(LLVM_VERSION
) clang
/tools
/scan-view
/bin
/scan-view
> debian
/man
/scan-view-
$(LLVM_VERSION
).1 || true
800 help2man
--no-info
--version-string
=$(LLVM_VERSION
) clang
/tools
/clang-format
/clang-format-diff.py
> debian
/man
/clang-format-diff-
$(LLVM_VERSION
).1 || true
802 CMDS
="llvm-dwarfdump llvm-mc llvm-objdump llvm-rtdyld llvm-size llvm-ranlib lldb clang-format clang clang++ clang-tblgen clang-check clang-cpp clang-tidy clang-apply-replacements clang-rename clang-query pp-trace sancov lli modularize clang-include-fixer find-all-symbols clang-reorder-fields ld.lld llvm-tblgen clang-change-namespace clang-offload-bundler clangd clang-repl clang-nvlink-wrapper git-clang-format run-clang-tidy"; \
803 for f in
$$CMDS; do \
804 echo
"Generating manpage of $$f"; \
805 LD_LIBRARY_PATH
=$(DEB_INST
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/lib
/:/usr
/lib
/*/libfakeroot help2man
--no-info
--version-string
=$(LLVM_VERSION
) $(TARGET_BUILD_STAGE2
)/bin
/$$f > debian
/man
/$$f-$(LLVM_VERSION
).1 || true
; \
807 if
test "$(OPENMP_ENABLE)" = yes
; then \
808 cd openmp
/runtime
&& doxygen doc
/doxygen
/config
; cd
-; \
809 cd openmp
/runtime
/doc
/doxygen
/generated
/html
/ && rm jquery.js
&& ln
-s
/usr
/share
/javascript
/jquery
/jquery.js
; \
812 override_dh_auto_install
:
813 # Clean up temporary files to make sure the install works
814 rm -rf
$(find
$(TARGET_BUILD
) -wholename
'*CMakeFiles*' -not
-name CMakeLists.txt
-a
-name
"*.dir" -type d
)
815 # install/fast enables a make install without recompiling temporary files
816 LD_LIBRARY_PATH
=$(STAGE_2_LIB_DIR
):$$LD_LIBRARY_PATH DESTDIR
=$(DEB_INST
)/ ninja
-C
$(TARGET_BUILD
) $(VERBOSE
) stage2-install
819 rm -f
$(DEB_INST
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/bin
/argdumper
820 rm -f
$(DEB_INST
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/share
/clang
/clang-format-bbedit.applescript
821 # Remove bat files https://bugs.llvm.org/show_bug.cgi?id=30755
822 rm -f
$(DEB_INST
)/usr
/share
/clang
/scan-build-
$(LLVM_VERSION
)/libexec
/*.bat
$(DEB_INST
)/usr
/share
/clang
/scan-build-
$(LLVM_VERSION
)/bin
/*.bat
824 rm -f
$(DEB_INST
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/lib
/libExampleIRTransforms.a
825 # Remove an example - introduced in https://reviews.llvm.org/D61446
826 rm -f
$(DEB_INST
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/lib
/libBye.a
828 cp
$(TARGET_BUILD_STAGE2
)/bin
/clang-query
$(DEB_INST
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/bin
830 # Only run on executable, not script
831 chrpath
-d
`find $(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/bin/ -type f -executable -exec file -i '{}' \; | grep 'x-executable; charset=binary'|cut -d: -f1`
834 cd debian
/tmp
/usr
/lib
/llvm-
$(LLVM_VERSION
)/lib
/ && \
835 ln
-s libclang-
$(LLVM_VERSION
).so.
$(SONAME_CLANG
) libclang.so.
$(SONAME_EXT
) && \
836 ln
-s libclang-
$(LLVM_VERSION
).so.
$(SONAME_CLANG
) libclang-
$(LLVM_VERSION
).so.
$(SONAME_EXT
)
838 if
test "$(LIBUNWIND_ENABLE)" = yes
; then \
839 mkdir
-p debian
/tmp
/usr
/include/libunwind
; \
840 cp
-R libunwind
/include/* debian
/tmp
/usr
/include/libunwind
/; \
844 if
test "$(OPENMP_ENABLE)" = yes
; then \
845 cd debian
/tmp
/usr
/lib
/llvm-
$(LLVM_VERSION
)/lib
; \
846 ln
-s libomp.so.
$(SONAME_OPENMP
) libomp.so
; \
847 cp libomp.so.
$(SONAME_OPENMP
) libomp-
$(LLVM_VERSION
).so.
$(SONAME_OPENMP
); \
850 # Remove artifact (where compiler-rt is built)
851 # if test -d $(TARGET_BUILD)/tools/clang/runtime/compiler-rt/clang_linux; then \
852 # cd $(TARGET_BUILD)/tools/clang/runtime/compiler-rt/clang_linux && rm -rf $$(find . -mindepth 2 -maxdepth 2 -type d) && rm -rf $$(find -empty) && rm -rf */.dir; \
855 mkdir
-p
$(CURDIR
)/debian
/clang-
$(LLVM_VERSION
)/usr
/bin
/
856 cp compiler-rt
/lib
/asan
/scripts
/asan_symbolize.py
$(CURDIR
)/debian
/clang-
$(LLVM_VERSION
)/usr
/bin
/asan_symbolize-
$(LLVM_VERSION
)
858 ifeq (${LIBFUZZER_ENABLE},yes
)
859 mkdir
-p
$(CURDIR
)/debian
/libfuzzer-
$(LLVM_VERSION
)-dev
/usr
/lib
/llvm-
$(LLVM_VERSION
)/lib
/
860 cp
-v
$(TARGET_BUILD
)/libFuzzer.a
$(CURDIR
)/debian
/libfuzzer-
$(LLVM_VERSION
)-dev
/usr
/lib
/llvm-
$(LLVM_VERSION
)/lib
/
863 # Create this fake directory to make the install libclang-common-dev happy
864 # under the unsupported archs of compiler-rt
865 mkdir
-p
$(DEB_INST
)/usr
/lib
/clang
/$(LLVM_VERSION
)/lib
866 mkdir
-p
$(DEB_INST
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/lib
/clang
/$(LLVM_VERSION_FULL
)/lib
/
867 mkdir
-p
$(DEB_INST
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/lib
/clang
/$(LLVM_VERSION
)/lib
/clang_linux
/
868 mkdir
-p
$(TARGET_BUILD
)/tools
/clang
/runtime
/compiler-rt
/clang_linux
/
869 mkdir
-p
$(DEB_INST
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/lib
/clang
/$(LLVM_VERSION_FULL
)/share
/
870 # On some archs, the sanitizers are not built. As we explicitly includes some txt files, create
871 # a fake txt to make sure it doesn't fail
872 echo
"The *.txt files, if available, contain helper to override some of the errors messages." > $(DEB_INST
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/lib
/clang
/$(LLVM_VERSION_FULL
)/README.txt
873 echo
"Please visit https://github.com/google/sanitizers/wiki/AddressSanitizer for help" >> $(DEB_INST
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/lib
/clang
/$(LLVM_VERSION_FULL
)/README.txt
874 # Path changed. Make a copy of it
875 cp
$(DEB_INST
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/lib
/clang
/$(LLVM_VERSION_FULL
)/README.txt
$(DEB_INST
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/lib
/clang
/$(LLVM_VERSION_FULL
)/share
/README.txt
877 # Remove things that CMake install but which aren't packaged yet,
878 # or are packaged from the source or build tree.
879 mv
$(DEB_INST
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/bin
/clang-
$(LLVM_VERSION
) \
880 $(DEB_INST
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/bin
/clang
883 rm -f
$(DEB_INST
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/lib
/python
*/*-packages
/six.py
884 rm -f
$(DEB_INST
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/local
/lib
/python
*/*-packages
/six.py
885 rm -rf
$(DEB_INST
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/build
/utils
/lit
/lit
/__pycache__
/ \
886 $(DEB_INST
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/build
/utils
/lit
/lit
/*/__pycache__
/
888 DESTDIR
=$(DEB_INST
) ninja
$(VERBOSE
) -C libclc
/build
install
889 ifeq (${COMPILER_RT_WASM_ENABLE},yes
)
890 DESTDIR
=$(DEB_INST
) ninja
$(VERBOSE
) -C build-compiler-rt-wasm32
install
891 DESTDIR
=$(DEB_INST
) ninja
$(VERBOSE
) -C build-compiler-rt-wasm64
install
895 mkdir
-p
$(DEB_INST
)/usr
/bin
/
896 cd
$(DEB_INST
)/usr
/bin
/; \
898 for f in ..
/lib
/llvm-
$(LLVM_VERSION
)/bin
/*; do \
899 ln
-s
$$f `basename $$f`-$(LLVM_VERSION
); \
900 echo
"Link $$f to `basename $$f`-$(LLVM_VERSION)"; \
903 # Rename some stuff with the version name
904 cp
$(CURDIR
)/clang
/tools
/scan-build
/man
/scan-build
.1 $(CURDIR
)/clang
/tools
/scan-build
/man
/scan-build-
$(LLVM_VERSION
).1
906 # copy the vim files (except that tablegen does not exist for indent
907 VIM_DIRS
="ftdetect ftplugin syntax indent"; \
908 for
dir in
$$VIM_DIRS; do \
909 cp
-f
$(CURDIR
)/llvm
/utils
/vim
/$$dir/llvm.vim
$(CURDIR
)/llvm
/utils
/vim
/$$dir/llvm-
$(LLVM_VERSION
).vim
; \
910 if
test -f
$(CURDIR
)/llvm
/utils
/vim
/$$dir/tablegen.vim
; then \
911 cp
-f
$(CURDIR
)/llvm
/utils
/vim
/$$dir/tablegen.vim
$(CURDIR
)/llvm
/utils
/vim
/$$dir/tablegen-
$(LLVM_VERSION
).vim
; \
914 cp
-f
$(CURDIR
)/llvm
/utils
/vim
/vimrc
$(CURDIR
)/llvm
/utils
/vim
/llvm-
$(LLVM_VERSION
)-vimrc
916 cp
-f
$(CURDIR
)/clang
/tools
/clang-format
/clang-format-diff.py
$(CURDIR
)/clang
/tools
/clang-format
/clang-format-diff-
$(LLVM_VERSION
)
918 cp
-f
$(CURDIR
)/clang
/tools
/clang-format
/clang-format.py clang
/tools
/clang-format
/clang-format-
$(LLVM_VERSION
).py
920 rm -rf clang
/tools
/scan-build-
$(LLVM_VERSION
)
921 cp
-fR
$(CURDIR
)/clang
/tools
/scan-build clang
/tools
/scan-build-
$(LLVM_VERSION
)
923 rm -rf clang
/tools
/scan-build-py-
$(LLVM_VERSION
)
924 cp
-fR
$(CURDIR
)/clang
/tools
/scan-build-py clang
/tools
/scan-build-py-
$(LLVM_VERSION
)
925 chmod
+x clang
/tools
/scan-build-py-
$(LLVM_VERSION
)/bin
/*
927 rm -rf clang
/tools
/scan-view-
$(LLVM_VERSION
)
928 cp
-fR
$(CURDIR
)/clang
/tools
/scan-view clang
/tools
/scan-view-
$(LLVM_VERSION
)
930 # Remove some license files
931 rm -f
$(DEB_INST
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/include/llvm
/Support
/LICENSE.TXT
933 # Disable CMake's package validation checks for target files that we may remove.
934 sed
-i
'/_IMPORT_CHECK_TARGETS \(Polly\|sancov\|llvm-omp-device-info\|omptarget\)/ {s|^|#|}' $(DEB_INST
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/lib
/cmake
/llvm
/LLVMExports-
*.cmake
936 # Also disable mlir-* checks in the cmake
937 sed
-i
'/_IMPORT_CHECK_TARGETS \(mlir-\|MLIR\)/ {s|^|#|}' $(DEB_INST
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/lib
/cmake
/llvm
/LLVMExports-
*.cmake
938 sed
-i
'/_cmake_import_check_files_for_mli/ {s|^|#|}' $(DEB_INST
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/lib
/cmake
/llvm
/LLVMExports-release.cmake
939 sed
-i
'/_cmake_import_check_files_for_MLIR/ {s|^|#|}' $(DEB_INST
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/lib
/cmake
/llvm
/LLVMExports-release.cmake
941 # Disable CMake's package validation checks for binaries that may not be installed
942 sed
-i
's|.*_IMPORT_CHECK_FILES_FOR_.*/bin/.*)|#&|' $(DEB_INST
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/lib
/cmake
/clang
/ClangTargets-
*.cmake
944 # Adjust to the existing symlink. See #994827
945 sed
-i
"s|libclang-$(LLVM_VERSION).so.$(LLVM_VERSION).*\"|libclang-$(LLVM_VERSION).so.1\"|" $(DEB_INST
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/lib
/cmake
/clang
/ClangTargets-
*.cmake
947 # Managed in python*-lldb-X.Y.links.in
948 rm -f
$(DEB_INST
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/lib
/python
*/*-packages
/lldb
/_lldb.so
950 # Manage the polly files. Sometimes, we build them. Sometimes not.
951 if
test "$(POLLY_ENABLE)" = yes
; then \
952 mkdir
-p
$(CURDIR
)/debian
/libclang-
$(LLVM_VERSION
)-dev
/usr
/lib
/llvm-
$(LLVM_VERSION
)/lib
/ $(CURDIR
)/debian
/libclang-common-
$(LLVM_VERSION
)-dev
/usr
/lib
/llvm-
$(LLVM_VERSION
)/include/polly
/; \
953 mv
-f
$(DEB_INST
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/lib
/libPolly
* \
954 $(CURDIR
)/debian
/libclang-common-
$(LLVM_VERSION
)-dev
/usr
/lib
/llvm-
$(LLVM_VERSION
)/lib
/; \
955 rm -rf
$(CURDIR
)/debian
/libclang-common-
$(LLVM_VERSION
)-dev
/usr
/lib
/llvm-
$(LLVM_VERSION
)/include/polly
; \
956 mv
-f
$(DEB_INST
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/include/polly
/ \
957 $(CURDIR
)/debian
/libclang-common-
$(LLVM_VERSION
)-dev
/usr
/lib
/llvm-
$(LLVM_VERSION
)/include/; \
960 mkdir
-p
$(CURDIR
)/debian
/usr
/share
/doc
/llvm-
$(LLVM_VERSION
)-doc
/ $(CURDIR
)/debian
/usr
/share
/doc
/clang-
$(LLVM_VERSION
)-doc
/
961 cp
-R
$(TARGET_BUILD_STAGE2
)/docs
/html
$(CURDIR
)/debian
/usr
/share
/doc
/llvm-
$(LLVM_VERSION
)-doc
/
962 cp
-R
$(TARGET_BUILD_STAGE2
)/tools
/clang
/docs
/html
$(CURDIR
)/debian
/usr
/share
/doc
/clang-
$(LLVM_VERSION
)-doc
/
963 cp
-R
$(TARGET_BUILD_STAGE2
)/tools
/clang
/tools
/extra
/docs
/html
$(CURDIR
)/debian
/usr
/share
/doc
/clang-
$(LLVM_VERSION
)-doc
/clang-extra
965 # Rename OCaml bindings
966 if
test "$(OCAML_ENABLE)" = yes
; then \
967 mkdir
-p
"$(DEB_INST)$(OCAML_STDLIB_DIR)"; \
968 mkdir
-p
"$(DEB_INST)usr/lib/llvm-$(LLVM_VERSION)/docs/ocaml/html/html"; \
969 mkdir
-p
"$(DEB_INST)usr/lib/llvm-$(LLVM_VERSION)/share/doc/llvm/ocaml-html/"; \
970 if
test -d
"$(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/lib/ocaml"; then \
971 mv
-f
"$(DEB_INST)usr/lib/llvm-$(LLVM_VERSION)/lib/ocaml" \
972 "$(DEB_INST)$(OCAML_STDLIB_DIR)/llvm-$(LLVM_VERSION)"; \
976 # For some reasons, from Ubuntu jammy, python stuff are installed in /local/lib, move it back
977 if
test -d
$(DEB_INST
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/local
/lib
/; then \
978 mv
$(DEB_INST
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/local
/lib
/* $(DEB_INST
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/lib
/; \
979 rm -f
$(DEB_INST
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/lib
/python
*/*-packages
/six.py
; \
980 ls
$(DEB_INST
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/local
/; \
981 rmdir
$(DEB_INST
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/local
/lib
; \
982 rmdir
$(DEB_INST
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/local
; \
985 # Delete the target build directory to save some space on the build systems
986 # All the files have been installed in $(CURDIR)/debian/tmp/ already
987 rm -rf
$(TARGET_BUILD
)
990 override_dh_makeshlibs
:
991 dh_makeshlibs
-plibclang
$(SONAME_EXT
)-$(LLVM_VERSION
)
992 dh_makeshlibs
-pliblldb-
$(LLVM_VERSION
)
993 dh_makeshlibs
-plibllvm
$(LLVM_VERSION
)
994 dh_makeshlibs
-plibomp
$(SONAME_OPENMP
)-$(LLVM_VERSION
)
995 dh_makeshlibs
--remaining-packages
-V
997 override_dh_shlibdeps
:
998 # Ignore asan libraries. They would trigger dependencies to multiarch libraries
999 dh_shlibdeps
-l
$(DEB_INST
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/lib
/ -Xlibclang_rt.asan
-Xlibclang_rt.asan
-Xlibclang_rt.asan-
*.so
-Xlibclang_rt.asan-
*.so
1001 override_dh_installman
:
1002 if
test -f lld
/docs
/ld.lld
.1; then \
1003 mv lld
/docs
/ld.lld
.1 lld
/docs
/ld.lld-
$(LLVM_VERSION
).1; \
1006 # Make sure that lli manpage is only in llvm-3.2-runtime (See #697117)
1007 rm -f
$(CURDIR
)/debian
/llvm-
$(LLVM_VERSION
)/usr
/share
/man
/man1
/lli
*
1011 : # running out of diskspace on the buildds
1012 find
$(TARGET_BUILD
) -name
'*.o' -o
-name
'*.a' -type f | xargs
-r
rm -f
1013 ifeq (0, $(strip $(shell dpkg
--compare-versions
$(DH_VERSION
) ge
9.20160114; echo
$$?
)))
1014 : # If we don't have the right version of debhelper, don't run the option
1015 dh_strip
-p libclang
$(SONAME_EXT
)-$(LLVM_VERSION
) --dbgsym-migration
='libclang$(SONAME_EXT)-$(LLVM_VERSION)-dbg'
1016 dh_strip
-p libllvm
$(LLVM_VERSION
) --dbgsym-migration
='libllvm$(LLVM_VERSION)-dbg'
1017 dh_strip
-p liblldb-
$(LLVM_VERSION
) --dbgsym-migration
='liblldb-$(LLVM_VERSION)-dbg'
1018 dh_strip
-p libomp
$(SONAME_OPENMP
)-$(LLVM_VERSION
) --dbgsym-migration
='libomp$(SONAME_OPENMP)-$(LLVM_VERSION)-dbg'
1020 # ifeq (${LLD_ENABLE},yes)
1021 # PATH=$(CURDIR)/:$$PATH dh_strip -p liblld-$(LLVM_VERSION) --dbg-package=liblld-$(LLVM_VERSION)-dbg
1023 ifeq ($(shell dpkg
--compare-versions
$(shell dpkg-query
-W
-f
'$${Version}' binutils
) lt
2.31.1-11 ; echo
$$?
),0)
1024 : # building with clang, binutils/strip has hard time stripping some libs because of
1025 : # https://sourceware.org/bugzilla/show_bug.cgi?id=23788
1026 : # use llvm-strip instead
1027 : # Workaround some issues with stripping by using llvm's
1028 if
test ! -f
$(CURDIR
)/strip; then \
1029 ln
-s
$(CURDIR
)/debian
/llvm-
$(LLVM_VERSION
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/bin
/llvm-strip
$(CURDIR
)/strip; \
1031 ls
-al
$(CURDIR
)/debian
/.debhelper
/*/dbgsym-root
/usr
/lib
/debug
/.build-id
/*/*|| true
1032 : # On some old version of Debian (stretch) and Ubuntu, Rules-Requires-Root isn't supported
1033 : # Sometime, it fails because of chown: changing ownership of 'debian/.debhelper/clang-7/dbgsym-root/usr/lib/debug/.build-id/37/ba506ae9d2f82219bf5c552f7c09853052b2b0.debug': Operation not permitted
1034 : # Therefore, continue when we encounter an error
1035 PATH
=$(CURDIR
)/:$$PATH LD_LIBRARY_PATH
=$(DEB_INST
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/lib
/:/usr
/lib
/*/libfakeroot dh_strip
-a
-v || true
1036 : # Remove the workaround
1038 : # for some reasons, the +x might be removed
1039 chmod
-f
+x
$(CURDIR
)/debian
/*/usr
/lib
/llvm-
$(LLVM_VERSION
)/bin
/* || true
1041 # GNU strip doesn't recognize WebAssembly binaries, and actually corrupts them.
1042 # llvm-strip (as of 15.0.2) fails with --strip-debug (but works with --strip-all)
1043 dh_strip
-a
-v
-Xlibclang_rt.builtins-wasm32.a
-Xlibclang_rt.builtins-wasm64.a
1046 override_dh_install
:
1047 ifeq (${POLLY_ENABLE},yes
)
1048 # only for arch:any builds
1049 ifneq (,$(filter libclang-common-
$(LLVM_VERSION
)-dev
, $(shell dh_listpackages
)))
1050 dh_install
-p libclang-common-
$(LLVM_VERSION
)-dev usr
/lib
/llvm-
$(LLVM_VERSION
)/lib
/cmake
/polly
/*.cmake usr
/lib
/llvm-
$(LLVM_VERSION
)/lib
/cmake
/polly
1051 # On old Debian & Ubuntu, removing the files is necessary
1052 rm -rf debian
/tmp
/usr
/lib
/llvm-
$(LLVM_VERSION
)/lib
/cmake
/polly
/*.cmake
1054 rm -rf
$(CURDIR
)/debian
/tmp
/usr
/lib
/llvm-
$(LLVM_VERSION
)/lib
/cmake
/polly
/*.cmake
1057 dh_install
--fail-missing
1059 override_dh_installdeb
:
1060 # Managed by the package
1063 rm -f
$(CURDIR
)/debian
/tmp
/usr
/lib
/llvm-
$(LLVM_VERSION
)/lib
/python
*/*-packages
/lldb
/__init__.pyc
$(CURDIR
)/debian
/python
*-lldb-
$(LLVM_VERSION
)/usr
/lib
/llvm-
$(LLVM_VERSION
)/lib
/python
*/*-packages
/lldb
/__init__.pyc
1064 rm -f
$(CURDIR
)/debian
/clang-
$(LLVM_VERSION
)-examples
/usr
/share
/doc
/clang-
$(LLVM_VERSION
)-examples
/examples
/*Make
*
1066 # the openmp header files moved to the same path as lib clang headers.
1067 # To make sure they aren't conflicting ( https://bugs.llvm.org/show_bug.cgi?id=46977 )
1068 # Remove them from the libclang-common package
1069 rm -f
$(CURDIR
)/debian
/libclang-common-
$(LLVM_VERSION
)-dev
/usr
/lib
/llvm-
$(LLVM_VERSION
)/lib
/clang
/$(LLVM_VERSION_FULL
)/include/omp
*.h
1071 # Remove some libc++ abi files in the libc++ file. See bug #969274
1072 rm -f
$(CURDIR
)/debian
/libc
++-$(LLVM_VERSION
)-dev
/usr
/lib
/llvm-
$(LLVM_VERSION
)/include/c
++/__cxxabi_config.h
$(CURDIR
)/debian
/libc
++-$(LLVM_VERSION
)-dev
/usr
/lib
/llvm-
$(LLVM_VERSION
)/include/c
++/cxxabi.h
1073 # Remove auto generated python pyc
1074 find
$(CURDIR
)/debian
/llvm-
$(LLVM_VERSION
)-tools
/usr
/lib
/llvm-
$(LLVM_VERSION
)/ -name
'*.pyc' | xargs
-r
rm -f
1076 ifeq (${RUN_TEST},yes
)
1077 # List of the archs we know we have 100 % tests working
1078 ARCH_LLVM_TEST_OK
:= i386 amd64
1080 override_dh_auto_test
:
1081 echo
"Running tests: $(RUN_TEST)"
1083 ifneq (,$(findstring $(DEB_HOST_ARCH
),$(ARCH_LLVM_TEST_OK
)))
1084 # logs the output to check-llvm_build_log.txt for validation through autopkgtest
1085 ninja
$(VERBOSE
) -C
$(TARGET_BUILD
) stage2-check-llvm | tee check-llvm_build_log.txt
1087 ninja
$(VERBOSE
) -C
$(TARGET_BUILD
) stage2-check-llvm || true
1091 ninja
$(VERBOSE
) -C
$(TARGET_BUILD
) stage2-check-clang || true
1093 # Clang extra tests (ex: clang-tidy)
1094 ninja
$(VERBOSE
) -C
$(TARGET_BUILD_STAGE2
) check-clang-tools || true
1097 ifeq (${LLD_ENABLE},yes
)
1098 ninja
$(VERBOSE
) -C
$(TARGET_BUILD_STAGE2
) check-lld || true
1102 ninja
$(VERBOSE
) -C
$(TARGET_BUILD_STAGE2
) check-sanitizer || true
1105 ninja
$(VERBOSE
) -C
$(TARGET_BUILD_STAGE2
) check-libcxx || true
1108 ninja
$(VERBOSE
) -C
$(TARGET_BUILD_STAGE2
) check-libcxxabi || true
1111 ninja
$(VERBOSE
) -C
$(TARGET_BUILD_STAGE2
) check-mlir || true
1114 ninja
$(VERBOSE
) -C libclc
/build
test || true
1117 ifeq (,$(filter $(DEB_HOST_ARCH
), $(LLDB_DISABLE_ARCHS
) armhf armel
))
1118 ifneq (,$(filter codecoverage
,$(DEB_BUILD_OPTIONS
)))
1119 # Create a symlink to run the testsuite: see https://bugs.archlinux.org/task/50759
1120 cd
$(CURDIR
)/$(TARGET_BUILD
)/lib
/python
*/*-packages
/; \
1121 if
test ! -e _lldb.so
; then \
1122 ln
-s lldb
/_lldb.so
; \
1124 if
test "$(CODECOVERAGE)" = "no"; then \
1125 LD_LIBRARY_PATH
=$$LD_LIBRARY_PATH:$(CURDIR
)/$(TARGET_BUILD
)/lib
/ ninja
$(VERBOSE
) -C
$(TARGET_BUILD
) check-lldb || true
; \
1127 # remove the workaround
1128 rm $(CURDIR
)/$(TARGET_BUILD
)/lib
/python
*/*-packages
/_lldb.so
1133 #ifeq (${POLLY_ENABLE},yes)
1134 # ninja -C $(TARGET_BUILD) check-polly || true
1137 # Managed by debian build system
1138 rm -f
$(CURDIR
)/$(TARGET_BUILD
)/lib
/python
*/*-packages
/lldb
/_lldb.so
1140 # The compression of the code coverage report is done in the
1141 # hook B21GetCoverageResults on the server
1142 if
test "$(CODECOVERAGE)" = "yes"; then \
1143 REPORT
=reports
/llvm-toolchain.
info; \
1144 mkdir
-p reports
/; \
1145 lcov
--directory
$(TARGET_BUILD
)/ --capture
--ignore-errors source
--output-file
$$REPORT; \
1146 lcov
--remove
$$REPORT "/usr*" -o
$$REPORT; \
1147 genhtml
-o reports
/coverage
--show-details
--highlight
--legend
$$REPORT; \
1148 chmod
0755 `find reports/coverage -type d`; \
1149 chmod
0644 `find reports/coverage -type f`; \
1152 override_dh_auto_test
:
1153 @echo
"Skipping tests"
1157 override_dh_gencontrol
:
1158 dh_gencontrol
-- $(control_vars
)
1161 override_dh_auto_clean
:
1162 rm -rf
$(TARGET_BUILD
) tools
/clang
/include/clang
/Debian
/debian_path.h llvm
/docs
/_build
/ clang
/docs
/_build tools
/clang
/docs
/_html
/
1164 rm -rf cov-int
/ reports
/
1165 rm -f
`ls debian/*.in|sed -e "s|.in$$||g"`
1166 find utils
-name
'*.pyc' | xargs
-r
rm -f
1167 # Use -I because a test has a space in its name
1168 find lldb
/test -iname
'*.pyc' | xargs
-I
{} -r
rm -f
{}
1169 find
test -name
'*.pyc' -o
-name
'*.cm[ix]' | xargs
-r
rm -f
1170 find
test/Bindings
-name
'*.o' | xargs
-r
rm -f
1171 rm -f tools
/clang tools
/polly tools
/lld tools
/lldb projects
/compiler-rt
1172 rm -rf tools
/clang
/tools
/extra clang
/tools
/extra
/
1173 rm -f
$(CURDIR
)/utils
/vim
/llvm-
$(LLVM_VERSION
).vim
$(CURDIR
)/utils
/vim
/tablegen-
$(LLVM_VERSION
).vim
1174 rm -f
$(CURDIR
)/clang
/tools
/clang-format
/clang-format-diff-
$(LLVM_VERSION
)
1175 rm -f
$(CURDIR
)/clang
/tools
/clang-format
/clang-format-
$(LLVM_VERSION
).py
1177 rm -rf build-compiler-rt-wasm32 build-compiler-rt-wasm64
1178 if
test -f lld
/docs
/ld.lld-
$(LLVM_VERSION
).1; then \
1179 mv lld
/docs
/ld.lld-
$(LLVM_VERSION
).1 lld
/docs
/ld.lld
.1; \
1181 for f in debian
/*.in
; do \
1182 f2
=$$(echo
$$f | sed
's/\.in$$//;s/X\.Y/$(LLVM_VERSION)/'); \
1185 if
test "$(SCAN_BUILD)" = "yes"; then \
1186 patch
-f
-R
-p1
< debian
/patches
/on-the-fly
/use-scan-build-runtimes.diff||true
; \
1188 : # for some reason, the docs are written to debian/usr and debian/man ...
1189 rm -rf debian
/usr debian
/man
1190 : # remove extra stamps
1191 rm -f debian-
*-build
1193 .PHONY
: override_dh_strip preconfigure debian-full-build debian-libfuzzer-build debian-libclc-build debian-rtlib-wasm-build