diff mbox series

[meta-oe,1/3] lua: add recipe for lua-5.2

Message ID 20240122193109.3041355-1-f_l_k@t-online.de
State Accepted
Headers show
Series [meta-oe,1/3] lua: add recipe for lua-5.2 | expand

Commit Message

Markus Volk Jan. 22, 2024, 7:31 p.m. UTC
mpv only supports lua-5.2 and luajit. Add lua-5.2 to unblock gui build
for platforms that dont support luajit

Signed-off-by: Markus Volk <f_l_k@t-online.de>
---
 .../lua/lua-5.2/Makefile-build-so.patch       | 82 +++++++++++++++++++
 .../recipes-devtools/lua/lua-5.2/lua.pc.in    | 10 +++
 .../recipes-devtools/lua/lua-5.2/run-ptest    | 19 +++++
 meta-oe/recipes-devtools/lua/lua-5.2_5.2.3.bb | 67 +++++++++++++++
 4 files changed, 178 insertions(+)
 create mode 100644 meta-oe/recipes-devtools/lua/lua-5.2/Makefile-build-so.patch
 create mode 100644 meta-oe/recipes-devtools/lua/lua-5.2/lua.pc.in
 create mode 100644 meta-oe/recipes-devtools/lua/lua-5.2/run-ptest
 create mode 100644 meta-oe/recipes-devtools/lua/lua-5.2_5.2.3.bb

Comments

Khem Raj Jan. 23, 2024, 2:01 a.m. UTC | #1
this fails to build.

https://autobuilder.yoctoproject.org/typhoon/#/builders/88/builds/3547/steps/14/logs/stdio

