PKGBUILD 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. # Maintainer (arch:linux-tools): Sébastien Luttringer <seblu@archlinux.org>
  2. # Maintainer: David P. <megver83@parabola.nu>
  3. # Contributor: Omar Vega Ramos <ovruni@gnu.org.pe>
  4. # Contributor: André Silva <emulatorman@hyperbola.info>
  5. # Contributor: Márcio Silva <coadde@hyperbola.info>
  6. # Contributor: bill-auger <bill-auger@programmer.net>
  7. # parabola changes and rationale:
  8. # - changed upstream to linux-libre
  9. # - removed hyperV and bpf support
  10. pkgbase=linux-libre-tools
  11. pkgname=(
  12. 'bootconfig'
  13. 'cgroup_event_listener'
  14. 'cpupower'
  15. 'libtraceevent'
  16. 'linux-libre-tools-meta'
  17. 'perf'
  18. # 'python-perf'
  19. 'tmon'
  20. 'usbip'
  21. )
  22. case "$CARCH" in
  23. armv7h) pkgname+=('gpio-utils' 'iio-utils') ;;
  24. i686|x86_64) pkgname+=('turbostat' 'x86_energy_perf_policy') ;;
  25. esac
  26. pkgver=6.1.5
  27. pkgver+=_gnu
  28. pkgrel=1
  29. license=('GPL2')
  30. arch=('x86_64')
  31. arch+=('i686' 'armv7h')
  32. url='https://linux-libre.fsfla.org/'
  33. options=('!strip')
  34. makedepends=('git')
  35. # split packages need all package dependencies set manually in makedepends
  36. # kernel source deps
  37. makedepends+=('asciidoc' 'xmlto')
  38. # perf deps
  39. makedepends+=('perl' 'python' 'slang' 'elfutils' 'libunwind' 'audit' 'zstd' 'libcap')
  40. makedepends_x86_64=('numactl')
  41. makedepends_i686=('numactl')
  42. # cpupower deps
  43. makedepends+=('pciutils')
  44. # usbip deps
  45. makedepends+=('glib2' 'sysfsutils' 'udev')
  46. # tmon deps
  47. makedepends+=('ncurses')
  48. # turbostat deps
  49. [[ "$CARCH" =~ 'x86_64|i686' ]] &&
  50. makedepends+=('libcap')
  51. groups=("$pkgbase")
  52. source=("https://linux-libre.fsfla.org/pub/linux-libre/releases/${pkgver//_/-}/linux-libre-${pkgver//_/-}.tar.xz"{,.sign}
  53. # "https://linux-libre.fsfla.org/pub/linux-libre/releases/${pkgver%.*}-gnu/patch-${pkgver%.*}-gnu-${pkgver//_/-}.xz"{,.sign}
  54. 'cpupower.default'
  55. 'cpupower.systemd'
  56. 'cpupower.service'
  57. 'usbipd.service'
  58. )
  59. sha256sums=('1d41ec34b7d9741aeebaaf9527d97938c311debe1494950d13df8598a1e8bef6'
  60. 'SKIP'
  61. '4fa509949d6863d001075fa3e8671eff2599c046d20c98bb4a70778595cd1c3f'
  62. 'b692f4859ed3fd9831a058a450a84d8c409bf7e3e45aac1c2896a14bb83f3d7a'
  63. '42d2ec9f1d9cc255ee7945a27301478364ef482f5a6ddfc960189f03725ccec2'
  64. '2e187734d8aec58a3046d79883510d779aa93fb3ab20bd3132c1a607ebe5498f'
  65. )
  66. validpgpkeys=('474402C8C582DAFBE389C427BCB7CF877E7D47A7') # Alexandre Oliva
  67. prepare() {
  68. cd linux-${pkgver%_*}
  69. # apply patch from the source array (should be a pacman feature)
  70. local src
  71. for src in "${source[@]}"; do
  72. src="${src%%::*}"
  73. src="${src##*/}"
  74. src="${src%.xz}"
  75. [[ $src = *.patch || $src = patch-* ]] || continue
  76. echo ":: Applying patch $src"
  77. patch -p1 -N -i "$srcdir/$src"
  78. done
  79. }
  80. build() {
  81. echo ':: libtraceevent'
  82. pushd linux-${pkgver%_*}/tools/lib/traceevent
  83. make
  84. popd
  85. echo ':: perf'
  86. pushd linux-${pkgver%_*}/tools/perf
  87. make -f Makefile.perf \
  88. prefix=/usr \
  89. lib=lib/perf \
  90. perfexecdir=lib/perf \
  91. EXTRA_CFLAGS=' -Wno-error=bad-function-cast -Wno-error=declaration-after-statement -Wno-error=switch-enum' \
  92. NO_SDT=1 \
  93. PYTHON=python \
  94. PYTHON_CONFIG=python-config \
  95. PERF_VERSION=$pkgver-$pkgrel \
  96. DESTDIR="$pkgdir"
  97. popd
  98. echo ':: cpupower'
  99. pushd linux-${pkgver%_*}/tools/power/cpupower
  100. make VERSION=$pkgver-$pkgrel
  101. popd
  102. if [[ "$CARCH" == x86_64 ]] || [[ "$CARCH" == i686 ]]; then
  103. echo ':: x86_energy_perf_policy'
  104. pushd linux-${pkgver%_*}/tools/power/x86/x86_energy_perf_policy
  105. make
  106. popd
  107. fi
  108. echo ':: usbip'
  109. pushd linux-${pkgver%_*}/tools/usb/usbip
  110. # Fix gcc compilation
  111. sed -i 's,-Wall -Werror -Wextra,-fcommon,' configure.ac
  112. ./autogen.sh
  113. ./configure --prefix=/usr --sbindir=/usr/bin
  114. make
  115. popd
  116. echo ':: tmon'
  117. pushd linux-${pkgver%_*}/tools/thermal/tmon
  118. make
  119. popd
  120. echo ':: cgroup_event_listener'
  121. pushd linux-${pkgver%_*}/tools/cgroup
  122. make
  123. popd
  124. if [[ "$CARCH" == x86_64 ]] || [[ "$CARCH" == i686 ]]; then
  125. echo ':: turbostat'
  126. pushd linux-${pkgver%_*}/tools/power/x86/turbostat
  127. make
  128. popd
  129. fi
  130. echo ':: hv'
  131. pushd linux/tools/hv
  132. CFLAGS+=' -DKVP_SCRIPTS_PATH=\"/usr/lib/hyperv/kvp_scripts/\"' make
  133. if [[ "$CARCH" == armv7h ]]; then
  134. echo ':: gpio'
  135. pushd linux-${pkgver%_*}/tools/gpio
  136. make -j1
  137. popd
  138. echo ':: iio'
  139. pushd linux-${pkgver%_*}/tools/iio
  140. make -j1
  141. popd
  142. fi
  143. echo ':: bootconfig'
  144. pushd linux/tools/bootconfig
  145. make
  146. popd
  147. }
  148. package_linux-libre-tools-meta() {
  149. pkgdesc='GNU/Linux-libre kernel tools meta package'
  150. groups=()
  151. depends=(
  152. 'bootconfig'
  153. 'cgroup_event_listener'
  154. 'cpupower'
  155. 'libtraceevent'
  156. 'perf'
  157. # 'python-perf'
  158. 'tmon'
  159. 'usbip'
  160. )
  161. conflicts=(
  162. 'acpidump'
  163. )
  164. depends_x86_64=('turbostat' 'x86_energy_perf_policy')
  165. depends_i686=('turbostat' 'x86_energy_perf_policy')
  166. depends_armv7h=('gpio-utils' 'iio-utils')
  167. replaces=(linux-tools-meta)
  168. conflicts+=(linux-tools-meta)
  169. provides=(linux-tools-meta)
  170. }
  171. package_libtraceevent() {
  172. pkgdesc='GNU/Linux-libre kernel trace event library'
  173. depends=('glibc')
  174. cd linux-${pkgver%_*}/tools/lib/traceevent
  175. install -dm 755 "$pkgdir/usr/lib"
  176. install -m 644 libtraceevent.so "$pkgdir/usr/lib"
  177. }
  178. package_perf() {
  179. pkgdesc='GNU/Linux-libre kernel performance auditing tool'
  180. depends=('glibc' 'perl' 'python' 'slang' 'elfutils' 'libunwind' 'binutils'
  181. 'audit' 'coreutils' 'glib2' 'xz' 'zlib' 'libelf' 'bash'
  182. 'zstd' 'libcap')
  183. depends_x86_64=('numactl')
  184. depends_i686=('numactl')
  185. optdepends=('gtk2: support GTK2 browser for perf report')
  186. cd linux-${pkgver%_*}/tools/perf
  187. make -f Makefile.perf \
  188. prefix=/usr \
  189. lib=lib/perf \
  190. perfexecdir=lib/perf \
  191. EXTRA_CFLAGS=' -Wno-error=bad-function-cast -Wno-error=declaration-after-statement -Wno-error=switch-enum' \
  192. NO_SDT=1 \
  193. PYTHON=python \
  194. PYTHON_CONFIG=python-config \
  195. PERF_VERSION=$pkgver-$pkgrel \
  196. DESTDIR="$pkgdir" \
  197. install
  198. cd "$pkgdir"
  199. # add linker search path
  200. mkdir "$pkgdir/etc/ld.so.conf.d"
  201. echo '/usr/lib/perf' > "$pkgdir/etc/ld.so.conf.d/$pkgname.conf"
  202. # move completion in new directory
  203. install -Dm644 etc/bash_completion.d/perf usr/share/bash-completion/completions/perf
  204. rm -r etc/bash_completion.d
  205. # no exec on usr/share
  206. find usr/share -type f -exec chmod a-x {} \;
  207. }
  208. #package_python-perf(){
  209. # pkgdesc='GNU/Linux-libre kernel performance auditing tool (python bindings)'
  210. # depends=('python')
  211. #
  212. # cd linux-${pkgver%_*}/tools/perf
  213. #
  214. # make install-python_ext PYTHON=python DESTDIR="$pkgdir"
  215. #}
  216. package_cpupower() {
  217. pkgdesc='GNU/Linux-libre kernel tool to examine and tune power saving related features of your processor'
  218. backup=('etc/default/cpupower')
  219. depends=('glibc' 'bash' 'pciutils')
  220. conflicts=('cpufrequtils')
  221. replaces=('cpufrequtils')
  222. install=cpupower.install
  223. pushd linux-${pkgver%_*}/tools/power/cpupower
  224. make \
  225. DESTDIR="$pkgdir" \
  226. sbindir='/usr/bin' \
  227. libdir='/usr/lib' \
  228. mandir='/usr/share/man' \
  229. docdir='/usr/share/doc/cpupower' \
  230. install install-man
  231. popd
  232. # install startup scripts
  233. install -Dm 644 $pkgname.default "$pkgdir/etc/default/$pkgname"
  234. install -Dm 644 $pkgname.service "$pkgdir/usr/lib/systemd/system/$pkgname.service"
  235. install -Dm 755 $pkgname.systemd "$pkgdir/usr/lib/systemd/scripts/$pkgname"
  236. }
  237. package_x86_energy_perf_policy() {
  238. pkgdesc='Read or write MSR_IA32_ENERGY_PERF_BIAS'
  239. depends=('glibc')
  240. cd linux-${pkgver%_*}/tools/power/x86/x86_energy_perf_policy
  241. install -Dm 755 x86_energy_perf_policy "$pkgdir/usr/bin/x86_energy_perf_policy"
  242. install -Dm 644 x86_energy_perf_policy.8 "$pkgdir/usr/share/man/man8/x86_energy_perf_policy.8"
  243. }
  244. package_usbip() {
  245. pkgdesc='An USB device sharing system over IP network'
  246. depends=('glibc' 'glib2' 'sysfsutils' 'systemd-libs')
  247. pushd linux-${pkgver%_*}/tools/usb/usbip
  248. make install DESTDIR="$pkgdir"
  249. popd
  250. # module loading
  251. install -Dm 644 /dev/null "$pkgdir/usr/lib/modules-load.d/$pkgname.conf"
  252. printf 'usbip-core\nusbip-host\n' > "$pkgdir/usr/lib/modules-load.d/$pkgname.conf"
  253. # systemd
  254. install -Dm 644 usbipd.service "$pkgdir/usr/lib/systemd/system/usbipd.service"
  255. }
  256. package_tmon() {
  257. pkgdesc='Monitoring and Testing Tool for GNU/Linux-libre kernel thermal subsystem'
  258. depends=('glibc' 'ncurses')
  259. cd linux-${pkgver%_*}/tools/thermal/tmon
  260. make install INSTALL_ROOT="$pkgdir"
  261. }
  262. package_cgroup_event_listener() {
  263. pkgdesc='Simple listener of cgroup events'
  264. depends=('glibc')
  265. cd linux-${pkgver%_*}/tools/cgroup
  266. install -Dm755 cgroup_event_listener "$pkgdir/usr/bin/cgroup_event_listener"
  267. }
  268. package_turbostat() {
  269. pkgdesc='Report processor frequency and idle statistics'
  270. depends=('glibc' 'libcap')
  271. cd linux-${pkgver%_*}/tools/power/x86/turbostat
  272. make install DESTDIR="$pkgdir"
  273. }
  274. package_gpio-utils() {
  275. pkgdesc='GPIO character device utilities'
  276. depends=('glibc')
  277. cd linux-${pkgver%_*}/tools/gpio
  278. make install DESTDIR="$pkgdir"
  279. }
  280. package_iio-utils() {
  281. pkgdesc='Industrial IO utilities'
  282. depends=('glibc')
  283. cd linux-${pkgver%_*}/tools/iio
  284. make install DESTDIR="$pkgdir"
  285. }
  286. package_bootconfig() {
  287. pkgdesc='Apply, delete or show boot config to initrd'
  288. depends=('glibc')
  289. cd linux/tools/bootconfig
  290. install -dm755 "$pkgdir/usr/bin"
  291. make install DESTDIR="$pkgdir"
  292. }