keyutils-1.5.9-r2.ebuild 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="5"
  4. inherit multilib eutils toolchain-funcs linux-info multilib-minimal
  5. DESCRIPTION="Linux Key Management Utilities"
  6. HOMEPAGE="https://people.redhat.com/dhowells/keyutils/"
  7. SRC_URI="https://people.redhat.com/dhowells/${PN}/${P}.tar.bz2"
  8. LICENSE="GPL-2 LGPL-2.1"
  9. SLOT="0"
  10. KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~arm-linux ~x86-linux"
  11. IUSE="static static-libs test"
  12. RDEPEND=""
  13. DEPEND="!prefix? ( >=sys-kernel/linux-headers-2.6.11 )"
  14. pkg_setup() {
  15. CONFIG_CHECK="~KEYS"
  16. use test && CONFIG_CHECK="${CONFIG_CHECK} ~KEYS_DEBUG_PROC_KEYS"
  17. ERROR_KEYS="You must have CONFIG_KEYS to use this package!"
  18. ERROR_KEYS_DEBUG_PROC_KEYS="You must have CONFIG_KEYS_DEBUG_PROC_KEYS to run the package testsuite!"
  19. linux-info_pkg_setup
  20. }
  21. src_prepare() {
  22. epatch "${FILESDIR}"/${PN}-1.5.5-makefile-fixup.patch
  23. epatch "${FILESDIR}"/${PN}-1.5.9-endian-check-{1,2}.patch #426424
  24. epatch "${FILESDIR}"/${PN}-1.5.9-disable-tests.patch #519062 #522050
  25. # The lsb check is useless, so avoid spurious command not found messages.
  26. sed -i -e 's,lsb_release,:,' tests/prepare.inc.sh || die
  27. # All the test files are bash, but try to execute via `sh`.
  28. sed -i -r \
  29. -e 's:([[:space:]])sh([[:space:]]):\1bash\2:' \
  30. tests/{Makefile*,*.sh} || die
  31. find tests/ -name '*.sh' -exec sed -i '1s:/sh$:/bash:' {} +
  32. # Some tests call the kernel which calls userspace, but that will
  33. # run the install keyutils rather than the locally compiled one,
  34. # so disable round trip tests.
  35. rm -rf tests/keyctl/requesting/{bad-args,piped,valid}
  36. multilib_copy_sources
  37. }
  38. multilib_src_compile() {
  39. tc-export AR CC
  40. sed -i \
  41. -e "1iRPATH = $(usex static -static '')" \
  42. -e '/^C.*FLAGS/s|:=|+=|' \
  43. -e 's:-Werror::' \
  44. -e '/^BUILDFOR/s:=.*:=:' \
  45. -e "/^LIBDIR/s:=.*:= /usr/$(get_libdir):" \
  46. -e '/^USRLIBDIR/s:=.*:=$(LIBDIR):' \
  47. -e "s: /: ${EPREFIX}/:g" \
  48. -e '/^NO_ARLIB/d' \
  49. Makefile || die
  50. # We need the static lib in order to statically link programs.
  51. if use static ; then
  52. export NO_ARLIB=0
  53. # Hack the progs to depend on the static lib instead.
  54. sed -i \
  55. -e '/^.*:.*[$](DEVELLIB)$/s:$(DEVELLIB):$(ARLIB):' \
  56. Makefile || die
  57. else
  58. export NO_ARLIB=$(usex static-libs 0 1)
  59. fi
  60. emake
  61. }
  62. multilib_src_test() {
  63. # Execute the locally compiled code rather than the
  64. # older versions already installed in the system.
  65. LD_LIBRARY_PATH=${BUILD_DIR} \
  66. PATH="${BUILD_DIR}:${PATH}" \
  67. emake test
  68. }
  69. multilib_src_install() {
  70. # Possibly undo the setting for USE=static (see src_compile).
  71. export NO_ARLIB=$(usex static-libs 0 1)
  72. default
  73. use static || gen_usr_ldscript -a keyutils
  74. }
  75. multilib_src_install_all() {
  76. dodoc README
  77. }