包信息 Makefile

版权

# by Qige <[email protected]> since 2018.01.24

包含基础编译规则

include $(TOPDIR)/rules.mk

包版本定义

APP_NAME:=omc-agent
PKG_NAME:=arn-agent-omc
PKG_VERSION:=3.1
PKG_RELEASE:=1

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

(可选)git/svn/http/ftp 版

PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION)-$(PKG_RELEASE).tar.bz2
PKG_SOURCE_SUBDIR:=$(PKG_NAME)_$(PKG_VERSION)-$(PKG_RELEASE)
PKG_SOURCE_URL:=https://github.com/6wilink/arn-agent-omc-c.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=6f9e02f3de5676f45974410814e4497288d4bdb9
PKG_MAINTAINER:=Qige Zhao <[email protected]>

包规则

include $(INCLUDE_DIR)/packages.mk

使用源文件需要使用“cmake”时

include $(INCLUDE_DIR)/cmake.mk

包描述与分类,依赖关系

define Package/$(PKG_NAME)
  SECTION:=utils
  CATEGORY:=Utilities
  TITLE:=Agent for iOMC v3
  DEPENDS:=+libgws2 +libiwinfo +libuci
endef

define Package/$(PKG_NAME)/description
  Adaptive Radio Network iOMC v3 Agent.
  Collects baseband, radio, system information,
  reports to iOMC3 server.
  And executes commands from administrators.
endef

(可选)冲突文件

define Package/$(PKG_NAME)/conffiles
  /etc/config/omcd
endef

编译前的准备,将源文件拷贝到编译文件夹(git/http/ftp/svn等方式时,不使用此选项)

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

(可选)当纯脚本类包时,定义空的“compile”即可跳过,也可以使用空的“Makefile”

define Build/Compile
endef

定义安装时的文件结构

define Package/$(PKG_NAME)/install
  $(INSTALL_DIR) $(1)/usr/lib/
  $(INSTALL_DIR) $(1)/etc/conf/
  $(INSTALL_DIR) $(1)/usr/sbin/
  $(INSTALL_DIR) $(1)/etc/init.d/

  $(CP) \
    $(PKG_BUILD_DIR)/*.so \
    $(1)/usr/lib/
  $(INSTALL_CONF) \
    $(PKG_BUILD_DIR)/conf/$(PKG_NAME).conf \
    $(1)/etc/config/$(APP_NAME)
  $(INSTALL_BIN) \
    $(PKG_BUILD_DIR)/$(PKG_NAME) 
    $(1)/usr/sbin/$(APP_NAME)
  $(INSTALL_BIN) \
    $(PKG_BUILD_DIR)/init/$(PKG_NAME).init
    $(1)/etc/init.d/$(APP_NAME)
endef

最后,返回以上定义

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

results matching ""

    No results matching ""