luajit-2.0.2.ebuild 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. # Copyright 1999-2015 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. inherit eutils multilib pax-utils versionator toolchain-funcs
  5. MY_PV="$(get_version_component_range 1-3)"
  6. MY_P="LuaJIT-${MY_PV}"
  7. if [[ $(get_version_component_range 4) != "" ]]; then
  8. HOTFIX="v${PV}"
  9. HOTFIX="${HOTFIX/_p/_hotfix}.patch"
  10. fi
  11. DESCRIPTION="Just-In-Time Compiler for the Lua programming language"
  12. HOMEPAGE="http://luajit.org/"
  13. SRC_URI="http://luajit.org/download/${MY_P}.tar.gz
  14. ${HOTFIX:+http://luajit.org/download/${HOTFIX}}"
  15. LICENSE="MIT"
  16. # this should probably be pkgmoved to 2.0 for sake of consistency.
  17. SLOT="2"
  18. KEYWORDS="amd64 arm ~ppc x86 ~amd64-linux ~x86-linux"
  19. IUSE="lua52compat"
  20. S="${WORKDIR}/${MY_P}"
  21. src_prepare(){
  22. if [[ -n ${HOTFIX} ]]; then
  23. epatch "${DISTDIR}/${HOTFIX}"
  24. fi
  25. sed -i "s,PREFIX= /usr/local,PREFIX= ${EPREFIX}/usr," Makefile || die 'sed failed.'
  26. sed -i "s,/lib,/$(get_libdir)," etc/${PN}.pc || die 'sed2 failed.'
  27. }
  28. src_compile() {
  29. emake \
  30. Q= \
  31. PREFIX="${EPREFIX}/usr" \
  32. DESTDIR="${D}" \
  33. HOST_CC="$(tc-getBUILD_CC)" \
  34. STATIC_CC="$(tc-getCC)" \
  35. DYNAMIC_CC="$(tc-getCC) -fPIC" \
  36. TARGET_LD="$(tc-getCC)" \
  37. TARGET_AR="$(tc-getAR) rcus" \
  38. TARGET_STRIP="true" \
  39. INSTALL_LIB="${ED%/}/usr/$(get_libdir)" \
  40. XCFLAGS="$(usex lua52compat "-DLUAJIT_ENABLE_LUA52COMPAT" "")"
  41. }
  42. src_install(){
  43. emake install \
  44. DESTDIR="${D}" \
  45. HOST_CC="$(tc-getBUILD_CC)" \
  46. STATIC_CC="$(tc-getCC)" \
  47. DYNAMIC_CC="$(tc-getCC) -fPIC" \
  48. TARGET_LD="$(tc-getCC)" \
  49. TARGET_AR="$(tc-getAR) rcus" \
  50. TARGET_STRIP="true" \
  51. INSTALL_LIB="${ED%/}/usr/$(get_libdir)"
  52. pax-mark m "${ED}usr/bin/luajit-${MY_PV}"
  53. cd "${S}"/doc
  54. dohtml -r *
  55. }