diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/Kbuild.include | 3 | ||||
-rw-r--r-- | scripts/Makefile.lib | 2 | ||||
-rwxr-xr-x | scripts/gen_compile_commands.py | 4 | ||||
-rwxr-xr-x | scripts/sphinx-pre-install | 118 |
4 files changed, 99 insertions, 28 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 77c742fa4fb1..4b0432e095ae 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include | |||
@@ -190,9 +190,6 @@ echo-cmd = $(if $($(quiet)cmd_$(1)),\ | |||
190 | # printing commands | 190 | # printing commands |
191 | cmd = @set -e; $(echo-cmd) $(cmd_$(1)) | 191 | cmd = @set -e; $(echo-cmd) $(cmd_$(1)) |
192 | 192 | ||
193 | # Add $(obj)/ for paths that are not absolute | ||
194 | objectify = $(foreach o,$(1),$(if $(filter /%,$(o)),$(o),$(obj)/$(o))) | ||
195 | |||
196 | ### | 193 | ### |
197 | # if_changed - execute command if any prerequisite is newer than | 194 | # if_changed - execute command if any prerequisite is newer than |
198 | # target, or command line has changed | 195 | # target, or command line has changed |
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 5241d0751eb0..41c50f9461e5 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib | |||
@@ -45,7 +45,6 @@ subdir-ym := $(sort $(subdir-y) $(subdir-m)) | |||
45 | multi-used-y := $(sort $(foreach m,$(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m)))) | 45 | multi-used-y := $(sort $(foreach m,$(obj-y), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))), $(m)))) |
46 | multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))), $(m)))) | 46 | multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))), $(m)))) |
47 | multi-used := $(multi-used-y) $(multi-used-m) | 47 | multi-used := $(multi-used-y) $(multi-used-m) |
48 | single-used-m := $(sort $(filter-out $(multi-used-m),$(obj-m))) | ||
49 | 48 | ||
50 | # $(subdir-obj-y) is the list of objects in $(obj-y) which uses dir/ to | 49 | # $(subdir-obj-y) is the list of objects in $(obj-y) which uses dir/ to |
51 | # tell kbuild to descend | 50 | # tell kbuild to descend |
@@ -91,7 +90,6 @@ lib-y := $(addprefix $(obj)/,$(lib-y)) | |||
91 | subdir-obj-y := $(addprefix $(obj)/,$(subdir-obj-y)) | 90 | subdir-obj-y := $(addprefix $(obj)/,$(subdir-obj-y)) |
92 | real-obj-y := $(addprefix $(obj)/,$(real-obj-y)) | 91 | real-obj-y := $(addprefix $(obj)/,$(real-obj-y)) |
93 | real-obj-m := $(addprefix $(obj)/,$(real-obj-m)) | 92 | real-obj-m := $(addprefix $(obj)/,$(real-obj-m)) |
94 | single-used-m := $(addprefix $(obj)/,$(single-used-m)) | ||
95 | multi-used-m := $(addprefix $(obj)/,$(multi-used-m)) | 93 | multi-used-m := $(addprefix $(obj)/,$(multi-used-m)) |
96 | subdir-ym := $(addprefix $(obj)/,$(subdir-ym)) | 94 | subdir-ym := $(addprefix $(obj)/,$(subdir-ym)) |
97 | 95 | ||
diff --git a/scripts/gen_compile_commands.py b/scripts/gen_compile_commands.py index 7915823b92a5..c458696ef3a7 100755 --- a/scripts/gen_compile_commands.py +++ b/scripts/gen_compile_commands.py | |||
@@ -21,9 +21,9 @@ _LINE_PATTERN = r'^cmd_[^ ]*\.o := (.* )([^ ]*\.c)$' | |||
21 | _VALID_LOG_LEVELS = ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'] | 21 | _VALID_LOG_LEVELS = ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'] |
22 | 22 | ||
23 | # A kernel build generally has over 2000 entries in its compile_commands.json | 23 | # A kernel build generally has over 2000 entries in its compile_commands.json |
24 | # database. If this code finds 500 or fewer, then warn the user that they might | 24 | # database. If this code finds 300 or fewer, then warn the user that they might |
25 | # not have all the .cmd files, and they might need to compile the kernel. | 25 | # not have all the .cmd files, and they might need to compile the kernel. |
26 | _LOW_COUNT_THRESHOLD = 500 | 26 | _LOW_COUNT_THRESHOLD = 300 |
27 | 27 | ||
28 | 28 | ||
29 | def parse_arguments(): | 29 | def parse_arguments(): |
diff --git a/scripts/sphinx-pre-install b/scripts/sphinx-pre-install index f230e65329a2..3b638c0e1a4f 100755 --- a/scripts/sphinx-pre-install +++ b/scripts/sphinx-pre-install | |||
@@ -83,6 +83,17 @@ sub check_missing(%) | |||
83 | foreach my $prog (sort keys %missing) { | 83 | foreach my $prog (sort keys %missing) { |
84 | my $is_optional = $missing{$prog}; | 84 | my $is_optional = $missing{$prog}; |
85 | 85 | ||
86 | # At least on some LTS distros like CentOS 7, texlive doesn't | ||
87 | # provide all packages we need. When such distros are | ||
88 | # detected, we have to disable PDF output. | ||
89 | # | ||
90 | # So, we need to ignore the packages that distros would | ||
91 | # need for LaTeX to work | ||
92 | if ($is_optional == 2 && !$pdf) { | ||
93 | $optional--; | ||
94 | next; | ||
95 | } | ||
96 | |||
86 | if ($is_optional) { | 97 | if ($is_optional) { |
87 | print "Warning: better to also install \"$prog\".\n"; | 98 | print "Warning: better to also install \"$prog\".\n"; |
88 | } else { | 99 | } else { |
@@ -333,10 +344,13 @@ sub give_debian_hints() | |||
333 | 344 | ||
334 | if ($pdf) { | 345 | if ($pdf) { |
335 | check_missing_file("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", | 346 | check_missing_file("/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", |
336 | "fonts-dejavu", 1); | 347 | "fonts-dejavu", 2); |
348 | |||
349 | check_missing_file("/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc", | ||
350 | "fonts-noto-cjk", 2); | ||
337 | } | 351 | } |
338 | 352 | ||
339 | check_program("dvipng", 1) if ($pdf); | 353 | check_program("dvipng", 2) if ($pdf); |
340 | check_missing(\%map); | 354 | check_missing(\%map); |
341 | 355 | ||
342 | return if (!$need && !$optional); | 356 | return if (!$need && !$optional); |
@@ -363,6 +377,7 @@ sub give_redhat_hints() | |||
363 | my @fedora_tex_pkgs = ( | 377 | my @fedora_tex_pkgs = ( |
364 | "texlive-collection-fontsrecommended", | 378 | "texlive-collection-fontsrecommended", |
365 | "texlive-collection-latex", | 379 | "texlive-collection-latex", |
380 | "texlive-xecjk", | ||
366 | "dejavu-sans-fonts", | 381 | "dejavu-sans-fonts", |
367 | "dejavu-serif-fonts", | 382 | "dejavu-serif-fonts", |
368 | "dejavu-sans-mono-fonts", | 383 | "dejavu-sans-mono-fonts", |
@@ -371,22 +386,45 @@ sub give_redhat_hints() | |||
371 | # | 386 | # |
372 | # Checks valid for RHEL/CentOS version 7.x. | 387 | # Checks valid for RHEL/CentOS version 7.x. |
373 | # | 388 | # |
374 | if (! $system_release =~ /Fedora/) { | 389 | my $old = 0; |
390 | my $rel; | ||
391 | $rel = $1 if ($system_release =~ /release\s+(\d+)/); | ||
392 | |||
393 | if (!($system_release =~ /Fedora/)) { | ||
375 | $map{"virtualenv"} = "python-virtualenv"; | 394 | $map{"virtualenv"} = "python-virtualenv"; |
376 | } | ||
377 | 395 | ||
378 | my $release; | 396 | if ($rel && $rel < 8) { |
397 | $old = 1; | ||
398 | $pdf = 0; | ||
399 | |||
400 | printf("Note: texlive packages on RHEL/CENTOS <= 7 are incomplete. Can't support PDF output\n"); | ||
401 | printf("If you want to build PDF, please read:\n"); | ||
402 | printf("\thttps://www.systutorials.com/241660/how-to-install-tex-live-on-centos-7-linux/\n"); | ||
403 | } | ||
404 | } else { | ||
405 | if ($rel && $rel < 26) { | ||
406 | $old = 1; | ||
407 | } | ||
408 | } | ||
409 | if (!$rel) { | ||
410 | printf("Couldn't identify release number\n"); | ||
411 | $old = 1; | ||
412 | $pdf = 0; | ||
413 | } | ||
379 | 414 | ||
380 | $release = $1 if ($system_release =~ /Fedora\s+release\s+(\d+)/); | 415 | if ($pdf) { |
416 | check_missing_file("/usr/share/fonts/google-noto-cjk/NotoSansCJK-Regular.ttc", | ||
417 | "google-noto-sans-cjk-ttc-fonts", 2); | ||
418 | } | ||
381 | 419 | ||
382 | check_rpm_missing(\@fedora26_opt_pkgs, 1) if ($pdf && $release >= 26); | 420 | check_rpm_missing(\@fedora26_opt_pkgs, 2) if ($pdf && !$old); |
383 | check_rpm_missing(\@fedora_tex_pkgs, 1) if ($pdf); | 421 | check_rpm_missing(\@fedora_tex_pkgs, 2) if ($pdf); |
384 | check_missing_tex(1) if ($pdf); | 422 | check_missing_tex(2) if ($pdf); |
385 | check_missing(\%map); | 423 | check_missing(\%map); |
386 | 424 | ||
387 | return if (!$need && !$optional); | 425 | return if (!$need && !$optional); |
388 | 426 | ||
389 | if ($release >= 18) { | 427 | if (!$old) { |
390 | # dnf, for Fedora 18+ | 428 | # dnf, for Fedora 18+ |
391 | printf("You should run:\n\n\tsudo dnf install -y $install\n"); | 429 | printf("You should run:\n\n\tsudo dnf install -y $install\n"); |
392 | } else { | 430 | } else { |
@@ -425,8 +463,15 @@ sub give_opensuse_hints() | |||
425 | "texlive-zapfding", | 463 | "texlive-zapfding", |
426 | ); | 464 | ); |
427 | 465 | ||
428 | check_rpm_missing(\@suse_tex_pkgs, 1) if ($pdf); | 466 | $map{"latexmk"} = "texlive-latexmk-bin"; |
429 | check_missing_tex(1) if ($pdf); | 467 | |
468 | # FIXME: add support for installing CJK fonts | ||
469 | # | ||
470 | # I tried hard, but was unable to find a way to install | ||
471 | # "Noto Sans CJK SC" on openSUSE | ||
472 | |||
473 | check_rpm_missing(\@suse_tex_pkgs, 2) if ($pdf); | ||
474 | check_missing_tex(2) if ($pdf); | ||
430 | check_missing(\%map); | 475 | check_missing(\%map); |
431 | 476 | ||
432 | return if (!$need && !$optional); | 477 | return if (!$need && !$optional); |
@@ -450,7 +495,14 @@ sub give_mageia_hints() | |||
450 | "texlive-fontsextra", | 495 | "texlive-fontsextra", |
451 | ); | 496 | ); |
452 | 497 | ||
453 | check_rpm_missing(\@tex_pkgs, 1) if ($pdf); | 498 | $map{"latexmk"} = "texlive-collection-basic"; |
499 | |||
500 | if ($pdf) { | ||
501 | check_missing_file("/usr/share/fonts/google-noto-cjk/NotoSansCJK-Regular.ttc", | ||
502 | "google-noto-sans-cjk-ttc-fonts", 2); | ||
503 | } | ||
504 | |||
505 | check_rpm_missing(\@tex_pkgs, 2) if ($pdf); | ||
454 | check_missing(\%map); | 506 | check_missing(\%map); |
455 | 507 | ||
456 | return if (!$need && !$optional); | 508 | return if (!$need && !$optional); |
@@ -473,7 +525,13 @@ sub give_arch_linux_hints() | |||
473 | "texlive-latexextra", | 525 | "texlive-latexextra", |
474 | "ttf-dejavu", | 526 | "ttf-dejavu", |
475 | ); | 527 | ); |
476 | check_pacman_missing(\@archlinux_tex_pkgs, 1) if ($pdf); | 528 | check_pacman_missing(\@archlinux_tex_pkgs, 2) if ($pdf); |
529 | |||
530 | if ($pdf) { | ||
531 | check_missing_file("/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc", | ||
532 | "noto-fonts-cjk", 2); | ||
533 | } | ||
534 | |||
477 | check_missing(\%map); | 535 | check_missing(\%map); |
478 | 536 | ||
479 | return if (!$need && !$optional); | 537 | return if (!$need && !$optional); |
@@ -492,15 +550,31 @@ sub give_gentoo_hints() | |||
492 | ); | 550 | ); |
493 | 551 | ||
494 | check_missing_file("/usr/share/fonts/dejavu/DejaVuSans.ttf", | 552 | check_missing_file("/usr/share/fonts/dejavu/DejaVuSans.ttf", |
495 | "media-fonts/dejavu", 1) if ($pdf); | 553 | "media-fonts/dejavu", 2) if ($pdf); |
554 | |||
555 | if ($pdf) { | ||
556 | check_missing_file("/usr/share/fonts/noto-cjk/NotoSansCJKsc-Regular.otf", | ||
557 | "media-fonts/noto-cjk", 2); | ||
558 | } | ||
496 | 559 | ||
497 | check_missing(\%map); | 560 | check_missing(\%map); |
498 | 561 | ||
499 | return if (!$need && !$optional); | 562 | return if (!$need && !$optional); |
500 | 563 | ||
501 | printf("You should run:\n\n"); | 564 | printf("You should run:\n\n"); |
502 | printf("\tsudo su -c 'echo \"media-gfx/imagemagick svg png\" > /etc/portage/package.use/imagemagick'\n"); | 565 | |
503 | printf("\tsudo su -c 'echo \"media-gfx/graphviz cairo pdf\" > /etc/portage/package.use/graphviz'\n"); | 566 | my $imagemagick = "media-gfx/imagemagick svg png"; |
567 | my $cairo = "media-gfx/graphviz cairo pdf"; | ||
568 | my $portage_imagemagick = "/etc/portage/package.use/imagemagick"; | ||
569 | my $portage_cairo = "/etc/portage/package.use/graphviz"; | ||
570 | |||
571 | if (qx(cat $portage_imagemagick) ne "$imagemagick\n") { | ||
572 | printf("\tsudo su -c 'echo \"$imagemagick\" > $portage_imagemagick'\n") | ||
573 | } | ||
574 | if (qx(cat $portage_cairo) ne "$cairo\n") { | ||
575 | printf("\tsudo su -c 'echo \"$cairo\" > $portage_cairo'\n"); | ||
576 | } | ||
577 | |||
504 | printf("\tsudo emerge --ask $install\n"); | 578 | printf("\tsudo emerge --ask $install\n"); |
505 | 579 | ||
506 | } | 580 | } |
@@ -560,7 +634,7 @@ sub check_distros() | |||
560 | my %map = ( | 634 | my %map = ( |
561 | "sphinx-build" => "sphinx" | 635 | "sphinx-build" => "sphinx" |
562 | ); | 636 | ); |
563 | check_missing_tex(1) if ($pdf); | 637 | check_missing_tex(2) if ($pdf); |
564 | check_missing(\%map); | 638 | check_missing(\%map); |
565 | print "I don't know distro $system_release.\n"; | 639 | print "I don't know distro $system_release.\n"; |
566 | print "So, I can't provide you a hint with the install procedure.\n"; | 640 | print "So, I can't provide you a hint with the install procedure.\n"; |
@@ -589,11 +663,13 @@ sub check_needs() | |||
589 | check_program("make", 0); | 663 | check_program("make", 0); |
590 | check_program("gcc", 0); | 664 | check_program("gcc", 0); |
591 | check_python_module("sphinx_rtd_theme", 1) if (!$virtualenv); | 665 | check_python_module("sphinx_rtd_theme", 1) if (!$virtualenv); |
592 | check_program("xelatex", 1) if ($pdf); | ||
593 | check_program("dot", 1); | 666 | check_program("dot", 1); |
594 | check_program("convert", 1); | 667 | check_program("convert", 1); |
595 | check_program("rsvg-convert", 1) if ($pdf); | 668 | |
596 | check_program("latexmk", 1) if ($pdf); | 669 | # Extra PDF files - should use 2 for is_optional |
670 | check_program("xelatex", 2) if ($pdf); | ||
671 | check_program("rsvg-convert", 2) if ($pdf); | ||
672 | check_program("latexmk", 2) if ($pdf); | ||
597 | 673 | ||
598 | check_distros(); | 674 | check_distros(); |
599 | 675 | ||