tar-1.34-r3.ebuild 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. # Copyright 1999-2024 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=8
  4. VERIFY_SIG_OPENPGP_KEY_PATH="${BROOT}"/usr/share/openpgp-keys/tar.asc
  5. inherit multiprocessing verify-sig
  6. DESCRIPTION="Use this to make tarballs :)"
  7. HOMEPAGE="https://www.gnu.org/software/tar/"
  8. SRC_URI="
  9. mirror://gnu/tar/${P}.tar.xz
  10. https://alpha.gnu.org/gnu/tar/${P}.tar.xz
  11. verify-sig? (
  12. mirror://gnu/tar/${P}.tar.xz.sig
  13. https://alpha.gnu.org/gnu/tar/${P}.tar.xz.sig
  14. )
  15. "
  16. LICENSE="GPL-3+"
  17. SLOT="0"
  18. if [[ -z "$(ver_cut 3)" || "$(ver_cut 3)" -lt 90 ]] ; then
  19. KEYWORDS="~alpha amd64 ~arm arm64 hppa ~ia64 ~loong ~m68k ~mips ~ppc ppc64 ~riscv ~s390 sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris"
  20. fi
  21. IUSE="acl +lbzip2 +pigz +pixz +plzip minimal nls selinux xattr"
  22. RDEPEND="
  23. acl? ( virtual/acl )
  24. lbzip2? ( app-arch/lbzip2 )
  25. pigz? ( app-arch/pigz )
  26. pixz? ( app-arch/pixz )
  27. plzip? ( app-arch/plzip )
  28. selinux? ( sys-libs/libselinux )
  29. "
  30. DEPEND="${RDEPEND}
  31. xattr? ( elibc_glibc? ( sys-apps/attr ) )
  32. "
  33. BDEPEND="
  34. nls? ( sys-devel/gettext )
  35. verify-sig? ( sec-keys/openpgp-keys-tar )
  36. "
  37. PDEPEND="
  38. app-alternatives/tar
  39. "
  40. src_configure() {
  41. # -fanalyzer doesn't make sense for us in ebuilds, as it's for static analysis
  42. export gl_cv_warn_c__fanalyzer=no
  43. local myeconfargs=(
  44. --bindir="${EPREFIX}"/bin
  45. # Avoid -Werror
  46. --disable-gcc-warnings
  47. --enable-backup-scripts
  48. --libexecdir="${EPREFIX}"/usr/sbin
  49. $(use_with acl posix-acls)
  50. $(use_enable nls)
  51. $(use_with selinux)
  52. $(use_with xattr xattrs)
  53. # autoconf looks for gtar before tar (in configure scripts), hence
  54. # in Prefix it is important that it is there, otherwise, a gtar from
  55. # the host system (FreeBSD, Solaris, Darwin) will be found instead
  56. # of the Prefix provided (GNU) tar
  57. --program-prefix=g
  58. )
  59. use lbzip2 && myeconfargs+=(--with-bzip2=lbzip2)
  60. use pigz && myeconfargs+=(--with-gzip=pigz)
  61. use pixz && myeconfargs+=(--with-xz=pixz)
  62. use plzip && myeconfargs+=(--with-lzip=plzip)
  63. # Drop CONFIG_SHELL hack after 1.35: https://git.savannah.gnu.org/cgit/tar.git/commit/?id=7687bf4acc4dc4554538389383d7fb4c3e6521cd
  64. CONFIG_SHELL="${BROOT}"/bin/bash FORCE_UNSAFE_CONFIGURE=1 econf "${myeconfargs[@]}"
  65. }
  66. src_test() {
  67. # Drop after 1.35: https://git.savannah.gnu.org/cgit/tar.git/commit/?id=18f90676e4695ffcf13413e9fbb24cc0ae2ae9d5
  68. local -x XZ_OPT= XZ_DEFAULTS=
  69. emake check TESTSUITEFLAGS="--jobs=$(get_makeopts_jobs)"
  70. }
  71. src_install() {
  72. default
  73. # A nasty yet required piece of baggage
  74. exeinto /etc
  75. doexe "${FILESDIR}"/rmt
  76. mv "${ED}"/usr/sbin/{gbackup,backup-tar} || die
  77. mv "${ED}"/usr/sbin/{grestore,restore-tar} || die
  78. mv "${ED}"/usr/sbin/{g,}backup.sh || die
  79. mv "${ED}"/usr/sbin/{g,}dump-remind || die
  80. if use minimal ; then
  81. find "${ED}"/etc "${ED}"/*bin/ "${ED}"/usr/*bin/ \
  82. -type f -a '!' -name gtar \
  83. -delete || die
  84. fi
  85. if ! use minimal; then
  86. dosym grmt /usr/sbin/rmt
  87. fi
  88. dosym grmt.8 /usr/share/man/man8/rmt.8
  89. }
  90. pkg_postinst() {
  91. # Ensure to preserve the symlink before app-alternatives/tar
  92. # is installed
  93. if [[ ! -h ${EROOT}/bin/tar ]]; then
  94. if [[ -e ${EROOT}/usr/bin/tar ]] ; then
  95. # bug #904887
  96. ewarn "${EROOT}/usr/bin/tar exists but is not a symlink."
  97. ewarn "This is expected during Prefix bootstrap and unusual otherwise."
  98. ewarn "Moving away unexpected ${EROOT}/usr/bin/tar to .bak."
  99. mv "${EROOT}/usr/bin/tar" "${EROOT}/usr/bin/tar.bak" || die
  100. fi
  101. ln -s gtar "${EROOT}/bin/tar" || die
  102. fi
  103. }