uutf-1.0.0-r1.ebuild 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="5"
  4. inherit findlib
  5. DESCRIPTION="Non-blocking streaming Unicode codec for OCaml"
  6. HOMEPAGE="http://erratique.ch/software/uutf"
  7. SRC_URI="http://erratique.ch/software/uutf/releases/${P}.tbz"
  8. LICENSE="ISC"
  9. SLOT="0/${PV}"
  10. KEYWORDS="~amd64 ~arm ~ppc"
  11. IUSE="doc utftrip +ocamlopt test"
  12. RDEPEND=">=dev-lang/ocaml-3.12:=[ocamlopt?]
  13. dev-ml/uchar:=
  14. utftrip? ( dev-ml/cmdliner:= )"
  15. DEPEND="${RDEPEND}
  16. dev-ml/ocamlbuild
  17. dev-ml/topkg
  18. test? ( dev-ml/cmdliner )"
  19. src_compile() {
  20. ocaml pkg/pkg.ml build \
  21. --with-cmdliner "$(usex utftrip true false)" \
  22. || die
  23. }
  24. src_test() {
  25. if use ocamlopt ; then
  26. ocamlbuild -use-ocamlfind tests.otarget || die
  27. pushd _build/test || die
  28. ./test.native || die
  29. #Rebuild to avoid mismatches between installed files, bug #604674
  30. popd || die
  31. ocaml pkg/pkg.ml build \
  32. --with-cmdliner "$(usex utftrip true false)" \
  33. || die
  34. else
  35. ewarn "Sorry, ${PN} tests require native support (ocamlopt)"
  36. fi
  37. }
  38. src_install() {
  39. # Can't use opam-installer here as it is an opam dep...
  40. findlib_src_preinst
  41. local nativelibs=""
  42. use ocamlopt && nativelibs="$(echo _build/src/uutf.cm{x,xa,xs} _build/src/uutf.a)"
  43. ocamlfind install uutf _build/pkg/META _build/src/uutf.mli _build/src/uutf.cm{a,i} ${nativelibs} || die
  44. use utftrip && newbin utftrip.$(usex ocamlopt native byte) utftrip
  45. dodoc CHANGES.md README.md
  46. use doc && dohtml -r doc/*
  47. }