[OpenWrt-Devel] Want to know : How to compile packages

Jeonghum Joh oosaprogrammer at gmail.com
Fri Apr 3 01:18:27 EDT 2020


Hello,

I am trying to add lua-serial[1] into openwrt I have.
There is openwrt Makefile[2] and I modified it like this below:

--------------------------- [[below]]
-----------------------------------------------------------
#
# Copyright (C) 2015 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:=lua-serial
PKG_VERSION:=1.0.0
PKG_RELEASE:=1
PKG_MAINTAINER:=Unwired Devices <info at unwds.com>
PKG_LICENSE:=MIT

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
#PKG_SOURCE_URL:=https://github.com/unwireddevices/lua-serial
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=bd2e35d56ffe79db307341a70a51e3fbc1e698e9
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)

PKG_INSTALL:=1

include $(INCLUDE_DIR)/package.mk

define Package/lua-serial
  SUBMENU:=Lua
  SECTION:=lang
  CATEGORY:=Languages
  TITLE:=Lua Serial UART Library
  URL:=https://github.com/unwireddevices/lua-serial
  DEPENDS:=+lua
endef

define Package/lua-serial/description
  Serial port communication functions for Lua
endef

CONFIGURE_ARGS += \
        --with-lua-inc=$(STAGING_DIR)/usr/include \
        --with-lua-lib=$(STAGING_DIR)/usr/lib

define Build/Configure
        $(call Build/Configure/Default,--with-linux-headers=$(LINUX_DIR))
endef

define Build/Install
endef

define Package/lua-serial/install
        $(INSTALL_DIR) $(1)/usr/lib/lua
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/build/lin32/_ul_serial.so
$(1)/usr/lib/lua/
        $(INSTALL_DATA) $(PKG_BUILD_DIR)/src/ul_serial.lua $(1)/usr/lib/lua/
endef

$(eval $(call BuildPackage,lua-serial))
------------------------------------------------------------------------------------------


After I have compiled and flashed the firmware, I changed a bit of a lua
source file below:
./package/lua-serial/src/ul_serial.lua

And I tried to clean and compile again and flashed it and checked to see if
my change is applied well.
But my change is NOT applied at all.
I did :
- added some change in ./package/lua-serial/src/ul_serial.lua
- make package/lua-serial/clean
- make
- flashed new firmware
- check to see if my change is applied into  /usr/lib/lua/ul_serial.lua
But my change is not applied at all!

When I tried to "find -name ul_serial.lua" under the top openwrt directory,
I get output like:

./package/lua-serial/src/ul_serial.lua
./staging_dir/target/root-mediatek/usr/lib/lua/ul_serial.lua
./build_dir/target/root.orig-mediatek/usr/lib/lua/ul_serial.lua
./build_dir/target/root-mediatek/usr/lib/lua/ul_serial.lua
./build_dir/target/lua-serial-1.0.0/ipkg-aarch64_cortex-a53_neon-vfpv4/lua-serial/usr/lib/lua/ul_serial.lua
./build_dir/target/lua-serial-1.0.0/ul_serial.lua
./build_dir/target/lua-serial-1.0.0/src/ul_serial.lua

And after I clean the package lua-serial with :
make -j25 V=s package/lua-serial/clean

I tried to " find -name ul_serial.lua" under the top openwrt directory, I
get output like:
./package/lua-serial/src/ul_serial.lua
./staging_dir/target/root-mediatek/usr/lib/lua/ul_serial.lua
./build_dir/target/root.orig-mediatek/usr/lib/lua/ul_serial.lua
./build_dir/target/root-mediatek/usr/lib/lua/ul_serial.lua

./package/lua-serial/src/ul_serial.lua is original source code of my
working package.
What are those below and why don't they get removed?

./staging_dir/target/root-mediatek/usr/lib/lua/ul_serial.lua
./build_dir/target/root.orig-mediatek/usr/lib/lua/ul_serial.lua
./build_dir/target/root-mediatek/usr/lib/lua/ul_serial.lua

How am I supposed to really clean previous built package?

And I'd like to understand build system architecture and behavior of
openwrt.
Is there a good reference I can study?

Thank you very much in advance.
Jeonghum

[1] https://github.com/unwireddevices/lua-serial
[2]
https://github.com/unwireddevices/lua-serial/blob/master/openwrt/Makefile
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20200403/d2c94c64/attachment.htm>
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list