On Mon, Jan 22, 2024 at 11:31 AM Markus Volk <f_l_k@t-online.de> wrote:
>
> mpv only supports lua-5.2 and luajit. Add lua-5.2 to unblock gui build
> for platforms that dont support luajit
>
> Signed-off-by: Markus Volk <f_l_k@t-online.de>
> ---
>  .../lua/lua-5.2/Makefile-build-so.patch       | 82 +++++++++++++++++++
>  .../recipes-devtools/lua/lua-5.2/lua.pc.in    | 10 +++
>  .../recipes-devtools/lua/lua-5.2/run-ptest    | 19 +++++
>  meta-oe/recipes-devtools/lua/lua-5.2_5.2.3.bb | 67 +++++++++++++++
>  4 files changed, 178 insertions(+)
>  create mode 100644 meta-oe/recipes-devtools/lua/lua-5.2/Makefile-build-so.patch
>  create mode 100644 meta-oe/recipes-devtools/lua/lua-5.2/lua.pc.in
>  create mode 100644 meta-oe/recipes-devtools/lua/lua-5.2/run-ptest
>  create mode 100644 meta-oe/recipes-devtools/lua/lua-5.2_5.2.3.bb
>
> diff --git a/meta-oe/recipes-devtools/lua/lua-5.2/Makefile-build-so.patch b/meta-oe/recipes-devtools/lua/lua-5.2/Makefile-build-so.patch
> new file mode 100644
> index 000000000..343d1ddd6
> --- /dev/null
> +++ b/meta-oe/recipes-devtools/lua/lua-5.2/Makefile-build-so.patch
> @@ -0,0 +1,82 @@
> +Upstream-Status: Inappropriate [Upstream doesn't support so libs]
> +
> +diff -ru lua-5.2.1/Makefile lua-5.2.1.new/Makefile
> +--- a/Makefile 2012-05-17 16:05:54.000000000 +0200
> ++++ b/Makefile 2012-09-12 22:39:07.162748096 +0200
> +@@ -38,16 +38,16 @@
> + # Convenience platforms targets.
> + PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
> +
> ++# Lua version and release.
> ++V= 5.2
> ++R= $V.3
> ++
> + # What to install.
> + TO_BIN= lua luac
> + TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp
> +-TO_LIB= liblua.a
> ++TO_LIB= liblua.a liblua.so.$(R)
> + TO_MAN= lua.1 luac.1
> +
> +-# Lua version and release.
> +-V= 5.2
> +-R= $V.3
> +-
> + # Targets start here.
> + all:  $(PLAT)
> +
> +@@ -63,7 +63,8 @@
> +       cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
> +       cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
> +       cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
> +-
> ++      ln -sf ./liblua.so.$(R) $(INSTALL_LIB)/liblua.so.$(V)
> ++      ln -sf ./liblua.so.$(R) $(INSTALL_LIB)/liblua.so
> + uninstall:
> +       cd src && cd $(INSTALL_BIN) && $(RM) $(TO_BIN)
> +       cd src && cd $(INSTALL_INC) && $(RM) $(TO_INC)
> +diff -ru lua-5.2.1/src/luaconf.h lua-5.2.1.new/src/luaconf.h
> +--- lua-5.2.1/src/luaconf.h    2012-05-11 16:14:42.000000000 +0200
> ++++ lua-5.2.1.new/src/luaconf.h        2012-09-12 22:40:27.986622772 +0200
> +@@ -100,7 +100,7 @@
> + #else                 /* }{ */
> +
> + #define LUA_VDIR      LUA_VERSION_MAJOR "." LUA_VERSION_MINOR "/"
> +-#define LUA_ROOT      "/usr/local/"
> ++#define LUA_ROOT      "/usr"
> + #define LUA_LDIR      LUA_ROOT "share/lua/" LUA_VDIR
> + #define LUA_CDIR      LUA_ROOT "lib/lua/" LUA_VDIR
> + #define LUA_PATH_DEFAULT  \
> +diff -ru lua-5.2.1/src/Makefile lua-5.2.1.new/src/Makefile
> +--- lua-5.2.1/src/Makefile     2012-03-09 17:32:16.000000000 +0100
> ++++ lua-5.2.1.new/src/Makefile 2012-09-12 22:38:08.591386896 +0200
> +@@ -29,6 +29,7 @@
> + PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
> +
> + LUA_A=        liblua.a
> ++LUA_SO= liblua.so
> + CORE_O=       lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \
> +       lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o \
> +       ltm.o lundump.o lvm.o lzio.o
> +@@ -43,7 +44,7 @@
> + LUAC_O=       luac.o
> +
> + ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O)
> +-ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
> ++ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) $(LUA_SO)
> + ALL_A= $(LUA_A)
> +
> + # Targets start here.
> +@@ -59,6 +60,12 @@
> +       $(AR) $@ $(BASE_O)
> +       $(RANLIB) $@
> +
> ++$(LUA_SO): $(CORE_O) $(LIB_O)
> ++      $(CC) -shared -ldl -Wl,-soname,$(LUA_SO).5.2 -o $@.5.2.3 $? -lm $(MYLDFLAGS)
> ++
> ++
> ++
> ++
> + $(LUA_T): $(LUA_O) $(LUA_A)
> +       $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
> +
> diff --git a/meta-oe/recipes-devtools/lua/lua-5.2/lua.pc.in b/meta-oe/recipes-devtools/lua/lua-5.2/lua.pc.in
> new file mode 100644
> index 000000000..c26775fa7
> --- /dev/null
> +++ b/meta-oe/recipes-devtools/lua/lua-5.2/lua.pc.in
> @@ -0,0 +1,10 @@
> +libdir=@LIBDIR@
> +includedir=@INCLUDEDIR@
> +
> +Name: Lua
> +Description: Lua language engine
> +Version: @VERSION@
> +Requires:
> +Libs: -L${libdir} -llua -lm -ldl
> +Cflags: -I${includedir}
> +
> diff --git a/meta-oe/recipes-devtools/lua/lua-5.2/run-ptest b/meta-oe/recipes-devtools/lua/lua-5.2/run-ptest
> new file mode 100644
> index 000000000..8e085e1af
> --- /dev/null
> +++ b/meta-oe/recipes-devtools/lua/lua-5.2/run-ptest
> @@ -0,0 +1,19 @@
> +#!/bin/sh
> +
> +cd test
> +lua -e"_U=true" all.lua > lua-test.tmp
> +
> +echo "--- test output ---"
> +cat lua-test.tmp
> +echo ""
> +echo ""
> +echo "--- ptest result ---"
> +
> +grep "final OK \!\!\!" lua-test.tmp > /dev/null
> +if [ $? -eq 0 ]; then
> +   echo "PASS: lua"
> +else
> +   echo "FAIL: lua"
> +fi
> +
> +rm -f lua-test.tmp
> diff --git a/meta-oe/recipes-devtools/lua/lua-5.2_5.2.3.bb b/meta-oe/recipes-devtools/lua/lua-5.2_5.2.3.bb
> new file mode 100644
> index 000000000..58f716337
> --- /dev/null
> +++ b/meta-oe/recipes-devtools/lua/lua-5.2_5.2.3.bb
> @@ -0,0 +1,67 @@
> +SUMMARY = "Lua is a powerful light-weight programming language designed \
> +for extending applications."
> +LICENSE = "MIT"
> +LIC_FILES_CHKSUM = "file://doc/readme.html;beginline=381;endline=399;md5=07ddfddb01fa4ed9f2fb5e8eeae817a4"
> +HOMEPAGE = "http://www.lua.org/"
> +
> +SRC_URI = "http://www.lua.org/ftp/lua-${PV}.tar.gz;name=tarballsrc \
> +           file://lua.pc.in \
> +           ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'http://www.lua.org/tests/lua-${PV_testsuites}-tests.tar.gz;name=tarballtest file://run-ptest ', '', d)} \
> +           file://Makefile-build-so.patch \
> +           "
> +
> +# if no test suite matches PV release of Lua exactly, download the suite for the closest Lua release.
> +PV_testsuites = "5.2.2"
> +
> +SRC_URI[tarballsrc.sha256sum] = "13c2fb97961381f7d06d5b5cea55b743c163800896fd5c5e2356201d3619002d"
> +SRC_URI[tarballtest.sha256sum] = "07c1071c66d9cb4dc80200ed430fc21ebbbccf1f55148b87eb0b9522932e4eb6"
> +
> +S = "${WORKDIR}/lua-${PV}"
> +
> +DEPENDS = "readline"
> +inherit pkgconfig binconfig ptest
> +
> +TARGET_CC_ARCH += " -fPIC  ${LDFLAGS}"
> +EXTRA_OEMAKE = "'CC=${CC} -fPIC' 'MYCFLAGS=${CFLAGS} -fPIC' MYLDFLAGS='${LDFLAGS}'"
> +
> +do_configure:prepend() {
> +    sed -i -e s:/usr/local:${prefix}:g src/luaconf.h
> +    sed -i -e s:lib/lua/:${baselib}/lua/:g src/luaconf.h
> +}
> +
> +do_compile () {
> +    oe_runmake linux
> +}
> +
> +do_install () {
> +    oe_runmake \
> +        'INSTALL_TOP=${D}${prefix}' \
> +        'INSTALL_BIN=${D}${bindir}' \
> +        'INSTALL_INC=${D}${includedir}/' \
> +        'INSTALL_MAN=${D}${mandir}/man1' \
> +        'INSTALL_SHARE=${D}${datadir}' \
> +        'INSTALL_LIB=${D}${libdir}' \
> +        'INSTALL_CMOD=${D}${libdir}' \
> +        install
> +    install -d ${D}${libdir}/pkgconfig  ${D}${datadir}/doc/lua
> +
> +    sed -e s/@VERSION@/${PV}/ -e s#@LIBDIR@#${libdir}# -e s#@INCLUDEDIR@#${includedir}# ${WORKDIR}/lua.pc.in > ${WORKDIR}/lua.pc
> +    install -m 0644 ${WORKDIR}/lua.pc ${D}${libdir}/pkgconfig/
> +    install -m 0644 doc/*.{gif,png,css,html} ${D}${datadir}/doc/lua
> +    rm -rf ${D}${datadir}/lua
> +}
> +
> +do_install_ptest () {
> +        cp -R --no-dereference --preserve=mode,links -v ${WORKDIR}/lua-${PV_testsuites}-tests ${D}${PTEST_PATH}/test
> +}
> +
> +do_install_ptest:append:libc-musl () {
> +        # locale tests does not work on musl, due to limited locale implementation
> +        # https://wiki.musl-libc.org/open-issues.html#Locale-limitations
> +        sed -i -e 's|os.setlocale("pt_BR") or os.setlocale("ptb")|false|g' ${D}${PTEST_PATH}/test/literals.lua
> +}
> +
> +BBCLASSEXTEND = "native nativesdk"
> +
> +inherit multilib_script
> +MULTILIB_SCRIPTS = "${PN}-dev:${includedir}/luaconf.h"
> --
> 2.43.0
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#108374): https://lists.openembedded.org/g/openembedded-devel/message/108374
> Mute This Topic: https://lists.openembedded.org/mt/103894012/1997914
> Group Owner: openembedded-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
Markus Volk Jan. 24, 2024, 12:07 p.m. UTC | #2
There seems to be an issue with do_install, but I struggle to find 
useful information in the error message in stdio output. I'm not able 
to reproduce the issue locally. Lua-5.2 install is fine here, even with 
ptest enabled.

In some circumstances it can be handy to have a recipe for lua-5.2, but 
fortunately it is not a must-have I would say

On Mon, Jan 22 2024 at 06:01:51 PM -08:00:00, Khem Raj 
<raj.khem@gmail.com> wrote:
> this fails to build.
> 
> <https://autobuilder.yoctoproject.org/typhoon/#/builders/88/builds/3547/steps/14/logs/stdio>
> 
> On Mon, Jan 22, 2024 at 11:31 AM Markus Volk <f_l_k@t-online.de 
> <mailto:f_l_k@t-online.de>> wrote:
>> 
>>  mpv only supports lua-5.2 and luajit. Add lua-5.2 to unblock gui 
>> build
>>  for platforms that dont support luajit
>> 
>>  Signed-off-by: Markus Volk <f_l_k@t-online.de 
>> <mailto:f_l_k@t-online.de>>
>>  ---
>>   .../lua/lua-5.2/Makefile-build-so.patch       | 82 
>> +++++++++++++++++++
>>   .../recipes-devtools/lua/lua-5.2/lua.pc.in    | 10 +++
>>   .../recipes-devtools/lua/lua-5.2/run-ptest    | 19 +++++
>>   meta-oe/recipes-devtools/lua/lua-5.2_5.2.3.bb | 67 +++++++++++++++
>>   4 files changed, 178 insertions(+)
>>   create mode 100644 
>> meta-oe/recipes-devtools/lua/lua-5.2/Makefile-build-so.patch
>>   create mode 100644 meta-oe/recipes-devtools/lua/lua-5.2/lua.pc.in
>>   create mode 100644 meta-oe/recipes-devtools/lua/lua-5.2/run-ptest
>>   create mode 100644 meta-oe/recipes-devtools/lua/lua-5.2_5.2.3.bb
>> 
>>  diff --git 
>> a/meta-oe/recipes-devtools/lua/lua-5.2/Makefile-build-so.patch 
>> b/meta-oe/recipes-devtools/lua/lua-5.2/Makefile-build-so.patch
>>  new file mode 100644
>>  index 000000000..343d1ddd6
>>  --- /dev/null
>>  +++ b/meta-oe/recipes-devtools/lua/lua-5.2/Makefile-build-so.patch
>>  @@ -0,0 +1,82 @@
>>  +Upstream-Status: Inappropriate [Upstream doesn't support so libs]
>>  +
>>  +diff -ru lua-5.2.1/Makefile lua-5.2.1.new/Makefile
>>  +--- a/Makefile 2012-05-17 16:05:54.000000000 +0200
>>  ++++ b/Makefile 2012-09-12 22:39:07.162748096 +0200
>>  +@@ -38,16 +38,16 @@
>>  + # Convenience platforms targets.
>>  + PLATS= aix ansi bsd freebsd generic linux macosx mingw posix 
>> solaris
>>  +
>>  ++# Lua version and release.
>>  ++V= 5.2
>>  ++R= $V.3
>>  ++
>>  + # What to install.
>>  + TO_BIN= lua luac
>>  + TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp
>>  +-TO_LIB= liblua.a
>>  ++TO_LIB= liblua.a liblua.so.$(R)
>>  + TO_MAN= lua.1 luac.1
>>  +
>>  +-# Lua version and release.
>>  +-V= 5.2
>>  +-R= $V.3
>>  +-
>>  + # Targets start here.
>>  + all:  $(PLAT)
>>  +
>>  +@@ -63,7 +63,8 @@
>>  +       cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
>>  +       cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
>>  +       cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
>>  +-
>>  ++      ln -sf ./liblua.so.$(R) $(INSTALL_LIB)/liblua.so.$(V)
>>  ++      ln -sf ./liblua.so.$(R) $(INSTALL_LIB)/liblua.so
>>  + uninstall:
>>  +       cd src && cd $(INSTALL_BIN) && $(RM) $(TO_BIN)
>>  +       cd src && cd $(INSTALL_INC) && $(RM) $(TO_INC)
>>  +diff -ru lua-5.2.1/src/luaconf.h lua-5.2.1.new/src/luaconf.h
>>  +--- lua-5.2.1/src/luaconf.h    2012-05-11 16:14:42.000000000 +0200
>>  ++++ lua-5.2.1.new/src/luaconf.h        2012-09-12 
>> 22:40:27.986622772 +0200
>>  +@@ -100,7 +100,7 @@
>>  + #else                 /* }{ */
>>  +
>>  + #define LUA_VDIR      LUA_VERSION_MAJOR "." LUA_VERSION_MINOR "/"
>>  +-#define LUA_ROOT      "/usr/local/"
>>  ++#define LUA_ROOT      "/usr"
>>  + #define LUA_LDIR      LUA_ROOT "share/lua/" LUA_VDIR
>>  + #define LUA_CDIR      LUA_ROOT "lib/lua/" LUA_VDIR
>>  + #define LUA_PATH_DEFAULT  \
>>  +diff -ru lua-5.2.1/src/Makefile lua-5.2.1.new/src/Makefile
>>  +--- lua-5.2.1/src/Makefile     2012-03-09 17:32:16.000000000 +0100
>>  ++++ lua-5.2.1.new/src/Makefile 2012-09-12 22:38:08.591386896 +0200
>>  +@@ -29,6 +29,7 @@
>>  + PLATS= aix ansi bsd freebsd generic linux macosx mingw posix 
>> solaris
>>  +
>>  + LUA_A=        liblua.a
>>  ++LUA_SO= liblua.so
>>  + CORE_O=       lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o 
>> lfunc.o lgc.o llex.o \
>>  +       lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o 
>> ltable.o \
>>  +       ltm.o lundump.o lvm.o lzio.o
>>  +@@ -43,7 +44,7 @@
>>  + LUAC_O=       luac.o
>>  +
>>  + ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O)
>>  +-ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
>>  ++ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) $(LUA_SO)
>>  + ALL_A= $(LUA_A)
>>  +
>>  + # Targets start here.
>>  +@@ -59,6 +60,12 @@
>>  +       $(AR) $@ $(BASE_O)
>>  +       $(RANLIB) $@
>>  +
>>  ++$(LUA_SO): $(CORE_O) $(LIB_O)
>>  ++      $(CC) -shared -ldl -Wl,-soname,$(LUA_SO).5.2 -o $@.5.2.3 $? 
>> -lm $(MYLDFLAGS)
>>  ++
>>  ++
>>  ++
>>  ++
>>  + $(LUA_T): $(LUA_O) $(LUA_A)
>>  +       $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
>>  +
>>  diff --git a/meta-oe/recipes-devtools/lua/lua-5.2/lua.pc.in 
>> b/meta-oe/recipes-devtools/lua/lua-5.2/lua.pc.in
>>  new file mode 100644
>>  index 000000000..c26775fa7
>>  --- /dev/null
>>  +++ b/meta-oe/recipes-devtools/lua/lua-5.2/lua.pc.in
>>  @@ -0,0 +1,10 @@
>>  +libdir=@LIBDIR@
>>  +includedir=@INCLUDEDIR@
>>  +
>>  +Name: Lua
>>  +Description: Lua language engine
>>  +Version: @VERSION@
>>  +Requires:
>>  +Libs: -L${libdir} -llua -lm -ldl
>>  +Cflags: -I${includedir}
>>  +
>>  diff --git a/meta-oe/recipes-devtools/lua/lua-5.2/run-ptest 
>> b/meta-oe/recipes-devtools/lua/lua-5.2/run-ptest
>>  new file mode 100644
>>  index 000000000..8e085e1af
>>  --- /dev/null
>>  +++ b/meta-oe/recipes-devtools/lua/lua-5.2/run-ptest
>>  @@ -0,0 +1,19 @@
>>  +#!/bin/sh
>>  +
>>  +cd test
>>  +lua -e"_U=true" all.lua > lua-test.tmp
>>  +
>>  +echo "--- test output ---"
>>  +cat lua-test.tmp
>>  +echo ""
>>  +echo ""
>>  +echo "--- ptest result ---"
>>  +
>>  +grep "final OK \!\!\!" lua-test.tmp > /dev/null
>>  +if [ $? -eq 0 ]; then
>>  +   echo "PASS: lua"
>>  +else
>>  +   echo "FAIL: lua"
>>  +fi
>>  +
>>  +rm -f lua-test.tmp
>>  diff --git a/meta-oe/recipes-devtools/lua/lua-5.2_5.2.3.bb 
>> b/meta-oe/recipes-devtools/lua/lua-5.2_5.2.3.bb
>>  new file mode 100644
>>  index 000000000..58f716337
>>  --- /dev/null
>>  +++ b/meta-oe/recipes-devtools/lua/lua-5.2_5.2.3.bb
>>  @@ -0,0 +1,67 @@
>>  +SUMMARY = "Lua is a powerful light-weight programming language 
>> designed \
>>  +for extending applications."
>>  +LICENSE = "MIT"
>>  +LIC_FILES_CHKSUM = 
>> "file://doc/readme.html;beginline=381;endline=399;md5=07ddfddb01fa4ed9f2fb5e8eeae817a4" 
>> <file://doc/readme.html;beginline=381;endline=399;md5=07ddfddb01fa4ed9f2fb5e8eeae817a4>
>>  +HOMEPAGE = "<http://www.lua.org/>"
>>  +
>>  +SRC_URI = "http://www.lua.org/ftp/lua-${PV}.tar.gz;name=tarballsrc 
>> <http://www.lua.org/ftp/lua-$%7BPV%7D.tar.gz;name=tarballsrc> \
>>  +           file://lua.pc.in <file://lua.pc.in/> \
>>  +           ${@bb.utils.contains 
>> <mailto:${@bb.utils.contains>('DISTRO_FEATURES', 'ptest', 
>> 'http://www.lua.org/tests/lua-${PV_testsuites}-tests.tar.gz;name=tarballtest 
>> <http://www.lua.org/tests/lua-$%7BPV_testsuites%7D-tests.tar.gz;name=tarballtest> 
>> file://run-ptest <file://run-ptest/> ', '', d)} \
>>  +           file://Makefile-build-so.patch 
>> <file://makefile-build-so.patch/> \
>>  +           "
>>  +
>>  +# if no test suite matches PV release of Lua exactly, download the 
>> suite for the closest Lua release.
>>  +PV_testsuites = "5.2.2"
>>  +
>>  +SRC_URI[tarballsrc.sha256sum] = 
>> "13c2fb97961381f7d06d5b5cea55b743c163800896fd5c5e2356201d3619002d"
>>  +SRC_URI[tarballtest.sha256sum] = 
>> "07c1071c66d9cb4dc80200ed430fc21ebbbccf1f55148b87eb0b9522932e4eb6"
>>  +
>>  +S = "${WORKDIR}/lua-${PV}"
>>  +
>>  +DEPENDS = "readline"
>>  +inherit pkgconfig binconfig ptest
>>  +
>>  +TARGET_CC_ARCH += " -fPIC  ${LDFLAGS}"
>>  +EXTRA_OEMAKE = "'CC=${CC} -fPIC' 'MYCFLAGS=${CFLAGS} -fPIC' 
>> MYLDFLAGS='${LDFLAGS}'"
>>  +
>>  +do_configure:prepend() {
>>  +    sed -i -e s:/usr/local:${prefix}:g src/luaconf.h
>>  +    sed -i -e s:lib/lua/:${baselib}/lua/:g src/luaconf.h
>>  +}
>>  +
>>  +do_compile () {
>>  +    oe_runmake linux
>>  +}
>>  +
>>  +do_install () {
>>  +    oe_runmake \
>>  +        'INSTALL_TOP=${D}${prefix}' \
>>  +        'INSTALL_BIN=${D}${bindir}' \
>>  +        'INSTALL_INC=${D}${includedir}/' \
>>  +        'INSTALL_MAN=${D}${mandir}/man1' \
>>  +        'INSTALL_SHARE=${D}${datadir}' \
>>  +        'INSTALL_LIB=${D}${libdir}' \
>>  +        'INSTALL_CMOD=${D}${libdir}' \
>>  +        install
>>  +    install -d ${D}${libdir}/pkgconfig  ${D}${datadir}/doc/lua
>>  +
>>  +    sed -e s/@VERSION@/${PV}/ -e s#@LIBDIR@#${libdir}# -e 
>> s#@INCLUDEDIR@#${includedir}# ${WORKDIR}/lua.pc.in > 
>> ${WORKDIR}/lua.pc
>>  +    install -m 0644 ${WORKDIR}/lua.pc ${D}${libdir}/pkgconfig/
>>  +    install -m 0644 doc/*.{gif,png,css,html} ${D}${datadir}/doc/lua
>>  +    rm -rf ${D}${datadir}/lua
>>  +}
>>  +
>>  +do_install_ptest () {
>>  +        cp -R --no-dereference --preserve=mode,links -v 
>> ${WORKDIR}/lua-${PV_testsuites}-tests ${D}${PTEST_PATH}/test
>>  +}
>>  +
>>  +do_install_ptest:append:libc-musl () {
>>  +        # locale tests does not work on musl, due to limited 
>> locale implementation
>>  +        # 
>> <https://wiki.musl-libc.org/open-issues.html#Locale-limitations>
>>  +        sed -i -e 's|os.setlocale("pt_BR") or 
>> os.setlocale("ptb")|false|g' ${D}${PTEST_PATH}/test/literals.lua
>>  +}
>>  +
>>  +BBCLASSEXTEND = "native nativesdk"
>>  +
>>  +inherit multilib_script
>>  +MULTILIB_SCRIPTS = "${PN}-dev:${includedir}/luaconf.h"
>>  --
>>  2.43.0
>> 
>> 
>>  -=-=-=-=-=-=-=-=-=-=-=-
>>  Links: You receive all messages sent to this group.
>>  View/Reply Online (#108374): 
>> <https://lists.openembedded.org/g/openembedded-devel/message/108374>
>>  Mute This Topic: 
>> <https://lists.openembedded.org/mt/103894012/1997914>
>>  Group Owner: openembedded-devel+owner@lists.openembedded.org 
>> <mailto:openembedded-devel+owner@lists.openembedded.org>
>>  Unsubscribe: 
>> <https://lists.openembedded.org/g/openembedded-devel/unsub> 
>> [raj.khem@gmail.com <mailto:raj.khem@gmail.com>]
>>  -=-=-=-=-=-=-=-=-=-=-=-
>>
diff mbox series

Patch

diff --git a/meta-oe/recipes-devtools/lua/lua-5.2/Makefile-build-so.patch b/meta-oe/recipes-devtools/lua/lua-5.2/Makefile-build-so.patch
new file mode 100644
index 000000000..343d1ddd6
--- /dev/null
+++ b/meta-oe/recipes-devtools/lua/lua-5.2/Makefile-build-so.patch
@@ -0,0 +1,82 @@ 
+Upstream-Status: Inappropriate [Upstream doesn't support so libs]
+
+diff -ru lua-5.2.1/Makefile lua-5.2.1.new/Makefile
+--- a/Makefile	2012-05-17 16:05:54.000000000 +0200
++++ b/Makefile	2012-09-12 22:39:07.162748096 +0200
+@@ -38,16 +38,16 @@
+ # Convenience platforms targets.
+ PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
+ 
++# Lua version and release.
++V= 5.2
++R= $V.3
++
+ # What to install.
+ TO_BIN= lua luac
+ TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp
+-TO_LIB= liblua.a
++TO_LIB= liblua.a liblua.so.$(R)
+ TO_MAN= lua.1 luac.1
+ 
+-# Lua version and release.
+-V= 5.2
+-R= $V.3
+-
+ # Targets start here.
+ all:	$(PLAT)
+ 
+@@ -63,7 +63,8 @@
+ 	cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
+ 	cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
+ 	cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
+-
++	ln -sf ./liblua.so.$(R) $(INSTALL_LIB)/liblua.so.$(V)
++	ln -sf ./liblua.so.$(R) $(INSTALL_LIB)/liblua.so
+ uninstall:
+ 	cd src && cd $(INSTALL_BIN) && $(RM) $(TO_BIN)
+ 	cd src && cd $(INSTALL_INC) && $(RM) $(TO_INC)
+diff -ru lua-5.2.1/src/luaconf.h lua-5.2.1.new/src/luaconf.h
+--- lua-5.2.1/src/luaconf.h	2012-05-11 16:14:42.000000000 +0200
++++ lua-5.2.1.new/src/luaconf.h	2012-09-12 22:40:27.986622772 +0200
+@@ -100,7 +100,7 @@
+ #else			/* }{ */
+ 
+ #define LUA_VDIR	LUA_VERSION_MAJOR "." LUA_VERSION_MINOR "/"
+-#define LUA_ROOT	"/usr/local/"
++#define LUA_ROOT	"/usr"
+ #define LUA_LDIR	LUA_ROOT "share/lua/" LUA_VDIR
+ #define LUA_CDIR	LUA_ROOT "lib/lua/" LUA_VDIR
+ #define LUA_PATH_DEFAULT  \
+diff -ru lua-5.2.1/src/Makefile lua-5.2.1.new/src/Makefile
+--- lua-5.2.1/src/Makefile	2012-03-09 17:32:16.000000000 +0100
++++ lua-5.2.1.new/src/Makefile	2012-09-12 22:38:08.591386896 +0200
+@@ -29,6 +29,7 @@
+ PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
+ 
+ LUA_A=	liblua.a
++LUA_SO= liblua.so
+ CORE_O=	lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \
+ 	lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o \
+ 	ltm.o lundump.o lvm.o lzio.o
+@@ -43,7 +44,7 @@
+ LUAC_O=	luac.o
+ 
+ ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O)
+-ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
++ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) $(LUA_SO)
+ ALL_A= $(LUA_A)
+ 
+ # Targets start here.
+@@ -59,6 +60,12 @@
+ 	$(AR) $@ $(BASE_O)
+ 	$(RANLIB) $@
+ 
++$(LUA_SO): $(CORE_O) $(LIB_O)
++	$(CC) -shared -ldl -Wl,-soname,$(LUA_SO).5.2 -o $@.5.2.3 $? -lm $(MYLDFLAGS)
++
++
++
++
+ $(LUA_T): $(LUA_O) $(LUA_A)
+ 	$(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
+ 
diff --git a/meta-oe/recipes-devtools/lua/lua-5.2/lua.pc.in b/meta-oe/recipes-devtools/lua/lua-5.2/lua.pc.in
new file mode 100644
index 000000000..c26775fa7
--- /dev/null
+++ b/meta-oe/recipes-devtools/lua/lua-5.2/lua.pc.in
@@ -0,0 +1,10 @@ 
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@
+
+Name: Lua
+Description: Lua language engine
+Version: @VERSION@
+Requires:
+Libs: -L${libdir} -llua -lm -ldl
+Cflags: -I${includedir}
+
diff --git a/meta-oe/recipes-devtools/lua/lua-5.2/run-ptest b/meta-oe/recipes-devtools/lua/lua-5.2/run-ptest
new file mode 100644
index 000000000..8e085e1af
--- /dev/null
+++ b/meta-oe/recipes-devtools/lua/lua-5.2/run-ptest
@@ -0,0 +1,19 @@ 
+#!/bin/sh
+
+cd test
+lua -e"_U=true" all.lua > lua-test.tmp
+
+echo "--- test output ---"
+cat lua-test.tmp
+echo ""
+echo ""
+echo "--- ptest result ---"
+
+grep "final OK \!\!\!" lua-test.tmp > /dev/null
+if [ $? -eq 0 ]; then
+   echo "PASS: lua"
+else
+   echo "FAIL: lua"
+fi
+
+rm -f lua-test.tmp
diff --git a/meta-oe/recipes-devtools/lua/lua-5.2_5.2.3.bb b/meta-oe/recipes-devtools/lua/lua-5.2_5.2.3.bb
new file mode 100644
index 000000000..58f716337
--- /dev/null
+++ b/meta-oe/recipes-devtools/lua/lua-5.2_5.2.3.bb
@@ -0,0 +1,67 @@ 
+SUMMARY = "Lua is a powerful light-weight programming language designed \
+for extending applications."
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://doc/readme.html;beginline=381;endline=399;md5=07ddfddb01fa4ed9f2fb5e8eeae817a4"
+HOMEPAGE = "http://www.lua.org/"
+
+SRC_URI = "http://www.lua.org/ftp/lua-${PV}.tar.gz;name=tarballsrc \
+           file://lua.pc.in \
+           ${@bb.utils.contains('DISTRO_FEATURES', 'ptest', 'http://www.lua.org/tests/lua-${PV_testsuites}-tests.tar.gz;name=tarballtest file://run-ptest ', '', d)} \
+           file://Makefile-build-so.patch \
+           "
+
+# if no test suite matches PV release of Lua exactly, download the suite for the closest Lua release.
+PV_testsuites = "5.2.2"
+
+SRC_URI[tarballsrc.sha256sum] = "13c2fb97961381f7d06d5b5cea55b743c163800896fd5c5e2356201d3619002d"
+SRC_URI[tarballtest.sha256sum] = "07c1071c66d9cb4dc80200ed430fc21ebbbccf1f55148b87eb0b9522932e4eb6"
+
+S = "${WORKDIR}/lua-${PV}"
+
+DEPENDS = "readline"
+inherit pkgconfig binconfig ptest
+
+TARGET_CC_ARCH += " -fPIC  ${LDFLAGS}"
+EXTRA_OEMAKE = "'CC=${CC} -fPIC' 'MYCFLAGS=${CFLAGS} -fPIC' MYLDFLAGS='${LDFLAGS}'"
+
+do_configure:prepend() {
+    sed -i -e s:/usr/local:${prefix}:g src/luaconf.h
+    sed -i -e s:lib/lua/:${baselib}/lua/:g src/luaconf.h
+}
+
+do_compile () {
+    oe_runmake linux
+}
+
+do_install () {
+    oe_runmake \
+        'INSTALL_TOP=${D}${prefix}' \
+        'INSTALL_BIN=${D}${bindir}' \
+        'INSTALL_INC=${D}${includedir}/' \
+        'INSTALL_MAN=${D}${mandir}/man1' \
+        'INSTALL_SHARE=${D}${datadir}' \
+        'INSTALL_LIB=${D}${libdir}' \
+        'INSTALL_CMOD=${D}${libdir}' \
+        install
+    install -d ${D}${libdir}/pkgconfig  ${D}${datadir}/doc/lua
+
+    sed -e s/@VERSION@/${PV}/ -e s#@LIBDIR@#${libdir}# -e s#@INCLUDEDIR@#${includedir}# ${WORKDIR}/lua.pc.in > ${WORKDIR}/lua.pc
+    install -m 0644 ${WORKDIR}/lua.pc ${D}${libdir}/pkgconfig/
+    install -m 0644 doc/*.{gif,png,css,html} ${D}${datadir}/doc/lua
+    rm -rf ${D}${datadir}/lua
+}
+
+do_install_ptest () {
+        cp -R --no-dereference --preserve=mode,links -v ${WORKDIR}/lua-${PV_testsuites}-tests ${D}${PTEST_PATH}/test
+}
+
+do_install_ptest:append:libc-musl () {
+        # locale tests does not work on musl, due to limited locale implementation
+        # https://wiki.musl-libc.org/open-issues.html#Locale-limitations
+        sed -i -e 's|os.setlocale("pt_BR") or os.setlocale("ptb")|false|g' ${D}${PTEST_PATH}/test/literals.lua
+}
+
+BBCLASSEXTEND = "native nativesdk"
+
+inherit multilib_script
+MULTILIB_SCRIPTS = "${PN}-dev:${includedir}/luaconf.h"