blob: 033bdfd500a70baaf39ef7a9ea157b3baa3401d9 (
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
|
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
inherit eutils multilib multilib-minimal portability pax-utils toolchain-funcs versionator flag-o-matic check-reqs git-r3 patches
DESCRIPTION="Just-In-Time Compiler for the Lua programming language"
HOMEPAGE="https://luajit.org/"
EGIT_REPO_URI="https://luajit.org/git/luajit-2.0.git"
EGIT_BRANCH="v2.1"
EGIT_MIN_CLONE_TYPE="single"
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() {
patches_src_prepare
# fixing prefix and version
sed -r \
-e 's|^(VERSION)=.*|\1=${PV}|' \
-e 's|^(INSTALL_SONAME)=.*|\1=$(INSTALL_SOSHORT1).$(VERSION)|' \
-e 's|^(INSTALL_PCNAME)=.*|\1=${P}.pc|' \
-e 's|( PREFIX)=.*|\1=${EROOT}usr|' \
-e 's|^(FILE_MAN)=.*|\1=${P}.1|' \
-i Makefile || die "failed to fix prefix in Makefile"
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 -O0/' \
-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=${EROOT}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" "")
$(usex amd64 "-DLUAJIT_ENABLE_GC64" "")
# $(usex arm64 "-DLUAJIT_ENABLE_GC64" "")
# $(usex mips64 "-DLUAJIT_ENABLE_GC64" "")
# $(usex ppc64 "-DLUAJIT_ENABLE_GC64" "")
# $(usex s390_64 "-DLUAJIT_ENABLE_GC64" "")
)
emake \
Q= \
HOST_CC="$(tc-getCC)" \
CC="${CC}" \
TARGET_STRIP="true" \
XCFLAGS="${xcflags[*]}" ${opt}
}
multilib_src_install() {
emake DESTDIR="${D}" MULTILIB="$(get_libdir)" install
einstalldocs
host-is-pax && pax-mark m "${ED}usr/bin/${P}"
newman "etc/${P}.1" "luacjit-${PV}.1"
newbin "${FILESDIR}/luac.jit" "luacjit-${PV}"
ln -fs "${P}" "${ED}usr/bin/${PN}-${SLOT}"
}
pkg_postinst() {
if [[ ! -n $(readlink "${EROOT}"usr/bin/luajit) ]] ; then
eselect luajit set luajit-${PV}
fi
if [[ ! -n $(readlink "${EROOT}"usr/bin/lua) ]] ; then
eselect lua set jit-${PV}
fi
}
|