luvit-9999.ebuild 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=5
  4. inherit toolchain-funcs multilib git-2
  5. # TODO: FHS https://github.com/luvit/luvit/issues/379
  6. DESCRIPTION="Takes node.js' architecture and dependencies and fits it in the Lua language"
  7. HOMEPAGE="http://luvit.io/"
  8. EGIT_REPO_URI="git://github.com/luvit/luvit.git"
  9. KEYWORDS=""
  10. SLOT="0"
  11. IUSE="bundled-libs examples libressl"
  12. # luvit Apache-2.0
  13. # luajit MIT
  14. # yajl BSD
  15. LICENSE="Apache-2.0 bundled-libs? ( BSD MIT )"
  16. # fails in portage environment
  17. # succeeds if run manually
  18. RESTRICT="test"
  19. RDEPEND="
  20. !libressl? ( dev-libs/openssl:0= )
  21. libressl? ( dev-libs/libressl:0= )
  22. sys-libs/zlib
  23. !bundled-libs? (
  24. dev-lang/luajit:2[lua52compat]
  25. >=dev-libs/yajl-2.0.4
  26. )"
  27. DEPEND="${RDEPEND}
  28. virtual/pkgconfig"
  29. EGIT_HAS_SUBMODULES=1
  30. src_prepare() {
  31. rm -r deps/{openssl,zlib} || die
  32. if use bundled-libs ; then
  33. MY_YAJL_VERSION=$(git --git-dir deps/yajl/.git describe --tags)
  34. MY_LUAJIT_VERSION=$(git --git-dir deps/luajit/.git describe --tags)
  35. else
  36. rm -r deps/{luajit,yajl} || die
  37. MY_YAJL_VERSION=$($(tc-getPKG_CONFIG) --modversion yajl)
  38. MY_LUAJIT_VERSION=$($(tc-getPKG_CONFIG) --modversion luajit)
  39. fi
  40. MY_HTTP_VERSION=$(git --git-dir deps/http-parser/.git describe --tags)
  41. MY_UV_VERSION=$(git --git-dir deps/uv/.git describe --all --long | cut -f 3 -d -)
  42. sed \
  43. -e "s:^YAJL_VERSION=.*:YAJL_VERSION=${MY_YAJL_VERSION}:" \
  44. -e "s:^LUAJIT_VERSION=.*:LUAJIT_VERSION=${MY_LUAJIT_VERSION}:" \
  45. -e "s:^HTTP_VERSION=.*:HTTP_VERSION=${MY_HTTP_VERSION}:" \
  46. -e "s:^UV_VERSION.*:UV_VERSION=${MY_UV_VERSION}:" \
  47. -i Makefile || die "sed failed"
  48. sed -i \
  49. -e "s/-Werror//" \
  50. -e "s/-O3//" \
  51. deps/http-parser/Makefile || die "fixing flags failed!"
  52. }
  53. src_configure() {
  54. # skip retarded gyp build system
  55. :
  56. }
  57. src_compile() {
  58. tc-export CC AR
  59. emake -C deps/cares
  60. myemakeargs=(
  61. DEBUG=0
  62. WERROR=0
  63. USE_SYSTEM_SSL=1
  64. USE_SYSTEM_ZLIB=1
  65. # bundled luajit is compiled with special flags
  66. USE_SYSTEM_LUAJIT=$(usex bundled-libs "0" "1")
  67. USE_SYSTEM_YAJL=$(usex bundled-libs "0" "1")
  68. PREFIX=/usr
  69. LIBDIR="${D}"/usr/$(get_libdir)/${PN}
  70. DESTDIR="${D}"
  71. )
  72. emake "${myemakeargs[@]}" all
  73. }
  74. src_install() {
  75. emake "${myemakeargs[@]}" install
  76. dodoc TODO ChangeLog README.markdown errors.markdown
  77. if use examples ; then
  78. dodoc -r examples
  79. docompress -x /usr/share/doc/${PF}/examples
  80. fi
  81. }