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