blob: 5688539f65f3790ba6733039b87695ba2a41ee57 (
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: This ebuild is from Lua overlay; Bumped by mva; $
EAPI="5"
inherit base eutils multilib multilib-minimal portability pax-utils toolchain-funcs versionator flag-o-matic check-reqs git-r3
DESCRIPTION="Just-In-Time Compiler for the Lua programming language"
HOMEPAGE="http://luajit.org/"
SRC_URI=""
EGIT_REPO_URI="http://luajit.org/git/luajit-2.0.git"
SLOT="2"
LICENSE="MIT"
KEYWORDS=""
IUSE="debug valgrind lua52compat +optimization"
RDEPEND="
valgrind? ( dev-util/valgrind )
"
DEPEND="
${RDEPEND}
app-eselect/eselect-luajit
app-eselect/eselect-lua
"
PDEPEND="
virtual/lua[luajit]
"
HTML_DOCS=( "doc/" )
MULTILIB_WRAPPED_HEADERS=(
/usr/include/luajit-${SLOT}/luaconf.h
)
check_req() {
if use optimization; then
CHECKREQS_MEMORY="300M"
check-reqs_pkg_${1}
fi
}
pkg_pretend() {
check_req pretend
}
pkg_setup() {
check_req setup
}
src_prepare(){
# fixing prefix and version
# sed -r \
# -e 's|^(VERSION)=.*|\1=$(MAJVER).$(MINVER)|' \
# -e 's|\$\(MAJVER\)\.\$\(MINVER\)\.\$\(RELVER\)|$(VERSION)|' \
# -e 's|^(FILE_MAN)=.*|\1=${PN}-$(VERSION).1|' \
# -e 's|^(INSTALL_PCNAME)=.*|\1=${PN}-$(VERSION).pc|' \
# -e 's|^(INSTALL_SOSHORT)=.*|\1=lib${PN}-${SLOT}.so|' \
# -e 's|^(INSTALL_ANAME)=.*|\1=lib${PN}-${SLOT}.a|' \
# -e 's|^(INSTALL_SONAME)=.*|\1=lib${PN}-${SLOT}.so.${PV}|' \
# -e 's|( PREFIX)=.*|\1=/usr|' \
# -e '/\$\(SYMLINK\)\ \$\(INSTALL_TNAME\)\ \$\(INSTALL_TSYM\)/d' \
# -i Makefile || die "failed to fix prefix in Makefile"
sed -r \
-e 's|^(VERSION)=.*|\1=${PV}|' \
-e 's|\$\(MAJVER\)\.\$\(MINVER\)\.\$\(RELVER\)|$(VERSION)|' \
-e 's|^(INSTALL_PCNAME)=.*|\1=${P}.pc|' \
-e 's|( PREFIX)=.*|\1=/usr|' \
-e 's|^(FILE_MAN)=.*|\1=${P}.1|' \
-i Makefile || die "failed to fix prefix in Makefile"
# sed -r \
# -e 's|^(libname=.*-)\$\{abiver\}|\1${majver}.${minver}|' \
# -i "etc/${PN}.pc" || die "Failed to slottify"
# sed -r \
# -e 's|^(TARGET_SONAME)=.*|\1=lib${PN}-${SLOT}.so.${PV}|' \
# -i src/Makefile || die "Failed to slottify"
sed -r \
-e 's|^(#define LUA_LJDIR).*|\1 "/'${P}'/"|' \
-i src/luaconf.h || die "Failed to slotify"
use debug && (
sed -r \
-e 's/#(CCDEBUG= -g)/\1 -ggdb/' \
-i src/Makefile || die "Failed to enable debug"
)
mv "${S}"/etc/${PN}.1 "${S}"/etc/${P}.1
multilib_copy_sources
}
multilib_src_configure() {
sed -r \
-e "s|^(prefix)=.*|\1=/usr|" \
-e "s|^(multilib)=.*|\1=$(get_libdir)|" \
-i "etc/${PN}.pc" || die "Failed to slottify"
}
multilib_src_compile() {
local opt xcflags;
use optimization && opt="amalg";
tc-export CC
xcflags=(
$(usex lua52compat "-DLUAJIT_ENABLE_LUA52COMPAT" "")
$(usex debug "-DLUAJIT_USE_GDBJIT" "")
$(usex valgrind "-DLUAJIT_USE_VALGRIND" "")
$(usex valgrind "-DLUAJIT_USE_SYSMALLOC" "")
)
emake \
Q= \
HOST_CC="$(tc-getCC)" \
CC="${CC}" \
TARGET_STRIP="true" \
XCFLAGS="${xcflags[*]}" "${opt}"
}
multilib_src_install() {
emake DESTDIR="${D}" MULTILIB="$(get_libdir)" install
base_src_install_docs
host-is-pax && pax-mark m "${ED}usr/bin/${P}"
newman "etc/${P}.1" "luacjit-${PV}.1"
newbin "${FILESDIR}/luac.jit" "luacjit-${PV}"
ln -s "${P}" "${ED}usr/bin/${PN}-${SLOT}"
}
pkg_postinst() {
if [[ ! -n $(readlink "${ROOT}"usr/bin/luajit) ]] ; then
eselect luajit set luajit-${PV}
fi
if [[ ! -n $(readlink "${ROOT}"usr/bin/lua) ]] ; then
eselect lua set jit-${PV}
fi
}
|