summaryrefslogtreecommitdiff
blob: ffe7074bef3b2fbc985d03cd68889bdcc0a8f0af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-lang/luajit/luajit-2.0.0.ebuild,v 1.2 2013/03/05 21:54:23 bicatali Exp $

EAPI=5

inherit eutils multilib pax-utils versionator toolchain-funcs

MY_P="LuaJIT-$(get_version_component_range 1-3)"
if [[ $(get_version_component_range 4) != "" ]]; then
	HOTFIX="$(get_version_component_range 3-4)"
	HOTFIX="${HOTFIX/_p/_hotfix}.patch"
fi

DESCRIPTION="Just-In-Time Compiler for the Lua programming language"
HOMEPAGE="http://luajit.org/"
SRC_URI="http://luajit.org/download/${MY_P}.tar.gz
	${HOTFIX:+http://luajit.org/download/${HOTFIX}}"

LICENSE="MIT"
# this should probably be pkgmoved to 2.0 for sake of consistency.
SLOT="2"
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
IUSE=""

S="${WORKDIR}/${MY_P}"

src_prepare(){
	if [[ -n ${HOTFIX} ]]; then
		epatch "${DISTDIR}/${HOTFIX}"
	fi

	epatch "${FILESDIR}"/${MY_P}-gentoo.patch
	sed -i \
		-e "s:/usr:${EPREFIX}/usr:g" \
		etc/luajit.pc Makefile src/luaconf.h src/Makefile || die

}

src_compile() {
	emake \
		DESTDIR="${D}" \
		HOST_CC="$(tc-getBUILD_CC)" \
		STATIC_CC="$(tc-getCC)" \
		DYNAMIC_CC="$(tc-getCC) -fPIC" \
		TARGET_LD="$(tc-getCC)" \
		TARGET_AR="$(tc-getAR) rcus" \
		TARGET_STRIP="true" \
		LDCONFIG="true" \
		LIBDIR="$(get_libdir)"
}

src_install(){
	emake install \
		DESTDIR="${D}" \
		HOST_CC="$(tc-getBUILD_CC)" \
		STATIC_CC="$(tc-getCC)" \
		DYNAMIC_CC="$(tc-getCC) -fPIC" \
		TARGET_LD="$(tc-getCC)" \
		TARGET_AR="$(tc-getAR) rcus" \
		TARGET_STRIP="true" \
		LDCONFIG="true" \
		LIBDIR="$(get_libdir)"

	pax-mark m "${ED}usr/bin/luajit-2.0"

	cd "${S}"/doc
	dohtml -r *
}