-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathkernel-tools.spec
More file actions
857 lines (720 loc) · 25.9 KB
/
kernel-tools.spec
File metadata and controls
857 lines (720 loc) · 25.9 KB
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
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
# TODO:
# - redefine: PACKAGE_BUGREPORT=cpufreq@vger.kernel.org
# - add -n python-perf?
# - add bcond to disable building docs (perf docs)
# - install of perf links perf binary again
# - build runqslower (needs vmlinux with BPF section)
#
# Conditional build:
%bcond_without verbose # verbose build (V=1)
%bcond_without cpupower # cpupower tools
%bcond_without perf # perf tools
%bcond_without gtk # GTK+ 2.x perf support
%bcond_without libunwind # libunwind perf support
%bcond_without multilib # multilib perf support
%bcond_with runqslower # runqslower bpf tool
%bcond_without usbip # usbip utils
%ifnarch %{x8664}
%undefine with_multilib
%endif
%define basever 6.19
%define postver .0
Summary: Assortment of tools for the Linux kernel
Summary(pl.UTF-8): Zestaw narzędzi dla jądra Linuksa
Name: kernel-tools
Version: %{basever}%{postver}
Release: 2
License: GPL v2
Group: Applications/System
Source0: https://www.kernel.org/pub/linux/kernel/v6.x/linux-%{basever}.tar.xz
# Source0-md5: 59c1e1f9c69a6fa9051450ba2ca38200
Source1: cpupower.service
Source2: cpupower.config
Source3: cpupower@.service
%if "%{postver}" != ".0"
Patch0: https://www.kernel.org/pub/linux/kernel/v6.x/patch-%{version}.xz
# Patch0-md5: dac2a9e84973152d0e92cf9a887aefdb
%endif
Patch1: x32.patch
Patch2: regex.patch
Patch3: %{name}-perf-update.patch
Patch4: %{name}-perf-gtk2.patch
URL: https://www.kernel.org/
BuildRequires: bison
BuildRequires: docutils
BuildRequires: flex
BuildRequires: gettext-tools
BuildRequires: libtraceevent-devel
BuildRequires: linux-libc-headers >= 7:4.12
BuildRequires: ncurses-devel
BuildRequires: ncurses-ext-devel
BuildRequires: pciutils-devel
BuildRequires: pkgconfig
BuildRequires: python3
BuildRequires: python3-modules
BuildRequires: readline-devel
BuildRequires: rpm-build >= 4.6
BuildRequires: rpmbuild(macros) >= 1.673
BuildRequires: tar >= 1:1.22
BuildRequires: xz
%if %{with perf}
BuildRequires: asciidoc
BuildRequires: audit-libs-devel
BuildRequires: babeltrace-devel
BuildRequires: binutils-devel >= 4:2.29
BuildRequires: clang >= 12.0.1
BuildRequires: docbook-dtd45-xml
BuildRequires: docbook-style-xsl
BuildRequires: elfutils-devel >= 0.158
%if %{with multilib}
BuildRequires: gcc-multilib-32
BuildRequires: gcc-multilib-x32
%endif
# for `btftool btf dump file ... format c` - requires vmlinux with BPF section
%{?with_runqslower:BuildRequires: kernel-vmlinux >= 5.?}
BuildRequires: libbpf-devel
BuildRequires: libcap-devel
BuildRequires: libstdc++-devel >= 6:8
%{?with_libunwind:BuildRequires: libunwind-devel >= 0.99}
BuildRequires: llvm-devel >= 13
BuildRequires: numactl-devel
BuildRequires: openssl-devel
BuildRequires: perl-devel >= 5.1
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: rpm-pythonprov
BuildRequires: slang-devel
BuildRequires: xmlto
BuildRequires: xz-devel
BuildRequires: zlib-devel
BuildRequires: zstd-devel
# openscd? (CORESIGHT=1 for %{arm}?)
%if %{with gtk}
BuildRequires: gtk+2-devel >= 2.0
%endif
%endif
%if %{with usbip}
BuildRequires: autoconf >= 2.59
BuildRequires: automake >= 1:1.9
BuildRequires: gcc >= 6:4.0
BuildRequires: libtool >= 2:2
BuildRequires: libwrap-devel
BuildRequires: udev-devel
%endif
# /usr/bin/turbostat
Conflicts: pmtools < 20110323-2
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
# otherwise /usr/lib/rpm/bin/debugedit: canonicalization unexpectedly shrank by one character
%define _enable_debug_packages 0
%ifarch ppc ppc64
%define makearch powerpc
%else
%ifarch aarch64
%define makearch arm64
%else
%define makearch %{_target_base_arch}
%endif
%endif
%define makeopts ARCH=%{makearch} CC="%{__cc}" CXX="%{__cxx}" %{?with_verbose:V=1}
%description
This package contains the software from tools/ subdirectory from Linux
kernel source and the supporting documentation.
%description -l pl.UTF-8
Ten pakiet zawiera oprogramowanie z podkatalogu tools/ ze źródeł jądra
Linuksa oraz związaną z nim dokumentację.
%package cpupower
Summary: cpupower - Shows and sets processor power related values
Summary(pl.UTF-8): cpupower - wyświetlanie i ustawianie wartości związanych z zużyciem energii przez procesor
Group: Applications/System
Requires(post,preun,postun): systemd-units >= 38
Requires: %{name}-cpupower-libs = %{version}-%{release}
Requires: systemd-units >= 0.38
Provides: cpupowerutils = 1:009-0.6.p1
Obsoletes: cpupowerutils < 1:009-0.6.p1
Obsoletes: cpuspeed < 1:1.5-16
%description cpupower
cpupower is a collection of tools to examine and tune power saving
related features of your processor.
%description cpupower -l pl.UTF-8
cpupower to zbiór narzędzi do sprawdzania i ustawiania opcji procesora
związanych z oszczędzaniem energii.
%package cpupower-libs
Summary: cpupower library
Summary(pl.UTF-8): Biblioteka cpupower
Group: Libraries
%description cpupower-libs
cpupower library.
%description cpupower-libs -l pl.UTF-8
Biblioteka cpupower.
%package cpupower-libs-devel
Summary: Development files for the cpupower library
Summary(pl.UTF-8): Pliki programistyczne biblioteki cpupower
Group: Development/Libraries
Requires: %{name}-cpupower-libs = %{version}-%{release}
Provides: cpupowerutils-devel = 1:009-0.6.p1
Obsoletes: cpupowerutils-devel < 1:009-0.6.p1
Conflicts: cpufrequtils-devel
%description cpupower-libs-devel
Development files for the cpupower library.
%description cpupower-libs-devel -l pl.UTF-8
Pliki programistyczne biblioteki cpupower.
%package -n bash-completion-cpupower
Summary: Bash completion for cpupower tools
Summary(pl.UTF-8): Bashowe uzupełnianie parametrów dla poleceń cpupower
Group: Applications/Shells
Requires: %{name}-cpupower = %{version}-%{release}
Requires: bash-completion
BuildArch: noarch
%description -n bash-completion-cpupower
Bash completion for cpupower tools.
%description -n bash-completion-cpupower -l pl.UTF-8
Bashowe uzupełnianie parametrów dla poleceń cpupower.
%package hv
Summary: Hyper-V virtualization tools
Summary(pl.UTF-8): Narzędzia do wirtualizacji Hyper-V
Group: Applications/System
%description hv
Hyper-V virtualization tools.
%description hv -l pl.UTF-8
Narzędzia do wirtualizacji Hyper-V.
%package perf
Summary: perf profiler tool
Summary(pl.UTF-8): Narzędzie profilujące perf
Group: Applications/System
Suggests: binutils
Obsoletes: kernel-tools-perf-core < 3.16.2
Obsoletes: kernel-tools-perf-slang < 3.16.2
%description perf
Perf is a profiler tool for Linux 2.6+ based systems that abstracts
away CPU hardware differences in Linux performance measurements and
presents a simple commandline interface. Perf is based on the
perf_events interface exported by recent versions of the Linux kernel.
This package contains core files, scripts and text interface (TUI).
%description perf -l pl.UTF-8
Perf to narzędzie profilujące dla systemów opartych na Linuksie 2.6+,
odseparowujące od różnic sprzętowych między pomiarami wydajności w
zależności od procesora oraz udostępniające prosty interfejs linii
poleceń. Perf jest oparty na interfejsie perf_events eksportowanym
przez nowe wersje jądra Linuksa.
Ten pakiet zawiera podstawowe pliki, skrypty oraz interfejs tekstowy
(TUI).
%package perf-vdso32
Summary: perf profiler tool - VDSO 32-bit ABI reader
Summary(pl.UTF-8): Narzędzie profilujące perf - odczyt VDSO dla ABI 32-bitowego
Group: Applications/System
Requires: %{name}-perf = %{version}-%{release}
%description perf-vdso32
Perf is a profiler tool for Linux 2.6+ based systems that abstracts
away CPU hardware differences in Linux performance measurements and
presents a simple commandline interface. Perf is based on the
perf_events interface exported by recent versions of the Linux kernel.
This package contains perf-read-vdso32 tool for reading the 32-bit
compatibility VDSO in 64-bit mode.
%description perf-vdso32 -l pl.UTF-8
Perf to narzędzie profilujące dla systemów opartych na Linuksie 2.6+,
odseparowujące od różnic sprzętowych między pomiarami wydajności w
zależności od procesora oraz udostępniające prosty interfejs linii
poleceń. Perf jest oparty na interfejsie perf_events eksportowanym
przez nowe wersje jądra Linuksa.
Ten pakiet zawiera narzędzie perf-read-vdso32 do odczytu VDSO dla
binariów 32-bitowych w trybie 64-bitowym.
%package perf-vdsox32
Summary: perf profiler tool - VDSO x32 ABI reader
Summary(pl.UTF-8): Narzędzie profilujące perf - odczyt VDSO dla ABI x32
Group: Applications/System
Requires: %{name}-perf = %{version}-%{release}
%description perf-vdsox32
Perf is a profiler tool for Linux 2.6+ based systems that abstracts
away CPU hardware differences in Linux performance measurements and
presents a simple commandline interface. Perf is based on the
perf_events interface exported by recent versions of the Linux kernel.
This package contains perf-read-vdso32 tool for reading the x32 mode
32-bit compatibility VDSO in 64-bit mode.
%description perf-vdsox32 -l pl.UTF-8
Perf to narzędzie profilujące dla systemów opartych na Linuksie 2.6+,
odseparowujące od różnic sprzętowych między pomiarami wydajności w
zależności od procesora oraz udostępniające prosty interfejs linii
poleceń. Perf jest oparty na interfejsie perf_events eksportowanym
przez nowe wersje jądra Linuksa.
Ten pakiet zawiera narzędzie perf-read-vdso32 do odczytu VDSO dla
binariów ABI x32 w trybie 64-bitowym.
%package perf-gtk
Summary: perf profiler tool (GTK+ 2 GUI)
Summary(pl.UTF-8): Narzędzie profilujące perf (interfejs graficzny GTK+ 2)
Group: X11/Applications
Requires: %{name}-perf = %{version}-%{release}
%description perf-gtk
Perf is a profiler tool for Linux 2.6+ based systems that abstracts
away CPU hardware differences in Linux performance measurements and
presents a simple commandline interface. Perf is based on the
perf_events interface exported by recent versions of the Linux kernel.
This package contains GTK+ 2 based GUI.
%description perf-gtk -l pl.UTF-8
Perf to narzędzie profilujące dla systemów opartych na Linuksie 2.6+,
odseparowujące od różnic sprzętowych między pomiarami wydajności w
zależności od procesora oraz udostępniające prosty interfejs linii
poleceń. Perf jest oparty na interfejsie perf_events eksportowanym
przez nowe wersje jądra Linuksa.
Ten pakiet zawiera graficzny interfejs oparty na GTK+ 2.
%package -n bash-completion-perf
Summary: Bash completion for perf command
Summary(pl.UTF-8): Bashowe uzupełnianie parametrów dla polecenia perf
Group: Applications/Shells
Requires: %{name}-perf = %{version}-%{release}
Requires: bash-completion
BuildArch: noarch
%description -n bash-completion-perf
Bash completion for perf command.
%description -n bash-completion-perf -l pl.UTF-8
Bashowe uzupełnianie parametrów dla polecenia perf.
%package -n bash-completion-kernel-tools
Summary: Bash completion for kernel-tools commands
Summary(pl.UTF-8): Bashowe uzupełnianie parametrów dla poleceń kernel-tools
Group: Applications/Shells
Requires: %{name} = %{version}-%{release}
Requires: bash-completion >= 1:2.0
BuildArch: noarch
%description -n bash-completion-kernel-tools
Bash completion for kernel-tools commands (currently bpftool).
%description -n bash-completion-kernel-tools -l pl.UTF-8
Bashowe uzupełnianie parametrów dla poleceń kernel-tools (obecnie
bpftool).
%package -n usbip
Summary: USB device sharing system over IP network
Summary(pl.UTF-8): System współdzielenia urządzeń USB po sieci IP
Group: Networking/Utilities
Requires: usbip-libs = %{version}-%{release}
# /lib/hwdata/usb.ids (note: only uncompressed file supported)
Requires: hwdata >= 0.243-2
%description -n usbip
The USB/IP Project aims to develop a general USB device sharing system
over IP network. To share USB devices between computers with their
full functionality, USB/IP encapsulates "USB requests" into IP packets
and transmits them between computers. Original USB device drivers and
applications can be also used for remote USB devices without any
modification of them. A computer can use remote USB devices as if they
were directly attached; for example, we can:
- USB storage devices: fdisk, mkfs, mount/umount, file operations,
play a DVD movie and record a DVD-R media.
- USB keyboards and USB mice: use with Linux console and X Window
System.
- USB webcams and USB speakers: view webcam, capture image data and
play some music.
- USB printers, USB scanners, USB serial converters and USB Ethernet
interfaces: ok, use fine.
%description -n usbip -l pl.UTF-8
Projekt USB/IP ma na celu stworzenie ogólnego systemu współdzielenia
urządzeń USB po sieci IP. W celu współdzielenia urządzeń USB między
komputerami z zachowaniem pełnej funkcjonalności, USB/IP obudowuje
żądania SUB w pakiety IP i przesyła je między komputerami. Oryginalne
sterowniki urządzeń USB oraz aplikacje mogą być używane bez żadnych
modyfikacji. Komputer może wykorzystywać zdaln urządzenia USB tak,
jakby były podłączone bezpośrednio. Przykładowe możliwości:
- urządzenia USB do przechowywania danych: można używać programów
fdisk, mkfs, mount/umount, operacji na plikach, odtwarzać filmy DVD
oraz nagrywać nośniki DVD-R
- klawiatury i myszy USB: można ich używać na linuksowej konsoli oraz
w systemie X Window
- kamery i głośniki USB: można oglądać obraz z kamery, robić zdjęcia i
odtwarzać muzykę
- drukarki, skanery, konwertery portów szeregowych oraz interfejsy
sieciowe USB: można ich normalnie używać
%package -n usbip-libs
Summary: USB/IP library
Summary(pl.UTF-8): Biblioteka USB/IP
Group: Libraries
%description -n usbip-libs
USB over IP library.
%description -n usbip-libs -l pl.UTF-8
Biblioteka USB po IP.
%package -n usbip-devel
Summary: Header files for usbip library
Summary(pl.UTF-8): Pliki nagłówkowe biblioteki usbip
Group: Development/Libraries
Requires: usbip-libs = %{version}-%{release}
%description -n usbip-devel
This package contains the header files needed to develop programs
which make use of USB/IP.
%description -n usbip-devel -l pl.UTF-8
Ten pakiet zawiera pliki nagłówkowe potrzebne do tworzenia programów
wykorzystujących USB/IP.
%package -n usbip-static
Summary: Static usbip library
Summary(pl.UTF-8): Statyczna biblioteka usbip
Group: Development/Libraries
Requires: usbip-devel = %{version}-%{release}
%description -n usbip-static
Static usbip library.
%description -n usbip-static -l pl.UTF-8
Statyczna biblioteka usbip.
%prep
%setup -qc
cd linux-%{basever}
%if "%{postver}" != ".0"
%patch -P0 -p1
%endif
%patch -P1 -p1
%patch -P2 -p1
%patch -P3 -p1
%patch -P4 -p1
%{__sed} -i -e '/^CFLAGS = /s/ -g / $(OPTFLAGS) /' tools/hv/Makefile
%{__sed} -i -e '/^CFLAGS+=/s/ -O1 / $(OPTFLAGS) /' tools/thermal/tmon/Makefile
%{__sed} -i -e 's#libexec/perf-core#%{_lib}/perf-core#g' tools/perf/Makefile.config
# don't rebuild on make install
%{__sed} -i -e '/^\$(LIBBPF): FORCE/ s/FORCE$//' tools/bpf/bpftool/Makefile
%if %{without runqslower}
%{__sed} -i -e '/^all: / s/ runqslower//' \
-e '/^install: / s/ runqslower_install//' \
tools/bpf/Makefile
%endif
%build
Wstringop=""
Waddressof=""
%if "%{cc_version}" >= "8"
Wstringop="-Wno-error=stringop-truncation"
%endif
%if "%{cc_version}" >= "9"
Waddressof="-Wno-error=address-of-packed-member"
%endif
cd linux-%{basever}
# Simple Disk Sleep Monitor
%{__make} -C tools/laptop/dslm \
%{makeopts} \
EXTRA_CFLAGS="%{rpmcflags}"
# tools common (used eg. by tools/mm)
%{__make} -C tools/lib/api \
%{makeopts} \
EXTRA_CFLAGS="%{rpmcflags} $Wstringop"
# lsgpio
CFLAGS="%{rpmcflags}" \
%{__make} -C tools/gpio -j1 \
%{makeopts}
# HyperV is Windows based, x86 specific
%ifarch %{ix86} %{x8664} x32
%{__make} -C tools/hv \
%{makeopts} \
OPTFLAGS="%{rpmcflags}"
%endif
CFLAGS="%{rpmcflags}" \
%{__make} -C tools/iio -j1 \
%{makeopts}
%{__make} -C tools/laptop/freefall \
%{makeopts} \
CFLAGS="%{rpmcflags}"
# make bpftool first, top-level bpf CFLAGS cause includes conflict
CFLAGS="%{rpmcflags}" \
%{__make} -C tools/bpf/bpftool \
%{makeopts}
CFLAGS="%{rpmcflags}" \
%{__make} -C tools/bpf \
%{makeopts} \
EXTRA_CFLAGS="%{rpmcflags}" \
%{?with_runqslower:VMLINUX_BTF=$(rpm -ql kernel-vmlinux | head -n 1)}
# perf
%if %{with perf}
CXXFLAGS="%{rpmcxxflags}" \
%{__make} -C tools/perf all man \
%ifarch %{x8664}
IS_X86_64=1 \
%{!?with_multilib:NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1} \
%endif
%{?with_gtk:GTK2=1} \
%{!?with_libunwind:NO_LIBUNWIND=1} \
%{makeopts} \
EXTRA_CFLAGS="%{rpmcflags}" \
JOBS=%{__jobs} \
VF=1 \
WERROR=0 \
prefix=%{_prefix} \
perfexecdir=%{_libdir}/perf-core \
lib=%{_lib} \
template_dir=%{_datadir}/perf-core/templates
%endif
# cpupower
%if %{with cpupower}
%{__make} -C tools/power/cpupower \
%{makeopts} \
CPUFREQ_BENCH=false \
OPTIMIZATION="%{rpmcflags}" \
STRIPCMD=true
%ifarch %{ix86} x32
%{__make} -C tools/power/cpupower/debug/i386 centrino-decode powernow-k8-decode \
%{makeopts} \
CFLAGS="%{rpmcflags}"
%endif
%ifarch %{x8664} x32
%{__make} -C tools/power/cpupower/debug/x86_64 centrino-decode powernow-k8-decode \
%{makeopts} \
CFLAGS="%{rpmcflags}"
%endif
%endif
%ifarch %{ix86} %{x8664} x32
CFLAGS="%{rpmcflags}" \
%{__make} -C tools/power/x86/x86_energy_perf_policy \
%{makeopts}
CFLAGS="%{rpmcflags}" \
%{__make} -C tools/power/x86/turbostat \
%{makeopts}
%endif
%{__make} -C tools/thermal/tmon \
%{makeopts} \
OPTFLAGS="%{rpmcflags}"
# usbip-utils
%if %{with usbip}
cd tools/usb/usbip
%{__libtoolize}
%{__aclocal}
%{__autoconf}
%{__autoheader}
%{__automake}
%configure \
CFLAGS="%{rpmcflags} $Wstringop $Waddressof" \
--disable-silent-rules \
--with-usbids-dir=/lib/hwdata
%{__make}
cd ../../..
%endif
# page-types, slabinfo
%{__make} -C tools/mm page-types slabinfo \
%{makeopts}
CFLAGS="%{rpmcflags} -Wall -Wextra -I../lib"
# gen_init_cpio
%{__make} -C usr gen_init_cpio \
%{makeopts} \
CFLAGS="%{rpmcflags}"
# kernel-chktaint
%{__make} -C tools/debugging
%install
rm -rf $RPM_BUILD_ROOT
cd linux-%{basever}
%if %{with cpupower}
%{__make} -C tools/power/cpupower install \
DESTDIR=$RPM_BUILD_ROOT \
libdir=%{_libdir} \
mandir=%{_mandir} \
CPUFREQ_BENCH=false
%{__rm} $RPM_BUILD_ROOT{/etc/cpupower-service.conf,/usr/libexec/cpupower,/usr/lib/systemd/system/cpupower.service}
%find_lang cpupower
%{__mv} cpupower.lang ..
install -d $RPM_BUILD_ROOT{/etc/sysconfig,%{systemdunitdir}}
cp -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdunitdir}/cpupower.service
cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/cpupower
cp -p %{SOURCE3} $RPM_BUILD_ROOT%{systemdunitdir}/cpupower@.service
%ifarch %{ix86} x32
install -p tools/power/cpupower/debug/i386/{centrino,powernow-k8}-decode $RPM_BUILD_ROOT%{_bindir}
%endif
%ifarch %{x8664} x32
install -p tools/power/cpupower/debug/x86_64/{centrino,powernow-k8}-decode $RPM_BUILD_ROOT%{_bindir}
%endif
%endif
%if %{with perf}
CXXFLAGS="%{rpmcxxflags}" \
%{__make} -C tools/perf install \
%ifarch %{x8664}
IS_X86_64=1 \
%{!?with_multilib:NO_PERF_READ_VDSO32=1 NO_PERF_READ_VDSOX32=1} \
%endif
%{?with_gtk:GTK2=1} \
%{!?with_libunwind:NO_LIBUNWIND=1} \
LIBPERL=1 \
%{makeopts} \
EXTRA_CFLAGS="%{rpmcflags}" \
WERROR=0 \
prefix=%{_prefix} \
perfexecdir=%{_libdir}/perf-core \
template_dir=%{_datadir}/perf-core/templates \
bash_compdir=%{bash_compdir} \
lib=%{_lib} \
DESTDIR=$RPM_BUILD_ROOT
%py3_comp $RPM_BUILD_ROOT%{_libdir}/perf-core/scripts/python
%py3_ocomp $RPM_BUILD_ROOT%{_libdir}/perf-core/scripts/python
%{__rm} -r $RPM_BUILD_ROOT%{_libdir}/perf-core/tests
%endif
%if %{with usbip}
%{__make} -C tools/usb/usbip install \
DESTDIR=$RPM_BUILD_ROOT
%{__rm} $RPM_BUILD_ROOT%{_libdir}/libusbip.la
%endif
install -d $RPM_BUILD_ROOT{%{_bindir},%{_sbindir},%{_mandir}/man8}
install -p tools/laptop/dslm/dslm $RPM_BUILD_ROOT%{_sbindir}
install -p tools/gpio/lsgpio $RPM_BUILD_ROOT%{_bindir}
%ifarch %{ix86} %{x8664} x32
install -p tools/hv/hv_{fcopy_uio,kvp,vss}_daemon $RPM_BUILD_ROOT%{_sbindir}
# TODO: PLD-specific hv_get_dhcp_info,hv_get_dns_info,hv_set_ifconfig
%{__sed} -e '1s,/usr/bin/env python3,%{__python3},' tools/hv/lsvmbus >$RPM_BUILD_ROOT%{_bindir}/lsvmbus
chmod 755 $RPM_BUILD_ROOT%{_bindir}/lsvmbus
%endif
install -p tools/iio/{iio_event_monitor,iio_generic_buffer,lsiio} $RPM_BUILD_ROOT%{_bindir}
install -p tools/laptop/freefall/freefall $RPM_BUILD_ROOT%{_sbindir}
%{__make} -C tools/bpf install \
prefix=$RPM_BUILD_ROOT%{_prefix} \
bash_compdir=$RPM_BUILD_ROOT%{bash_compdir} \
%{?with_verbose:V=1}
%{__make} -C tools/bpf/bpftool doc-install \
prefix=$RPM_BUILD_ROOT%{_prefix} \
mandir=$RPM_BUILD_ROOT%{_mandir} \
%{?with_verbose:V=1}
install -p tools/thermal/tmon/tmon $RPM_BUILD_ROOT%{_bindir}
cp -p tools/thermal/tmon/tmon.8 $RPM_BUILD_ROOT%{_mandir}/man8
install -p tools/mm/slabinfo $RPM_BUILD_ROOT%{_bindir}
install -p tools/mm/page-types $RPM_BUILD_ROOT%{_sbindir}
%ifarch %{ix86} %{x8664} x32
install -d $RPM_BUILD_ROOT%{_mandir}/man8
%{__make} -C tools/power/x86/x86_energy_perf_policy install \
DESTDIR=$RPM_BUILD_ROOT
%{__make} -C tools/power/x86/turbostat install \
DESTDIR=$RPM_BUILD_ROOT
%endif
# gen_init_cpio
install -p usr/gen_init_cpio $RPM_BUILD_ROOT%{_bindir}/gen_init_cpio
%{__make} -C tools/debugging install \
DESTDIR=$RPM_BUILD_ROOT
%clean
rm -rf $RPM_BUILD_ROOT
%post cpupower-libs -p /sbin/ldconfig
%postun cpupower-libs -p /sbin/ldconfig
%post cpupower
%systemd_post cpupower.service
%preun cpupower
%systemd_preun cpupower.service
%postun cpupower
%systemd_reload
%post -n usbip-libs -p /sbin/ldconfig
%postun -n usbip-libs -p /sbin/ldconfig
%files
%defattr(644,root,root,755)
%attr(755,root,root) %{_bindir}/bpf_asm
%attr(755,root,root) %{_bindir}/bpf_dbg
%attr(755,root,root) %{_bindir}/bpf_jit_disasm
%attr(755,root,root) %{_bindir}/gen_init_cpio
%attr(755,root,root) %{_bindir}/iio_event_monitor
%attr(755,root,root) %{_bindir}/iio_generic_buffer
%attr(755,root,root) %{_bindir}/kernel-chktaint
%attr(755,root,root) %{_bindir}/lsgpio
%attr(755,root,root) %{_bindir}/lsiio
%attr(755,root,root) %{_bindir}/slabinfo
%attr(755,root,root) %{_bindir}/tmon
%attr(755,root,root) %{_sbindir}/bpftool
%attr(755,root,root) %{_sbindir}/dslm
%attr(755,root,root) %{_sbindir}/freefall
%attr(755,root,root) %{_sbindir}/page-types
%{_mandir}/man8/bpftool*.8*
%{_mandir}/man8/tmon.8*
%ifarch %{ix86} %{x8664} x32
%attr(755,root,root) %{_bindir}/centrino-decode
%attr(755,root,root) %{_bindir}/powernow-k8-decode
%endif
%ifarch %{ix86} %{x8664} x32
%attr(755,root,root) %{_bindir}/turbostat
%attr(755,root,root) %{_bindir}/x86_energy_perf_policy
%{_mandir}/man8/turbostat.8*
%{_mandir}/man8/x86_energy_perf_policy.8*
%endif
%files cpupower -f cpupower.lang
%defattr(644,root,root,755)
%attr(755,root,root) %{_bindir}/cpupower
%{_mandir}/man1/cpupower*.1*
%{systemdunitdir}/cpupower.service
%{systemdunitdir}/cpupower@.service
%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/cpupower
%files cpupower-libs
%defattr(644,root,root,755)
%{_libdir}/libcpupower.so.*.*.*
%ghost %{_libdir}/libcpupower.so.1
%files cpupower-libs-devel
%defattr(644,root,root,755)
%{_libdir}/libcpupower.so
%{_includedir}/cpufreq.h
%{_includedir}/cpuidle.h
%{_includedir}/powercap.h
%files -n bash-completion-cpupower
%defattr(644,root,root,755)
%{bash_compdir}/cpupower
%ifarch %{ix86} %{x8664} x32
%files hv
%defattr(644,root,root,755)
# TODO: PLDify these scripts and move to bindir
%doc linux-%{basever}/tools/hv/hv_{get_dhcp_info,get_dns_info,set_ifconfig}.sh
%attr(755,root,root) %{_bindir}/lsvmbus
%attr(755,root,root) %{_sbindir}/hv_fcopy_uio_daemon
%attr(755,root,root) %{_sbindir}/hv_kvp_daemon
%attr(755,root,root) %{_sbindir}/hv_vss_daemon
%endif
%if %{with perf}
%files perf
%defattr(644,root,root,755)
%attr(755,root,root) %{_bindir}/perf
%attr(755,root,root) %{_bindir}/trace
%{_mandir}/man1/perf*.1*
%{_docdir}/perf-tip
%dir %{_libdir}/perf-core
%attr(755,root,root) %{_libdir}/perf-core/perf-archive
%attr(755,root,root) %{_libdir}/perf-core/perf-iostat
%dir %{_libdir}/perf-core/dlfilters
%{_libdir}/perf-core/dlfilters/dlfilter-show-cycles.so
%{_libdir}/perf-core/dlfilters/dlfilter-test-api-v0.so
%{_libdir}/perf-core/dlfilters/dlfilter-test-api-v2.so
%dir %{_libdir}/perf-core/scripts
%dir %{_libdir}/perf-core/scripts/perl
%dir %{_libdir}/perf-core/scripts/perl/Perf-Trace-Util
%dir %{_libdir}/perf-core/scripts/perl/Perf-Trace-Util/lib
%dir %{_libdir}/perf-core/scripts/perl/Perf-Trace-Util/lib/Perf
%dir %{_libdir}/perf-core/scripts/perl/Perf-Trace-Util/lib/Perf/Trace
%{_libdir}/perf-core/scripts/perl/Perf-Trace-Util/lib/Perf/Trace/*.pm
%dir %{_libdir}/perf-core/scripts/perl/bin
%attr(755,root,root) %{_libdir}/perf-core/scripts/perl/bin/*
%{_libdir}/perf-core/scripts/perl/*.pl
%dir %{_libdir}/perf-core/scripts/python
%dir %{_libdir}/perf-core/scripts/python/Perf-Trace-Util
%dir %{_libdir}/perf-core/scripts/python/Perf-Trace-Util/lib
%dir %{_libdir}/perf-core/scripts/python/Perf-Trace-Util/lib/Perf
%dir %{_libdir}/perf-core/scripts/python/Perf-Trace-Util/lib/Perf/Trace
%{_libdir}/perf-core/scripts/python/Perf-Trace-Util/lib/Perf/Trace/*.py
%dir %{_libdir}/perf-core/scripts/python/Perf-Trace-Util/lib/Perf/Trace/__pycache__
%{_libdir}/perf-core/scripts/python/Perf-Trace-Util/lib/Perf/Trace/__pycache__/*.py[co]
%dir %{_libdir}/perf-core/scripts/python/bin
%attr(755,root,root) %{_libdir}/perf-core/scripts/python/bin/*
%{_libdir}/perf-core/scripts/python/*.py
%dir %{_libdir}/perf-core/scripts/python/__pycache__
%{_libdir}/perf-core/scripts/python/__pycache__/*.py[co]
%{_includedir}/perf
%if %{with multilib}
%files perf-vdso32
%defattr(644,root,root,755)
%attr(755,root,root) %{_bindir}/perf-read-vdso32
%files perf-vdsox32
%defattr(644,root,root,755)
%attr(755,root,root) %{_bindir}/perf-read-vdsox32
%endif
%if %{with gtk}
%files perf-gtk
%defattr(644,root,root,755)
%{_libdir}/libperf-gtk.so
%endif
%files -n bash-completion-perf
%defattr(644,root,root,755)
/etc/bash_completion.d/perf
%endif
%files -n bash-completion-kernel-tools
%defattr(644,root,root,755)
%{bash_compdir}/bpftool
%if %{with usbip}
%files -n usbip
%defattr(644,root,root,755)
%doc linux-%{basever}/tools/usb/usbip/{AUTHORS,README}
%attr(755,root,root) %{_sbindir}/usbip
%attr(755,root,root) %{_sbindir}/usbipd
%{_mandir}/man8/usbip.8*
%{_mandir}/man8/usbipd.8*
%files -n usbip-libs
%defattr(644,root,root,755)
%{_libdir}/libusbip.so.*.*.*
%ghost %{_libdir}/libusbip.so.0
%files -n usbip-devel
%defattr(644,root,root,755)
%{_libdir}/libusbip.so
%{_includedir}/usbip
%files -n usbip-static
%defattr(644,root,root,755)
%{_libdir}/libusbip.a
%endif