keyutils-1.5.9-r3.ebuild 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. multilib_copy_sources
  38. }
  39. multilib_src_compile() {
  40. tc-export AR CC
  41. sed -i \
  42. -e "1iRPATH = $(usex static -static '')" \
  43. -e '/^C.*FLAGS/s|:=|+=|' \
  44. -e 's:-Werror::' \
  45. -e '/^BUILDFOR/s:=.*:=:' \
  46. -e "/^LIBDIR/s:=.*:= /usr/$(get_libdir):" \
  47. -e '/^USRLIBDIR/s:=.*:=$(LIBDIR):' \
  48. -e "s: /: ${EPREFIX}/:g" \
  49. -e '/^NO_ARLIB/d' \
  50. Makefile || die
  51. # We need the static lib in order to statically link programs.
  52. if use static ; then
  53. export NO_ARLIB=0
  54. # Hack the progs to depend on the static lib instead.
  55. sed -i \
  56. -e '/^.*:.*[$](DEVELLIB)$/s:$(DEVELLIB):$(ARLIB):' \
  57. Makefile || die
  58. else
  59. export NO_ARLIB=$(usex static-libs 0 1)
  60. fi
  61. emake
  62. }
  63. multilib_src_test() {
  64. # Execute the locally compiled code rather than the
  65. # older versions already installed in the system.
  66. LD_LIBRARY_PATH=${BUILD_DIR} \
  67. PATH="${BUILD_DIR}:${PATH}" \
  68. emake test
  69. }
  70. multilib_src_install() {
  71. # Possibly undo the setting for USE=static (see src_compile).
  72. export NO_ARLIB=$(usex static-libs 0 1)
  73. default
  74. use static || gen_usr_ldscript -a keyutils
  75. }
  76. multilib_src_install_all() {
  77. dodoc README
  78. }