Creating packages
One of the things that we've attempted to do with OpenWrt's template
system is make it incredibly easy to port software to OpenWrt. If you
look at a typical package directory in OpenWrt you'll find two things:
-
package/Makefile
-
package/patches
-
package/files
The patches directory is optional and typically contains bug fixes or optimizations to reduce the size of the executable.
The files directory is optional. It typically includes default config or init files.
The package makefile is the important item because it provides the steps actually needed to download and compile the package.
Looking at one of the package makefiles, you'd hardly recognize it as a
makefile. Through what can only be described as blatant disregard and
abuse of the traditional make format, the makefile has been transformed
into an object oriented template which simplifies the entire ordeal.
Here for example, is package/bridge/Makefile:
include $(TOPDIR)/rules.mk
PKG_NAME:=bridge
PKG_VERSION:=1.0.6
PKG_RELEASE:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/bridge-utils-$(PKG_VERSION)
PKG_SOURCE:=bridge-utils-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=@SF/bridge
PKG_MD5SUM:=9b7dc52656f5cbec846a7ba3299f73bd
PKG_CAT:=zcat
include $(INCLUDE_DIR)/package.mk
define Package/bridge
SECTION:=base
CATEGORY:=Network
TITLE:=Ethernet bridging configuration utility
#DESCRIPTION:=This variable is obsolete. use the Package/name/description define instead!
URL:=
endef
define Package/bridge/description
Ethernet bridging configuration utility
Manage ethernet bridging; a way to connect networks together to
form a larger network.
endef
define Build/Configure
$(call Build/Configure/Default,--with-linux-headers=$(LINUX_DIR))
endef
define Package/bridge/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/brctl/brctl $(1)/usr/sbin/
endef
$(eval $(call BuildPackage,bridge))
阅读(624) | 评论(1) | 转发(0) |