keyutils-1.5.9-r4.ebuild 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. epatch "${FILESDIR}"/${PN}-1.5.9-header-extern-c.patch
  26. # The lsb check is useless, so avoid spurious command not found messages.
  27. sed -i -e 's,lsb_release,:,' tests/prepare.inc.sh || die
  28. # All the test files are bash, but try to execute via `sh`.
  29. sed -i -r \
  30. -e 's:([[:space:]])sh([[:space:]]):\1bash\2:' \
  31. tests/{Makefile*,*.sh} || die
  32. find tests/ -name '*.sh' -exec sed -i '1s:/sh$:/bash:' {} +
  33. # Some tests call the kernel which calls userspace, but that will
  34. # run the install keyutils rather than the locally compiled one,
  35. # so disable round trip tests.
  36. rm -rf tests/keyctl/requesting/{bad-args,piped,valid}
  37. # Delete man pages that are included in the common package now. #612640
  38. rm man/*-keyring.7 man/keyrings.7 || die
  39. multilib_copy_sources
  40. }
  41. multilib_src_compile() {
  42. tc-export AR CC
  43. sed -i \
  44. -e "1iRPATH = $(usex static -static '')" \
  45. -e '/^C.*FLAGS/s|:=|+=|' \
  46. -e 's:-Werror::' \
  47. -e '/^BUILDFOR/s:=.*:=:' \
  48. -e "/^LIBDIR/s:=.*:= /usr/$(get_libdir):" \
  49. -e '/^USRLIBDIR/s:=.*:=$(LIBDIR):' \
  50. -e "s: /: ${EPREFIX}/:g" \
  51. -e '/^NO_ARLIB/d' \
  52. Makefile || die
  53. # We need the static lib in order to statically link programs.
  54. if use static ; then
  55. export NO_ARLIB=0
  56. # Hack the progs to depend on the static lib instead.
  57. sed -i \
  58. -e '/^.*:.*[$](DEVELLIB)$/s:$(DEVELLIB):$(ARLIB):' \
  59. Makefile || die
  60. else
  61. export NO_ARLIB=$(usex static-libs 0 1)
  62. fi
  63. emake
  64. }
  65. multilib_src_test() {
  66. # Execute the locally compiled code rather than the
  67. # older versions already installed in the system.
  68. LD_LIBRARY_PATH=${BUILD_DIR} \
  69. PATH="${BUILD_DIR}:${PATH}" \
  70. emake test
  71. }
  72. multilib_src_install() {
  73. # Possibly undo the setting for USE=static (see src_compile).
  74. export NO_ARLIB=$(usex static-libs 0 1)
  75. default
  76. use static || gen_usr_ldscript -a keyutils
  77. }
  78. multilib_src_install_all() {
  79. dodoc README
  80. }