PKGBUILD 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825
  1. # Maintainer (arch): Christian Hesse <mail@eworm.de>
  2. # Maintainer: Luke Shumaker <lukeshu@parabola.nu>
  3. # Contributor: Omar Vega Ramos <ovruni@gnu.org.pe>
  4. # Contributor: Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
  5. # Contributor: bill-auger <bill-auger@programmer.net>
  6. # Tips for the maintainer (i.e.: future me?):
  7. #
  8. # - I check in the .SRCINFO file because it makes it easier to verify
  9. # that the metadata changes are what you expect.
  10. # - I use the `./srcinfo-gen.sh` script to update .SRCINFO after
  11. # `libremakepkg`ing the package.
  12. # - I use the `./srcinfo-diff.sh` script to sanity-check
  13. # .SRCINFO:depends against Arch's version.
  14. # There are a lot of pkgnames in this file, whether in the pkgname=()
  15. # array, or in provides=(), conflicts=(), or replaces=(). Let's go
  16. # over where each comes from and what it means, for clarity.
  17. #
  18. # Inherited from Arch:
  19. # * systemd's current pkgname=():
  20. # - `systemd`: Duh
  21. # - `systemd-libs`: `libsystemd.so`, `libudev.so`, and the NSS modules
  22. # - `systemd-resolvconf`: resolvconf(1)
  23. # - `systemd-sysvcompat`: init(1), halt(8), poweroff(8), reboot(8), shutdown(8)
  24. # - `systemd-tests`: Installable tests (/usr/lib/systemd/tests/) for the
  25. # installed systemd
  26. # - `systemd-ukify`: ukify(1)
  27. # * historical systemd pkgname=() values:
  28. # - `udev`: existed as a split package 2012-02 to 2012-05, when it merged into
  29. # `systemd-tools`
  30. # - `systemd-tools`: existed as a split package 2012-02 to 2012-08, when it
  31. # merged into `systemd`
  32. # - `libsystemd`: the name of `systemd-libs` prior to 2019-02
  33. # * separate packages:
  34. # - `systemd-sysvcompat`: existed as a separate package (not a split package)
  35. # 2012-02 to 2012-06
  36. # - `nss-myhostname`: a separate that existed first in `extra` then in `core`,
  37. # 2012-02 to 2013-01, when it became part of systemd
  38. # - `sysvinit`: a separate package that existed in `core` until 2013-05
  39. # - `openresolv`: prior to 2018-06 this was Arch's only `resolvconf`
  40. # implementation, so most packages depended on it instead of the `resolvconf`
  41. # virtual package
  42. # * virtual packages:
  43. # - `resolvconf`: since 2018-06, resolvconf(1)
  44. #
  45. # From Parabola (mostly by the decision-making of lukeshu):
  46. # * systemd's current pkgname=():
  47. # - We further split `systemd` into:
  48. # + `systemd`: systemd itself
  49. # + `systemd-udev`: just udev
  50. # + `systemd-boot`: just bootctl and usr/lib/systemd/boot/
  51. # + `systemd-common`: files shared between `systemd` and `systemd-udev`
  52. # - We further split `systemd-libs` into a separate package for each
  53. # library and NSS module:
  54. # + `systemd-libsystemd`
  55. # + `systemd-libudev`
  56. # + `systemd-nss-systemd`
  57. # + `systemd-nss-myhostname`
  58. # + `systemd-nss-mymachines`
  59. # + `systemd-nss-resolve`
  60. # Separating libsystemd and libudev are obvious. I can make a good case for
  61. # separating nss-myhostname, because it's useful on nonsystemd boxes. But I
  62. # guess I (lukeshu) separated out the other NSS modules too just for
  63. # consistency with nss-myhostname? I'm sure I felt strongly about it at the
  64. # time.
  65. # * separate packages:
  66. # - `notsystemd-resolvconf`: existed 2018-07 to 2018-08, was identical to
  67. # `systemd-resolvconf`
  68. # * virtual packages:
  69. # - `init`: `/usr/bin/init`; invented by lukeshu in order to have mutual
  70. # provides/conflicts between `systemd-sysvcompat`, `sysvinit`, and
  71. # `openrc-init`.
  72. # - `libsystemd-standalone`: `libsystemd.so`; the pkgname has `-standalone`
  73. # appended because we inherited from Arch a different (historical) meaning of
  74. # what the `libsystemd` pkgname is.
  75. # - `libudev`: `libudev.so`
  76. # - `nss-systemd`: `libnss_systemd.so`
  77. # - `nss-myhostname`: `libnss_myhostname.so`
  78. # - `nss-mymachines`: `libnss_mymachines.so`
  79. # - `nss-resolve`: `libnss_resolve.so`
  80. pkgbase=systemd
  81. pkgname=('systemd'
  82. 'systemd-libs'
  83. 'systemd-resolvconf'
  84. 'systemd-sysvcompat'
  85. 'systemd-ukify')
  86. pkgname+=('systemd-common' 'systemd-udev' 'systemd-boot' 'systemd-tests')
  87. # We split Arch's systemd-libs into systemd-$X, for the following $X:
  88. _systemd_libs=('libsystemd' 'libudev' 'nss-systemd' 'nss-myhostname' 'nss-mymachines' 'nss-resolve')
  89. pkgname+=("${_systemd_libs[@]/#/systemd-}")
  90. _tag='256.5'
  91. # Upstream versioning is incompatible with pacman's version comparisons, one
  92. # way or another. So we replace dashes and tildes with the empty string to
  93. # make sure pacman's version comparing does the right thing for rc versions:
  94. pkgver="${_tag/[-~]/}"
  95. pkgrel=1
  96. pkgrel+=.parabola1
  97. arch=('x86_64')
  98. arch+=('i686' 'armv7h' 'ppc64le')
  99. license=('LGPL-2.1-or-later')
  100. url='https://www.github.com/systemd/systemd'
  101. makedepends=('acl' 'cryptsetup' 'docbook-xsl' 'gperf' 'lz4' 'xz' 'pam' 'libelf'
  102. 'intltool' 'iptables' 'kmod' 'libarchive' 'libcap' 'libidn2' 'libgcrypt'
  103. 'libmicrohttpd' 'libxcrypt' 'libxslt' 'util-linux' 'linux-api-headers'
  104. 'python-jinja' 'python-lxml' 'quota-tools' 'shadow' 'git'
  105. 'meson' 'libseccomp' 'pcre2' 'audit' 'kexec-tools' 'libxkbcommon'
  106. 'bash-completion' 'p11-kit' 'systemd' 'libfido2' 'tpm2-tss' 'rsync'
  107. 'bpf' 'libbpf' 'clang' 'llvm' 'curl' 'gnutls' 'python-pyelftools'
  108. 'libpwquality' 'qrencode' 'lib32-gcc-libs' 'python-pefile')
  109. makedepends=(${makedepends[*]/lib32-gcc-libs}) # only include lib32-gcc-libs on x86_64
  110. makedepends_x86_64=('lib32-gcc-libs')
  111. makedepends+=('jq') # Parabola: For _lib_deps()
  112. conflicts=("mkinitcpio<38-1")
  113. validpgpkeys=('63CDA1E5D3FC22B998D20DD6327F26951A015CC4' # Lennart Poettering <lennart@poettering.net>
  114. 'A9EA9081724FFAE0484C35A1A81CEA22BC8C7E2E' # Luca Boccassi <luca.boccassi@gmail.com>
  115. '9A774DB5DB996C154EBBFBFDA0099A18E29326E1' # Yu Watanabe <watanabe.yu+github@gmail.com>
  116. '5C251B5FC54EB2F80F407AAAC54CA336CFEB557E') # Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
  117. source=("git+https://github.com/systemd/systemd#tag=v${_tag}?signed"
  118. '0001-Use-Arch-Linux-device-access-groups.patch'
  119. '0001-FSDG-bootctl-Say-Systemd-Boot-Manager-instead-of-Lin.patch'
  120. '0002-FSDG-os-release-Default-PRETTY_NAME-to-GNU-Linux-ins.patch'
  121. '0003-FSDG-os-release-Default-NAME-to-GNU-Linux-instead-of.patch'
  122. '0004-FSDG-os-release-Default-ID-to-gnu-linux-instead-of-l.patch'
  123. '0005-FSDG-systemd-resolved-Fallback-hostname-to-gnu-linux.patch'
  124. '0006-FSDG-man-Mention-Parabola-instead-of-Arch.patch'
  125. '0007-FSDG-man-Refer-to-the-operating-system-as-GNU-Linux.patch'
  126. # bootloader files
  127. 'parabola.conf'
  128. 'loader.conf'
  129. 'splash-parabola.bmp'
  130. # pam configuration
  131. 'systemd-user.pam'
  132. # pacman / libalpm hooks
  133. 'systemd-hook'
  134. '20-systemd-sysusers.hook'
  135. '30-systemd-binfmt.hook'
  136. '30-systemd-catalog.hook'
  137. '30-systemd-daemon-reload-system.hook'
  138. '30-systemd-daemon-reload-user.hook'
  139. '30-systemd-hwdb.hook'
  140. '30-systemd-sysctl.hook'
  141. '30-systemd-tmpfiles.hook'
  142. '30-systemd-udev-reload.hook'
  143. '30-systemd-update.hook')
  144. sha512sums=('493daf7c4d80b5c3c2f90822f0aa18cd2f9c8c5de950f71947a8b1ef2bada1b0b163ec5d850bab48ae46426694838041bbe1ee00920e384080b2a2625bf68ef5'
  145. '3ccf783c28f7a1c857120abac4002ca91ae1f92205dcd5a84aff515d57e706a3f9240d75a0a67cff5085716885e06e62597baa86897f298662ec36a940cf410e'
  146. '28bf5c24c962dc4aafc3838e6a8dd2bf2c05e44c15d018ea50a0b374b1741ebdd4dbe1df56bb5e2f32bc4d3fa8573b5a02004e475272f7949468706ce0c77f0e'
  147. 'a92a37e41a611dfc63417c641347d1c1784373d8100f5e999de3c7bc0c2ae9d9034f3daa08741a271447b35c7b2b786715b4bd0156d3f177cc51d1d1c64f43a9'
  148. '6885e3a04e53d2cd40475e3853394b2a97795c55fa4c8c696aff1f33a5f55400ddffbed710d70591a8c4e3bd2f46417d76dcdc19bca386a8e88e604dbf0b473d'
  149. '846767c26613ebf91d8a25b69f92a50a056ae2908165c09af187159fae7da1617718ad23bd0b02ef08809630b5bd90c11cdb5f4bb8e7ec2c663156f68b18fa22'
  150. 'f3d77a2e66598e6b9875522e7541da4a3238234ad5beee134186ba230a352adb51a089709e949cde7d8ed4c6857680a4fea806f70c7d1cc15dd95bd8efe5c535'
  151. '437c42469341caf18d74dd86f19b940a029f225c59321b3081eadb7116e1c1a2fbf71ac245cdf78610bf816dc4afc933db94fbd0e005d9569442f52009329df6'
  152. 'ec6a43d1297de5b0531b76615a394e616d72f3d434584c2c7119d17e9ab49fc58904ec4fb5cdff71cf8739403ce76cf60b884644e7908db9bfa776b41825bbf7'
  153. '70b3f1d6aaa9cd4b6b34055a587554770c34194100b17b2ef3aaf4f16f68da0865f6b3ae443b3252d395e80efabd412b763259ffb76c902b60e23b6b522e3cc8'
  154. '6c6f579644ea2ebb6b46ee274ab15110718b0de40def8c30173ba8480b045d403f2aedd15b50ad9b96453f4ad56920d1350ff76563755bb9a80b10fa7f64f1d9'
  155. 'a50bc85061a9a16d776235099867bc1a17c17dddb74c1ecf5614c849735a9779c5e34e5ddca8ca6af4b59a40f57c08ecf219b98cab09476ddb0f110e6a35e45c'
  156. 'b90c99d768dc2a4f020ba854edf45ccf1b86a09d2f66e475de21fe589ff7e32c33ef4aa0876d7f1864491488fd7edb2682fc0d68e83a6d4890a0778dc2d6fe19'
  157. '3cb8f88c1bffc753d0c540be5d25a0fdb9224478cca64743b5663340f2f26b197775286e6e680228db54c614dcd11da1135e625674a622127681662bec4fa886'
  158. '299dcc7094ce53474521356647bdd2fb069731c08d14a872a425412fcd72da840727a23664b12d95465bf313e8e8297da31259508d1c62cc2dcea596160e21c5'
  159. '0d6bc3d928cfafe4e4e0bc04dbb95c5d2b078573e4f9e0576e7f53a8fab08a7077202f575d74a3960248c4904b5f7f0661bf17dbe163c524ab51dd30e3cb80f7'
  160. '2b50b25e8680878f7974fa9d519df7e141ca11c4bfe84a92a5d01bb193f034b1726ea05b3c0030bad1fbda8dbb78bf1dc7b73859053581b55ba813c39b27d9dc'
  161. 'a436d3f5126c6c0d6b58c6865e7bd38dbfbfb7babe017eeecb5e9d162c21902cbf4e0a68cf3ac2f99815106f9fa003b075bd2b4eb5d16333fa913df6e2f3e32a'
  162. '190112e38d5a5c0ca91b89cd58f95595262a551530a16546e1d84700fc9644aa2ca677953ffff655261e8a7bff6e6af4e431424df5f13c00bc90b77c421bc32d'
  163. 'a1661ab946c6cd7d3c6251a2a9fd68afe231db58ce33c92c42594aedb5629be8f299ba08a34713327b373a3badd1554a150343d8d3e5dfb102999c281bd49154'
  164. '9426829605bbb9e65002437e02ed54e35c20fdf94706770a3dc1049da634147906d6b98bf7f5e7516c84068396a12c6feaf72f92b51bdf19715e0f64620319de'
  165. 'da7a97d5d3701c70dd5388b0440da39006ee4991ce174777931fea2aa8c90846a622b2b911f02ae4d5fffb92680d9a7e211c308f0f99c04896278e2ee0d9a4dc'
  166. 'a50d202a9c2e91a4450b45c227b295e1840cc99a5e545715d69c8af789ea3dd95a03a30f050d52855cabdc9183d4688c1b534eaa755ebe93616f9d192a855ee3'
  167. '825b9dd0167c072ba62cabe0677e7cd20f2b4b850328022540f122689d8b25315005fa98ce867cf6e7460b2b26df16b88bb3b5c9ebf721746dce4e2271af7b97')
  168. _meson_version="${pkgver}-${pkgrel}"
  169. _meson_vcs_tag='false'
  170. _meson_mode='release'
  171. _meson_compile=()
  172. _meson_install=()
  173. if ((_systemd_UPSTREAM)); then
  174. _meson_version="${pkgver}"
  175. _meson_vcs_tag='true'
  176. _meson_mode='developer'
  177. pkgname+=('systemd-tests')
  178. if ((_systemd_QUIET)); then
  179. _meson_install=('--quiet')
  180. else
  181. _meson_compile=('--verbose')
  182. fi
  183. fi
  184. _backports=(
  185. )
  186. _reverts=(
  187. )
  188. prepare() {
  189. cd "${pkgbase}"
  190. local _c _l
  191. for _c in "${_backports[@]}"; do
  192. if [[ "${_c}" == *..* ]]; then _l='--reverse'; else _l='--max-count=1'; fi
  193. git log --oneline "${_l}" "${_c}"
  194. git cherry-pick --mainline 1 --no-commit "${_c}"
  195. done
  196. for _c in "${_reverts[@]}"; do
  197. if [[ "${_c}" == *..* ]]; then _l='--reverse'; else _l='--max-count=1'; fi
  198. git log --oneline "${_l}" "${_c}"
  199. git revert --mainline 1 --no-commit "${_c}"
  200. done
  201. # Replace cdrom/dialout/tape groups with optical/uucp/storage
  202. patch -Np1 -i ../0001-Use-Arch-Linux-device-access-groups.patch
  203. # apply FSDG patches
  204. local _patch
  205. for _patch in "$srcdir"/????-FSDG-*.patch; do
  206. echo "applying $_patch"
  207. patch -Np1 -i "$_patch"
  208. done
  209. # avoid the warning and non-zero exit per mkinitcpio::install/consolefont
  210. echo "FONT=sun12x22" >> factory/templates/vconsole.conf.in
  211. }
  212. build() {
  213. local _timeservers=({0..3}.arch.pool.ntp.org)
  214. local _nameservers=(
  215. # We use these public name services, ordered by their privacy policy (hopefully):
  216. # * Cloudflare (https://1.1.1.1/)
  217. # * Quad9 (https://www.quad9.net/)
  218. # * Google (https://developers.google.com/speed/public-dns/)
  219. '1.1.1.1#cloudflare-dns.com'
  220. '9.9.9.9#dns.quad9.net'
  221. '8.8.8.8#dns.google'
  222. '2606:4700:4700::1111#cloudflare-dns.com'
  223. '2620:fe::9#dns.quad9.net'
  224. '2001:4860:4860::8888#dns.google'
  225. )
  226. local _meson_options=(
  227. -Dversion-tag="${_meson_version}-parabola"
  228. -Dvcs-tag="${_meson_vcs_tag}"
  229. -Dshared-lib-tag="${_meson_version}"
  230. -Dmode="${_meson_mode}"
  231. -Dapparmor=disabled
  232. -Dbootloader=enabled
  233. -Dxenctrl=disabled
  234. -Dbpf-framework=enabled
  235. -Dima=false
  236. -Dinstall-tests=true
  237. -Dlibidn2=enabled
  238. -Dlz4=enabled
  239. -Dman=enabled
  240. -Dnscd=false
  241. -Dselinux=disabled
  242. # We disable DNSSEC by default, it still causes trouble:
  243. # https://github.com/systemd/systemd/issues/10579
  244. -Ddbuspolicydir=/usr/share/dbus-1/system.d
  245. -Ddefault-dnssec=no
  246. -Ddefault-hierarchy=unified
  247. -Ddefault-kill-user-processes=false
  248. -Ddefault-locale='C.UTF-8'
  249. -Dlocalegen-path=/usr/bin/locale-gen
  250. -Ddns-over-tls=openssl
  251. -Dfallback-hostname='parabola'
  252. -Dnologin-path=/usr/bin/nologin
  253. -Dntp-servers="${_timeservers[*]}"
  254. -Ddns-servers="${_nameservers[*]}"
  255. -Drpmmacrosdir=no
  256. -Dsysvinit-path=
  257. -Dsysvrcnd-path=
  258. -Dsbat-distro='parabola'
  259. -Dsbat-distro-summary='Parabola GNU/Linux-libre'
  260. -Dsbat-distro-pkgname="${pkgname}"
  261. -Dsbat-distro-version="${pkgver}"
  262. -Dsbat-distro-url="https://www.parabola.nu/packages/libre/${CARCH}/${pkgname}/"
  263. )
  264. arch-meson "${pkgbase}" build "${_meson_options[@]}" $MESON_EXTRA_CONFIGURE_OPTIONS
  265. meson compile -C build "${_meson_compile[@]}"
  266. }
  267. check() {
  268. # FIXME: Tests fail on armv7h. I (lukeshu) am pretty sure it's all
  269. # related to running in qemu-user-static instead of on a native
  270. # kernel, but we should verify that.
  271. #
  272. # $ grep -e TIMEOUT -e FAIL systemd-255.6-1.parabola1-armv7h-check.log
  273. # 605/1252 systemd:network / test-network FAIL 0.20s killed by signal 6 SIGABRT
  274. # 788/1252 systemd:test / test-fd-util FAIL 0.18s killed by signal 6 SIGABRT
  275. # 794/1252 systemd:test / test-loopback FAIL 0.08s exit status 1
  276. # 799/1252 systemd:test / test-mount-util FAIL 0.21s killed by signal 6 SIGABRT
  277. # 804/1252 systemd:resolve / test-resolved-stream FAIL 5.20s killed by signal 6 SIGABRT
  278. # 808/1252 systemd:test / test-process-util FAIL 0.36s killed by signal 6 SIGABRT
  279. # 864/1252 systemd:libsystemd / test-netlink FAIL 0.10s killed by signal 6 SIGABRT
  280. # 950/1252 systemd:test / test-mountpoint-util FAIL 0.13s killed by signal 6 SIGABRT
  281. # 967/1252 systemd:test / test-raw-clone FAIL 0.12s killed by signal 6 SIGABRT
  282. # 1108/1252 systemd:core / test-path FAIL 30.17s exit status 1
  283. # 1133/1252 systemd:sysusers / test-sysusers TIMEOUT 30.18s killed by signal 15 SIGTERM
  284. # 1134/1252 systemd:systemctl / test-systemctl-enable TIMEOUT 30.22s killed by signal 15 SIGTERM
  285. # 1150/1252 systemd:network / test-network-generator-conversion TIMEOUT 30.17s killed by signal 15 SIGTERM
  286. # 1189/1252 systemd:kernel-install / test-kernel-install TIMEOUT 30.12s killed by signal 15 SIGTERM
  287. # 1252/1252 systemd:libsystemd / test-journal-verify TIMEOUT 90.08s killed by signal 15 SIGTERM
  288. if [[ $CARCH == armv7h ]]; then
  289. return
  290. fi
  291. meson test -C build --print-errorlogs
  292. }
  293. # How we use this function might seem like "overthinking it", and it
  294. # sorta is, but it's doing the (tedious, error-prone) comparisons that
  295. # I'd otherwise have to do manually when merging from Arch.
  296. _lib_deps() {
  297. # Resolve short names, to make calling code readable.
  298. # Where each .so file lives (relative to either $srcdir or $pkgdirbase).
  299. declare -A paths=(
  300. [libsystemd-shared]="systemd-common/usr/lib/systemd/libsystemd-shared-${pkgver}-${pkgrel}.so"
  301. [libsystemd]='systemd-libsystemd/usr/lib/libsystemd.so'
  302. [libudev]='systemd-libudev/usr/lib/libudev.so'
  303. [libnss_systemd]='systemd-nss-systemd/usr/lib/libnss_systemd.so.2'
  304. [libnss_myhostname]='systemd-nss-myhostname/usr/lib/libnss_myhostname.so.2'
  305. [libnss_mymachines]='systemd-nss-mymachines/usr/lib/libnss_mymachines.so.2'
  306. [libnss_resolve]='systemd-nss-resolve/usr/lib/libnss_resolve.so.2'
  307. )
  308. local libname srcfile pkgfile libfile txtfile mode
  309. for libname in "$@"; do
  310. # Save the raw list to a textfile so that `makepkg --printsrcinfo`
  311. # works.
  312. srcfile="${_existing_srcdir:-${srcdir:-.}}/${paths[$libname]}"
  313. pkgfile="${_existing_pkgdirbase:-${pkgdirbase:-.}}/${paths[$libname]}"
  314. txtfile="srcinfo-${libname}.txt"
  315. # mode is: 'gen', 'lib', 'txt', 'nop', or 'err:*'
  316. mode="err:TXTFILE:'${txtfile}', SRCFILE:'${srcfile}', and PKGFILE:'${pkgfile}' are all missing"
  317. if [[ -n "${_existing_pkgdirbase:-}" ]]; then
  318. if [[ -f "$srcfile" ]]; then
  319. libfile=$srcfile
  320. mode=gen
  321. elif [[ -f "$pkgfile" ]]; then
  322. libfile=$pkgfile
  323. mode=gen
  324. else
  325. mode="err:SRCFILE:'${srcfile}' and PKGFILE:'${pkgfile}' are both missing"
  326. fi
  327. elif [[ -f "$srcfile" ]]; then
  328. libfile=$srcfile
  329. mode=lib
  330. elif [[ -f "$pkg_libfile" ]]; then
  331. libfile=$pkgfile
  332. mode=lib
  333. elif [[ -f "$txtfile" ]]; then
  334. mode=txt
  335. elif in_array lint_pkgbuild "${FUNCNAME[@]}" || in_array check_software "${FUNCNAME[@]}"; then
  336. mode=nop
  337. fi
  338. case "$mode" in
  339. gen|lib)
  340. {
  341. LC_ALL=C.UTF-8 readelf --dynamic "$libfile" |
  342. sed -nE 's/.* Shared library: \[(lib.*\.so)(\.[0-9.]+)?\]/\1/p'
  343. LC_ALL=C.UTF-8 readelf --string-dump=.note.dlopen "$libfile" 2>/dev/null |
  344. sed -En -e 1,2d -e '/^.{12}\|@FDO$/{ n; s/^.{12}//; p; }' |
  345. jq --raw-output '.[]|.soname[]' |
  346. sed -E 's/\.so(\.[0-9.]+)?$/.so/' |
  347. sed 's/^/dlopen:/'
  348. } | {
  349. if [[ $mode == gen ]]; then
  350. tee "$txtfile"
  351. else
  352. cat
  353. fi
  354. }
  355. ;;
  356. txt) cat "$txtfile";;
  357. nop) true;;
  358. err:*) error '%s' "${mode#err:}";;
  359. esac
  360. done |
  361. # Decide which optdepends to include.
  362. sed -E \
  363. $(if ! in_array libsystemd "$@"; then printf ' -e /^dlopen:libzstd\\.so$/d'; fi) \
  364. -e '/^dlopen:libarchive\.so$/d' \
  365. -e '/^dlopen:libbpf\.so$/d' \
  366. -e '/^dlopen:libcryptsetup\.so$/d' \
  367. -e '/^dlopen:libdw\.so$/d' \
  368. -e '/^dlopen:libelf\.so$/d' \
  369. -e '/^dlopen:libfido2\.so$/d' \
  370. -e '/^dlopen:libidn2\.so$/d' \
  371. -e '/^dlopen:libip4tc\.so$/d' \
  372. -e '/^dlopen:libp11-kit\.so$/d' \
  373. -e '/^dlopen:libpcre2-8\.so$/d' \
  374. -e '/^dlopen:libpwquality\.so$/d' \
  375. -e '/^dlopen:libqrencode\.so$/d' \
  376. -e '/^dlopen:libtss2-/d' \
  377. -e 's/^dlopen://' |
  378. # Add some redundant transitive dependencies, idk why, it's what
  379. # Arch does.
  380. sed -e 's/^libpam\.so$/libaudit.so\n&/' |
  381. # Refer to these by their just pkgname instead of .so, idk why,
  382. # it's what Arch does.
  383. sed -E \
  384. -e 's/^lib[cm]\.so$/glibc/' \
  385. -e 's/^libgcc_s\.so$/gcc-libs/' \
  386. -e 's/^libip4tc\.so$/iptables/' \
  387. -e 's/^liblzma\.so$/xz/' \
  388. -e 's/^lib(kmod|lz4|pam|zstd)\.so$/\1/' \
  389. -e 's/^(lib(cap|gcrypt))\.so$/\1/' |
  390. # Refer to these by both their pkgname and .so, idk why, it's what
  391. # Arch does.
  392. sed -E \
  393. -e 's/^libcrypt\.so$/libxcrypt\n&/' \
  394. -e 's/^libcrypto\.so$/openssl\n&/' \
  395. -e 's/^lib(mount|libblkid)\.so$/util-linux\n&/' \
  396. -e 's/^lib(acl|audit)\.so$/\1\n&/' \
  397. -e 's/^(lib(seccomp))\.so$/\1\n&/' |
  398. # Sort and de-duplicate.
  399. sort -u
  400. }
  401. _pick() {
  402. local p="$1" f d; shift
  403. for f; do
  404. d="$srcdir/$p/${f#$pkgdir/}"
  405. mkdir -p "$(dirname "$d")"
  406. mv "$f" "$d"
  407. rmdir -p --ignore-fail-on-non-empty "$(dirname "$f")"
  408. done
  409. }
  410. package_systemd() {
  411. pkgdesc='system and service manager'
  412. license+=(
  413. 'CC0-1.0' # siphash
  414. 'GPL-2.0-or-later' # udev
  415. 'MIT-0' # documentation and config files
  416. )
  417. depends=("systemd-libs=${pkgver}"
  418. 'acl' 'libacl.so' 'bash' 'cryptsetup' 'libcryptsetup.so' 'dbus'
  419. 'dbus-units' 'kbd' 'kmod' 'hwdata' 'libcap' 'libcap.so'
  420. 'libgcrypt' 'libxcrypt' 'libcrypt.so' 'libidn2' 'lz4' 'pam'
  421. 'libelf' 'libseccomp' 'libseccomp.so' 'util-linux' 'libblkid.so'
  422. 'libmount.so' 'xz' 'pcre2' 'audit' 'libaudit.so'
  423. 'openssl' 'libcrypto.so' 'libssl.so')
  424. provides=('nss-myhostname' "systemd-tools=$pkgver" "udev=$pkgver")
  425. replaces=('nss-myhostname' 'systemd-tools' 'udev')
  426. conflicts=('nss-myhostname' 'systemd-tools' 'udev')
  427. optdepends=('libmicrohttpd: systemd-journal-gatewayd and systemd-journal-remote'
  428. 'quota-tools: kernel-level quota management'
  429. 'systemd-sysvcompat: symlink package to provide sysvinit binaries'
  430. 'systemd-ukify: combine kernel and initrd into a signed Unified Kernel Image'
  431. 'polkit: allow administration as unprivileged user'
  432. 'curl: systemd-journal-upload, machinectl pull-tar and pull-raw'
  433. 'gnutls: systemd-journal-gatewayd and systemd-journal-remote'
  434. 'qrencode: show QR codes'
  435. 'iptables: firewall features'
  436. 'libarchive: convert DDIs to tarballs'
  437. 'libbpf: support BPF programs'
  438. 'libpwquality: check password quality'
  439. 'libfido2: unlocking LUKS2 volumes with FIDO2 token'
  440. 'libp11-kit: support PKCS#11'
  441. 'tpm2-tss: unlocking LUKS2 volumes with TPM2')
  442. backup=(etc/pam.d/systemd-user
  443. etc/systemd/coredump.conf
  444. etc/systemd/homed.conf
  445. etc/systemd/journald.conf
  446. etc/systemd/journal-remote.conf
  447. etc/systemd/journal-upload.conf
  448. etc/systemd/logind.conf
  449. etc/systemd/networkd.conf
  450. etc/systemd/oomd.conf
  451. etc/systemd/pstore.conf
  452. etc/systemd/resolved.conf
  453. etc/systemd/sleep.conf
  454. etc/systemd/system.conf
  455. etc/systemd/timesyncd.conf
  456. etc/systemd/user.conf
  457. etc/udev/iocost.conf
  458. etc/udev/udev.conf)
  459. install=systemd.install
  460. meson install -C build --destdir "$pkgdir" "${_meson_install[@]}"
  461. # split
  462. (
  463. cd "$pkgdir"
  464. # Parabola: Pull out `systemd-common`.
  465. _pick systemd-common usr/lib/systemd/"libsystemd-shared-${pkgver}-${pkgrel}.so"
  466. _pick systemd-libs usr/lib/lib{nss,systemd,udev}*.so*
  467. _pick systemd-libs usr/lib/pkgconfig
  468. _pick systemd-libs usr/include
  469. _pick systemd-libs usr/share/man/man3
  470. _pick systemd-libs usr/share/man/man8/{nss-,libnss_}*
  471. # Parabola: Further split `systemd-libs`
  472. (
  473. cd "$srcdir/systemd-libs"
  474. _pick systemd-libsystemd usr/include/systemd
  475. _pick systemd-libsystemd usr/lib/pkgconfig/libsystemd.pc
  476. _pick systemd-libsystemd usr/lib/libsystemd.so*
  477. _pick systemd-libsystemd usr/share/man/man3/{SD,sd,libsystemd}*
  478. _pick systemd-libudev usr/include/libudev.h
  479. _pick systemd-libudev usr/lib/pkgconfig/libudev.pc
  480. _pick systemd-libudev usr/lib/libudev.so*
  481. _pick systemd-libudev usr/share/man/man3/*udev*
  482. local nssmodule
  483. for nssmodule in systemd myhostname mymachines resolve; do
  484. _pick systemd-nss-$nssmodule usr/share/man/man8/nss-$nssmodule.8
  485. _pick systemd-nss-$nssmodule usr/share/man/man8/libnss_$nssmodule.*.8
  486. _pick systemd-nss-$nssmodule usr/lib/libnss_$nssmodule.so*
  487. done
  488. )
  489. # Verify that there's nothing left in `systemd-libs`.
  490. if ! rmdir "$srcdir/systemd-libs"; then
  491. error '%q should not longer exist\n' "$srcdir/systemd-libs"
  492. find "$srcdir/systemd-libs" -ls >&2
  493. return 1
  494. fi
  495. # Parabola: Pull out `systemd-udev`.
  496. # NB: Must do this *after* pulling out `systemd-libudev`.
  497. _pick systemd-udev etc/udev/
  498. _pick systemd-udev usr/lib/udev/
  499. while read -d '' -r file; do
  500. _pick systemd-udev "$file"
  501. done < <(find . \( -name '*udev*' -o -name '*hwdb*' \) -printf '%P\0')
  502. # Parabola: Pull out `systemd-boot`.
  503. _pick systemd-boot usr/bin/bootctl
  504. _pick systemd-boot usr/lib/systemd/boot/
  505. _pick systemd-boot usr/share/bash-completion/completions/bootctl
  506. _pick systemd-boot usr/share/zsh/site-functions/_bootctl
  507. _pick systemd-boot usr/share/man/man1/bootctl.1
  508. _pick systemd-boot usr/share/man/man5/loader.conf.5
  509. _pick systemd-boot usr/share/man/man7/sd-boot.7
  510. _pick systemd-boot usr/share/man/man7/systemd-boot.7
  511. # TODO: Consider also including integrations such as
  512. # systemd-boot-{random-seed,update}.service,
  513. # 90-loaderentry.install, or systemd-bless-boot.
  514. _pick systemd-ukify usr/bin/ukify
  515. _pick systemd-ukify usr/lib/systemd/ukify
  516. _pick systemd-ukify usr/share/man/man1/ukify.1
  517. # we move the ukify hook itself, but keep 90-uki-copy.install in place,
  518. # because there are other ways to generate UKIs w/o ukify, e.g. w/ mkinitcpio
  519. _pick systemd-ukify usr/lib/kernel/install.d/60-ukify.install
  520. _pick systemd-sysvcompat usr/share/man/man1/init.1
  521. _pick systemd-sysvcompat usr/share/man/man8/{halt,poweroff,reboot,shutdown}.8
  522. _pick systemd-sysvcompat usr/bin/{halt,init,poweroff,reboot,shutdown}
  523. _pick systemd-resolvconf usr/share/man/man1/resolvconf.1
  524. _pick systemd-resolvconf usr/bin/resolvconf
  525. _pick systemd-tests usr/lib/systemd/tests
  526. )
  527. # Parabola: Split the package.
  528. # (the "eval"/"outputvar" parts are so that `makepkg --printsrcinfo` works)
  529. license=($(eval "printf '%s\n' \"\${${outputvar:-license}[@]}\"|grep -vFx -e CC0-1.0 -e GPL-2.0-or-later")) # the CC0 parts end up in systemd-common, the GPL2 parts end up in systemd-udev
  530. depends=($(eval "printf '%s\n' \"\${${outputvar:-depends}[@]}\"|grep -vFx -f <(_lib_deps libsystemd-shared)"))
  531. depends+=("systemd-common=$pkgver-$pkgrel" "systemd-boot=$pkgver" 'udev')
  532. provides=($(eval "printf '%s\n' \"\${${outputvar:-provides}[@]}\"|grep -v -e nss-myhostname -e ^udev="))
  533. replaces=($(eval "printf '%s\n' \"\${${outputvar:-replaces}[@]}\"|grep -v -e nss-myhostname -e ^udev"))
  534. conflicts=($(eval "printf '%s\n' \"\${${outputvar:-conflicts}[@]}\"|grep -v -e nss-myhostname -e ^udev"))
  535. backup=($(eval "printf '%s\n' \"\${${outputvar:-backup}[@]}\"|grep -v -e etc/udev"))
  536. # we'll create this on installation
  537. rmdir "$pkgdir"/var/log/journal/remote
  538. # avoid a potential conflict with [core]/filesystem
  539. rm "$pkgdir"/usr/share/factory/etc/{issue,nsswitch.conf}
  540. sed -i -e '/^C \/etc\/nsswitch\.conf/d' \
  541. -e '/^C \/etc\/issue/d' "$pkgdir"/usr/lib/tmpfiles.d/etc.conf
  542. # ship default policy to leave services disabled
  543. echo 'disable *' >"$pkgdir"/usr/lib/systemd/system-preset/99-default.preset
  544. # The group 'systemd-journal' is allocated dynamically and may have varying
  545. # gid on different systems. Let's install with gid 0 (root), systemd-tmpfiles
  546. # will fix the permissions for us. (see /usr/lib/tmpfiles.d/systemd.conf)
  547. install -d -o root -g root -m 2755 "$pkgdir"/var/log/journal
  548. # Parabola: moved to package_systemd-boot()
  549. ## add example bootctl configuration
  550. #install -D -m0644 parabola.conf "$pkgdir"/usr/share/systemd/bootctl/parabola.conf
  551. #install -D -m0644 loader.conf "$pkgdir"/usr/share/systemd/bootctl/loader.conf
  552. #install -D -m0644 splash-parabola.bmp "$pkgdir"/usr/share/systemd/bootctl/splash-parabola.bmp
  553. # pacman hooks
  554. #install -D -m0755 systemd-hook "$pkgdir"/usr/share/libalpm/scripts/systemd-hook Parabola: moved to package_systemd-common()
  555. install -D -m0644 -t "$pkgdir"/usr/share/libalpm/hooks *.hook
  556. rm -- "$pkgdir"/usr/share/libalpm/hooks/*{udev,hwdb}* # Parabola: we put these in our `systmed-udev` package
  557. # overwrite the systemd-user PAM configuration with our own
  558. install -D -m0644 systemd-user.pam "$pkgdir"/etc/pam.d/systemd-user
  559. # create a directory for cryptsetup keys
  560. install -d -m0700 "$pkgdir"/etc/cryptsetup-keys.d
  561. # handle uncommon license
  562. install -d -m0755 "$pkgdir/usr/share/licenses/$pkgbase"
  563. ln -s -t "$_" /usr/share/doc/systemd/LICENSES/MIT-0.txt
  564. }
  565. package_systemd-libs() {
  566. pkgdesc='systemd client libraries'
  567. depends=('glibc' 'gcc-libs' 'libcap' 'libgcrypt' 'lz4' 'xz' 'zstd')
  568. license+=(
  569. 'CC0-1.0' # siphash
  570. 'GPL-2.0-or-later WITH Linux-syscall-note' # src/basic/linux/*
  571. 'MIT-0' # documentation
  572. )
  573. provides=('libsystemd' 'libsystemd.so' 'libudev.so')
  574. conflicts=('libsystemd')
  575. replaces=('libsystemd')
  576. # Parabola: First, sanity check that _lib_deps finds all of the
  577. # packages that are in Arch's depends=() list.
  578. diff -u /dev/null <(printf '%s\n' "${depends[@]}" | grep -vFx -f <(
  579. _lib_deps libsystemd libudev libnss_{systemd,myhostname,mymachines,resolve}))
  580. # Parabola: Split the package.
  581. pkgdesc+=' metapackage'
  582. depends=("${_systemd_libs[@]}")
  583. # (the "eval"/"outputvar" parts are so that `makepkg --printsrcinfo` works)
  584. provides=($(eval "printf '%s\n' \"\${${outputvar:-provides}[@]}\"|grep -v -e '\.so$'"))
  585. return
  586. mv -v "$pkgname"/* "$pkgdir"
  587. }
  588. package_systemd-resolvconf() {
  589. pkgdesc='systemd resolvconf replacement (for use with systemd-resolved)'
  590. depends=("systemd=${pkgver}")
  591. provides=('openresolv' 'resolvconf')
  592. conflicts=('resolvconf')
  593. replaces+=('notsystemd-resolvconf') # notsystemd-resolvconf should have never existed
  594. mv -v "$pkgname"/* "$pkgdir"
  595. }
  596. package_systemd-sysvcompat() {
  597. pkgdesc='sysvinit compat for systemd'
  598. conflicts=('sysvinit')
  599. depends=("systemd=${pkgver}")
  600. provides=('init')
  601. conflicts+=('init')
  602. mv -v "$pkgname"/* "$pkgdir"
  603. }
  604. package_systemd-tests() {
  605. pkgdesc='systemd tests'
  606. depends=("systemd=${pkgver}")
  607. mv -v "$pkgname"/* "$pkgdir"
  608. }
  609. package_systemd-ukify() {
  610. pkgdesc='Combine kernel and initrd into a signed Unified Kernel Image'
  611. provides=('ukify')
  612. depends=("systemd=${pkgver}" 'binutils' 'python-cryptography' 'python-pefile')
  613. optdepends=('python-pillow: Show the size of splash image'
  614. 'sbsigntools: Sign the embedded kernel')
  615. mv -v "$pkgname"/* "$pkgdir"
  616. }
  617. # vim:ft=sh syn=sh et sw=2:
  618. # Parabola: The remainder of the file is our additional split packages.
  619. package_systemd-common() {
  620. pkgdesc='systemd files shared between split packages'
  621. depends=($(_lib_deps libsystemd-shared))
  622. license+=(
  623. 'CC0-1.0' # siphash
  624. )
  625. mv -v "$pkgname"/* "$pkgdir"
  626. install -D -m0755 systemd-hook "$pkgdir"/usr/share/libalpm/scripts/systemd-hook
  627. }
  628. package_systemd-udev() {
  629. pkgdesc='Userspace device file manager'
  630. license+=('GPL-2.0-or-later')
  631. depends=("systemd-common=$pkgver-$pkgrel" "systemd-libudev=$pkgver"
  632. 'hwdata' 'kmod' 'util-linux')
  633. backup=(etc/udev/iocost.conf
  634. etc/udev/udev.conf)
  635. provides+=("${pkgname#systemd-}=$pkgver")
  636. conflicts+=("${pkgname#systemd-}")
  637. replaces+=("${pkgname#systemd-}")
  638. mv -v "$pkgname"/* "$pkgdir"
  639. # pacman hooks
  640. install -D -m0644 -t "$pkgdir"/usr/share/libalpm/hooks *{udev,hwdb}*.hook
  641. }
  642. package_systemd-boot() {
  643. pkgdesc='Simple UEFI boot manager'
  644. depends=("systemd-common=$pkgver-$pkgrel")
  645. mv -v "$pkgname"/* "$pkgdir"
  646. # add example bootctl configuration
  647. install -D -m0644 parabola.conf "$pkgdir"/usr/share/systemd/bootctl/parabola.conf
  648. install -D -m0644 loader.conf "$pkgdir"/usr/share/systemd/bootctl/loader.conf
  649. install -D -m0644 splash-parabola.bmp "$pkgdir"/usr/share/systemd/bootctl/splash-parabola.bmp
  650. }
  651. # TODO(lukeshu): I might have been over-zealous adding the licenses
  652. # for `siphash` and `src/basic/linux/*` to the following packages;
  653. # audit whether those packages actually include that code.
  654. package_systemd-libsystemd() {
  655. pkgdesc='systemd client library'
  656. depends=($(_lib_deps libsystemd))
  657. license+=(
  658. 'CC0-1.0' # siphash
  659. 'GPL-2.0-or-later WITH Linux-syscall-note' # src/basic/linux/*
  660. 'MIT-0' # documentation
  661. )
  662. provides=('libsystemd.so')
  663. provides+=("libsystemd-standalone=$pkgver")
  664. conflicts+=('libsystemd-standalone')
  665. replaces+=('libsystemd-standalone')
  666. mv -v "$pkgname"/* "$pkgdir"
  667. }
  668. package_systemd-libudev() {
  669. pkgdesc='systemd library for enumerating and introspecting local devices'
  670. depends=($(_lib_deps libudev))
  671. license+=(
  672. 'CC0-1.0' # siphash
  673. 'GPL-2.0-or-later WITH Linux-syscall-note' # src/basic/linux/*
  674. )
  675. provides=('libudev.so')
  676. provides+=("${pkgname#systemd-}=$pkgver")
  677. conflicts+=("${pkgname#systemd-}")
  678. replaces+=("${pkgname#systemd-}")
  679. mv -v "$pkgname"/* "$pkgdir"
  680. }
  681. package_systemd-nss-systemd() {
  682. pkgdesc='NSS module providing user and group resolution for dynamic users and groups'
  683. depends=($(_lib_deps libnss_systemd))
  684. license+=(
  685. 'CC0-1.0' # siphash
  686. 'GPL-2.0-or-later WITH Linux-syscall-note' # src/basic/linux/*
  687. )
  688. provides+=("${pkgname#systemd-}=$pkgver")
  689. conflicts+=("${pkgname#systemd-}")
  690. replaces+=("${pkgname#systemd-}")
  691. mv -v "$pkgname"/* "$pkgdir"
  692. }
  693. package_systemd-nss-myhostname() {
  694. pkgdesc='NSS module providing hostname resolution for the locally configured system hostname'
  695. depends=($(_lib_deps libnss_myhostname))
  696. license+=(
  697. 'CC0-1.0' # siphash
  698. 'GPL-2.0-or-later WITH Linux-syscall-note' # src/basic/linux/*
  699. )
  700. provides+=("${pkgname#systemd-}=$pkgver")
  701. conflicts+=("${pkgname#systemd-}")
  702. replaces+=("${pkgname#systemd-}")
  703. mv -v "$pkgname"/* "$pkgdir"
  704. }
  705. package_systemd-nss-mymachines() {
  706. pkgdesc='NSS module providing hostname resolution for local systemd-machined container instances'
  707. depends=($(_lib_deps libnss_mymachines))
  708. license+=(
  709. 'CC0-1.0' # siphash
  710. 'GPL-2.0-or-later WITH Linux-syscall-note' # src/basic/linux/*
  711. )
  712. provides+=("${pkgname#systemd-}=$pkgver")
  713. conflicts+=("${pkgname#systemd-}")
  714. replaces+=("${pkgname#systemd-}")
  715. mv -v "$pkgname"/* "$pkgdir"
  716. }
  717. package_systemd-nss-resolve() {
  718. pkgdesc='NSS module providing hostname resolution via systemd-resolved'
  719. depends=($(_lib_deps libnss_resolve))
  720. license+=(
  721. 'CC0-1.0' # siphash
  722. 'GPL-2.0-or-later WITH Linux-syscall-note' # src/basic/linux/*
  723. )
  724. provides+=("${pkgname#systemd-}=$pkgver")
  725. conflicts+=("${pkgname#systemd-}")
  726. replaces+=("${pkgname#systemd-}")
  727. mv -v "$pkgname"/* "$pkgdir"
  728. }