182c905dcSAndrew GeisslerSUMMARY = "Just-In-Time Compiler for Lua"
282c905dcSAndrew GeisslerLICENSE = "MIT"
3705982a5SPatrick WilliamsLIC_FILES_CHKSUM = "file://COPYRIGHT;md5=076b97f5c7e61532f7f6f3865f04da57"
482c905dcSAndrew GeisslerHOMEPAGE = "http://luajit.org"
582c905dcSAndrew Geissler
682c905dcSAndrew GeisslerSRC_URI = "git://luajit.org/git/luajit-2.0.git;protocol=http;branch=v2.1 \
782c905dcSAndrew Geissler           file://0001-Do-not-strip-automatically-this-leaves-the-stripping.patch \
887f5cff0SAndrew Geissler           file://0001-Use-builtin-for-clear_cache.patch \
982c905dcSAndrew Geissler           "
1082c905dcSAndrew Geissler
11705982a5SPatrick WilliamsPV = "2.1"
12705982a5SPatrick WilliamsSRCREV = "c525bcb9024510cad9e170e12b6209aedb330f83"
13d688a01eSAndrew Geissler
1482c905dcSAndrew GeisslerS = "${WORKDIR}/git"
1582c905dcSAndrew Geissler
1682c905dcSAndrew Geisslerinherit pkgconfig binconfig siteinfo
1782c905dcSAndrew Geissler
1882c905dcSAndrew GeisslerBBCLASSEXTEND = "native"
1982c905dcSAndrew Geissler
2082c905dcSAndrew Geissler# http://luajit.org/install.html#cross
2182c905dcSAndrew Geissler# Host luajit needs to be compiled with the same pointer size
2282c905dcSAndrew Geissler# If you want to cross-compile to any 32 bit target on an x64 OS,
2382c905dcSAndrew Geissler# you need to install the multilib development package (e.g.
2482c905dcSAndrew Geissler# libc6-dev-i386 on Debian/Ubuntu) and build a 32 bit host part
2582c905dcSAndrew Geissler# (HOST_CC="gcc -m32").
26213cb269SPatrick WilliamsBUILD_CC_ARCH:append = " ${@['-m32',''][d.getVar('SITEINFO_BITS') != '32']}"
2782c905dcSAndrew Geissler
2882c905dcSAndrew Geissler# The lua makefiles expect the TARGET_SYS to be from uname -s
2982c905dcSAndrew Geissler# Values: Windows, Linux, Darwin, iOS, SunOS, PS3, GNU/kFreeBSD
3082c905dcSAndrew GeisslerLUA_TARGET_OS = "Unknown"
31213cb269SPatrick WilliamsLUA_TARGET_OS:darwin = "Darwin"
32213cb269SPatrick WilliamsLUA_TARGET_OS:linux = "Linux"
33213cb269SPatrick WilliamsLUA_TARGET_OS:linux-gnueabi = "Linux"
34213cb269SPatrick WilliamsLUA_TARGET_OS:mingw32 = "Windows"
3582c905dcSAndrew Geissler
3682c905dcSAndrew Geissler# We don't want the lua buildsystem's compiler optimizations, or its
3782c905dcSAndrew Geissler# stripping, and we don't want it to pick up CFLAGS or LDFLAGS, as those apply
3882c905dcSAndrew Geissler# to both host and target compiles
3982c905dcSAndrew GeisslerEXTRA_OEMAKE = "\
4082c905dcSAndrew Geissler    Q= E='@:' \
4182c905dcSAndrew Geissler    \
4282c905dcSAndrew Geissler    CCOPT= CCOPT_x86= CFLAGS= LDFLAGS= TARGET_STRIP='@:' \
4382c905dcSAndrew Geissler    \
4482c905dcSAndrew Geissler    'TARGET_SYS=${LUA_TARGET_OS}' \
4582c905dcSAndrew Geissler    \
4682c905dcSAndrew Geissler    'CC=${CC}' \
4782c905dcSAndrew Geissler    'TARGET_AR=${AR} rcus' \
4882c905dcSAndrew Geissler    'TARGET_CFLAGS=${CFLAGS}' \
4982c905dcSAndrew Geissler    'TARGET_LDFLAGS=${LDFLAGS}' \
5082c905dcSAndrew Geissler    'TARGET_SHLDFLAGS=${LDFLAGS}' \
5182c905dcSAndrew Geissler    'HOST_CC=${BUILD_CC}' \
5282c905dcSAndrew Geissler    'HOST_CFLAGS=${BUILD_CFLAGS}' \
5382c905dcSAndrew Geissler    \
5482c905dcSAndrew Geissler    'PREFIX=${prefix}' \
5582c905dcSAndrew Geissler    'MULTILIB=${baselib}' \
5682c905dcSAndrew Geissler    'LDCONFIG=:' \
5782c905dcSAndrew Geissler"
5882c905dcSAndrew Geissler
5982c905dcSAndrew Geisslerdo_compile () {
6082c905dcSAndrew Geissler    oe_runmake
6182c905dcSAndrew Geissler}
6282c905dcSAndrew Geissler
6382c905dcSAndrew Geissler# There's INSTALL_LIB and INSTALL_SHARE also, but the lua binary hardcodes the
6482c905dcSAndrew Geissler# '/share' and '/' + LUA_MULTILIB paths, so we don't want to break those
6582c905dcSAndrew Geissler# expectations.
6682c905dcSAndrew GeisslerEXTRA_OEMAKEINST = "\
6782c905dcSAndrew Geissler    'DESTDIR=${D}' \
6882c905dcSAndrew Geissler    'INSTALL_BIN=${D}${bindir}' \
6982c905dcSAndrew Geissler    'INSTALL_INC=${D}${includedir}/luajit-$(MAJVER).$(MINVER)' \
7082c905dcSAndrew Geissler    'INSTALL_MAN=${D}${mandir}/man1' \
7182c905dcSAndrew Geissler"
7282c905dcSAndrew Geisslerdo_install () {
7382c905dcSAndrew Geissler    oe_runmake ${EXTRA_OEMAKEINST} install
7482c905dcSAndrew Geissler    rmdir ${D}${datadir}/lua/5.* \
7582c905dcSAndrew Geissler          ${D}${datadir}/lua \
7682c905dcSAndrew Geissler          ${D}${libdir}/lua/5.* \
7782c905dcSAndrew Geissler          ${D}${libdir}/lua
7882c905dcSAndrew Geissler}
7982c905dcSAndrew Geissler
8082c905dcSAndrew GeisslerPACKAGES += 'luajit-common'
8182c905dcSAndrew Geissler
8282c905dcSAndrew Geissler# See the comment for EXTRA_OEMAKEINST. This is needed to ensure the hardcoded
8382c905dcSAndrew Geissler# paths are packaged regardless of what the libdir and datadir paths are.
84213cb269SPatrick WilliamsFILES:${PN} += "${prefix}/${baselib} ${prefix}/share"
85213cb269SPatrick WilliamsFILES:${PN} += "${libdir}/libluajit-5.1.so.2 \
8682c905dcSAndrew Geissler    ${libdir}/libluajit-5.1.so.${PV} \
8782c905dcSAndrew Geissler"
88213cb269SPatrick WilliamsFILES:${PN}-dev += "${libdir}/libluajit-5.1.a \
8982c905dcSAndrew Geissler    ${libdir}/libluajit-5.1.so \
9082c905dcSAndrew Geissler    ${libdir}/pkgconfig/luajit.pc \
9182c905dcSAndrew Geissler"
92213cb269SPatrick WilliamsFILES:luajit-common = "${datadir}/${BPN}-${PV}"
9382c905dcSAndrew Geissler
94*73bd93f1SPatrick Williams# ppc64/riscv64/riscv32 is not supported in this release
95213cb269SPatrick WilliamsCOMPATIBLE_HOST:powerpc64 = "null"
96213cb269SPatrick WilliamsCOMPATIBLE_HOST:powerpc64le = "null"
97213cb269SPatrick WilliamsCOMPATIBLE_HOST:riscv64 = "null"
98213cb269SPatrick WilliamsCOMPATIBLE_HOST:riscv32 = "null"
99