lua-5.2.3.ebuild 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. inherit eutils autotools multilib portability toolchain-funcs versionator
  5. DESCRIPTION="A powerful light-weight programming language designed for extending applications"
  6. HOMEPAGE="http://www.lua.org/"
  7. SRC_URI="http://www.lua.org/ftp/${P}.tar.gz"
  8. LICENSE="MIT"
  9. SLOT="5.2"
  10. KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~arm-linux ~x86-linux"
  11. IUSE="+deprecated emacs readline static"
  12. RDEPEND="readline? ( sys-libs/readline:0= )
  13. app-eselect/eselect-lua
  14. !dev-lang/lua:0"
  15. DEPEND="${RDEPEND}
  16. sys-devel/libtool"
  17. PDEPEND="emacs? ( app-emacs/lua-mode )"
  18. src_prepare() {
  19. local PATCH_PV=$(get_version_component_range 1-2)
  20. epatch "${FILESDIR}"/${PN}-${PATCH_PV}-make-r1.patch
  21. [ -d "${FILESDIR}/${PV}" ] && \
  22. EPATCH_SOURCE="${FILESDIR}/${PV}" EPATCH_SUFFIX="upstream.patch" epatch
  23. sed -i \
  24. -e 's:\(define LUA_ROOT\s*\).*:\1"'${EPREFIX}'/usr/":' \
  25. -e "s:\(define LUA_CDIR\s*LUA_ROOT \"\)lib:\1$(get_libdir):" \
  26. src/luaconf.h \
  27. || die "failed patching luaconf.h"
  28. # correct lua versioning
  29. sed -i -e 's/\(LIB_VERSION = \)6:1:1/\10:0:0/' src/Makefile
  30. sed -i -e 's:\(/README\)\("\):\1.gz\2:g' doc/readme.html
  31. if ! use readline ; then
  32. sed -i -e '/#define LUA_USE_READLINE/d' src/luaconf.h
  33. fi
  34. # Using dynamic linked lua is not recommended for performance
  35. # reasons. http://article.gmane.org/gmane.comp.lang.lua.general/18519
  36. # Mainly, this is of concern if your arch is poor with GPRs, like x86
  37. # Note that this only affects the interpreter binary (named lua), not the lua
  38. # compiler (built statically) nor the lua libraries (both shared and static
  39. # are installed)
  40. if use static ; then
  41. sed -i -e 's:\(-export-dynamic\):-static \1:' src/Makefile
  42. fi
  43. # upstream does not use libtool, but we do (see bug #336167)
  44. cp "${FILESDIR}/configure.in" "${S}"
  45. eautoreconf
  46. }
  47. src_compile() {
  48. tc-export CC
  49. # what to link to liblua
  50. liblibs="-lm"
  51. liblibs="${liblibs} $(dlopen_lib)"
  52. # what to link to the executables
  53. mylibs=
  54. use readline && mylibs="-lreadline"
  55. cd src
  56. local myCFLAGS=""
  57. use deprecated && myCFLAGS="-DLUA_COMPAT_ALL"
  58. case "${CHOST}" in
  59. *-mingw*) : ;;
  60. *) myCFLAGS+=" -DLUA_USE_LINUX" ;;
  61. esac
  62. emake CC="${CC}" CFLAGS="${myCFLAGS} ${CFLAGS}" \
  63. SYSLDFLAGS="${LDFLAGS}" \
  64. RPATH="${EPREFIX}/usr/$(get_libdir)/" \
  65. LUA_LIBS="${mylibs}" \
  66. LIB_LIBS="${liblibs}" \
  67. V=$(get_version_component_range 1-2) \
  68. gentoo_all || die "emake failed"
  69. }
  70. src_install() {
  71. emake INSTALL_TOP="${ED}/usr" INSTALL_LIB="${ED}/usr/$(get_libdir)" \
  72. V=${SLOT} gentoo_install \
  73. || die "emake install gentoo_install failed"
  74. dodoc README
  75. dohtml doc/*.html doc/*.png doc/*.css doc/*.gif
  76. newman doc/lua.1 lua${SLOT}.1
  77. newman doc/luac.1 luac${SLOT}.1
  78. # We want packages to find our things...
  79. cp "${FILESDIR}/lua.pc" "${WORKDIR}"
  80. sed -i \
  81. -e "s:^V=.*:V= ${PATCH_PV}:" \
  82. -e "s:^R=.*:R= ${PV}:" \
  83. -e "s:/,lib,:/$(get_libdir):g" \
  84. "${WORKDIR}/lua.pc"
  85. insinto "/usr/$(get_libdir)/pkgconfig"
  86. newins "${WORKDIR}/lua.pc" "lua${SLOT}.pc"
  87. }
  88. # Makefile contains a dummy target that doesn't do tests
  89. # but causes issues with slotted lua (bug #510360)
  90. src_test() { :; }