1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546
|
#! /usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
# version number of the defaults package
include /usr/share/dpkg/pkg-info.mk
VMAJOR := $(shell echo $(DEB_VERSION) | awk -F. '{print $$1}')
VMINOR := $(shell echo $(DEB_VERSION) | awk -F. '{print $$2}' | sed -e 's/\([0-9]*\).*/\1/')
REL_EXT := $(shell echo $(DEB_VERSION) | sed -e 's/^$(VMAJOR)\.$(VMINOR)//')
# llvm-defaults 0.1 is the first version for 2.7.
REL_NO_27 := $(shell expr $(VMINOR) - 0)$(REL_EXT)
# llvm-defaults 0.2 is the first version for 2.8.
REL_NO_28 := $(shell expr $(VMINOR) - 0)$(REL_EXT)
# llvm-defaults 0.7 is the first version for 2.9.
REL_NO_29 := $(shell expr $(VMINOR) - 0)$(REL_EXT)
# llvm-defaults 0.9 is the first version for 3.0.
REL_NO_30 := $(shell expr $(VMINOR) - 0)$(REL_EXT)
# llvm-defaults 0.10 is the first version for 3.1.
REL_NO_31 := $(shell expr $(VMINOR) - 0)$(REL_EXT)
# llvm-defaults 0.16 is the first version for 3.2.
REL_NO_32 := $(shell expr $(VMINOR) - 0)$(REL_EXT)
# llvm-defaults 0.21 is the first version for 3.3.
REL_NO_33 := $(shell expr $(VMINOR) - 0)$(REL_EXT)
# llvm-defaults 0.22 is the first version for 3.4.
REL_NO_34 := $(shell expr $(VMINOR) - 0)$(REL_EXT)
# llvm-defaults 0.24 is the first version for 3.5.
REL_NO_35 := $(shell expr $(VMINOR) - 0)$(REL_EXT)
# llvm-defaults 0.27 is the first version for 3.6.
REL_NO_36 := $(shell expr $(VMINOR) - 0)$(REL_EXT)
# llvm-defaults (not in debian) is the first version for 3.7.
REL_NO_37 := $(shell expr $(VMINOR) - 0)$(REL_EXT)
# llvm-defaults 0.34 is the first version for 3.8.
REL_NO_38 := $(shell expr $(VMINOR) - 0)$(REL_EXT)
# llvm-defaults (not in debian) is the first version for 3.9.
REL_NO_39 := $(shell expr $(VMINOR) - 0)$(REL_EXT)
# llvm-defaults 0.37 is the first version for 4.0.
REL_NO_40 := $(shell expr $(VMINOR) - 0)$(REL_EXT)
# llvm-defaults 0.41 is the first version for 5.0.
REL_NO_50 := $(shell expr $(VMINOR) - 0)$(REL_EXT)
# llvm-defaults 0.41 is the first version for 6.0.
REL_NO_60 := $(shell expr $(VMINOR) - 0)$(REL_EXT)
# llvm-defaults 0.44 is the first version for 7.0.
REL_NO_70 := $(shell expr $(VMINOR) - 0)$(REL_EXT)
# llvm-defaults 0.48 is the first version for 8.0.
REL_NO_80 := $(shell expr $(VMINOR) - 0)$(REL_EXT)
# llvm-defaults 0.49 is the first version for 9.0.
REL_NO_90 := $(shell expr $(VMINOR) - 0)$(REL_EXT)
# llvm-defaults 0.50 is the first version for 10.
REL_NO_100 := $(shell expr $(VMINOR) - 0)$(REL_EXT)
# llvm-defaults 0.51 is the first version for 11.
REL_NO_110 := $(shell expr $(VMINOR) - 0)$(REL_EXT)
# llvm-defaults 0.52 is the first version for 12.
REL_NO_120 := $(shell expr $(VMINOR) - 0)$(REL_EXT)
# llvm-defaults 0.53 is the first version for 13.
REL_NO_130 := $(shell expr $(VMINOR) - 0)$(REL_EXT)
# llvm-defaults 0.53 is the first version for 14.
REL_NO_140 := $(shell expr $(VMINOR) - 0)$(REL_EXT)
# llvm-defaults 0.56 is the first version for 15.
REL_NO_150 := $(shell expr $(VMINOR) - 0)$(REL_EXT)
# llvm-defaults 0.57 is the first version for 16.
REL_NO_160 := $(shell expr $(VMINOR) - 0)$(REL_EXT)
# llvm-defaults 0.58 is the first version for 17.
REL_NO_170 := $(shell expr $(VMINOR) - 0)$(REL_EXT)
# llvm-defaults 0.59 is the first version for 18.
REL_NO_180 := $(shell expr $(VMINOR) - 0)$(REL_EXT)
# llvm-defaults 0.60 is the first version for 19.
REL_NO_190 := $(shell expr $(VMINOR) - 0)$(REL_EXT)
# llvm-defaults 0.60ubuntu1~ppa1 is the first version for 20.
REL_NO_200 := $(shell expr $(VMINOR) - 0)$(REL_EXT)
# llvm-defaults 0.63 is the first version for 21.
REL_NO_210 := $(shell expr $(VMINOR) - 0)$(REL_EXT)
# minimum required version
REQV := (>= 1:21.1.4-4)
CURRENT_VERSION := 21.1.4
# architecture dependent variables
include /usr/share/dpkg/architecture.mk
# complete version number, including the release
CV_LLVM := 1:$(CURRENT_VERSION)-$(REL_NO_210)
distribution := $(shell lsb_release -is)
all_packages := llvm llvm-runtime llvm-dev \
clang clang-tools libclang-cpp-dev libclang-dev clang-format clang-tidy clangd \
python3-clang libomp-dev libc++-dev libc++abi-dev libllvm-ocaml-dev libclang-rt-dev \
libc++-dev-wasm32 libclang-rt-dev-wasm32 libclang-rt-dev-wasm64 libclang-rt-dev-win \
flang
no_packages :=
ANY_ARCHS := amd64 arm64 armel armhf hurd-amd64 hurd-i386 i386 loong64 m68k \
mipsel mips64el powerpc ppc64 ppc64el riscv64 s390x sparc sparc64 x32
OFFLOAD_ARCHS = amd64 arm64 ppc64el
OMP_ARCHS = $(OFFLOAD_ARCHS) loong64 mips64el
HWASAN_ARCHS = amd64 arm64 riscv64 i386 x32
LLDB_ARCHS = amd64 arm64 armel armhf i386 loong64 m68k ppc64el riscv64 s390x x32
ifneq (,$(filter $(DEB_HOST_ARCH),$(LLDB_ARCHS)))
all_packages += lldb liblldb-dev python3-lldb
else
no_packages += lldb liblldb-dev python3-lldb
endif
LLD_ARCHS = $(ANY_ARCHS)
ifneq (,$(filter $(DEB_HOST_ARCH),$(LLD_ARCHS)))
all_packages += lld liblld-dev
else
no_packages += lld liblld-dev
endif
FLANG_ARCHS = amd64 arm64 ppc64el ppc64 sparc64 riscv64 loong64
ifneq (,$(filter $(DEB_HOST_ARCH),$(FLANG_ARCHS)))
all_packages += flang libflang-dev
else
no_packages += flang libflang-dev
endif
BOLT_ARCHS = amd64 arm64
ifneq (,$(filter $(DEB_HOST_ARCH),$(BOLT_ARCHS)))
all_packages += llvm-bolt libbolt-dev
else
no_packages += llvm-bolt libbolt-dev
endif
POLLY_ARCHS = $(ANY_ARCHS)
ifneq (,$(filter $(DEB_HOST_ARCH),$(POLLY_ARCHS)))
all_packages += libpolly-dev
else
no_packages += libpolly-dev
endif
# 64bit and i386
CLANG_RT_ARCHS = $(ANY_ARCHS)
ifneq (,$(filter $(DEB_HOST_ARCH),$(CLANG_RT_ARCHS)))
#all_packages += libclang-rt-dev
else
no_packages += libclang-rt-dev
endif
packages := $(filter-out $(no_packages), $(all_packages))
# derived version number (without release)
V_LLVM := $(shell echo $(CV_LLVM) | sed 's/^[0-9]*://' | sed 's/-[^-]*$$//')
# number for the package name
PV_LLVM := $(shell echo $(V_LLVM) | awk -F. '{printf "%d", $$1}')
OS_NAME := Linux
ifeq ($(DEB_HOST_ARCH),hurd-i386)
OS_NAME := Hurd
endif
ifneq (,$(filter $(DEB_HOST_ARCH),kfreebsd-i386 kfreebsd-amd64))
OS_NAME := kFreeBSD
endif
README:
m4 -DPACKAGES="$(packages)" \
-DOS_NAME=$(OS_NAME) \
-DDEB_ARCH=$(DEB_HOST_ARCH) \
-DPV_LLVM=$(PV_LLVM) \
debian/README.Debian.m4 > debian/README.Debian.tmp2
uniq debian/README.Debian.tmp2 > debian/README.Debian.tmp
rm -f debian/README.Debian.tmp2
[ -e debian/README.Debian ] \
&& cmp -s debian/README.Debian debian/README.Debian.tmp \
&& rm -f debian/README.Debian.tmp && exit 0; \
mv debian/README.Debian.tmp debian/README.Debian
.PHONY: README
substvars:
( \
echo 'version:llvm=$(CV_LLVM)'; \
echo 'pv:llvm=$(PV_LLVM)'; \
echo 'reqv:llvm=$(REQV)'; \
) > debian/substvars.local
.PHONY: substvars
build: build-arch build-indep
build-arch: build-stamp
build-indep: build-stamp
build-stamp: control-stamp
dh_testdir
touch build-stamp
clean:
dh_testdir
rm -f *-stamp
rm -f debian/substvars.local
dh_clean
install: build README substvars
dh_testdir
dh_prep
for p in $(packages); do \
cp -l debian/substvars.local debian/$$p.substvars; \
done
: # llvm
dh_installdirs -pllvm \
usr/bin usr/share/man/man1
for bin in \
bugpoint llc llvm-ar llvm-as llvm-bcanalyzer llvm-config \
llvm-cov llvm-diff llvm-dis llvm-dwarfdump llvm-extract \
llvm-link llvm-mc llvm-nm llvm-objdump \
llvm-ranlib llvm-rtdyld llvm-size llvm-tblgen llvm-profdata \
llvm-symbolizer dsymutil llvm-PerfectShuffle llvm-c-test llvm-cat \
llvm-cfi-verify llvm-cvtres llvm-cxxdump llvm-cxxfilt llvm-dlltool \
llvm-dwp llvm-exegesis llvm-lib llvm-lto llvm-lto2 llvm-mca llvm-modextract \
llvm-mt llvm-objcopy llvm-opt-report llvm-pdbutil llvm-rc llvm-readelf \
llvm-readobj llvm-split llvm-stress llvm-strings llvm-strip llvm-undname \
llvm-xray sanstats opt llvm-addr2line llvm-reduce \
; do \
dh_link -pllvm \
/usr/lib/llvm-$(PV_LLVM)/bin/$$bin \
/usr/bin/$$bin ; \
done
for bin in \
yaml2obj obj2yaml verify-uselistorder \
; do \
dh_link -pllvm \
/usr/lib/llvm-$(PV_LLVM)/bin/$$bin \
/usr/bin/$$bin ; \
done
# To know if there is a manpage or not
# L="LIST ABOVE"
# for f in $L; do if test -f /usr/share/man/man1/$f-7.1.gz; then echo $f; fi; done|tr "\n" " "
for man in \
bugpoint llc llvm-ar llvm-as llvm-bcanalyzer llvm-config llvm-cov \
llvm-diff llvm-dis llvm-dwarfdump llvm-extract llvm-link llvm-mc \
llvm-nm llvm-objdump llvm-ranlib llvm-rtdyld llvm-size llvm-tblgen \
llvm-profdata llvm-symbolizer dsymutil llvm-cxxfilt llvm-exegesis \
llvm-lib llvm-mca llvm-objcopy llvm-pdbutil llvm-readelf llvm-readobj \
llvm-stress llvm-strings llvm-strip opt llvm-addr2line; do \
dh_link -pllvm \
/usr/share/man/man1/$$man-$(PV_LLVM).1.gz \
/usr/share/man/man1/$$man.1.gz ; \
done
for man in \
clang; do \
dh_link -pclang \
/usr/share/man/man1/$$man-$(PV_LLVM).1.gz \
/usr/share/man/man1/$$man.1.gz ; \
done
for man in \
clang-apply-replacements clang-check clang-query \
scan-build scan-build-py scan-view sancov; do \
dh_link -pclang-tools \
/usr/share/man/man1/$$man-$(PV_LLVM).1.gz \
/usr/share/man/man1/$$man.1.gz ; \
done
for man in \
clang-format clang-format-diff; do \
dh_link -pclang-format \
/usr/share/man/man1/$$man-$(PV_LLVM).1.gz \
/usr/share/man/man1/$$man.1.gz ; \
done
for man in \
clangd; do \
dh_link -pclangd \
/usr/share/man/man1/$$man-$(PV_LLVM).1.gz \
/usr/share/man/man1/$$man.1.gz ; \
done
for man in \
clang-tidy; do \
dh_link -pclang-tidy \
/usr/share/man/man1/$$man-$(PV_LLVM).1.gz \
/usr/share/man/man1/$$man.1.gz ; \
done
for man in \
lldb; do \
dh_link -plldb \
/usr/share/man/man1/$$man-$(PV_LLVM).1.gz \
/usr/share/man/man1/$$man.1.gz ; \
done
for man in \
ld.lld lld; do \
dh_link -plld \
/usr/share/man/man1/ld.lld-$(PV_LLVM).1.gz \
/usr/share/man/man1/$$man.1.gz ; \
done
: # llvm-runtime
dh_installdirs -pllvm-runtime \
usr/bin usr/share/man/man1
dh_link -pllvm-runtime \
/usr/lib/llvm-$(PV_LLVM)/bin/lli /usr/bin/lli
dh_link -pllvm-runtime \
/usr/share/man/man1/lli-$(PV_LLVM).1.gz /usr/share/man/man1/lli.1.gz
: # llvm-dev
dh_installdirs -pllvm-dev \
/usr/include \
/usr/share/vim/addons/syntax/ \
/usr/lib
dh_link -pllvm-dev \
/usr/lib/llvm-$(PV_LLVM)/include/llvm /usr/include/llvm \
/usr/lib/llvm-$(PV_LLVM)/include/llvm-c /usr/include/llvm-c \
/usr/share/vim/addons/syntax/llvm-$(PV_LLVM).vim /usr/share/vim/addons/syntax/llvm.vim \
/usr/share/vim/addons/syntax/tablegen-$(PV_LLVM).vim /usr/share/vim/addons/syntax/tablegen.vim \
/usr/share/emacs/site-lisp/llvm-$(PV_LLVM) /usr/share/emacs/site-lisp/llvm
for lib in \
libLTO.so LLVMgold.so; do \
dh_link -pllvm-dev \
/usr/lib/llvm-$(PV_LLVM)/lib/$$lib /usr/lib/$$lib; \
done
: # liblldb-dev
dh_installdirs -pliblldb-dev \
/usr/include \
/usr/lib
dh_link -pliblldb-dev \
/usr/lib/llvm-$(PV_LLVM)/include/lldb /usr/include/lldb \
for lib in \
liblldb.so; do \
dh_link -pliblldb-dev \
/usr/lib/llvm-$(PV_LLVM)/lib/$$lib /usr/lib/$$lib; \
done
: # liblld-dev
dh_installdirs -pliblld-dev \
/usr/include
dh_link -pliblld-dev \
/usr/lib/llvm-$(PV_LLVM)/include/lld /usr/include/lld \
: # libllvm-ocaml-dev
dh_installdirs -plibllvm-ocaml-dev \
/usr/lib/ocaml/METAS
dh_link -plibllvm-ocaml-dev \
/usr/lib/ocaml/META.llvm /usr/lib/ocaml/METAS/META.llvm
: # clang
dh_installdirs -pclang \
usr/bin usr/share/man/man1
for bin in \
clang clang++ clang-cl clang-cpp clang-scan-deps \
; do \
dh_link -pclang \
/usr/lib/llvm-$(PV_LLVM)/bin/$$bin \
/usr/bin/$$bin ; \
done
# clang-tools
dh_installdirs -pclang-tools \
usr/bin usr/share/man/man1
for bin in \
clang-check c-index-test \
clang-apply-replacements clang-query sancov; do \
dh_link -pclang-tools \
/usr/lib/llvm-$(PV_LLVM)/bin/$$bin \
/usr/bin/$$bin ; \
done
# clang-tidy
for bin in \
clang-tidy \
; do \
dh_link -pclang-tidy \
/usr/lib/llvm-$(PV_LLVM)/bin/$$bin \
/usr/bin/$$bin ; \
done
dh_link -pclang-tidy \
/usr/bin/run-clang-tidy-$(PV_LLVM).py \
/usr/bin/run-clang-tidy
dh_link -pclang-tidy \
/usr/bin/clang-tidy-diff-$(PV_LLVM).py \
/usr/bin/clang-tidy-diff
# clang-format
dh_link -pclang-format \
/usr/bin/clang-format-$(PV_LLVM) \
/usr/bin/clang-format
dh_link -pclang-format \
/usr/bin/clang-format-diff-$(PV_LLVM) \
/usr/bin/clang-format-diff
dh_link -pclang-format \
/usr/bin/git-clang-format-$(PV_LLVM) \
/usr/bin/git-clang-format
dh_link -pclang-format \
/usr/share/vim/addons/syntax/clang-format-$(PV_LLVM).py \
/usr/share/vim/addons/syntax/clang-format.py
dh_link -pclang-format \
/usr/share/emacs/site-lisp/clang-format-$(PV_LLVM) \
/usr/share/emacs/site-lisp/clang-format
# clangd
dh_link -pclangd \
/usr/bin/clangd-$(PV_LLVM) \
/usr/bin/clangd
# clang-tools
dh_link -pclang-tools \
/usr/bin/scan-build-$(PV_LLVM) \
/usr/bin/scan-build
dh_link -pclang-tools \
/usr/bin/scan-build-py-$(PV_LLVM) \
/usr/bin/scan-build-py
dh_link -pclang-tools \
/usr/bin/scan-view-$(PV_LLVM) \
/usr/bin/scan-view
dh_link -pclang-tools \
/usr/bin/asan_symbolize-$(PV_LLVM) \
/usr/bin/asan_symbolize
ifneq (,$(filter $(DEB_HOST_ARCH),$(HWASAN_ARCHS)))
dh_link -pclang-tools \
/usr/bin/hwasan_symbolize-$(PV_LLVM) \
/usr/bin/hwasan_symbolize
endif
# lldb
dh_link -plldb \
/usr/bin/lldb-$(PV_LLVM) \
/usr/bin/lldb
dh_link -plldb \
/usr/bin/lldb-argdumper-$(PV_LLVM) \
/usr/bin/lldb-argdumper
dh_link -plldb \
/usr/bin/lldb-server-$(PV_LLVM) \
/usr/bin/lldb-server
# lld
dh_link -plld \
/usr/bin/lld-$(PV_LLVM) \
/usr/bin/lld
dh_link -plld \
/usr/bin/ld.lld-$(PV_LLVM) \
/usr/bin/ld.lld
dh_link -plld \
/usr/bin/lld-link-$(PV_LLVM) \
/usr/bin/lld-link
dh_link -plld \
/usr/bin/wasm-ld-$(PV_LLVM) \
/usr/bin/wasm-ld
# flang
for bin in \
bbc f18-parse-demo fir-opt flang-new flang-to-external-fc tco \
; do \
dh_link -pflang \
/usr/bin/$$bin-$(PV_LLVM) \
/usr/bin/$$bin ; \
done
# bolt
for bin in \
llvm-bolt llvm-bolt-heatmap llvm-boltdiff merge-fdata perf2bolt \
; do \
dh_link -pllvm-bolt \
/usr/bin/$$bin-$(PV_LLVM) \
/usr/bin/$$bin ; \
done
nopkgs := $(foreach p, $(no_packages),-N$(p))
binary-indep: build install
# nothing to do
binary-arch: build install
dh_testdir
dh_lintian
dh_installchangelogs -a $(nopkgs)
dh_installdocs -a $(nopkgs) debian/README.Debian
dh_compress -a $(nopkgs) -X README.Debian
dh_fixperms -a $(nopkgs)
dh_installdeb -a $(nopkgs)
for p in $(packages) ; do \
dh_gencontrol -p$$p -- -v$(CV_LLVM) ; \
done
dh_md5sums -a $(nopkgs)
dh_builddeb -a $(nopkgs)
control-stamp: debian/control
debian/control: debian/control.in
sed \
-e "s|@MULTILIB_ARCHS@|$(MULTILIB_ARCHS)|g" \
-e "s|@LLDB_ARCHS@|$(LLDB_ARCHS)|g" \
-e "s|@OCAML_ARCHS@|$(OCAML_ARCHS)|g" \
-e "s|@OMP_ARCHS@|$(OMP_ARCHS)|g" \
-e "s|@OFFLOAD_ARCHS@|$(OFFLOAD_ARCHS)|g" \
-e "s|@FLANG_ARCHS@|$(FLANG_ARCHS)|g" \
-e "s|@LIBC_ARCHS@|$(LIBC_ARCHS)|g" \
-e "s|@LLD_ARCHS@|$(sort $(LLD_ARCHS))|g" \
-e "s|@POLLY_ARCHS@|$(sort $(POLLY_ARCHS))|g" \
-e "s|@LIBUNWIND_ARCHS@|$(sort $(LIBUNWIND_ARCHS))|g" \
-e "s|@ANY_ARCHS@|$(sort $(ANY_ARCHS))|g" \
-e "s|@LIBFUZZER_ARCHS@|$(sort $(LIBFUZZER_ARCHS))|g" \
-e "s|@BOLT_ARCHS@|$(sort $(BOLT_ARCHS))|g" \
debian/control.in > debian/control
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install
|