OpenWrt Forum Archive

Topic: I cannot package lualanes for OpenWRT: make ignores the Makefile.

The content of this topic has been archived on 5 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I am currently trying to get Lua Lanes (lualanes) to work with the OpenWRT builroot system. I've written a Makefile, and it does show up in the configuration menu, but it simply does not build. No matter what I do, make simply ignores my Makefile and states: "Nothing to be done for compile". Subsequently installing the firmware on the device does show lanes.lua (which is not compiled), but misses lua51-lanes.so, which is the essential library. The sources were obtained from http://luaforge.net/frs/?group_id=265&a … se_id=1692, version 2.0.3.

My Makefile looks like this:

include $(TOPDIR)/rules.mk

PKG_NAME:=lualanes
PKG_VERSION:=2.0.3
PKG_RELEASE:=1

include $(INCLUDE_DIR)/package.mk

PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)

define Package/lualanes
  SUBMENU:=Lua
  SECTION:=lang
  CATEGORY:=Languages
  TITLE:=LuaLanes
  URL:=http://luaforge.net/projects/lanes/
  DEPENDS:=+lua +luac +liblua
endef

define Build/Prepare
        mkdir -p $(PKG_BUILD_DIR)
        $(CP) ./src/* $(PKG_BUILD_DIR)/
endef

define Build/Compile
endef

define Package/install
        $(CP) $(INSTALL_DIR)/lanes.lua $(1)/usr/share/lua/5.1/
        $(CP) $(INSTALL_DIR)/lua51-lanes.so $(1)/usr/lib/lua/
endef

$(eval $(call BuildPackage,lualanes))

I did move all source files to the ./src directory.

I have tried many different Makefiles; tried running the compiler directly from the makefile, instead of from Lanes' own Makefile, but nothing works. I tried letting OpenWRT do the extraction and make process itself; same result.

Did I forget something obvious? Or did someone already port Lanes to OpenWRT?

Your build/compile section is empty so there's indeed "Nothing to be done for compile". Try removing that empty section to allow OpenWrt to use its default actions

Thanks for the speedy reply! I did what you recommended, but unfortunately with the same result:

make[2]: Entering directory `/home/jp/code/openwrt/backfire/package/lualanes'
make[2]: Nothing to be done for `compile'.
make[2]: Leaving directory `/home/jp/code/openwrt/backfire/package/lualanes'

Anything else that might be the cause?

(Last edited by huygens on 12 Jul 2010, 16:33)

I overlooked another error in your Makefile, "define Package/install" must be "define Package/lualanes/install"

Thanks! It runs now! Only, I still get an error. The full compilation output is as follows:


make[3]: Entering directory `/home/jp/code/openwrt/backfire/package/lualanes'
(cd /home/jp/code/openwrt/backfire/build_dir/target-mips_uClibc-0.9.30.1/lualanes/./; if [ -x ./configure ]; then /usr/bin/find /home/jp/code/openwrt/backfire/build_dir/target-mips_uClibc-0.9.30.1/lualanes/ -name config.guess | xargs -r chmod u+w; /usr/bin/find /home/jp/code/openwrt/backfire/build_dir/target-mips_uClibc-0.9.30.1/lualanes/ -name config.guess | xargs -r -n1 cp /home/jp/code/openwrt/backfire/scripts/config.guess; /usr/bin/find /home/jp/code/openwrt/backfire/build_dir/target-mips_uClibc-0.9.30.1/lualanes/ -name config.sub | xargs -r chmod u+w; /usr/bin/find /home/jp/code/openwrt/backfire/build_dir/target-mips_uClibc-0.9.30.1/lualanes/ -name config.sub | xargs -r -n1 cp /home/jp/code/openwrt/backfire/scripts/config.sub; AR=mips-openwrt-linux-uclibc-ar AS="mips-openwrt-linux-uclibc-gcc -c -Os -pipe -mips32 -mtune=mips32 -funit-at-a-time -fhonour-copts -msoft-float" LD=mips-openwrt-linux-uclibc-ld NM=mips-openwrt-linux-uclibc-nm CC="mips-openwrt-linux-uclibc-gcc" GCC="mips-openwrt-linux-uclibc-gcc" CXX="mips-openwrt-linux-uclibc-g++" RANLIB=mips-openwrt-linux-uclibc-ranlib STRIP=mips-openwrt-linux-uclibc-strip OBJCOPY=mips-openwrt-linux-uclibc-objcopy OBJDUMP=mips-openwrt-linux-uclibc-objdump SIZE=mips-openwrt-linux-uclibc-size CFLAGS="-Os -pipe -mips32 -mtune=mips32 -funit-at-a-time -fhonour-copts -msoft-float " CXXFLAGS="-Os -pipe -mips32 -mtune=mips32 -funit-at-a-time -fhonour-copts -msoft-float " CPPFLAGS="-I/home/jp/code/openwrt/backfire/staging_dir/target-mips_uClibc-0.9.30.1/usr/include -I/home/jp/code/openwrt/backfire/staging_dir/target-mips_uClibc-0.9.30.1/include -I/home/jp/code/openwrt/backfire/staging_dir/toolchain-mips_gcc-4.3.3+cs_uClibc-0.9.30.1/usr/include -I/home/jp/code/openwrt/backfire/staging_dir/toolchain-mips_gcc-4.3.3+cs_uClibc-0.9.30.1/include " LDFLAGS="-L/home/jp/code/openwrt/backfire/staging_dir/target-mips_uClibc-0.9.30.1/usr/lib -L/home/jp/code/openwrt/backfire/staging_dir/target-mips_uClibc-0.9.30.1/lib -L/home/jp/code/openwrt/backfire/staging_dir/toolchain-mips_gcc-4.3.3+cs_uClibc-0.9.30.1/usr/lib -L/home/jp/code/openwrt/backfire/staging_dir/toolchain-mips_gcc-4.3.3+cs_uClibc-0.9.30.1/lib "   ./configure --target=mips-openwrt-linux --host=mips-openwrt-linux --build=i486-linux-gnu --program-prefix="" --program-suffix="" --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/lib --sysconfdir=/etc --datadir=/usr/share --localstatedir=/var --mandir=/usr/man --infodir=/usr/info --disable-nls  --disable-ipv6 ; fi; )
touch /home/jp/code/openwrt/backfire/build_dir/target-mips_uClibc-0.9.30.1/lualanes-2.0.3/.configured_
touch: cannot touch `/home/jp/code/openwrt/backfire/build_dir/target-mips_uClibc-0.9.30.1/lualanes-2.0.3/.configured_': No such file or directory
make[3]: *** [/home/jp/code/openwrt/backfire/build_dir/target-mips_uClibc-0.9.30.1/lualanes-2.0.3/.configured_] Error 1
make[3]: Leaving directory `/home/jp/code/openwrt/backfire/package/lualanes'


Do you have any idea as to why make cannot touch the .configured_ directory? Why wouldn't it exist? I mean, OpenWRT should create that directory itself, shouldn't it?

Solved that problem by editing my Makefile a little more. It now looks like:


include $(TOPDIR)/rules.mk

PKG_NAME:=lualanes
PKG_VERSION:=2.0.4
PKG_RELEASE:=1

include $(INCLUDE_DIR)/package.mk

PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)

define Package/lualanes
  SUBMENU:=Lua
  SECTION:=lang
  CATEGORY:=Languages
  TITLE:=LuaLanes
  URL:=http://luaforge.net/projects/lanes/
  DEPENDS:=+lua +luac +liblua
endef

define Build/Prepare
        mkdir -p $(PKG_BUILD_DIR)
        $(CP) ./src/* $(PKG_BUILD_DIR)/
endef

define Build/Configure
endef

define Package/lualanes/install
        $(CP) $(INSTALL_DIR)/lanes.lua $(1)/usr/share/lua/5.1/
        $(CP) $(INSTALL_DIR)/lua51-lanes.so $(1)/usr/lib/lua/
endef

$(eval $(call BuildPackage,lualanes))


But I now get this error:


/home/jp/code/openwrt/backfire/staging_dir/target-mips_uClibc-0.9.30.1/usr//include/lnum_config.h:29:3: error: #error "Need C99 for 'float' (use '--std=c99' or similar)"
cc1: warnings being treated as errors
lanes.c: In function 'selfdestruct_atexit':
lanes.c:947: error: implicit declaration of function 'pthread_yield'


How do I add the --std=c99 option? In the Makefile of lualanes? Or can I add that some way to the OpenWRT Makefile? Because I do not like having to modify the original sources (creates a maintenance headache).

PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)

Thats the default value, you can leave it out entirely then.

lanes.c:947: error: implicit declaration of function 'pthread_yield'

You need pthread, add +libpthread to DEPENDS and TARGET_LDFLAGS+=-lpthread

How do I add the --std=c99 option? In the Makefile of lualanes?

Try TARGET_CFLAGS+=--std=c99

You need pthread, add +libpthread to DEPENDS and TARGET_LDFLAGS+=-lpthread

That was nonesense, looks like pthread_yield was renamed to sched_yield, you can try this:
TARGET_CFLAGS+=--std=c99 -Dpthread_yield=sched_yield

If that does not work out, you'll have to patch the source

Thank you for the speedy reply! I added that; now the Makefile looks like this:


include $(TOPDIR)/rules.mk

PKG_NAME:=lualanes
PKG_VERSION:=2.0.4
PKG_RELEASE:=1

include $(INCLUDE_DIR)/package.mk
TARGET_CFLAGS+=--std=c99
TARGET_LDFLAGS+=-lpthread

define Package/lualanes
  SUBMENU:=Lua
  SECTION:=lang
  CATEGORY:=Languages
  TITLE:=LuaLanes
  URL:=http://luaforge.net/projects/lanes/
  DEPENDS:=+lua +luac +liblua +libpthread
endef

define Build/Prepare
        mkdir -p $(PKG_BUILD_DIR)
        $(CP) ./src/* $(PKG_BUILD_DIR)/
endef

define Build/Configure
endef

define Package/lualanes/install
        $(CP) $(INSTALL_DIR)/lanes.lua $(1)/usr/share/lua/5.1/
        $(CP) $(INSTALL_DIR)/lua51-lanes.so $(1)/usr/lib/lua/
endef

$(eval $(call BuildPackage,lualanes))


But I still get the same error. Complete output is:


make[3]: Entering directory `/home/jp/code/openwrt/backfire/package/lualanes'
mkdir -p /home/jp/code/openwrt/backfire/build_dir/target-mips_uClibc-0.9.30.1/lualanes-2.0.4
cp -fpR ./src/* /home/jp/code/openwrt/backfire/build_dir/target-mips_uClibc-0.9.30.1/lualanes-2.0.4/
touch /home/jp/code/openwrt/backfire/build_dir/target-mips_uClibc-0.9.30.1/lualanes-2.0.4/.prepared_70fcaa09e815b85ca94e1a9c4ecff1bc
touch /home/jp/code/openwrt/backfire/build_dir/target-mips_uClibc-0.9.30.1/lualanes-2.0.4/.configured_
CFLAGS="-Os -pipe -mips32 -mtune=mips32 -funit-at-a-time -fhonour-copts -msoft-float --std=c99  -I/home/jp/code/openwrt/backfire/staging_dir/target-mips_uClibc-0.9.30.1/usr/include -I/home/jp/code/openwrt/backfire/staging_dir/target-mips_uClibc-0.9.30.1/include -I/home/jp/code/openwrt/backfire/staging_dir/toolchain-mips_gcc-4.3.3+cs_uClibc-0.9.30.1/usr/include -I/home/jp/code/openwrt/backfire/staging_dir/toolchain-mips_gcc-4.3.3+cs_uClibc-0.9.30.1/include " CXXFLAGS="-Os -pipe -mips32 -mtune=mips32 -funit-at-a-time -fhonour-copts -msoft-float --std=c99  -I/home/jp/code/openwrt/backfire/staging_dir/target-mips_uClibc-0.9.30.1/usr/include -I/home/jp/code/openwrt/backfire/staging_dir/target-mips_uClibc-0.9.30.1/include -I/home/jp/code/openwrt/backfire/staging_dir/toolchain-mips_gcc-4.3.3+cs_uClibc-0.9.30.1/usr/include -I/home/jp/code/openwrt/backfire/staging_dir/toolchain-mips_gcc-4.3.3+cs_uClibc-0.9.30.1/include " LDFLAGS="-L/home/jp/code/openwrt/backfire/staging_dir/target-mips_uClibc-0.9.30.1/usr/lib -L/home/jp/code/openwrt/backfire/staging_dir/target-mips_uClibc-0.9.30.1/lib -L/home/jp/code/openwrt/backfire/staging_dir/toolchain-mips_gcc-4.3.3+cs_uClibc-0.9.30.1/usr/lib -L/home/jp/code/openwrt/backfire/staging_dir/toolchain-mips_gcc-4.3.3+cs_uClibc-0.9.30.1/lib -lpthread " make -C /home/jp/code/openwrt/backfire/build_dir/target-mips_uClibc-0.9.30.1/lualanes-2.0.4/. AR=mips-openwrt-linux-uclibc-ar AS="mips-openwrt-linux-uclibc-gcc -c -Os -pipe -mips32 -mtune=mips32 -funit-at-a-time -fhonour-copts -msoft-float --std=c99" LD=mips-openwrt-linux-uclibc-ld NM=mips-openwrt-linux-uclibc-nm CC="mips-openwrt-linux-uclibc-gcc" GCC="mips-openwrt-linux-uclibc-gcc" CXX="mips-openwrt-linux-uclibc-g++" RANLIB=mips-openwrt-linux-uclibc-ranlib STRIP=mips-openwrt-linux-uclibc-strip OBJCOPY=mips-openwrt-linux-uclibc-objcopy OBJDUMP=mips-openwrt-linux-uclibc-objdump SIZE=mips-openwrt-linux-uclibc-size CROSS="mips-openwrt-linux-uclibc-" ARCH="mips" ;
make[4]: Entering directory `/home/jp/code/openwrt/backfire/build_dir/target-mips_uClibc-0.9.30.1/lualanes-2.0.4'
cd src && make LUA=/usr/bin/lua5.1 LUAC=/usr/bin/luac5.1
make[5]: Entering directory `/home/jp/code/openwrt/backfire/build_dir/target-mips_uClibc-0.9.30.1/lualanes-2.0.4/src'
/usr/bin/luac5.1 -o keeper.lch.tmp keeper.lua
/usr/bin/lua5.1 ../tools/bin2c.lua keeper.lch.tmp -o keeper.lch
rm keeper.lch.tmp
mips-openwrt-linux-uclibc-gcc -Wall -Werror -O2 -I/home/jp/code/openwrt/backfire/staging_dir/target-mips_uClibc-0.9.30.1/usr//include   -D_GNU_SOURCE -fPIC   -c -o lanes.o lanes.c
lanes.c:1: note: someone does not honour COPTS correctly, passed 0 times
In file included from /home/jp/code/openwrt/backfire/staging_dir/target-mips_uClibc-0.9.30.1/usr//include/luaconf.h:169,
                 from /home/jp/code/openwrt/backfire/staging_dir/target-mips_uClibc-0.9.30.1/usr//include/lua.h:16,
                 from lanes.c:92:
/home/jp/code/openwrt/backfire/staging_dir/target-mips_uClibc-0.9.30.1/usr//include/lnum_config.h:29:3: error: #error "Need C99 for 'float' (use '--std=c99' or similar)"
cc1: warnings being treated as errors
lanes.c: In function 'selfdestruct_atexit':
lanes.c:947: error: implicit declaration of function 'pthread_yield'
make[5]: *** [lanes.o] Error 1
make[5]: Leaving directory `/home/jp/code/openwrt/backfire/build_dir/target-mips_uClibc-0.9.30.1/lualanes-2.0.4/src'
make[4]: *** [src/lua51-lanes.so] Error 2
make[4]: Leaving directory `/home/jp/code/openwrt/backfire/build_dir/target-mips_uClibc-0.9.30.1/lualanes-2.0.4'
make[3]: *** [/home/jp/code/openwrt/backfire/build_dir/target-mips_uClibc-0.9.30.1/lualanes-2.0.4/.built] Error 2
make[3]: Leaving directory `/home/jp/code/openwrt/backfire/package/lualanes'
make[2]: *** [package/lualanes/compile] Error 2


Do you know why it doesn't accept the options?


EDIT: Didn't see your second post.

(Last edited by huygens on 12 Jul 2010, 20:22)

Retried with Makefile:

include $(TOPDIR)/rules.mk

PKG_NAME:=lualanes
PKG_VERSION:=2.0.4
PKG_RELEASE:=1

include $(INCLUDE_DIR)/package.mk
TARGET_CFLAGS+=--std=c99
TARGET_LDFLAGS+=-lpthread -Dpthread_yield=sched_yield

define Package/lualanes
  SUBMENU:=Lua
  SECTION:=lang
  CATEGORY:=Languages
  TITLE:=LuaLanes
  URL:=http://luaforge.net/projects/lanes/
  DEPENDS:=+lua +luac +liblua +libpthread
endef

define Build/Prepare
        mkdir -p $(PKG_BUILD_DIR)
        $(CP) ./src/* $(PKG_BUILD_DIR)/
endef

define Build/Configure
endef

define Package/lualanes/install
        $(CP) $(INSTALL_DIR)/lanes.lua $(1)/usr/share/lua/5.1/
        $(CP) $(INSTALL_DIR)/lua51-lanes.so $(1)/usr/lib/lua/
endef

$(eval $(call BuildPackage,lualanes))


But it gives the same error as in the previous post. Did I do something wrong?

I gave it a try here and the makefile below works,

include $(TOPDIR)/rules.mk

PKG_NAME:=lualanes
PKG_VERSION:=2.0.3
PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
PKG_SOURCE_URL:=http://luaforge.net/frs/download.php/3927

# NB: lanes vs. lualanes
PKG_BUILD_DIR:=$(BUILD_DIR)/lanes-$(PKG_VERSION)
PKG_BUILD_DEPENDS:=lua/host luac/host

include $(INCLUDE_DIR)/package.mk

define Package/lualanes
  SUBMENU:=Lua
  SECTION:=lang
  CATEGORY:=Languages
  TITLE:=LuaLanes
  URL:=http://luaforge.net/projects/lanes/
  DEPENDS:=+lua +luac +liblua +libpthread
endef

define Build/Compile
    $(MAKE) -C $(PKG_BUILD_DIR) all \
        CC="$(TARGET_CC)" \
        LUA="$(STAGING_DIR_HOST)/bin/lua" \
        LUAC="$(STAGING_DIR_HOST)/bin/luac" \
        OPT_FLAGS="$(TARGET_CFLAGS) --std=c99 -Dpthread_yield=sched_yield"
endef

define Package/lualanes/install
    $(INSTALL_DIR) $(1)/usr/lib/lua
    $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/lanes.lua $(1)/usr/lib/lua/
    $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/lua51-lanes.so $(1)/usr/lib/lua/
endef

$(eval $(call BuildPackage,lualanes))

Wow, thanks a lot! That works, except for the PKG_SOURCE, which starts with lanes- instead of lualanes. With that fix (and for the record), the following Makefile runs like a charm (replacing every four spaces with a tab, of course).

include $(TOPDIR)/rules.mk

PKG_NAME:=lualanes
PKG_VERSION:=2.0.3
PKG_RELEASE:=1

PKG_SOURCE:=lanes-$(PKG_VERSION).tgz
PKG_SOURCE_URL:=http://luaforge.net/frs/download.php/3927

# NB: lanes vs. lualanes
PKG_BUILD_DIR:=$(BUILD_DIR)/lanes-$(PKG_VERSION)
PKG_BUILD_DEPENDS:=lua/host luac/host

include $(INCLUDE_DIR)/package.mk

define Package/lualanes
  SUBMENU:=Lua
  SECTION:=lang
  CATEGORY:=Languages
  TITLE:=LuaLanes
  URL:=http://luaforge.net/projects/lanes/
  DEPENDS:=+lua +luac +liblua +libpthread
endef

define Build/Compile
        $(MAKE) -C $(PKG_BUILD_DIR) all \
                CC="$(TARGET_CC)" \
                LUA="$(STAGING_DIR_HOST)/bin/lua" \
                LUAC="$(STAGING_DIR_HOST)/bin/luac" \
                OPT_FLAGS="$(TARGET_CFLAGS) --std=c99 -Dpthread_yield=sched_yield"
endef

define Package/lualanes/install
        $(INSTALL_DIR) $(1)/usr/lib/lua
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/lanes.lua $(1)/usr/lib/lua/
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/lua51-lanes.so $(1)/usr/lib/lua/
endef

$(eval $(call BuildPackage,lualanes))

I want to thank you a lot for your help - I would never have figured it out by myself. Thanks, jow!

It all compiles fine now, but unfortunately, creates a Segmentation Fault on the router. Does anyone know how to debug it on the router? Can I install gdb? Or enable a debug flag somewhere?

EDIT: Sorry, already found a package in the menuconfig.

(Last edited by huygens on 13 Jul 2010, 17:20)

I have lua lanes running on the Linksys WRT160NL with openwrt 10.03.
I solved the segmentation fault problem by compiling lua with the -lpthread option.  You can add it in the makefile of lua, located in ..../openwrt/package/lua/Makefile:
It's quick and dirty but it worked, if you know a more elegant way, let me know.

define Build/Compile
        $(MAKE) -C $(PKG_BUILD_DIR) \
                CC="$(TARGET_CROSS)gcc" \
                AR="$(TARGET_CROSS)ar rcu" \
                RANLIB="$(TARGET_CROSS)ranlib" \
                INSTALL_ROOT=/usr \
                CFLAGS="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -lpthread" \
                MYLDFLAGS="$(TARGET_LDFLAGS)" \
                PKG_VERSION=$(PKG_VERSION) \
                linux
        rm -rf $(PKG_INSTALL_DIR)
        mkdir -p $(PKG_INSTALL_DIR)
        $(MAKE) -C $(PKG_BUILD_DIR) \
                INSTALL_TOP="$(PKG_INSTALL_DIR)/usr" \
                install
endef

Hope it helps.

Mathijs

(Last edited by mdm on 17 Nov 2010, 23:15)

I could use some direction on this too.  I've been trying to get a lualanes package to build for 10.03 myself and am stumped.   I'm attempting to use the Make as huygens suggested in post #11 above, and get this:

make package/custom/lualanes v=99   
Collecting package info: done
make[1] package/custom/lualanes
make -r package/custom/lualanes: build failed. Please re-run make with V=99 to see what's going on
make: *** [package/custom/lualanes] Error 1

Error 1 seems pretty basic, but it's cause has escaped my direct googling efforts.     I started this quest by trying to build a package for Lua Task, but can't get past generating a proper Makefile for that as well.

First of all you could run make V=99 to see whats going on...

ok,  I had been doing that but missed how Make is unhappy if it finds a space instead of a Tab.   The package compiled after that.  I piped the Makefile through unexpand and the problem resolved itself.

Ok, so I've been round and round sorting out things, but now am stuck again.  Now getting a seg fault attempting a simple invocation of lanes.gen() with a simple function.   I've rebuilt lua with the -lpthread switch as mdm mentioned above.  I've changed to the latest lanes, 2.0.10 and no help.   I've built the kernel against the 10.03 tag.     I really need to find a way past this with either lanes or luatask, but can't find a makefile setup that works to build luatask for openwrt.   Any ideas out there as to how to proceed?  I'm not a kernel debugger so seg faults are a dealbreaker for me.  thanks in advance.

Hello.
I fix Makefile, for lualanes 3.9.4 (it is latest version lanes):

#
# Copyright (C) 2007-2014 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=lualanes
PKG_REV:=aa9bfcf2dd49f55f11b27e7c21d5b75d81ccfc7e
PKG_VERSION:=3.9.4
PKG_RELEASE=1

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_REV).tar.gz
PKG_SOURCE_URL:=https://github.com/LuaLanes/lanes.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=$(PKG_REV)
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)

PKG_INSTALL:=1
PKG_BUILD_PARALLEL:=1

PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_SOURCE_SUBDIR)
PKG_BUILD_DEPENDS:=lua/host luac/host

include $(INCLUDE_DIR)/package.mk

define Package/lualanes
    SUBMENU:=Lua
    SECTION:=lang
    CATEGORY:=Languages
    TITLE:=LuaLanes
    URL:=http://luaforge.net/projects/lanes/
    DEPENDS:=+lua +luac +liblua +libpthread
    MAINTAINER:=Vladimir Malyutin <first-leon@yandex.ru>
endef

define Package/lualanes/description
    Lanes is a lightweight, native, lazy evaluating multithreading library for Lua 5.1 and 5.2.
endef

define Build/Compile
    $(MAKE) -C $(PKG_BUILD_DIR) all \
        CC="$(TARGET_CC)" \
        LUA="$(STAGING_DIR_HOST)/bin/lua" \
        LUAC="$(STAGING_DIR_HOST)/bin/luac" \
        OPT_FLAGS="$(TARGET_CFLAGS) --std=c99 -Dpthread_yield=sched_yield"
endef

define Package/lualanes/install
    $(INSTALL_DIR) $(1)/usr/lib/lua
    $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/lanes.lua $(1)/usr/lib/lua/
    $(INSTALL_DIR) $(1)/usr/lib/lua/lanes
    $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/lanes/core.so $(1)/usr/lib/lua/lanes/core.so
endef

$(eval $(call BuildPackage,lualanes))

Upd: fix path for core.so, add description

(Last edited by first-leon on 23 Jul 2014, 17:10)

If your package Makefile is working, add it to the OpenWrt packages feed at GitHub: https://github.com/openwrt/packages/

(Last edited by written_direcon on 20 Jul 2014, 12:05)

I test this make file (run examples from lualanes) and it is work.
But i test in "attitude_adjustment" x86 only.
It is normaly?

I test this package on OpenWRT r37816 on WR703N (ar71xx) and it is work fine!

The discussion might have continued from here.