PKGBUILD 33 KB

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