182c905dcSAndrew GeisslerSUMMARY = "Just-In-Time Compiler for Lua"
282c905dcSAndrew GeisslerLICENSE = "MIT"
3*97771a30SAndrew GeisslerLIC_FILES_CHKSUM = "file://COPYRIGHT;md5=abe9020de9c00909317d02d5c803810e"
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 \
882c905dcSAndrew Geissler           file://clang.patch \
982c905dcSAndrew Geissler           "
1082c905dcSAndrew Geissler
11*97771a30SAndrew Geissler# Set PV to a version tag and date (YYMMDD) associated with SRCREV if it is later.
12*97771a30SAndrew GeisslerPV = "2.1.0~beta3-210112"
13*97771a30SAndrew GeisslerSRCREV = "ec6edc5c39c25e4eb3fca51b753f9995e97215da"
14d688a01eSAndrew Geissler
1582c905dcSAndrew GeisslerS = "${WORKDIR}/git"
1682c905dcSAndrew Geissler
1782c905dcSAndrew Geisslerinherit pkgconfig binconfig siteinfo
1882c905dcSAndrew Geissler
1982c905dcSAndrew GeisslerBBCLASSEXTEND = "native"
2082c905dcSAndrew Geissler
2182c905dcSAndrew Geissler# http://luajit.org/install.html#cross
2282c905dcSAndrew Geissler# Host luajit needs to be compiled with the same pointer size
2382c905dcSAndrew Geissler# If you want to cross-compile to any 32 bit target on an x64 OS,
2482c905dcSAndrew Geissler# you need to install the multilib development package (e.g.
2582c905dcSAndrew Geissler# libc6-dev-i386 on Debian/Ubuntu) and build a 32 bit host part
2682c905dcSAndrew Geissler# (HOST_CC="gcc -m32").
2782c905dcSAndrew GeisslerBUILD_CC_ARCH_append = " ${@['-m32',''][d.getVar('SITEINFO_BITS') != '32']}"
2882c905dcSAndrew Geissler
2982c905dcSAndrew Geissler# The lua makefiles expect the TARGET_SYS to be from uname -s
3082c905dcSAndrew Geissler# Values: Windows, Linux, Darwin, iOS, SunOS, PS3, GNU/kFreeBSD
3182c905dcSAndrew GeisslerLUA_TARGET_OS = "Unknown"
3282c905dcSAndrew GeisslerLUA_TARGET_OS_darwin = "Darwin"
3382c905dcSAndrew GeisslerLUA_TARGET_OS_linux = "Linux"
3482c905dcSAndrew GeisslerLUA_TARGET_OS_linux-gnueabi = "Linux"
3582c905dcSAndrew GeisslerLUA_TARGET_OS_mingw32 = "Windows"
3682c905dcSAndrew Geissler
3782c905dcSAndrew Geissler# We don't want the lua buildsystem's compiler optimizations, or its
3882c905dcSAndrew Geissler# stripping, and we don't want it to pick up CFLAGS or LDFLAGS, as those apply
3982c905dcSAndrew Geissler# to both host and target compiles
4082c905dcSAndrew GeisslerEXTRA_OEMAKE = "\
4182c905dcSAndrew Geissler    Q= E='@:' \
4282c905dcSAndrew Geissler    \
4382c905dcSAndrew Geissler    CCOPT= CCOPT_x86= CFLAGS= LDFLAGS= TARGET_STRIP='@:' \
4482c905dcSAndrew Geissler    \
4582c905dcSAndrew Geissler    'TARGET_SYS=${LUA_TARGET_OS}' \
4682c905dcSAndrew Geissler    \
4782c905dcSAndrew Geissler    'CC=${CC}' \
4882c905dcSAndrew Geissler    'TARGET_AR=${AR} rcus' \
4982c905dcSAndrew Geissler    'TARGET_CFLAGS=${CFLAGS}' \
5082c905dcSAndrew Geissler    'TARGET_LDFLAGS=${LDFLAGS}' \
5182c905dcSAndrew Geissler    'TARGET_SHLDFLAGS=${LDFLAGS}' \
5282c905dcSAndrew Geissler    'HOST_CC=${BUILD_CC}' \
5382c905dcSAndrew Geissler    'HOST_CFLAGS=${BUILD_CFLAGS}' \
5482c905dcSAndrew Geissler    \
5582c905dcSAndrew Geissler    'PREFIX=${prefix}' \
5682c905dcSAndrew Geissler    'MULTILIB=${baselib}' \
5782c905dcSAndrew Geissler    'LDCONFIG=:' \
5882c905dcSAndrew Geissler"
5982c905dcSAndrew Geissler
6082c905dcSAndrew Geisslerdo_compile () {
6182c905dcSAndrew Geissler    oe_runmake
6282c905dcSAndrew Geissler}
6382c905dcSAndrew Geissler
6482c905dcSAndrew Geissler# There's INSTALL_LIB and INSTALL_SHARE also, but the lua binary hardcodes the
6582c905dcSAndrew Geissler# '/share' and '/' + LUA_MULTILIB paths, so we don't want to break those
6682c905dcSAndrew Geissler# expectations.
6782c905dcSAndrew GeisslerEXTRA_OEMAKEINST = "\
6882c905dcSAndrew Geissler    'DESTDIR=${D}' \
6982c905dcSAndrew Geissler    'INSTALL_BIN=${D}${bindir}' \
7082c905dcSAndrew Geissler    'INSTALL_INC=${D}${includedir}/luajit-$(MAJVER).$(MINVER)' \
7182c905dcSAndrew Geissler    'INSTALL_MAN=${D}${mandir}/man1' \
7282c905dcSAndrew Geissler"
7382c905dcSAndrew Geisslerdo_install () {
7482c905dcSAndrew Geissler    oe_runmake ${EXTRA_OEMAKEINST} install
7582c905dcSAndrew Geissler    rmdir ${D}${datadir}/lua/5.* \
7682c905dcSAndrew Geissler          ${D}${datadir}/lua \
7782c905dcSAndrew Geissler          ${D}${libdir}/lua/5.* \
7882c905dcSAndrew Geissler          ${D}${libdir}/lua
7982c905dcSAndrew Geissler}
8082c905dcSAndrew Geissler
8182c905dcSAndrew GeisslerPACKAGES += 'luajit-common'
8282c905dcSAndrew Geissler
8382c905dcSAndrew Geissler# See the comment for EXTRA_OEMAKEINST. This is needed to ensure the hardcoded
8482c905dcSAndrew Geissler# paths are packaged regardless of what the libdir and datadir paths are.
8582c905dcSAndrew GeisslerFILES_${PN} += "${prefix}/${baselib} ${prefix}/share"
8682c905dcSAndrew GeisslerFILES_${PN} += "${libdir}/libluajit-5.1.so.2 \
8782c905dcSAndrew Geissler    ${libdir}/libluajit-5.1.so.${PV} \
8882c905dcSAndrew Geissler"
8982c905dcSAndrew GeisslerFILES_${PN}-dev += "${libdir}/libluajit-5.1.a \
9082c905dcSAndrew Geissler    ${libdir}/libluajit-5.1.so \
9182c905dcSAndrew Geissler    ${libdir}/pkgconfig/luajit.pc \
9282c905dcSAndrew Geissler"
9382c905dcSAndrew GeisslerFILES_luajit-common = "${datadir}/${BPN}-${PV}"
9482c905dcSAndrew Geissler
9582c905dcSAndrew Geissler# mips64/ppc/ppc64/riscv64 is not supported in this release
9682c905dcSAndrew GeisslerCOMPATIBLE_HOST_mipsarchn32 = "null"
9782c905dcSAndrew GeisslerCOMPATIBLE_HOST_mipsarchn64 = "null"
9882c905dcSAndrew GeisslerCOMPATIBLE_HOST_powerpc = "null"
9982c905dcSAndrew GeisslerCOMPATIBLE_HOST_powerpc64 = "null"
10082c905dcSAndrew GeisslerCOMPATIBLE_HOST_powerpc64le = "null"
10182c905dcSAndrew GeisslerCOMPATIBLE_HOST_riscv64 = "null"
102e231d58cSAndrew GeisslerCOMPATIBLE_HOST_riscv32 = "null"
103