add ucitrigger: a uci plugin, command line tool and lua interface for automatically...
[openwrt/openwrt.git] / package / uci / Makefile
1 #
2 # Copyright (C) 2008 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 UCI_VERSION=0.7
11 UCI_RELEASE=5
12
13 PKG_NAME:=uci
14 PKG_VERSION:=$(UCI_VERSION)$(if $(UCI_RELEASE),.$(UCI_RELEASE))
15 PKG_RELEASE:=1
16
17 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
18 PKG_SOURCE_URL:=http://downloads.openwrt.org/sources
19 PKG_MD5SUM:=ed34c5ef606a90da4aba03ce6d22eeb9
20
21 include $(INCLUDE_DIR)/package.mk
22
23 # set to 1 to enable debugging
24 DEBUG=
25
26 define Package/libuci
27 SECTION:=libs
28 CATEGORY:=Libraries
29 TITLE:=C library for the Unified Configuration Interface (UCI)
30 endef
31
32 define Package/uci
33 SECTION:=base
34 CATEGORY:=Base system
35 DEPENDS:=+libuci
36 TITLE:=Utility for the Unified Configuration Interface (UCI)
37 endef
38
39 define Package/ucitrigger
40 SECTION:=base
41 CATEGORY:=Base system
42 DEPENDS:=+libuci-lua
43 TITLE:=Automatic triggers for applying system config changes
44 endef
45
46 define Package/libuci-lua
47 SECTION=libs
48 CATEGORY=Libraries
49 DEPENDS:=+libuci +liblua
50 TITLE:=Lua plugin for UCI
51 endef
52
53 define Build/Configure
54 endef
55
56 TARGET_CFLAGS += $(FPIC)
57 UCI_MAKEOPTS = \
58 $(TARGET_CONFIGURE_OPTS) \
59 COPTS="$(TARGET_CFLAGS)" \
60 DEBUG="$(DEBUG)" \
61 VERSION="$(UCI_VERSION)" \
62 CPPFLAGS="-I$(PKG_BUILD_DIR) $(TARGET_CPPFLAGS)" \
63 OS="Linux"
64
65 # work around a nasty gcc bug
66 ifneq ($(CONFIG_GCC_VERSION_4_2_4),)
67 UCI_MAKEOPTS += WOPTS=""
68 endif
69
70 define Build/Compile
71 $(MAKE) -C $(PKG_BUILD_DIR) $(UCI_MAKEOPTS)
72 $(MAKE) -C $(PKG_BUILD_DIR)/lua $(UCI_MAKEOPTS)
73 $(MAKE) -C $(PKG_BUILD_DIR)/trigger $(UCI_MAKEOPTS) \
74 LIBS="$(TARGET_LDFLAGS) -L$(PKG_BUILD_DIR) -luci -llua -lcrypt -lm"
75 endef
76
77 define Package/libuci/install
78 $(INSTALL_DIR) $(1)/lib
79 $(CP) $(PKG_BUILD_DIR)/libuci.so* $(1)/lib/
80 endef
81
82 define Package/libuci-lua/install
83 $(INSTALL_DIR) $(1)/usr/lib/lua
84 $(CP) $(PKG_BUILD_DIR)/lua/uci.so $(1)/usr/lib/lua/
85 endef
86
87 define Package/ucitrigger/install
88 $(INSTALL_DIR) $(1)/usr/lib/lua/uci $(1)/lib/config/trigger $(1)/usr/sbin
89 $(INSTALL_DATA) ./trigger/lib/trigger.lua $(1)/usr/lib/lua/uci/
90 $(INSTALL_DATA) ./trigger/modules/*.lua $(1)/lib/config/trigger/
91 $(INSTALL_DATA) $(PKG_BUILD_DIR)/trigger/uci_trigger.so $(1)/usr/lib/
92 $(INSTALL_BIN) ./trigger/apply_config $(1)/usr/sbin/
93 endef
94
95 define Package/uci/install
96 $(INSTALL_DIR) $(1)/etc/uci-defaults
97 $(INSTALL_DIR) $(1)/sbin
98 $(INSTALL_BIN) $(PKG_BUILD_DIR)/uci $(1)/sbin/
99 $(CP) ./files/* $(1)/
100 endef
101
102 define Build/InstallDev
103 $(INSTALL_DIR) $(1)/usr/include
104 $(CP) $(PKG_BUILD_DIR)/uci{,_config}.h $(1)/usr/include
105 $(INSTALL_DIR) $(1)/usr/lib
106 $(CP) $(PKG_BUILD_DIR)/libuci.so* $(1)/usr/lib
107 $(CP) $(PKG_BUILD_DIR)/libuci.a $(1)/usr/lib
108 $(CP) $(PKG_BUILD_DIR)/libucimap.a $(1)/usr/lib
109 endef
110
111 $(eval $(call BuildPackage,uci))
112 $(eval $(call BuildPackage,libuci))
113 $(eval $(call BuildPackage,libuci-lua))
114 $(eval $(call BuildPackage,ucitrigger))