1*82c905dcSAndrew GeisslerSUMMARY = "Just-In-Time Compiler for Lua"
2*82c905dcSAndrew GeisslerLICENSE = "MIT"
3*82c905dcSAndrew GeisslerLIC_FILES_CHKSUM = "file://COPYRIGHT;md5=d739bb9250a55c124a545b588fd76771"
4*82c905dcSAndrew GeisslerHOMEPAGE = "http://luajit.org"
5*82c905dcSAndrew Geissler
6*82c905dcSAndrew GeisslerPV = "2.1.0~beta3"
7*82c905dcSAndrew GeisslerSRCREV = "0ad60ccbc3768fa8e3e726858adf261950edbc22"
8*82c905dcSAndrew GeisslerSRC_URI = "git://luajit.org/git/luajit-2.0.git;protocol=http;branch=v2.1 \
9*82c905dcSAndrew Geissler           file://0001-Do-not-strip-automatically-this-leaves-the-stripping.patch \
10*82c905dcSAndrew Geissler           file://clang.patch \
11*82c905dcSAndrew Geissler           "
12*82c905dcSAndrew Geissler
13*82c905dcSAndrew GeisslerS = "${WORKDIR}/git"
14*82c905dcSAndrew Geissler
15*82c905dcSAndrew Geisslerinherit pkgconfig binconfig siteinfo
16*82c905dcSAndrew Geissler
17*82c905dcSAndrew GeisslerBBCLASSEXTEND = "native"
18*82c905dcSAndrew Geissler
19*82c905dcSAndrew Geissler# http://luajit.org/install.html#cross
20*82c905dcSAndrew Geissler# Host luajit needs to be compiled with the same pointer size
21*82c905dcSAndrew Geissler# If you want to cross-compile to any 32 bit target on an x64 OS,
22*82c905dcSAndrew Geissler# you need to install the multilib development package (e.g.
23*82c905dcSAndrew Geissler# libc6-dev-i386 on Debian/Ubuntu) and build a 32 bit host part
24*82c905dcSAndrew Geissler# (HOST_CC="gcc -m32").
25*82c905dcSAndrew GeisslerBUILD_CC_ARCH_append = " ${@['-m32',''][d.getVar('SITEINFO_BITS') != '32']}"
26*82c905dcSAndrew Geissler
27*82c905dcSAndrew Geissler# The lua makefiles expect the TARGET_SYS to be from uname -s
28*82c905dcSAndrew Geissler# Values: Windows, Linux, Darwin, iOS, SunOS, PS3, GNU/kFreeBSD
29*82c905dcSAndrew GeisslerLUA_TARGET_OS = "Unknown"
30*82c905dcSAndrew GeisslerLUA_TARGET_OS_darwin = "Darwin"
31*82c905dcSAndrew GeisslerLUA_TARGET_OS_linux = "Linux"
32*82c905dcSAndrew GeisslerLUA_TARGET_OS_linux-gnueabi = "Linux"
33*82c905dcSAndrew GeisslerLUA_TARGET_OS_mingw32 = "Windows"
34*82c905dcSAndrew Geissler
35*82c905dcSAndrew Geissler# We don't want the lua buildsystem's compiler optimizations, or its
36*82c905dcSAndrew Geissler# stripping, and we don't want it to pick up CFLAGS or LDFLAGS, as those apply
37*82c905dcSAndrew Geissler# to both host and target compiles
38*82c905dcSAndrew GeisslerEXTRA_OEMAKE = "\
39*82c905dcSAndrew Geissler    Q= E='@:' \
40*82c905dcSAndrew Geissler    \
41*82c905dcSAndrew Geissler    CCOPT= CCOPT_x86= CFLAGS= LDFLAGS= TARGET_STRIP='@:' \
42*82c905dcSAndrew Geissler    \
43*82c905dcSAndrew Geissler    'TARGET_SYS=${LUA_TARGET_OS}' \
44*82c905dcSAndrew Geissler    \
45*82c905dcSAndrew Geissler    'CC=${CC}' \
46*82c905dcSAndrew Geissler    'TARGET_AR=${AR} rcus' \
47*82c905dcSAndrew Geissler    'TARGET_CFLAGS=${CFLAGS}' \
48*82c905dcSAndrew Geissler    'TARGET_LDFLAGS=${LDFLAGS}' \
49*82c905dcSAndrew Geissler    'TARGET_SHLDFLAGS=${LDFLAGS}' \
50*82c905dcSAndrew Geissler    'HOST_CC=${BUILD_CC}' \
51*82c905dcSAndrew Geissler    'HOST_CFLAGS=${BUILD_CFLAGS}' \
52*82c905dcSAndrew Geissler    \
53*82c905dcSAndrew Geissler    'PREFIX=${prefix}' \
54*82c905dcSAndrew Geissler    'MULTILIB=${baselib}' \
55*82c905dcSAndrew Geissler    'LDCONFIG=:' \
56*82c905dcSAndrew Geissler"
57*82c905dcSAndrew Geissler
58*82c905dcSAndrew Geisslerdo_compile () {
59*82c905dcSAndrew Geissler    oe_runmake
60*82c905dcSAndrew Geissler}
61*82c905dcSAndrew Geissler
62*82c905dcSAndrew Geissler# There's INSTALL_LIB and INSTALL_SHARE also, but the lua binary hardcodes the
63*82c905dcSAndrew Geissler# '/share' and '/' + LUA_MULTILIB paths, so we don't want to break those
64*82c905dcSAndrew Geissler# expectations.
65*82c905dcSAndrew GeisslerEXTRA_OEMAKEINST = "\
66*82c905dcSAndrew Geissler    'DESTDIR=${D}' \
67*82c905dcSAndrew Geissler    'INSTALL_BIN=${D}${bindir}' \
68*82c905dcSAndrew Geissler    'INSTALL_INC=${D}${includedir}/luajit-$(MAJVER).$(MINVER)' \
69*82c905dcSAndrew Geissler    'INSTALL_MAN=${D}${mandir}/man1' \
70*82c905dcSAndrew Geissler"
71*82c905dcSAndrew Geisslerdo_install () {
72*82c905dcSAndrew Geissler    oe_runmake ${EXTRA_OEMAKEINST} install
73*82c905dcSAndrew Geissler    rmdir ${D}${datadir}/lua/5.* \
74*82c905dcSAndrew Geissler          ${D}${datadir}/lua \
75*82c905dcSAndrew Geissler          ${D}${libdir}/lua/5.* \
76*82c905dcSAndrew Geissler          ${D}${libdir}/lua
77*82c905dcSAndrew Geissler}
78*82c905dcSAndrew Geissler
79*82c905dcSAndrew GeisslerPACKAGES += 'luajit-common'
80*82c905dcSAndrew Geissler
81*82c905dcSAndrew Geissler# See the comment for EXTRA_OEMAKEINST. This is needed to ensure the hardcoded
82*82c905dcSAndrew Geissler# paths are packaged regardless of what the libdir and datadir paths are.
83*82c905dcSAndrew GeisslerFILES_${PN} += "${prefix}/${baselib} ${prefix}/share"
84*82c905dcSAndrew GeisslerFILES_${PN} += "${libdir}/libluajit-5.1.so.2 \
85*82c905dcSAndrew Geissler    ${libdir}/libluajit-5.1.so.${PV} \
86*82c905dcSAndrew Geissler"
87*82c905dcSAndrew GeisslerFILES_${PN}-dev += "${libdir}/libluajit-5.1.a \
88*82c905dcSAndrew Geissler    ${libdir}/libluajit-5.1.so \
89*82c905dcSAndrew Geissler    ${libdir}/pkgconfig/luajit.pc \
90*82c905dcSAndrew Geissler"
91*82c905dcSAndrew GeisslerFILES_luajit-common = "${datadir}/${BPN}-${PV}"
92*82c905dcSAndrew Geissler
93*82c905dcSAndrew Geissler# mips64/ppc/ppc64/riscv64 is not supported in this release
94*82c905dcSAndrew GeisslerCOMPATIBLE_HOST_mipsarchn32 = "null"
95*82c905dcSAndrew GeisslerCOMPATIBLE_HOST_mipsarchn64 = "null"
96*82c905dcSAndrew GeisslerCOMPATIBLE_HOST_powerpc = "null"
97*82c905dcSAndrew GeisslerCOMPATIBLE_HOST_powerpc64 = "null"
98*82c905dcSAndrew GeisslerCOMPATIBLE_HOST_powerpc64le = "null"
99*82c905dcSAndrew GeisslerCOMPATIBLE_HOST_riscv64 = "null"
100