]>
Commit | Line | Data |
---|---|---|
875ec1e7 SL |
1 | #!/usr/bin/make -f |
2 | ||
d2c4dc94 | 3 | # polly, openmp & lldb aren't enabled for every platform |
750a70db SL |
4 | PROJECTS = clang;clang-tools-extra;libcxx;libcxxabi;compiler-rt;lld;debuginfo-tests |
5 | #;mlir | |
3c075840 | 6 | |
43b40b1a | 7 | TARGET_BUILD := build-llvm |
3b17d907 | 8 | TARGET_BUILD_STAGE2 := $(TARGET_BUILD)/tools/clang/stage2-bins |
65242311 | 9 | DEB_INST := $(CURDIR)/debian/tmp/ |
338ca522 | 10 | |
ac7fd96f SL |
11 | # Disable to move the previous method |
12 | BUILD_METHOD := stage2 | |
13 | ||
338ca522 SL |
14 | GXX_VERSIONED_PACKAGE := $(shell dpkg-query -W -f '$${Depends}' g++ | grep -o 'g++-[0-9][0-9.]*' | tail -n1 ) |
15 | GXX_VERSIONED_EXECUTABLE := $(shell dpkg -L $(GXX_VERSIONED_PACKAGE) | grep '/usr/bin/g++-[0-9][0-9.]*' | xargs ls -d | tail -n1 ) | |
16 | GCC_VERSION := $(subst /usr/bin/g++-,,$(GXX_VERSIONED_EXECUTABLE)) | |
17 | ||
42fc7bcf SL |
18 | LLVM_VERSION := $(shell dpkg-parsechangelog | sed -rne "s,^Version: 1:([0-9]+).*,\1,p") |
19 | LLVM_VERSION_FULL := $(shell dpkg-parsechangelog | sed -rne "s,^Version: 1:([0-9.]+)(~|-)(.*),\1,p") | |
ec919ec0 | 20 | ifeq ($(LLVM_VERSION),$(LLVM_VERSION_FULL)) |
228ad20a | 21 | LLVM_VERSION_FULL := $(LLVM_VERSION).0.0 |
ec919ec0 | 22 | endif |
18c9c055 | 23 | |
875ec1e7 | 24 | SONAME_EXT := 1 |
430f8ff5 | 25 | SONAME_OPENMP := 5 |
228ad20a | 26 | # Manage the case when the version is 3.5~svn213052-1~exp1 or 3.4.2-1 |
3f935e99 | 27 | DEBIAN_REVISION := $(shell dpkg-parsechangelog | sed -rne "s,^Version: 1:([0-9.]+)(~|-)(.*),\3,p") |
875ec1e7 SL |
28 | ifneq (,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS)))) |
29 | NJOBS := -j $(subst parallel=,,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS)))) | |
30 | endif | |
31 | ||
af1ace76 | 32 | VENDOR=$(shell lsb_release -is) |
773d6874 SL |
33 | DISTRO=$(shell lsb_release -sc) |
34 | ||
231b7c6e | 35 | DH_VERSION := $(shell dpkg -s debhelper | grep '^Version' | awk '{print $$2}') |
99d00fae | 36 | |
583a0943 | 37 | include /usr/share/dpkg/architecture.mk |
875ec1e7 | 38 | |
feae1e11 | 39 | LDFLAGS_EXTRA = |
4432e6b4 | 40 | CXXFLAGS_EXTRA = |
7d63b357 | 41 | CFLAGS_EXTRA = |
feae1e11 | 42 | CONFIGURE_EXTRA = |
be2b5264 | 43 | CMAKE_EXTRA = -DPYTHON_EXECUTABLE=/usr/bin/python3 |
708c17e6 | 44 | |
6ac04400 RS |
45 | BASE_PATH := $(CURDIR) |
46 | LIBCXX_EXCEPTIONS :=ON | |
47 | ||
48 | ifneq (,$(filter $(DEB_HOST_ARCH),s390x)) | |
49 | LIBCXX_EXCEPTIONS :=OFF | |
50 | endif | |
51 | ||
8e911fd3 | 52 | ifneq (,$(filter $(DEB_HOST_ARCH),i386 armel mips mipsel powerpc powerpcspe riscv64)) |
a859f070 | 53 | CMAKE_EXTRA += -DLIBOMP_LIBFLAGS="-latomic" -DCMAKE_SHARED_LINKER_FLAGS="-latomic" |
861a07c2 SL |
54 | endif |
55 | ||
bc883987 JPAG |
56 | ifneq (,$(filter $(DEB_HOST_ARCH),sparc sparc64)) |
57 | CMAKE_EXTRA += -DLLVM_PARALLEL_LINK_JOBS=4 | |
58 | endif | |
59 | ||
99289a0a | 60 | ifneq (,$(filter $(DEB_HOST_ARCH),armel mipsel powerpc riscv64)) |
75562373 | 61 | # For some reason, in the stage2 build, when clang is used to compile |
f01d96bc | 62 | # itself. The atomic detection is failing on armel and riscv64. Forcing the inclusion everywhere. |
75562373 SL |
63 | LDFLAGS_EXTRA += -latomic |
64 | endif | |
65 | ||
f0b4b8ba VC |
66 | # Ensure fixfilepath feature is disabled. The fixfilepath feature |
67 | # sets a -ffile-prefix-map flag, which is only supported in clang-10. | |
68 | export DEB_BUILD_MAINT_OPTIONS=reproducible=-fixfilepath | |
69 | ||
6ac04400 RS |
70 | # Cxx flags for building libcxx and libcxxabi |
71 | LIBCXXFLAGS := $(shell dpkg-buildflags --get CXXFLAGS) $(shell dpkg-buildflags --get CPPFLAGS) | |
72 | ||
f9c76b9c | 73 | ifeq ($(shell dpkg --compare-versions $(shell dpkg-query -W -f '$${Version}' g++-$(GCC_VERSION)) lt 4.9-20140411-1~ ; echo $$?),0) |
df9425ae | 74 | # Too old version of gcc. Force 4.9 |
87da0c64 | 75 | GCC_VERSION := 4.9 |
123767a4 SL |
76 | endif |
77 | ||
3e6b8215 | 78 | Z3_FLAG = -DLLVM_ENABLE_Z3_SOLVER=OFF |
4a38357f | 79 | ifeq ($(shell dpkg --compare-versions $(shell dpkg-query -W -f '$${Version}' libz3-dev) gt 4.7.0; echo $$?),0) |
3e6b8215 GC |
80 | # no ocaml support in main for Ubuntu |
81 | ifneq ($(shell dpkg-vendor --derives-from Ubuntu && echo yes),yes) | |
4a38357f SL |
82 | Z3_FLAG = -DLLVM_ENABLE_Z3_SOLVER=ON |
83 | endif | |
3e6b8215 | 84 | endif |
4a38357f | 85 | |
bf461e44 | 86 | # Change the default CPU for s390x |
af118900 GC |
87 | ZARCH=z196 |
88 | ifeq ($(shell dpkg-vendor --derives-from Ubuntu && echo yes),yes) | |
89 | ZARCH=z13 | |
90 | endif | |
91 | CMAKE_EXTRA += -DCLANG_SYSTEMZ_DEFAULT_ARCH=$(ZARCH) | |
92 | ||
123767a4 SL |
93 | export CC=gcc-$(GCC_VERSION) |
94 | export CXX=g++-$(GCC_VERSION) | |
95 | ||
100c94ad | 96 | opt_flags = -O2 -DNDEBUG -g1 |
1f3c14f3 | 97 | |
875ec1e7 SL |
98 | ifneq (,$(findstring $(DEB_HOST_ARCH),armel)) |
99 | opt_flags += -marm | |
da042a53 SL |
100 | # 3.8 fails to build, disable the compiler_rt builtins |
101 | # See http://lists.llvm.org/pipermail/llvm-dev/2016-May/099761.html | |
102 | CMAKE_EXTRA += -DCOMPILER_RT_BUILD_BUILTINS=OFF | |
a859f070 SL |
103 | # Check for ancient libstdc++ fails due to atomics usage |
104 | CMAKE_EXTRA_LIBCXX += -DLLVM_COMPILER_CHECKED=ON | |
a6465ecb SL |
105 | # Prevent clang from getting a > v4t default |
106 | # See bug #868779 | |
107 | CMAKE_EXTRA += -DLLVM_HOST_TRIPLE=arm-linux-gnueabi | |
875ec1e7 SL |
108 | endif |
109 | ||
af56187b SL |
110 | |
111 | ifneq (,$(findstring $(DEB_HOST_ARCH),armhf)) | |
112 | # avoid an issue with openmp on armhf | |
113 | CMAKE_EXTRA += -DLLVM_HOST_TRIPLE=armv7l-unknown-linux-gnueabihf | |
114 | endif | |
115 | ||
c27a5a49 | 116 | ifneq (,$(filter $(DEB_HOST_ARCH),mips64el)) |
eac2759e SL |
117 | # avoid an issue with search path on mips64el |
118 | # https://bugs.llvm.org/show_bug.cgi?id=41204 | |
119 | CMAKE_EXTRA += -DLLVM_HOST_TRIPLE=mips64el-linux-gnuabi64 | |
120 | endif | |
121 | ||
122 | ||
4ac4be96 | 123 | ifeq ($(shell dpkg --compare-versions $(shell dpkg-query -W -f '$${Version}' g++-$(GCC_VERSION)) ge 4.8-20121128-1~ ; echo $$?),0) |
a405cb76 SL |
124 | control_vars = '-Vdep:devlibs=libstdc++-$(GCC_VERSION)-dev, libgcc-$(GCC_VERSION)-dev' \ |
125 | '-Vdep:devlibs-objc=libobjc-$(GCC_VERSION)-dev' | |
4ac4be96 | 126 | else ifeq ($(shell dpkg --compare-versions $(shell dpkg-query -W -f '$${Version}' g++-$(GCC_VERSION)) ge 4.7.2-10~ ; echo $$?),0) |
a405cb76 SL |
127 | control_vars = '-Vdep:devlibs=libstdc++6-$(GCC_VERSION)-dev, libgcc-$(GCC_VERSION)-dev' \ |
128 | '-Vdep:devlibs-objc=libobjc-$(GCC_VERSION)-dev' | |
712c1081 | 129 | else |
4ac4be96 | 130 | control_vars = '-Vdep:devlibs=libstdc++6-$(GCC_VERSION)-dev' |
712c1081 SL |
131 | endif |
132 | ||
7d63b357 SL |
133 | # Disabled: |
134 | # Host compiler does not support '-fuse-ld=lld' | |
135 | # USE_LLD_ARCHS := amd64 | |
136 | # ifneq (,$(filter $(DEB_HOST_ARCH),$(USE_LLD_ARCHS))) | |
137 | # CMAKE_EXTRA += -DLLVM_ENABLE_LLD=ON | |
138 | # endif | |
139 | ||
e461697a | 140 | BINUTILS_GOLD_ARCHS := amd64 arm64 armhf i386 ppc64 x32 s390x hurd-i386 kfreebsd-amd64 kfreebsd-i386 |
128450ef | 141 | ifeq ($(shell dpkg --compare-versions $(shell dpkg-query -W -f '$${Version}' binutils) ge 2.23.1-1~exp3 ; echo $$?),0) |
584e8ad0 | 142 | ifneq (,$(filter $(DEB_HOST_ARCH),$(BINUTILS_GOLD_ARCHS))) |
ebe2c90f | 143 | # -fused-ld=gold enables the gold linker (but is not supported by all archs / distro) |
498563ae | 144 | LDFLAGS_EXTRA += -fuse-ld=gold |
7d63b357 | 145 | #--no-keep-files-mapped --no-map-whole-files |
498563ae SL |
146 | CXXFLAGS_EXTRA += -fuse-ld=gold |
147 | CFLAGS_EXTRA += -fuse-ld=gold | |
7d63b357 | 148 | #-Wl,--no-keep-files-mapped -Wl,--no-map-whole-files |
d4136d0a | 149 | CMAKE_EXTRA += -DLLVM_BINUTILS_INCDIR=/usr/include/ |
708c17e6 | 150 | endif |
ebe2c90f | 151 | endif |
875ec1e7 | 152 | |
ee6846e2 | 153 | CODECOVERAGE=no |
772552aa SL |
154 | ifneq (,$(filter codecoverage,$(DEB_BUILD_OPTIONS))) |
155 | # enable the code coverage | |
156 | CODECOVERAGE=yes | |
157 | # for -fvisibility-inlines-hidden see http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20130729/183016.html | |
158 | CXXFLAGS_EXTRA += -fprofile-arcs -ftest-coverage | |
159 | LDFLAGS_EXTRA += -coverage -lgcov | |
160 | RUN_TEST=yes | |
5a1349d0 SL |
161 | # OpenMP doesn't respect LDFLAGS |
162 | CMAKE_EXTRA+= -DLIBOMP_LDFLAGS="-coverage -lgcov" # don't pass LDFLAGS_EXTRA because it expects gcc arg | |
772552aa SL |
163 | endif |
164 | ||
498563ae | 165 | # Enable for bootstrap |
f72c848b | 166 | LDFLAGS_EXTRA += -fPIC -Wno-unused-command-line-argument -Wno-unknown-warning-option -Wl,--build-id |
1dfde1e3 | 167 | CXXFLAGS_EXTRA += -fPIC -Wno-unused-command-line-argument -Wno-unknown-warning-option |
3c89d34e | 168 | BOOTSTRAP_CXXFLAGS_EXTRA = $(CXXFLAGS_EXTRA) # Nothing for now. Keeping in case we need it |
1dfde1e3 | 169 | CFLAGS_EXTRA += -fPIC -Wno-unused-command-line-argument -Wno-unknown-warning-option |
3c89d34e | 170 | BOOTSTRAP_CFLAGS_EXTRA = $(CFLAGS_EXTRA) # Nothing for now. Keeping in case we need it |
498563ae | 171 | |
d5ce4ee9 | 172 | # Enable polly (or not) |
e213b377 | 173 | POLLY_ENABLE=yes |
b5662072 | 174 | ifneq (,$(filter $(DEB_HOST_ARCH), powerpc powerpcspe)) |
e213b377 | 175 | POLLY_ENABLE=no |
d2c4dc94 | 176 | else |
4e2033bd | 177 | PROJECTS+=;polly |
b6af4ab8 | 178 | endif |
d5ce4ee9 | 179 | |
514529a9 SL |
180 | # Enable openmp (or not) |
181 | OPENMP_ENABLE=yes | |
a859f070 | 182 | ifneq (,$(filter $(DEB_HOST_ARCH), mips mipsel powerpc powerpcspe riscv64 sparc64 s390x x32)) |
514529a9 | 183 | OPENMP_ENABLE=no |
d2c4dc94 | 184 | else |
4e2033bd | 185 | PROJECTS+=;openmp |
514529a9 SL |
186 | endif |
187 | ||
f5a56de6 | 188 | RUN_TEST=yes |
b0c28d11 | 189 | ifneq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) |
f5a56de6 SL |
190 | RUN_TEST=no |
191 | endif | |
3bea2aed GC |
192 | ifeq ($(shell dpkg-vendor --derives-from Ubuntu && echo yes),yes) |
193 | ifeq (riscv64,$(DEB_HOST_ARCH)) | |
194 | RUN_TEST=no | |
195 | endif | |
196 | endif | |
f5a56de6 | 197 | |
f0876adf SL |
198 | # llvm tests timeout, disable it on mipsel |
199 | ifeq (mipsel,$(DEB_HOST_ARCH)) | |
200 | RUN_TEST=no | |
201 | endif | |
202 | ||
afd4c9da SL |
203 | ifneq (,$(filter scan-build,$(DEB_BUILD_OPTIONS))) |
204 | # enable the build using scan-build | |
d4afd42d SL |
205 | # The package are installed through the variable declarations: |
206 | # OTHERMIRROR="deb http://llvm.org/apt/unstable/ llvm-toolchain main" | |
66eb6597 | 207 | # EXTRAPACKAGES="clang-X" |
cdfc21c7 SL |
208 | PRE_PROCESS=scan-build-$(LLVM_VERSION) --show-description -analyzer-config stable-report-filename=true |
209 | # -enable-checker optin.performance.Padding | |
b1ecb207 | 210 | PRE_PROCESS_CONF=scan-build-$(LLVM_VERSION) |
d4afd42d | 211 | # no need to run tests in this case |
b553daa1 | 212 | RUN_TEST=no |
0ee244c8 | 213 | CONFIGURE_EXTRA += --enable-assertions |
dd8713ff | 214 | CMAKE_EXTRA += -DLLVM_ENABLE_ASSERTIONS=ON |
afd4c9da SL |
215 | endif |
216 | ||
d4c5d744 SL |
217 | ifneq (,$(filter coverity,$(DEB_BUILD_OPTIONS))) |
218 | # enable the build using coverity | |
7353a359 | 219 | # pbuilder contains BINDMOUNTS="/opt/cov-analysis/" |
10a05cac | 220 | # And we have some pbuilder hooks to configure and pack the result |
d1ca05fc | 221 | # Where the binaries are installed on the jenkins instance |
0c8aea33 | 222 | PRE_PROCESS=PATH=$$PATH:/opt/cov-analysis/bin/ cov-build --dir cov-int |
850ed343 SL |
223 | # We don't want to check the temporary files produced by the configure |
224 | PRE_PROCESS_CONF= | |
bc3c8281 | 225 | COVERITY_ENABLE=1 |
0ee244c8 | 226 | CONFIGURE_EXTRA += --enable-assertions |
dd8713ff | 227 | CMAKE_EXTRA += -DLLVM_ENABLE_ASSERTIONS=ON |
d4c5d744 | 228 | # no need to run tests in this case |
b553daa1 | 229 | RUN_TEST=no |
b50b5e83 SL |
230 | else |
231 | COVERITY_ENABLE=0 | |
d4c5d744 SL |
232 | endif |
233 | ||
e4e11479 | 234 | LLDB_ENABLE=yes |
4baa800e | 235 | LLDB_DISABLE_ARCHS := hurd-i386 ia64 powerpc powerpcspe ppc64 riscv64 sparc64 |
03b2cfea | 236 | # hurd has threading issues |
03b2cfea SL |
237 | ifeq (,$(filter-out $(LLDB_DISABLE_ARCHS), $(DEB_HOST_ARCH))) |
238 | # Disable LLDB for this arch. | |
d2c4dc94 | 239 | LLDB_ENABLE=no |
bbdfe123 SL |
240 | else |
241 | # See https://llvm.org/bugs/show_bug.cgi?id=28898 | |
da19aa0c SL |
242 | # Enable it again as it seems it is fixed upstream https://bugs.llvm.org/show_bug.cgi?id=35291 |
243 | # CMAKE_EXTRA += -DLLDB_DISABLE_LIBEDIT=ON | |
4e2033bd | 244 | PROJECTS+=;lldb |
e4e11479 SL |
245 | endif |
246 | ||
5c2afe58 | 247 | LLD_ENABLE=yes |
03b2cfea | 248 | |
54017839 SL |
249 | ifneq (,$(filter $(DEB_HOST_ARCH_OS),linux)) |
250 | # only for linux | |
ff4caed6 | 251 | CMAKE_EXTRA += -DLLVM_USE_PERF=yes -DLLVM_ENABLE_LIBPFM=ON |
54017839 SL |
252 | endif |
253 | ||
1bc431e7 | 254 | # Use thinlto for the link phase |
e29bc92a | 255 | THIN_UNSUPPORTED_DISTRO := stretch xenial trusty |
773d6874 | 256 | # Don't enable for old distros |
25057e14 SL |
257 | ifeq (,$(filter $(DISTRO), $(THIN_UNSUPPORTED_DISTRO))) |
258 | # Only enable it for archs supporting gold | |
259 | ifneq (,$(filter $(DEB_HOST_ARCH),$(BINUTILS_GOLD_ARCHS))) | |
1243584e | 260 | # armhf is not yet quite ready for Thin, it FTBFS |
a9d36e7f | 261 | # 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 |
1243584e | 262 | ifeq (,$(filter $(DEB_HOST_ARCH), armhf)) |
44aa60f6 SL |
263 | # Use BOOTSTRAP_LLVM_ENABLE_LTO to make sure that it isn't used |
264 | # when running stage1 with gcc | |
265 | # For now, disable ThinLTO usage because: | |
266 | # * LLVM_ENABLE_LTO doesn't work with gcc >= 9 (option not accepted) | |
267 | # * BOOTSTRAP_LLVM_ENABLE_LTO is producing some large binary | |
268 | # See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=943623 | |
269 | # CMAKE_EXTRA += -DBOOTSTRAP_LLVM_ENABLE_LTO="Thin" | |
773d6874 | 270 | endif |
25057e14 | 271 | endif |
1243584e | 272 | endif |
1bc431e7 | 273 | |
21cd3633 SL |
274 | DH_OPTIONS= |
275 | OCAML_ENABLE= no | |
21abd3c8 | 276 | OCAML_ARCHS := amd64 arm64 armhf ppc64el s390x |
21cd3633 SL |
277 | ifneq (,$(filter $(DEB_HOST_ARCH),$(OCAML_ARCHS))) |
278 | # Enable OCAML for this arch. | |
eac6d991 SL |
279 | OCAML_ENABLE=yes |
280 | OCAML_STDLIB_DIR ?= $(shell ocamlc -where) | |
281 | DH_OPTIONS=--with ocaml | |
21cd3633 SL |
282 | endif |
283 | ||
45f800fa SL |
284 | LIBFUZZER_ENABLE=yes |
285 | ifeq (,$(filter $(DEB_HOST_ARCH_OS),linux)) | |
286 | LIBFUZZER_ENABLE=no | |
287 | endif | |
288 | ||
430f8ff5 RS |
289 | ifneq (,$(filter $(DEB_HOST_ARCH), mips mipsel)) |
290 | LIBOMP_ARCH = mips | |
291 | endif | |
292 | ||
293 | ifneq (,$(filter $(DEB_HOST_ARCH), mips64 mips64el)) | |
294 | LIBOMP_ARCH = mips64 | |
295 | endif | |
296 | ||
712c1081 | 297 | |
21cd3633 SL |
298 | %: |
299 | dh $@ $(DH_OPTIONS) | |
7aec1357 | 300 | |
4e2033bd SL |
301 | # For some reasons, some spaces are added, removing them |
302 | PROJECTS_LIST := $(shell echo "$(PROJECTS)"|sed -e "s| ||g") | |
8c0727ae SL |
303 | |
304 | preconfigure: | |
795b5b2a SL |
305 | @echo "DEB_HOST_MULTIARCH=$(DEB_HOST_MULTIARCH)" |
306 | @echo "DEB_HOST_GNU_TYPE=$(DEB_HOST_GNU_TYPE)" | |
307 | @echo "DEB_HOST_ARCH_BITS=$(DEB_HOST_ARCH_BITS)" | |
308 | @echo "DEB_HOST_ARCH=$(DEB_HOST_ARCH)" | |
309 | @echo "DEB_HOST_ARCH_OS=$(DEB_HOST_ARCH_OS)" | |
e29bc92a | 310 | @echo "DISTRO=$(DISTRO)" |
386d2533 | 311 | @echo "GCC_VERSION=$(GCC_VERSION)" |
4e2033bd | 312 | @echo 'PROJECTS=$(PROJECTS_LIST)' |
795b5b2a | 313 | |
8c0727ae SL |
314 | for f in debian/*.in; do \ |
315 | f2=$$(echo $$f | sed 's/\.in$$//;s/X\.Y/$(LLVM_VERSION)/'); \ | |
316 | echo "$$f => $$f2"; \ | |
317 | sed -e 's|@DEB_HOST_MULTIARCH@|$(DEB_HOST_MULTIARCH)|g' \ | |
21cd3633 | 318 | -e "s|@OCAML_STDLIB_DIR@|$(OCAML_STDLIB_DIR)|g" \ |
8c0727ae SL |
319 | -e "s|@LLVM_VERSION_FULL@|$(LLVM_VERSION_FULL)|g" \ |
320 | -e "s|@LLVM_VERSION@|$(LLVM_VERSION)|g" $$f > $$f2; \ | |
321 | done | |
875ec1e7 | 322 | |
c1e98235 | 323 | # Make install file executable for dh-exec |
4b61e92a | 324 | chmod +x debian/llvm-$(LLVM_VERSION)-dev.install debian/libclang-common-$(LLVM_VERSION)-dev.install debian/clang-tools-$(LLVM_VERSION).install debian/libomp-$(LLVM_VERSION)-dev.install |
c1e98235 | 325 | |
27d2c87d SL |
326 | # DH doesn't support the [power ...] in install on Ubuntu trusty |
327 | # fails with cp: cannot stat 'debian/tmp/[!powerpc': No such file or directory | |
328 | if test "$(DISTRO)" = "trusty"; then \ | |
329 | sed -i -e "s|\[\!powerpc \!powerpcspe\] ||g" debian/llvm-$(LLVM_VERSION)-dev.install; \ | |
330 | fi | |
331 | ||
03b2cfea | 332 | # Override this two targets. They are trying to manage the .in conversion for me |
21cd3633 SL |
333 | override_dh_ocamlinit: |
334 | override_dh_ocamlclean: | |
7aec1357 | 335 | |
8c0727ae | 336 | override_dh_auto_configure: preconfigure |
0118a145 SL |
337 | echo "Using gcc: " |
338 | $(CC) -v | |
875ec1e7 | 339 | mkdir -p $(TARGET_BUILD) |
43b40b1a | 340 | mkdir -p clang/include/clang/Debian |
675894d1 | 341 | sed -e "s|@DEB_PATCHSETVERSION@|$(DEBIAN_REVISION)|" \ |
43b40b1a | 342 | debian/debian_path.h > clang/include/clang/Debian/debian_path.h |
875ec1e7 | 343 | |
fe7a4317 | 344 | # Configure coverity (we need the compilers) + work around perf issues |
c6ad4a0d | 345 | -(if test $(COVERITY_ENABLE) -eq 1; then \ |
0c8aea33 | 346 | export PATH=$$PATH:/opt/cov-analysis/bin/; \ |
9f86c8bf | 347 | cov-configure --compiler clang --comptype clang; \ |
cff0f5da SL |
348 | cov-configure --compiler gcc-$(GCC_VERSION) --comptype gcc; \ |
349 | cov-configure --compiler g++-$(GCC_VERSION) --comptype gcc; \ | |
4432e6b4 | 350 | cov-configure -co /usr/bin/g++-$(GCC_VERSION) --comptype gcc -- -fPIC -std=c++11; \ |
cff0f5da | 351 | cov-configure -co /usr/bin/gcc-$(GCC_VERSION) --comptype gcc -- -fPIC; \ |
4432e6b4 | 352 | cov-configure -co /usr/bin/g++-$(GCC_VERSION) --comptype gcc -- -fPIC -std=c++11 -fno-exceptions; \ |
5f3fa775 | 353 | cov-configure -co /usr/bin/g++-$(GCC_VERSION) --comptype gcc --template \ |
fe7a4317 SL |
354 | --xml-option append_arg:"--ppp_translator" \ |
355 | --xml-option append_arg:"replace/llvm::AlignOf<PrevTy>::Alignment/(llvm::AlignOf<PrevTy>::Alignment)" \ | |
356 | --xml-option append_arg:"--ppp_translator" \ | |
357 | --xml-option append_arg:"replace/llvm::AlignOf<NextTy>::Alignment/(llvm::AlignOf<NextTy>::Alignment)"; \ | |
358 | cov-configure --compiler c++ --comptype g++ --template \ | |
359 | --xml-option append_arg:"--ppp_translator" \ | |
360 | --xml-option append_arg:"replace/llvm::AlignOf<PrevTy>::Alignment/(llvm::AlignOf<PrevTy>::Alignment)" \ | |
361 | --xml-option append_arg:"--ppp_translator" \ | |
779e06a3 | 362 | --xml-option append_arg:"replace/llvm::AlignOf<NextTy>::Alignment/(llvm::AlignOf<NextTy>::Alignment)"; \ |
c6ad4a0d | 363 | fi) |
bc3c8281 | 364 | |
f6d87b0d SL |
365 | echo "Running tests: $(RUN_TEST)" |
366 | ||
73fd0457 SL |
367 | # if cmake is installed in /tmp/cmake/ uses it |
368 | # Used to build llvm on old ubuntu (precise) on the llvm.org/apt/ ci | |
0ccac78e | 369 | CMAKE_BIN=cmake; \ |
470974ae SL |
370 | if test -f /tmp/cmake/bin/cmake; then \ |
371 | CMAKE_BIN=/tmp/cmake/bin/cmake; \ | |
0ccac78e | 372 | fi; \ |
3d7a27ec | 373 | echo "Using cmake: $$CMAKE_BIN"; \ |
5eecc2f0 | 374 | cd $(TARGET_BUILD) && \ |
3c075840 | 375 | $(PRE_PROCESS_CONF) $$CMAKE_BIN ../llvm/ \ |
4e2033bd | 376 | -DLLVM_ENABLE_PROJECTS="$(PROJECTS_LIST)" \ |
5eecc2f0 SL |
377 | -DCMAKE_INSTALL_PREFIX=/usr/lib/llvm-$(LLVM_VERSION) \ |
378 | -DCMAKE_VERBOSE_MAKEFILE=ON \ | |
379 | -DCMAKE_BUILD_TYPE=RelWithDebInfo \ | |
19e475ab | 380 | -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="$(opt_flags)" \ |
16a8720d | 381 | -DLLVM_LINK_LLVM_DYLIB=ON \ |
09c42dc5 | 382 | -DLLVM_INSTALL_UTILS=ON \ |
5eecc2f0 SL |
383 | -DLLVM_VERSION_SUFFIX= \ |
384 | -DLLVM_ENABLE_SPHINX=ON \ | |
a0f5abc2 | 385 | -DSPHINX_WARNINGS_AS_ERRORS=OFF \ |
5eecc2f0 SL |
386 | -DLLVM_ENABLE_RTTI=ON \ |
387 | -DLLVM_ENABLE_FFI=ON \ | |
117c9717 | 388 | -DLLVM_ENABLE_DUMP=ON \ |
5eecc2f0 | 389 | $(CMAKE_EXTRA) \ |
c8e7ff43 | 390 | -DLIBCLANG_LIBRARY_VERSION=$(SONAME_EXT) \ |
6a26661f | 391 | -DCLANG_LINK_CLANG_DYLIB=ON \ |
f0f0ba2c | 392 | -DENABLE_LINKER_BUILD_ID=ON \ |
a615a0eb | 393 | -DPOLLY_BUNDLED_JSONCPP=OFF \ |
6a26661f | 394 | -DCOMPILER_RT_USE_LIBCXX=NO \ |
4a38357f | 395 | $(Z3_FLAG) \ |
a6cb0b2d | 396 | -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="AVR" \ |
eb425e63 | 397 | -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON \ |
7d63b357 | 398 | -DCLANG_VENDOR=$(VENDOR) \ |
2c3d58ea | 399 | -DCLANG_ENABLE_BOOTSTRAP=ON \ |
1ea7b813 | 400 | -DCLANG_BUILD_EXAMPLES=OFF \ |
18cbb92f | 401 | -DLLVM_POLLY_LINK_INTO_TOOLS=ON \ |
2c3d58ea SL |
402 | -DBOOTSTRAP_CMAKE_CXX_FLAGS='$(BOOTSTRAP_CXXFLAGS_EXTRA)' \ |
403 | -DBOOTSTRAP_CMAKE_C_FLAGS='$(BOOTSTRAP_CFLAGS_EXTRA)' \ | |
e6e99188 | 404 | -DCLANG_BOOTSTRAP_PASSTHROUGH="CMAKE_INSTALL_PREFIX;CMAKE_VERBOSE_MAKEFILE;CMAKE_BUILD_TYPE;CMAKE_CXX_FLAGS_RELWITHDEBINFO;LLVM_LINK_LLVM_DYLIB;LLVM_INSTALL_UTILS;LLVM_VERSION_SUFFIX;LLVM_ENABLE_SPHINX;SPHINX_WARNINGS_AS_ERRORS;LLVM_BUILD_LLVM_DYLIB;LLVM_ENABLE_RTTI;LLVM_ENABLE_FFI;LIBCLANG_LIBRARY_VERSION;ENABLE_LINKER_BUILD_ID;POLLY_BUNDLED_JSONCPP;LLVM_EXPERIMENTAL_TARGETS_TO_BUILD;LLVM_USE_PERF;LLVM_ENABLE_ASSERTIONS;LLVM_BINUTILS_INCDIR;LLVM_HOST_TRIPLE;LLVM_COMPILER_CHECKED;COMPILER_RT_BUILD_BUILTINS;LIBOMP_LIBFLAGS;CMAKE_SHARED_LINKER_FLAGS;PYTHON_EXECUTABLE;LLVM_ENABLE_Z3_SOLVER;LLVM_POLLY_LINK_INTO_TOOLS;CLANG_VENDOR" |
77d09c0d SL |
405 | FOUND_VERSION=`grep LLVM_VERSION_STRING build-llvm/include/llvm/Config/llvm-config.h|cut -d\" -f2`; \ |
406 | if ! echo "$(LLVM_VERSION_FULL)"|grep "$$FOUND_VERSION"; then \ | |
407 | echo "mistmatch of version. Found: $$FOUND_VERSION / Expected: $(LLVM_VERSION_FULL)"; \ | |
408 | fi | |
7d63b357 SL |
409 | |
410 | # make | |
411 | VERBOSE=VERBOSE=1 | |
412 | # ninja | |
413 | #VERBOSE=-v | |
414 | ||
7c261d5b | 415 | debian-full-build: |
08afca5b | 416 | $(PRE_PROCESS) make $(NJOBS) -C $(TARGET_BUILD) $(VERBOSE) CFLAGS="$(CFLAGS_EXTRA)" CXXFLAGS="$(CXXFLAGS_EXTRA)" LDFLAGS="$(LDFLAGS_EXTRA)" REQUIRES_RTTI=1 DEBUGMAKE=1 $(BUILD_METHOD) |
7d63b357 SL |
417 | |
418 | # Check the stage 2 build worked | |
ac7fd96f | 419 | if test "$(BUILD_METHOD)" = "stage2"; then \ |
3b17d907 | 420 | if ! readelf --string-dump .comment $(TARGET_BUILD_STAGE2)/bin/clang 2>&1|grep -q "clang version"; then \ |
7d63b357 | 421 | echo "clang hasn't been built using clang. Bye bye. Check that the stage2 build has been done."; \ |
78a11429 | 422 | exit 2; \ |
ac7fd96f | 423 | fi; \ |
7d63b357 | 424 | fi |
78a11429 SL |
425 | if ldd $(TARGET_BUILD_STAGE2)/lib/libclang-$(LLVM_VERSION).so.1|grep -q libclang-cpp-$(LLVM_VERSION); then \ |
426 | echo "libclang-$(LLVM_VERSION).so.1 depends on libclang-cpp. Should not be the case"; \ | |
427 | exit 2; \ | |
428 | fi | |
7d63b357 SL |
429 | touch $@ |
430 | ||
431 | debian-libfuzzer-build: | |
432 | ifeq (${LIBFUZZER_ENABLE},yes) | |
bb5876c1 | 433 | cd $(TARGET_BUILD); \ |
7d63b357 SL |
434 | CFLAGS=`dpkg-buildflags --get CFLAGS`; \ |
435 | CFLAGS="$$CFLAGS `dpkg-buildflags --get CPPFLAGS`"; \ | |
436 | echo $$CFLAGS; \ | |
d0e691ea | 437 | $(BASE_PATH)/$(TARGET_BUILD_STAGE2)/bin/clang++ -c $$CFLAGS -std=c++11 $(BASE_PATH)/compiler-rt/lib/fuzzer/*.cpp -IFuzzer; \ |
7d63b357 SL |
438 | ar ruv libFuzzer.a Fuzzer*.o |
439 | endif | |
440 | touch $@ | |
441 | ||
a615a0eb | 442 | |
6ac04400 RS |
443 | LIBCXX_CMAKE_OPTIONS := \ |
444 | -DCMAKE_INSTALL_PREFIX=/usr/lib/llvm-$(LLVM_VERSION) \ | |
3b17d907 | 445 | -DLLVM_CONFIG_PATH=$(CURDIR)/$(TARGET_BUILD_STAGE2)/bin/llvm-config \ |
6ac04400 | 446 | -DCMAKE_BUILD_TYPE=RelWithDebInfo \ |
3b17d907 SL |
447 | -DCMAKE_CXX_COMPILER=$(CURDIR)/$(TARGET_BUILD_STAGE2)/bin/clang++ \ |
448 | -DCMAKE_C_COMPILER=$(CURDIR)/$(TARGET_BUILD_STAGE2)/bin/clang \ | |
6ac04400 RS |
449 | -DCMAKE_CXX_FLAGS="$(LIBCXXFLAGS)" \ |
450 | -DCMAKE_EXE_LINKER_FLAGS="" \ | |
451 | -DCMAKE_SHARED_LINKER_FLAGS="" \ | |
452 | -DCMAKE_MODULE_LINKER_FLAGS="" \ | |
3b17d907 SL |
453 | -DCMAKE_AR=$(CURDIR)/$(TARGET_BUILD_STAGE2)/bin/llvm-ar \ |
454 | -DCMAKE_RANLIB=$(CURDIR)/$(TARGET_BUILD_STAGE2)/bin/llvm-ranlib \ | |
2aa08a74 | 455 | -DLLVM_EXTERNAL_LIT=$(BASE_PATH)/llvm/utils/lit/lit.py \ |
0e0945ea | 456 | -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON \ |
6f053508 SL |
457 | -DLIBCXX_USE_COMPILER_RT=YES \ |
458 | -DLIBCXXABI_USE_COMPILER_RT=YES \ | |
a859f070 SL |
459 | $(CMAKE_EXTRA) \ |
460 | $(CMAKE_EXTRA_LIBCXX) | |
6ac04400 | 461 | |
7d63b357 SL |
462 | debian-libcxx-build: |
463 | # Builds libcxx | |
6ac04400 | 464 | |
6ac04400 | 465 | mkdir -p libcxx/build |
7d63b357 | 466 | mkdir -p libcxxabi/build |
6ac04400 | 467 | |
0486b90d SL |
468 | CMAKE_BIN=cmake; \ |
469 | if test -f /tmp/cmake/bin/cmake; then \ | |
470 | CMAKE_BIN=/tmp/cmake/bin/cmake; \ | |
471 | fi; \ | |
472 | echo "Using cmake: $$CMAKE_BIN"; \ | |
6ac04400 | 473 | cd libcxxabi/build && \ |
0486b90d | 474 | $(PRE_PROCESS_CONF) $$CMAKE_BIN ../ \ |
6ac04400 RS |
475 | $(LIBCXX_CMAKE_OPTIONS) \ |
476 | -DLIBCXXABI_LIBCXX_PATH=$(BASE_PATH)/libcxx \ | |
477 | -DLIBCXXABI_LIBCXX_LIBRARY_PATH=$(BASE_PATH)/libcxx/build/lib \ | |
b86536b8 | 478 | -DLIBCXXABI_LIBCXX_INCLUDES=$(BASE_PATH)/libcxx/include \ |
6ac04400 | 479 | -DLIBCXXABI_ENABLE_EXCEPTIONS=$(LIBCXX_EXCEPTIONS) \ |
acededc7 | 480 | -DLLVM_ENABLE_RTTI=ON && \ |
7d63b357 SL |
481 | $(PRE_PROCESS_CONF) make $(NJOBS) $(VERBOSE) CXXFLAGS="$(CXXFLAGS_EXTRA)" LDFLAGS="$(LDFLAGS_EXTRA)" |
482 | touch $@ | |
483 | ||
484 | debian-libcxxabi-build: | |
485 | # Builds libcxxabi | |
486 | ||
487 | mkdir -p libcxxabi/build | |
6ac04400 | 488 | |
0486b90d SL |
489 | CMAKE_BIN=cmake; \ |
490 | if test -f /tmp/cmake/bin/cmake; then \ | |
491 | CMAKE_BIN=/tmp/cmake/bin/cmake; \ | |
492 | fi; \ | |
493 | echo "Using cmake: $$CMAKE_BIN"; \ | |
6ac04400 | 494 | cd libcxx/build && \ |
0486b90d | 495 | $(PRE_PROCESS_CONF) $$CMAKE_BIN ../ \ |
6ac04400 | 496 | $(LIBCXX_CMAKE_OPTIONS) \ |
e54f11d3 | 497 | -DLIBCXX_CXX_ABI=libcxxabi \ |
6ac04400 RS |
498 | -DLIBCXX_CXX_ABI_INCLUDE_PATHS=$(BASE_PATH)/libcxxabi/include \ |
499 | -DLIBCXX_CXX_ABI_LIBRARY_PATH=$(BASE_PATH)/libcxxabi/build/lib \ | |
500 | -DLIBCXX_ENABLE_EXCEPTIONS=$(LIBCXX_EXCEPTIONS) \ | |
acededc7 | 501 | -DLIBCXX_INSTALL_EXPERIMENTAL_LIBRARY=ON && \ |
7d63b357 SL |
502 | $(PRE_PROCESS_CONF) make $(NJOBS) $(VERBOSE) CXXFLAGS="$(CXXFLAGS_EXTRA)" LDFLAGS="$(LDFLAGS_EXTRA)" |
503 | touch $@ | |
504 | ||
7c261d5b | 505 | override_dh_auto_build: debian-full-build debian-libfuzzer-build debian-libcxx-build debian-libcxxabi-build |
6ac04400 | 506 | |
a6c0767f SL |
507 | override_dh_prep: build_doc |
508 | dh_prep | |
509 | ||
76129c23 | 510 | build_doc: |
e97c5274 | 511 | cd $(CURDIR)/llvm/docs && make -f Makefile.sphinx && make -f Makefile.sphinx man |
c0198ab3 | 512 | cd $(CURDIR)/clang/docs && make -f Makefile.sphinx && make -f Makefile.sphinx man |
dfa81be0 | 513 | -(if test "$(OCAML_ENABLE)" = yes; then \ |
3b17d907 | 514 | make $(NJOBS) -C "$(TARGET_BUILD_STAGE2)/docs" ocaml_doc; \ |
dfa81be0 | 515 | fi) |
c0198ab3 | 516 | |
df8b6900 JPAG |
517 | make $(NJOBS) -C $(TARGET_BUILD_STAGE2) docs-llvm-html docs-clang-html docs-clang-tools-html docs-clang-tools-man docs-clang-man docs-llvm-man |
518 | ||
519 | ifeq (${POLLY_ENABLE},yes) | |
520 | make $(NJOBS) -C $(TARGET_BUILD_STAGE2) docs-polly-html docs-polly-man | |
521 | endif | |
875ec1e7 | 522 | |
a6c0767f | 523 | # Rename manpages |
a9ab44f7 | 524 | d=$(CURDIR)/docs/_build/man/; \ |
630eb4ec | 525 | if test -d $$d; then \ |
a9ab44f7 SL |
526 | cd $$d; \ |
527 | for f in *.1; do \ | |
528 | echo "$$f"|grep $(LLVM_VERSION) || mv $$f `echo $$f|sed "s|\.1|-$(LLVM_VERSION).1|"`; \ | |
529 | done; \ | |
530 | else \ | |
531 | echo "could not find $$d"; \ | |
630eb4ec | 532 | fi |
65fb2295 SL |
533 | # the clang doc generation only generates clang manpage |
534 | # When it will do more, we should move that in the loop above | |
a9ab44f7 | 535 | cd $(CURDIR)/clang/docs/_build/man/; mv clang.1 clang-$(LLVM_VERSION).1 |
fe848490 | 536 | |
76129c23 | 537 | # Remove the copy of jquery. See bug #701087 |
dbba4938 | 538 | 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 \ |
da7745a4 SL |
539 | cd $$d && rm -f jquery.js && ln -s /usr/share/javascript/jquery/jquery.js && cd -; \ |
540 | cd $$d && rm -f underscore.js && ln -s /usr/share/javascript/underscore/underscore.js && cd -; \ | |
76129c23 SL |
541 | done |
542 | ||
7d1b8a2a | 543 | mkdir -p debian/man/ |
1037ae5f SL |
544 | ls -al clang/tools/scan-view/bin/scan-view |
545 | clang/tools/scan-view/bin/scan-view --help || true | |
546 | help2man --no-info --version-string=$(LLVM_VERSION) clang/tools/scan-view/bin/scan-view > debian/man/scan-view-$(LLVM_VERSION).1 || true | |
547 | help2man --no-info --version-string=$(LLVM_VERSION) clang/tools/clang-format/clang-format-diff.py > debian/man/clang-format-diff-$(LLVM_VERSION).1 || true | |
76129c23 | 548 | |
540ef424 | 549 | CMDS="llvm-dwarfdump llvm-mc llvm-mcmarkup llvm-objdump llvm-rtdyld llvm-size llvm-ranlib lldb lldb-mi 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"; \ |
d13452ba SL |
550 | for f in $$CMDS; do \ |
551 | echo "Generating manpage of $$f"; \ | |
c0281a9d | 552 | 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; \ |
6d6fb79c | 553 | done |
514529a9 | 554 | if test "$(OPENMP_ENABLE)" = yes; then \ |
e9955fc3 | 555 | cd openmp/runtime && doxygen doc/doxygen/config; cd -; \ |
514529a9 SL |
556 | cd openmp/runtime/doc/doxygen/generated/html/ && rm jquery.js && ln -s /usr/share/javascript/jquery/jquery.js; \ |
557 | fi | |
875ec1e7 SL |
558 | |
559 | override_dh_auto_install: | |
b3654c24 SL |
560 | # Clean up temporary files to make sure the install works |
561 | rm -rf $(find $(TARGET_BUILD) -wholename '*CMakeFiles*' -not -name CMakeLists.txt -a -name "*.dir" -type d) | |
562 | # install/fast enables a make install without recompiling temporary files | |
ac7fd96f SL |
563 | if test "$(BUILD_METHOD)" = "stage2"; then \ |
564 | $(MAKE) -C $(TARGET_BUILD) $(VERBOSE) stage2-install DESTDIR=$(DEB_INST)/; \ | |
565 | else \ | |
566 | $(MAKE) -C $(TARGET_BUILD) $(VERBOSE) install DESTDIR=$(DEB_INST)/; \ | |
567 | fi | |
dd8713ff SL |
568 | # Not used on Linux. |
569 | rm -f $(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/bin/argdumper | |
570 | rm -f $(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/share/clang/clang-format-bbedit.applescript | |
eb2110af SL |
571 | # Remove bat files https://bugs.llvm.org/show_bug.cgi?id=30755 |
572 | rm -f $(DEB_INST)/usr/share/clang/scan-build-$(LLVM_VERSION)/libexec/*.bat $(DEB_INST)/usr/share/clang/scan-build-$(LLVM_VERSION)/bin/*.bat | |
dd8713ff | 573 | |
f656e7dd | 574 | rm -f $(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/lib/libExampleIRTransforms.a |
fb1f4563 SL |
575 | # Remove an example - introduced in https://reviews.llvm.org/D61446 |
576 | rm -f $(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/lib/libBye.a | |
f656e7dd | 577 | |
d6eab310 | 578 | cp $(TARGET_BUILD_STAGE2)/bin/clang-query $(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/bin |
dd8713ff | 579 | |
b742b383 SL |
580 | # Only run on executable, not script |
581 | 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` | |
514529a9 | 582 | chrpath -d libcxxabi/build/lib/libc++abi.so.1.0 |
a8d49d13 | 583 | chrpath -d libcxx/build/lib/libc++.so.1.0 |
b742b383 | 584 | |
db2178ef | 585 | : # libclang |
2009781b SL |
586 | cd debian/tmp/usr/lib/llvm-$(LLVM_VERSION)/lib/ && rm -f libclang.so.$(SONAME_EXT) libclang-$(LLVM_VERSION).so; \ |
587 | ln -s libclang-$(LLVM_VERSION).so.$(SONAME_EXT) libclang.so.$(SONAME_EXT) | |
7f06c60c | 588 | |
db2178ef | 589 | : # libomp |
8960a2eb RS |
590 | cd debian/tmp/usr/lib/llvm-$(LLVM_VERSION)/lib && rm -f libomp.so; \ |
591 | ln -s libomp.so.$(SONAME_OPENMP) libomp.so | |
592 | ||
514529a9 SL |
593 | if test "$(OPENMP_ENABLE)" = yes; then \ |
594 | mkdir -p debian/tmp/usr/lib/llvm-$(LLVM_VERSION)/include/openmp; \ | |
595 | cp -f openmp/runtime/exports/common*/include/* debian/tmp/usr/lib/llvm-$(LLVM_VERSION)/include/openmp; \ | |
27f0a07e | 596 | cd debian/tmp/usr/lib/llvm-$(LLVM_VERSION)/lib && cp libomp.so.$(SONAME_OPENMP) libomp-$(LLVM_VERSION).so.$(SONAME_OPENMP); \ |
514529a9 | 597 | fi |
430f8ff5 | 598 | |
b0c15f84 | 599 | # Remove artifact (where compiler-rt is built) |
dd8713ff SL |
600 | # if test -d $(TARGET_BUILD)/tools/clang/runtime/compiler-rt/clang_linux; then \ |
601 | # 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; \ | |
602 | # fi | |
e5cf5438 SL |
603 | |
604 | mkdir -p $(CURDIR)/debian/clang-$(LLVM_VERSION)/usr/bin/ | |
94db6453 | 605 | cp compiler-rt/lib/asan/scripts/asan_symbolize.py $(CURDIR)/debian/clang-$(LLVM_VERSION)/usr/bin/asan_symbolize-$(LLVM_VERSION) |
e5cf5438 | 606 | |
45f800fa | 607 | ifeq (${LIBFUZZER_ENABLE},yes) |
45fe7b69 SL |
608 | mkdir -p $(CURDIR)/debian/libfuzzer-$(LLVM_VERSION)-dev/usr/lib/llvm-$(LLVM_VERSION)/lib/ |
609 | cp -v $(TARGET_BUILD)/libFuzzer.a $(CURDIR)/debian/libfuzzer-$(LLVM_VERSION)-dev/usr/lib/llvm-$(LLVM_VERSION)/lib/ | |
45f800fa | 610 | endif |
45fe7b69 | 611 | |
875ec1e7 SL |
612 | # Create this fake directory to make the install libclang-common-dev happy |
613 | # under the unsupported archs of compiler-rt | |
65242311 SL |
614 | mkdir -p $(DEB_INST)/usr/lib/clang/$(LLVM_VERSION)/lib |
615 | mkdir -p $(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/lib/clang/$(LLVM_VERSION_FULL)/lib/ | |
616 | mkdir -p $(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/lib/clang/$(LLVM_VERSION)/lib/clang_linux/ | |
956d37d3 | 617 | mkdir -p $(TARGET_BUILD)/tools/clang/runtime/compiler-rt/clang_linux/ |
d34e5721 | 618 | mkdir -p $(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/lib/clang/$(LLVM_VERSION_FULL)/share/ |
a3daeed3 SL |
619 | # On some archs, the sanatizers are not built. As we explicitly includes some txt files, create |
620 | # a fake txt to make sure it doesn't fail | |
2b97c8a5 GC |
621 | 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 |
622 | 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 | |
68662551 SL |
623 | # Path changed. Make a copy of it |
624 | 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 | |
875ec1e7 | 625 | |
5eecc2f0 | 626 | # Remove things that CMake install but which aren't packaged yet, |
dd8713ff | 627 | # or are packaged from the source or build tree. |
dd8713ff SL |
628 | mv $(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/bin/clang-$(LLVM_VERSION) \ |
629 | $(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/bin/clang | |
5eecc2f0 | 630 | |
7138491d | 631 | # Probably useless |
6bbfdc3d | 632 | rm -f $(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/lib/python*/*-packages/six.py |
b2075702 | 633 | rm -rf $(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/build/utils/lit/lit/__pycache__/ \ |
3401c0d7 | 634 | $(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/build/utils/lit/lit/*/__pycache__/ |
dd8713ff | 635 | |
dd8713ff | 636 | |
6ac04400 RS |
637 | $(MAKE) -C libcxxabi/build install DESTDIR=$(DEB_INST) |
638 | $(MAKE) -C libcxx/build install DESTDIR=$(DEB_INST) | |
5f674308 | 639 | |
1448ae0a | 640 | # Rename binaries |
65242311 | 641 | mkdir -p $(DEB_INST)/usr/bin/ |
45fe7b69 SL |
642 | cd $(DEB_INST)/usr/bin/; \ |
643 | rm -f *; \ | |
b80030da | 644 | for f in ../lib/llvm-$(LLVM_VERSION)/bin/*; do \ |
1448ae0a SL |
645 | ln -s $$f `basename $$f`-$(LLVM_VERSION); \ |
646 | echo "Link $$f to `basename $$f`-$(LLVM_VERSION)"; \ | |
647 | done | |
648 | ||
31daa190 | 649 | # Rename some stuff with the version name |
6086214c | 650 | cp $(CURDIR)/clang/tools/scan-build/man/scan-build.1 $(CURDIR)/clang/tools/scan-build/man/scan-build-$(LLVM_VERSION).1 |
b1ecb207 | 651 | |
b910c7e9 | 652 | # copy the vim files (except that tablegen does not exist for indent |
d251a2ee SL |
653 | VIM_DIRS="ftdetect ftplugin syntax indent"; \ |
654 | for dir in $$VIM_DIRS; do \ | |
2aa08a74 SL |
655 | cp -f $(CURDIR)/llvm/utils/vim/$$dir/llvm.vim $(CURDIR)/llvm/utils/vim/$$dir/llvm-$(LLVM_VERSION).vim; \ |
656 | if test -f $(CURDIR)/llvm/utils/vim/$$dir/tablegen.vim; then \ | |
657 | cp -f $(CURDIR)/llvm/utils/vim/$$dir/tablegen.vim $(CURDIR)/llvm/utils/vim/$$dir/tablegen-$(LLVM_VERSION).vim; \ | |
d251a2ee SL |
658 | fi; \ |
659 | done | |
2aa08a74 | 660 | cp -f $(CURDIR)/llvm/utils/vim/vimrc $(CURDIR)/llvm/utils/vim/llvm-$(LLVM_VERSION)-vimrc |
31daa190 | 661 | |
a5a8400e | 662 | cp -f $(CURDIR)/clang/tools/clang-format/clang-format-diff.py $(CURDIR)/clang/tools/clang-format/clang-format-diff-$(LLVM_VERSION) |
76129c23 | 663 | |
a5a8400e | 664 | cp -f $(CURDIR)/clang/tools/clang-format/clang-format.py clang/tools/clang-format/clang-format-$(LLVM_VERSION).py |
7fa75a0e | 665 | |
d13452ba | 666 | rm -rf clang/tools/scan-build-$(LLVM_VERSION) |
94db6453 SL |
667 | cp -fR $(CURDIR)/clang/tools/scan-build clang/tools/scan-build-$(LLVM_VERSION) |
668 | ||
a46bba31 SL |
669 | rm -rf clang/tools/scan-build-py-$(LLVM_VERSION) |
670 | cp -fR $(CURDIR)/clang/tools/scan-build-py clang/tools/scan-build-py-$(LLVM_VERSION) | |
21cd3633 | 671 | chmod +x clang/tools/scan-build-py-$(LLVM_VERSION)/bin/* |
a46bba31 | 672 | |
d13452ba | 673 | rm -rf clang/tools/scan-view-$(LLVM_VERSION) |
94db6453 SL |
674 | cp -fR $(CURDIR)/clang/tools/scan-view clang/tools/scan-view-$(LLVM_VERSION) |
675 | ||
0d6e1b40 | 676 | # Remove some license files |
5eecc2f0 | 677 | rm -f $(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/include/llvm/Support/LICENSE.TXT |
1448ae0a | 678 | |
f075d6a0 | 679 | # Disable CMake's package validation checks for target files that we may remove. |
955d9f62 | 680 | sed -i '/_IMPORT_CHECK_TARGETS \(Polly\|sancov\)/ {s|^|#|}' $(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/lib/cmake/llvm/LLVMExports-*.cmake |
f075d6a0 | 681 | |
8ab8cd7b PW |
682 | # Disable CMake's package validation checks for binaries that may not be installed |
683 | sed -i 's|.*_IMPORT_CHECK_FILES_FOR_.*/bin/.*)|#&|' $(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/lib/cmake/clang/ClangTargets-*.cmake | |
684 | ||
c05f6c91 | 685 | # Managed in python*-lldb-X.Y.links.in |
e7d54dd0 | 686 | rm -f $(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/lib/python*/*-packages/lldb/_lldb.so |
e5cf5438 | 687 | |
35a0b39e | 688 | # For some reasons, hwasan_symbolize is sometimes built |
9d6d8b5b | 689 | if test -f $(CURDIR)/debian/tmp/usr/lib/llvm-$(LLVM_VERSION)/lib/clang/$(LLVM_VERSION_FULL)/bin/hwasan_symbolize; then \ |
35a0b39e SL |
690 | mkdir -p $(CURDIR)/debian/clang-tools-$(LLVM_VERSION)/usr/bin/; \ |
691 | mv $(CURDIR)/debian/tmp/usr/lib/llvm-$(LLVM_VERSION)/lib/clang/$(LLVM_VERSION_FULL)/bin/hwasan_symbolize $(CURDIR)/debian/clang-tools-$(LLVM_VERSION)/usr/lib/llvm-$(LLVM_VERSION)/lib/clang/$(LLVM_VERSION_FULL)/bin/; \ | |
692 | fi | |
693 | ||
65242311 | 694 | # Manage the polly files. Sometimes, we build them. Sometimes not. |
b6af4ab8 | 695 | if test "$(POLLY_ENABLE)" = yes; then \ |
65242311 SL |
696 | 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/; \ |
697 | mv -f $(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/lib/libpolly* \ | |
698 | $(CURDIR)/debian/libclang-$(LLVM_VERSION)-dev/usr/lib/llvm-$(LLVM_VERSION)/lib/; \ | |
699 | rm -rf $(CURDIR)/debian/libclang-common-$(LLVM_VERSION)-dev/usr/lib/llvm-$(LLVM_VERSION)/include/polly; \ | |
700 | mv -f $(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/include/polly/ \ | |
701 | $(CURDIR)/debian/libclang-common-$(LLVM_VERSION)-dev/usr/lib/llvm-$(LLVM_VERSION)/include/; \ | |
702 | fi | |
703 | ||
1aa9ae9e | 704 | mkdir -p $(CURDIR)/debian/usr/share/doc/llvm-$(LLVM_VERSION)-doc/ $(CURDIR)/debian/usr/share/doc/clang-$(LLVM_VERSION)-doc/ |
dbba4938 SL |
705 | cp -R $(TARGET_BUILD_STAGE2)/docs/html $(CURDIR)/debian/usr/share/doc/llvm-$(LLVM_VERSION)-doc/ |
706 | cp -R $(TARGET_BUILD_STAGE2)/tools/clang/docs/html $(CURDIR)/debian/usr/share/doc/clang-$(LLVM_VERSION)-doc/ | |
707 | cp -R $(TARGET_BUILD_STAGE2)/tools/clang/tools/extra/docs/html $(CURDIR)/debian/usr/share/doc/clang-$(LLVM_VERSION)-doc/clang-extra | |
1aa9ae9e | 708 | |
cc9911af | 709 | # Rename OCaml bindings |
21cd3633 | 710 | if test "$(OCAML_ENABLE)" = yes; then \ |
ebc5013b | 711 | mkdir -p "$(DEB_INST)$(OCAML_STDLIB_DIR)"; \ |
45f800fa | 712 | mkdir -p "$(DEB_INST)usr/lib/llvm-$(LLVM_VERSION)/docs/ocaml/html/html"; \ |
c62cdd3c | 713 | mkdir -p "$(DEB_INST)usr/lib/llvm-$(LLVM_VERSION)/share/doc/llvm/ocaml-html/"; \ |
21cd3633 | 714 | if test -d "$(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/lib/ocaml"; then \ |
21cd3633 SL |
715 | mv -f "$(DEB_INST)usr/lib/llvm-$(LLVM_VERSION)/lib/ocaml" \ |
716 | "$(DEB_INST)$(OCAML_STDLIB_DIR)/llvm-$(LLVM_VERSION)"; \ | |
717 | fi; \ | |
718 | fi | |
cc9911af | 719 | |
dd8713ff SL |
720 | # Delete the target build directory to save some space on the build systems |
721 | # All the files have been installed in $(CURDIR)/debian/tmp/ already | |
e28fb6b4 | 722 | rm -rf $(TARGET_BUILD) |
dd8713ff | 723 | |
1d9005f1 | 724 | |
cc9911af | 725 | override_dh_makeshlibs: |
6feb36ea SL |
726 | dh_makeshlibs -plibclang$(SONAME_EXT)-$(LLVM_VERSION) -V"libclang$(SONAME_EXT)-$(LLVM_VERSION) (>= 1:9~svn298832-1~)" -- -c4 |
727 | dh_makeshlibs -pliblldb-$(LLVM_VERSION) -V"liblldb-$(LLVM_VERSION) (>= 1:9~svn298832-1~)" | |
728 | dh_makeshlibs -plibllvm$(LLVM_VERSION) -V"libllvm$(LLVM_VERSION) (>= 1:9~svn298832-1~)" | |
73fd7c35 | 729 | dh_makeshlibs -plibomp$(SONAME_OPENMP)-$(LLVM_VERSION) -V"libomp$(SONAME_OPENMP)-$(LLVM_VERSION) (>= 1:9~svn298832-1~)" |
4cb6852b | 730 | dh_makeshlibs --remaining-packages |
cc9911af | 731 | |
52df5b22 | 732 | override_dh_shlibdeps: |
3eb35be5 | 733 | # Ignore asan libraries. They would trigger dependencies to multiarch libraries |
424a2b92 | 734 | 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 |
52df5b22 | 735 | |
e5cf5438 | 736 | override_dh_installman: |
af56187b SL |
737 | if test -f lld/docs/ld.lld.1; then \ |
738 | mv lld/docs/ld.lld.1 lld/docs/ld.lld-$(LLVM_VERSION).1; \ | |
739 | fi | |
e5cf5438 SL |
740 | dh_installman |
741 | # Make sure that lli manpage is only in llvm-3.2-runtime (See #697117) | |
742 | rm -f $(CURDIR)/debian/llvm-$(LLVM_VERSION)/usr/share/man/man1/lli* | |
743 | ||
744 | ||
875ec1e7 | 745 | override_dh_strip: |
e9f1d28b | 746 | : # running out of diskspace on the buildds |
c114641a | 747 | find $(TARGET_BUILD) -name '*.o' -o -name '*.a' -type f | xargs -r rm -f |
231b7c6e SL |
748 | ifeq (0, $(strip $(shell dpkg --compare-versions $(DH_VERSION) ge 9.20160114; echo $$?))) |
749 | : # If we don't have the right version of debhelper, don't run the option | |
6feb36ea SL |
750 | dh_strip -p libclang$(SONAME_EXT)-$(LLVM_VERSION) --dbgsym-migration='libclang$(SONAME_EXT)-$(LLVM_VERSION)-dbg (<< 1:9~svn327768-1~)' |
751 | dh_strip -p libllvm$(LLVM_VERSION) --dbgsym-migration='libllvm$(LLVM_VERSION)-dbg (<< 1:9~svn327768-1~)' | |
752 | dh_strip -p liblldb-$(LLVM_VERSION) --dbgsym-migration='liblldb-$(LLVM_VERSION)-dbg (<< 1:9~svn327768-1~)' | |
753 | dh_strip -p libomp$(SONAME_OPENMP)-$(LLVM_VERSION) --dbgsym-migration='libomp$(SONAME_OPENMP)-$(LLVM_VERSION)-dbg (<< 1:9~svn327768-1~)' | |
231b7c6e | 754 | endif |
06b90c93 | 755 | # ifeq (${LLD_ENABLE},yes) |
6bcd0a96 | 756 | # PATH=$(CURDIR)/:$$PATH dh_strip -p liblld-$(LLVM_VERSION) --dbg-package=liblld-$(LLVM_VERSION)-dbg |
06b90c93 | 757 | # endif |
f0f0ba2c | 758 | ifeq ($(shell dpkg --compare-versions $(shell dpkg-query -W -f '$${Version}' binutils) lt 2.31.1-11 ; echo $$?),0) |
87fdbcd7 SL |
759 | : # building with clang, binutils/strip has hard time stripping some libs because of |
760 | : # https://sourceware.org/bugzilla/show_bug.cgi?id=23788 | |
761 | : # use llvm-strip instead | |
7dd264c6 SL |
762 | : # Workaround some issues with stripping by using llvm's |
763 | if test ! -f $(CURDIR)/strip; then \ | |
764 | ln -s $(CURDIR)/debian/llvm-$(LLVM_VERSION)/usr/lib/llvm-$(LLVM_VERSION)/bin/llvm-strip $(CURDIR)/strip; \ | |
765 | fi | |
2630cd44 SL |
766 | ls -al $(CURDIR)/debian/.debhelper/*/dbgsym-root/usr/lib/debug/.build-id/*/*|| true |
767 | : # On some old version of Debian (stretch) and Ubuntu, Rules-Requires-Root isn't supported | |
768 | : # 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 | |
c471c172 | 769 | : # Therefore, continue when we encounter an error |
2630cd44 | 770 | PATH=$(CURDIR)/:$$PATH LD_LIBRARY_PATH=$(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/lib/:/usr/lib/*/libfakeroot dh_strip -a -v || true |
6bcd0a96 SL |
771 | : # Remove the workaround |
772 | rm $(CURDIR)/strip | |
fd33d673 SL |
773 | : # for some reasons, the +x might be removed |
774 | chmod -f +x $(CURDIR)/debian/*/usr/lib/llvm-$(LLVM_VERSION)/bin/* || true | |
10fe453c | 775 | else |
7600774a | 776 | dh_strip -a -v |
10fe453c | 777 | endif |
7aec1357 | 778 | |
44ef5ad8 | 779 | override_dh_install: |
8450b964 | 780 | # cp $(TARGET_BUILD)/lib/libLLVM-$(LLVM_VERSION).so $(DEB_INST)/usr/lib/llvm-$(LLVM_VERSION)/lib/libLLVM-$(LLVM_VERSION).so.$(SONAME_EXT) |
ed8ddc78 | 781 | ifeq (${POLLY_ENABLE},yes) |
259b7ad4 GC |
782 | # only for arch:any builds |
783 | ifneq (,$(filter libclang-common-$(LLVM_VERSION)-dev, $(shell dh_listpackages))) | |
935a21d5 | 784 | 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 |
21d3048d | 785 | # On old Debian & Ubuntu, removing the files is necessary |
0a64af0a | 786 | rm -rf debian/tmp/usr/lib/llvm-$(LLVM_VERSION)/lib/cmake/polly/*.cmake |
8e4a4321 GC |
787 | else |
788 | rm -rf $(CURDIR)/debian/tmp/usr/lib/llvm-$(LLVM_VERSION)/lib/cmake/polly/*.cmake | |
259b7ad4 | 789 | endif |
ed8ddc78 | 790 | endif |
44ef5ad8 | 791 | dh_install --fail-missing |
7aec1357 | 792 | |
1d2a025d SL |
793 | override_dh_installdeb: |
794 | # Managed by the package | |
795 | dh_installdeb -a | |
796 | ||
c05f6c91 | 797 | 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 |
673cb02f | 798 | rm -f $(CURDIR)/debian/clang-$(LLVM_VERSION)-examples/usr/share/doc/clang-$(LLVM_VERSION)-examples/examples/*Make* |
04d4813e SL |
799 | # Remove some libc++ abi files in the libc++ file. See bug #969274 |
800 | 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 | |
3ed4be9b SL |
801 | # Remove auto generated python pyc |
802 | find $(CURDIR)/debian/llvm-$(LLVM_VERSION)-tools/usr/lib/llvm-$(LLVM_VERSION)/ -name '*.pyc' | xargs -r rm -f | |
803 | ||
b553daa1 | 804 | ifeq (${RUN_TEST},yes) |
42bfe3ea | 805 | # List of the archs we know we have 100 % tests working |
056378d9 | 806 | ARCH_LLVM_TEST_OK := i386 amd64 |
dd8713ff | 807 | |
875ec1e7 | 808 | override_dh_auto_test: |
81435e71 | 809 | |
da2955c1 | 810 | # LLVM tests |
dd8713ff | 811 | ifneq (,$(findstring $(DEB_HOST_ARCH),$(ARCH_LLVM_TEST_OK))) |
f25e2499 | 812 | # logs the output to check-llvm_build_log.txt for validation through autopkgtest |
7d63b357 | 813 | $(MAKE) $(NJOBS) -C $(TARGET_BUILD) stage2-check-llvm | tee check-llvm_build_log.txt |
dd8713ff | 814 | else |
7d63b357 | 815 | $(MAKE) $(NJOBS) -C $(TARGET_BUILD) stage2-check-llvm || true |
dd8713ff SL |
816 | endif |
817 | ||
da2955c1 | 818 | # Clang tests |
7d63b357 | 819 | $(MAKE) $(NJOBS) -C $(TARGET_BUILD) stage2-check-clang || true |
dd8713ff | 820 | |
da2955c1 | 821 | # Clang extra tests (ex: clang-tidy) |
3b17d907 | 822 | $(MAKE) $(NJOBS) -C $(TARGET_BUILD_STAGE2) check-clang-tools || true |
da2955c1 SL |
823 | |
824 | # LLD tests | |
ef64786f | 825 | ifeq (${LLD_ENABLE},yes) |
3b17d907 | 826 | $(MAKE) $(NJOBS) -C $(TARGET_BUILD_STAGE2) check-lld || true |
ef64786f | 827 | endif |
7c7373be | 828 | |
528f1c84 | 829 | # Sanitizer |
3b17d907 | 830 | $(MAKE) $(NJOBS) -C $(TARGET_BUILD_STAGE2) check-sanitizer || true |
a4104082 | 831 | |
6ac04400 RS |
832 | # Libcxx |
833 | $(MAKE) $(NJOBS) -C libcxx/build check-libcxx || true | |
834 | ||
835 | # Libcxxabi | |
836 | $(MAKE) $(MAKE) -C libcxxabi/build check-libcxxabi || true | |
837 | ||
da2955c1 | 838 | # LLDB tests |
dd8713ff | 839 | ifeq (,$(filter $(DEB_HOST_ARCH), $(LLDB_DISABLE_ARCHS) armhf armel)) |
4a1524f5 | 840 | ifneq (,$(filter codecoverage,$(DEB_BUILD_OPTIONS))) |
f3a81d32 | 841 | # Create a symlink to run the testsuite: see https://bugs.archlinux.org/task/50759 |
e7d54dd0 | 842 | cd $(CURDIR)/$(TARGET_BUILD)/lib/python*/*-packages/; \ |
a6c8c74a SL |
843 | if test ! -e _lldb.so; then \ |
844 | ln -s lldb/_lldb.so; \ | |
845 | fi | |
f2830edd SL |
846 | if test "$(CODECOVERAGE)" = "no"; then \ |
847 | LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$(CURDIR)/$(TARGET_BUILD)/lib/ $(MAKE) $(NJOBS) -C $(TARGET_BUILD) check-lldb || true; \ | |
848 | fi | |
18368be9 | 849 | # remove the workaround |
e7d54dd0 | 850 | rm $(CURDIR)/$(TARGET_BUILD)/lib/python*/*-packages/_lldb.so |
dd8713ff | 851 | endif |
bf21400e | 852 | endif |
dd8713ff | 853 | |
da2955c1 | 854 | # Polly tests |
a958f0b7 SL |
855 | #ifeq (${POLLY_ENABLE},yes) |
856 | # $(MAKE) $(NJOBS) -C $(TARGET_BUILD) check-polly || true | |
857 | #endif | |
dd8713ff | 858 | |
fa3d839c | 859 | # Managed by debian build system |
e7d54dd0 | 860 | rm -f $(CURDIR)/$(TARGET_BUILD)/lib/python*/*-packages/lldb/_lldb.so |
1432f600 | 861 | |
c1c56e85 SL |
862 | # The compression of the code coverage report is done in the |
863 | # hook B21GetCoverageResults on the server | |
3dbb24b9 | 864 | if test "$(CODECOVERAGE)" = "yes"; then \ |
3b524bad | 865 | REPORT=reports/llvm-toolchain.info; \ |
3dbb24b9 | 866 | mkdir -p reports/; \ |
1db2f514 | 867 | lcov --directory $(TARGET_BUILD)/ --capture --ignore-errors source --output-file $$REPORT; \ |
9a38e3eb | 868 | lcov --remove $$REPORT "/usr*" -o $$REPORT; \ |
f11bd58b | 869 | genhtml -o reports/coverage --show-details --highlight --legend $$REPORT; \ |
b64f52e0 SL |
870 | chmod 0755 `find reports/coverage -type d`; \ |
871 | chmod 0644 `find reports/coverage -type f`; \ | |
3dbb24b9 | 872 | fi |
8bcfb779 | 873 | else |
f111124c | 874 | override_dh_auto_test: |
8bcfb779 | 875 | @echo "Skipping tests" |
f111124c SL |
876 | endif |
877 | ||
875ec1e7 | 878 | |
712c1081 SL |
879 | override_dh_gencontrol: |
880 | dh_gencontrol -- $(control_vars) | |
881 | ||
7aec1357 | 882 | |
875ec1e7 | 883 | override_dh_auto_clean: |
a5a8400e | 884 | rm -rf $(TARGET_BUILD) tools/clang/include/clang/Debian/debian_path.h docs/_build/ clang/docs/_build tools/clang/docs/_html/ |
10a05cac SL |
885 | # QA tools |
886 | rm -rf cov-int/ reports/ | |
0d6e1b40 | 887 | rm -f `ls debian/*.in|sed -e "s|.in$$||g"` |
12815a6f | 888 | find utils -name '*.pyc' | xargs -r rm -f |
a5a8400e SL |
889 | # Use -I because a test has a space in its name |
890 | find lldb/test -iname '*.pyc' | xargs -I{} -r rm -f {} | |
a2f2504b SL |
891 | find test -name '*.pyc' -o -name '*.cm[ix]' | xargs -r rm -f |
892 | find test/Bindings -name '*.o' | xargs -r rm -f | |
7c7373be | 893 | rm -f tools/clang tools/polly tools/lld tools/lldb projects/compiler-rt |
17ba2998 | 894 | rm -rf tools/clang/tools/extra clang/tools/extra/ |
a5a8400e SL |
895 | rm -f $(CURDIR)/utils/vim/llvm-$(LLVM_VERSION).vim $(CURDIR)/utils/vim/tablegen-$(LLVM_VERSION).vim |
896 | rm -f $(CURDIR)/clang/tools/clang-format/clang-format-diff-$(LLVM_VERSION) | |
897 | rm -f $(CURDIR)/clang/tools/clang-format/clang-format-$(LLVM_VERSION).py | |
6ac04400 | 898 | rm -rf libcxx/build libcxxabi/build |
4625379d SL |
899 | if test -f lld/docs/ld.lld-$(LLVM_VERSION).1; then \ |
900 | mv lld/docs/ld.lld-$(LLVM_VERSION).1 lld/docs/ld.lld.1; \ | |
901 | fi | |
214db535 | 902 | |
7c261d5b | 903 | .PHONY: override_dh_strip preconfigure debian-full-build debian-libfuzzer-build debian-libcxx-build debian-libcxxabi-build |