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