'How to create a binary package in OpenWrt

I would like to create a binary package in OpenWrt.

Initially, it would contain a single binary executable and a shared library it depends on.

I can see examples of how to build a package from source, but have not found anything specific about installing binary executables under OpenWrt.

Below in my attempt at creating an OpenWrt Makefile:

# OpenWrt package Makefile for mypkg
# with myapp binary and libxyz shared library

include $(TOPDIR)/rules.mk

PKG_NAME:=mypkg
PKG_VERSION:=03
PKG_RELEASE:=2

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_RELEASE).tar.gz

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

include $(INCLUDE_DIR)/package.mk

define Package/$(PKG_NAME)
        SECTION:=mypkg
        CATEGORY:=MyPkg
        TITLE:=My package
endef

define Package/$(PKG_NAME)/description
        My package for OpenWrt
endef

define Package/$(PKG_NAME)/install
        mkdir -p $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
        tar -x -C $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) -f $(TOPDIR)/dl/$(PKG_SOURCE)
        $(INSTALL_DIR) $(1)/usr/bin/mypkg
        $(INSTALL_BIN) $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/mypkg-03-2/opt/mypkg/sdk/bin/mypkg/myapp $(1)/usr/bin/mypkg
        $(INSTALL_DIR) $(1)/lib
        $(INSTALL_BIN) $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)/mypkg-03-2/opt/mypkg/sdk/lib/libxyz.so.1 $(1)/lib
endef

$(eval $(call BuildPackage,$(PKG_NAME)))


Solution 1:[1]

To answer my own question, found that I needed to add empty dummy sections in the Makefile for configure and compile actions thus:

define Build/Compile
         true
endef

define Build/Configure
         true
endef

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1