findlib.eclass 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. # Copyright 1999-2011 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. # @ECLASS: findlib.eclass
  4. # @MAINTAINER:
  5. # ml@gentoo.org
  6. # @AUTHOR:
  7. # Original author: Matthieu Sozeau <mattam@gentoo.org> (retired)
  8. # @BLURB: ocamlfind (a.k.a. findlib) eclass
  9. # @DESCRIPTION:
  10. # ocamlfind (a.k.a. findlib) eclass
  11. # From this findlib version there is proper stublibs support.
  12. DEPEND=">=dev-ml/findlib-1.0.4-r1"
  13. [[ ${FINDLIB_USE} ]] && DEPEND="${FINDLIB_USE}? ( ${DEPEND} )"
  14. check_ocamlfind() {
  15. if [ ! -x "${EPREFIX}"/usr/bin/ocamlfind ]
  16. then
  17. eerror "In findlib.eclass: could not find the ocamlfind executable"
  18. eerror "Please report this bug on gentoo's bugzilla, assigning to ml@gentoo.org"
  19. die "ocamlfind executabled not found"
  20. fi
  21. }
  22. # @FUNCTION: findlib_src_preinst
  23. # @DESCRIPTION:
  24. # Prepare the image for a findlib installation.
  25. # We use the stublibs style, so no ld.conf needs to be
  26. # updated when a package installs C shared libraries.
  27. findlib_src_preinst() {
  28. has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
  29. has "${EAPI:-0}" 0 1 2 && use !prefix && ED="${D}"
  30. check_ocamlfind
  31. # destdir is the ocaml sitelib
  32. local destdir=`ocamlfind printconf destdir`
  33. # strip off prefix
  34. destdir=${destdir#${EPREFIX}}
  35. dodir ${destdir} || die "dodir failed"
  36. export OCAMLFIND_DESTDIR=${ED}${destdir}
  37. # stublibs style
  38. dodir ${destdir}/stublibs || die "dodir failed"
  39. export OCAMLFIND_LDCONF=ignore
  40. }
  41. # @FUNCTION: findlib_src_install
  42. # @DESCRIPTION:
  43. # Install with a properly setup findlib
  44. findlib_src_install() {
  45. findlib_src_preinst
  46. make DESTDIR="${D}" "$@" install || die "make failed"
  47. }