PKGBUILD 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. # Maintainer (arch): Levente Polyak <anthraxx[at]archlinux[dot]org>
  2. # Maintainer (arch): Morten Linderud <foxboron@archlinux.org>
  3. # Maintainer (archarm): Kevin Mihelich <kevin@archlinuxarm.org>
  4. # Maintainer: Luke T. Shumaker <lukeshu@parabola.nu>
  5. # Contributor: André Silva <emulatorman@hyperbola.info>
  6. # Contributor: Márcio Silva <coadde@hyperbola.info>
  7. # Contributor: Omar Vega Ramos <ovruni@gnu.org.pe>
  8. # Contributor: Nicolás Reynolds <fauno@kiwwwi.com.ar>
  9. # Contributor: Daniel Milewski <niitotantei@riseup.net>
  10. # Contributor: bill-auger <bill-auger@programmer.net>
  11. # ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
  12. # - arch/host/flags for armv7h, and aarch64
  13. # - pacman.conf: architecture=armv7h/aarch64, added our aur and alarm repos
  14. # - makepkg.conf: adjusted C/CXX/LDFLAGS
  15. # - patch to sync filesystem after install/remove
  16. # - reverts to allow scriplet input on stdin
  17. # - patch to fix application/gzip change in file 5.37
  18. # Parabola:
  19. # - pacman: backport
  20. # https://gitlab.archlinux.org/pacman/pacman/-/merge_requests/152
  21. # per https://labs.parabola.nu/issues/3625
  22. # - pacman.conf, makepkg.conf: Provide the default files for all
  23. # architectures.
  24. # - makepkg: Allow "${X}.parabola${Y}" pkgrel values
  25. # - pacman-key: Have `pacman-key --updatedb` pass --yes to gpg, which
  26. # can help with expired keys.
  27. pkgname=pacman
  28. pkgver=6.1.0
  29. pkgrel=3
  30. pkgrel+=.parabola7
  31. pkgdesc="A library-based package manager with dependency support"
  32. arch=('x86_64')
  33. arch+=('armv7h' 'i686')
  34. url="https://www.archlinux.org/pacman/"
  35. license=('GPL-2.0-or-later')
  36. depends=('bash' 'glibc' 'libarchive' 'curl' 'gpgme' 'pacman-mirrorlist'
  37. 'gettext' 'gawk' 'coreutils' 'gnupg' 'grep')
  38. makedepends=('meson' 'asciidoc' 'doxygen')
  39. checkdepends=('python' 'fakechroot')
  40. optdepends=('perl-locale-gettext: translation support in makepkg-template')
  41. provides=('libalpm.so')
  42. backup=(etc/pacman.conf
  43. etc/makepkg.conf)
  44. options=('strip')
  45. validpgpkeys=('6645B0A8C7005E78DB1D7864F99FFE0FEAE999BD' # Allan McRae <allan@archlinux.org>
  46. 'B8151B117037781095514CA7BBDFFC92306B1121') # Andrew Gregory (pacman) <andrew@archlinux.org>
  47. source=(https://gitlab.archlinux.org/pacman/pacman/-/releases/v$pkgver/downloads/pacman-$pkgver.tar.xz{,.sig}
  48. revertme-makepkg-remove-libdepends-and-libprovides.patch::https://gitlab.archlinux.org/pacman/pacman/-/commit/354a300cd26bb1c7e6551473596be5ecced921de.patch
  49. "$pkgname-fix-msg-unknown-key.patch::https://gitlab.archlinux.org/pacman/pacman/-/commit/6bb95c8856437513ee0ab19226bc090d6fd0fb06.patch"
  50. "$pkgname-man-gitlab.patch::https://gitlab.archlinux.org/pacman/pacman/-/commit/95f148c2222db608a0d72d5c5577d0c71e7fa199.patch"
  51. "$pkgname-make-aligned-titles.patch::https://gitlab.archlinux.org/pacman/pacman/-/commit/5e0496260b7d3f9c9fcf2b1c4899e4dbcc20ff03.patch"
  52. "$pkgname-repo-add-parseopts.patch::https://gitlab.archlinux.org/pacman/pacman/-/commit/0571ee82bff0edbd5ffac2228d4e6ac510b9008e.patch"
  53. "$pkgname-drop-result-warn.patch::https://gitlab.archlinux.org/pacman/pacman/-/commit/111eed0251238a9d3f90e76d62f2ac01aeccce48.patch"
  54. "$pkgname-fix-debugedit.patch::https://gitlab.archlinux.org/pacman/pacman/-/commit/bae9594ac1806ce30f2af1de27c49bb101a00d44.patch"
  55. pacman.conf
  56. makepkg.conf)
  57. source_armv7h=(arm-0001-Sychronize-filesystem.patch
  58. arm-0002-Revert-close-stdin-before-running-install-scripts.patch
  59. arm-0003-Revert-alpm_run_chroot-always-connect-parent2child-p.patch)
  60. source=(${source[@]/pacman.conf/"${arch[@]/#/pacman.conf.}"}) # Parabola: pacman.conf -> pacman.conf.{armv7h,i686,x86_64}
  61. source=("${source[@]/makepkg.conf/makepkg.conf.in}") # Parabola: makepkg.conf -> makepkg.conf.in
  62. source+=(1001-backport-url-fix.patch::https://gitlab.archlinux.org/pacman/pacman/-/commit/eb5bf6913835e7553433ef82bdf0a456528f9b50.patch # https://labs.parabola.nu/issues/3625
  63. 9001-makepkg-Treat-pkgrel-more-similarly-to-pkgver.patch
  64. 9002-pacman-key-updatedb.patch)
  65. sha256sums=('5a60ac6e6bf995ba6140c7d038c34448df1f3daa4ae7141d2cad88eeb5f1f9d9'
  66. 'SKIP'
  67. 'b3bce9d662e189e8e49013b818f255d08494a57e13fc264625f852f087d3def2'
  68. '94c987046c2ff232fa0d395cddc11644840d767806711e04ef34f876a9baf217'
  69. '0774d7035e34661f74b673d4b0a94be877bdc0158a555b873ec6bd4e2c936377'
  70. '7bb64910265ce2590f593cdfd302076e49f67a68f8cc792a9aaac572d36fc842'
  71. '2bbfe40539513ff5775aaf900644c8985ef618f5df9af856b9d571e2501365b0'
  72. '160515b741aadc876a67f213029f5f62a51ff072ea4aaeb687bbe614035bf72f'
  73. '1f4e4cc54332e60c9da2bdabf9a80dc11db466535f1a0be298cbf654f0723721'
  74. '1f0563083ae048f54da8db2bc2790c9f21c09f2af54dadb6d00d8f6be5d537cc'
  75. 'fb668d67c2e8db6f1500e53706fbb0aee5213a494b30ce287524b62a818f94a4'
  76. 'ef6e712ac51a237d0d05be5805fb30fe952d255aaeb5d70ce851d39c76937903'
  77. '72c606c676252b72fcaab5ac3aa057332d748e1930200c7fa95c73e09208d898'
  78. '353069264dda744736ac57ef2bb1f7c6617a922252ca8e6be26b08a929cb3410'
  79. '9ccc7ef5bd27a68d8788f10c6e5b36495c5d9038d4eb160f9ea4dc9901b622d8'
  80. '39e4db3eed5dc522baffb7f853a7dbb7b417cc7a718599d768297adfbe99e263')
  81. sha256sums_armv7h=('8d70fb5094f58aad98b601bbc42be354c2014b9fe734a1ee0b1e14bb041cc9cc'
  82. '0e771370da68c855bfb4eaad4c2ae137883a474886a049b934dac2e775574cb9'
  83. '2f586f72c34150330389854575a21be1d3ef3637c4f94bec2e948c2717a5aecb')
  84. prepare() {
  85. cd "$pkgname-$pkgver"
  86. # handle patches
  87. local -a patches
  88. patches=($(printf '%s\n' "${source[@]}" | grep '.patch'))
  89. patches=("${patches[@]%%::*}")
  90. patches=("${patches[@]##*/}")
  91. if (( ${#patches[@]} != 0 )); then
  92. for patch in "${patches[@]}"; do
  93. if [[ $patch =~ revertme-* ]]; then
  94. msg2 "Reverting patch $patch..."
  95. patch -RNp1 < "../$patch"
  96. else
  97. msg2 "Applying patch $patch..."
  98. patch -Np1 < "../$patch"
  99. fi
  100. done
  101. fi
  102. ## Parabola changes ##
  103. # Generate a "makepkg.conf.${carch}" file for each "${arch[@]}".
  104. local carch chost cflags ldflags
  105. local cxxflags ltoflags rustflags dbgflags dbgrustflags options libdirs
  106. for carch in "${arch[@]}"; do
  107. # Base definitions. Each architecture must still set `chost`,
  108. # `cflags`, and `ldflags`; and may modify these base definitions.
  109. cxxflags='$CFLAGS -Wp,-D_GLIBCXX_ASSERTIONS'
  110. ltoflags='-flto=auto'
  111. rustflags='-Cforce-frame-pointers=yes'
  112. dbgflags='-g'
  113. dbgrustflags='-C debuginfo=2'
  114. options=(strip docs !libtool !staticlibs emptydirs zipman purge debug lto)
  115. libdirs=('lib:usr/lib')
  116. zstdflags=(-T0 --ultra -20)
  117. case "$carch" in
  118. armv7h)
  119. chost='armv7l-unknown-linux-gnueabihf'
  120. # ALARM includes '-mno-omit-leaf-frame-pointer' in CFLAGS in
  121. # their pacman-6.1.0-3-armv7h.pkg.tar.xz, even though that
  122. # flag doesn't exist on armv7h (as of
  123. # gcc-14.1.1+r1+g43b730b9134-1-armv7h.pkg.tar.xz). So I guess
  124. # ALARM is just shipping a broken makepkg.conf?
  125. cflags='-march=armv7-a -mfloat-abi=hard -mfpu=neon -O2 -pipe -fstack-protector-strong -fno-plt -fexceptions \
  126. -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security \
  127. -fstack-clash-protection \
  128. -fno-omit-frame-pointer'
  129. # ALARM includes '-Wl,-z,pack-relative-relocs' in LDFLAGS in
  130. # their pacman-6.1.0-3-armv7h.pkg.tar.xz, even though that
  131. # flag is x86- (and ppc64-?) -only. Depending on how the
  132. # compiler is called, that may result in a harmless warning on
  133. # stderr, or it may result in the compiler failing.
  134. ldflags='-Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now'
  135. # overrides
  136. ltoflags=""
  137. rustflags=""
  138. dbgrustflags=""
  139. options=("${options[@]/#lto/!lto}") # disable lto
  140. zstdflags=(--single-thread) # optimize for memory use
  141. ;;
  142. i686)
  143. chost='i686-pc-linux-gnu'
  144. cflags='-march=i686 -mtune=generic -O2 -pipe -fno-plt -fexceptions \
  145. -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security \
  146. -fstack-clash-protection -fcf-protection \
  147. -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer'
  148. ldflags='-Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now \
  149. -Wl,-z,pack-relative-relocs'
  150. ;;
  151. x86_64)
  152. chost='x86_64-pc-linux-gnu'
  153. cflags='-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions \
  154. -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security \
  155. -fstack-clash-protection -fcf-protection \
  156. -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer'
  157. ldflags='-Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now \
  158. -Wl,-z,pack-relative-relocs'
  159. # overrides
  160. libdirs+=('lib32:usr/lib32')
  161. ;;
  162. esac
  163. sed < "${srcdir}"/makepkg.conf.in > "${srcdir}/makepkg.conf.${carch}" \
  164. -e "s|@CARCH@|${carch}|g" \
  165. -e "s|@CHOST@|${chost}|g" \
  166. -e "s|@CFLAGS@|${cflags//'\'/'\\\'}|g" \
  167. -e "s|@CXXFLAGS@|${cxxflags//'\'/'\\\'}|g" \
  168. -e "s|@LDFLAGS@|${ldflags//'\'/'\\\'}|g" \
  169. -e "s|@LTOFLAGS@|${ltoflags//'\'/'\\\'}|g" \
  170. -e "s|@RUSTFLAGS@|${rustflags//'\'/'\\\'}|g" \
  171. -e "s|@DBGFLAGS@|${dbgflags//'\'/'\\\'}|g" \
  172. -e "s|@DBGRUSTFLAGS@|${dbgrustflags//'\'/'\\\'}|g" \
  173. -e "s|@OPTIONS@|${options[*]}|g" \
  174. -e "s|@LIBDIRS@|${libdirs[*]@Q}|g" \
  175. -e "s|@ZSTDFLAGS@|${zstdflags[*]}|g"
  176. done
  177. # Put the files for this arch at a neutral location.
  178. cp -T "${srcdir}/pacman.conf.${CARCH}" "${srcdir}"/pacman.conf
  179. cp -T "${srcdir}/makepkg.conf.${CARCH}" "${srcdir}"/makepkg.conf
  180. }
  181. build() {
  182. cd "$pkgname-$pkgver"
  183. meson --prefix=/usr \
  184. --buildtype=plain \
  185. -Ddoc=enabled \
  186. -Ddoxygen=enabled \
  187. -Dscriptlet-shell=/usr/bin/bash \
  188. -Dldconfig=/usr/bin/ldconfig \
  189. build
  190. meson compile -C build
  191. }
  192. check() {
  193. cd "$pkgname-$pkgver"
  194. meson test -C build
  195. }
  196. package() {
  197. cd "$pkgname-$pkgver"
  198. DESTDIR="$pkgdir" meson install -C build
  199. # install Arch specific stuff
  200. install -dm755 "$pkgdir/etc"
  201. install -m644 "$srcdir/pacman.conf" "$pkgdir/etc"
  202. install -m644 "$srcdir/makepkg.conf" "$pkgdir/etc"
  203. local wantsdir="$pkgdir/usr/lib/systemd/system/sockets.target.wants"
  204. install -dm755 "$wantsdir"
  205. local unit
  206. for unit in dirmngr gpg-agent gpg-agent-{browser,extra,ssh} keyboxd; do
  207. ln -s "../${unit}@.socket" "$wantsdir/${unit}@etc-pacman.d-gnupg.socket"
  208. done
  209. ## install Parabola specific stuff ##
  210. # per-arch pacman.conf(s) and makepkg.conf(s)
  211. local carch
  212. for carch in "${arch[@]}"; do
  213. install -D -m644 -t "$pkgdir/usr/share/pacman/defaults/" "$srcdir/pacman.conf.$carch"
  214. install -D -m644 -t "$pkgdir/usr/share/pacman/defaults/" "$srcdir/makepkg.conf.$carch"
  215. done
  216. }
  217. # vim: set ts=2 sw=2 et: