3ce9e9ee3887939e2573dc7745dabf89a386485c
[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=12012009
11 UCI_RELEASE=5
12
13 PKG_NAME:=uci
14 PKG_VERSION:=$(UCI_VERSION)$(if $(UCI_RELEASE),.$(UCI_RELEASE))
15 PKG_RELEASE:=1
16 PKG_REV:=aa3ab8012bfbf793d2884c08ea924545a04e9544
17
18 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
19 PKG_SOURCE_URL:=git://nbd.name/uci.git
20 PKG_SOURCE_SUBDIR:=uci-$(PKG_VERSION)
21 PKG_SOURCE_VERSION:=$(PKG_REV)
22 PKG_SOURCE_PROTO:=git
23
24 include $(INCLUDE_DIR)/package.mk
25
26 # set to 1 to enable debugging
27 DEBUG=
28
29 define Package/libuci
30 SECTION:=libs
31 CATEGORY:=Libraries
32 TITLE:=C library for the Unified Configuration Interface (UCI)
33 endef
34
35 define Package/uci
36 SECTION:=base
37 CATEGORY:=Base system
38 DEPENDS:=+libuci
39 TITLE:=Utility for the Unified Configuration Interface (UCI)
40 endef
41
42 define Package/ucitrigger
43 SECTION:=base
44 CATEGORY:=Base system
45 DEPENDS:=+libuci-lua +lua
46 TITLE:=Automatic triggers for applying system config changes
47 endef
48
49 define Package/libuci-lua
50 SECTION=libs
51 CATEGORY=Libraries
52 DEPENDS:=+libuci +liblua
53 TITLE:=Lua plugin for UCI
54 endef
55
56 define Build/Configure
57 endef
58
59 UCI_MAKEOPTS = \
60 $(TARGET_CONFIGURE_OPTS) \
61 COPTS="$(TARGET_CFLAGS)" \
62 DEBUG="$(DEBUG)" \
63 VERSION="$(UCI_VERSION)" \
64 CPPFLAGS="-I$(PKG_BUILD_DIR) $(TARGET_CPPFLAGS)" \
65 FPIC="$(FPIC)" \
66 OS="Linux"
67
68 # work around a nasty gcc bug
69 ifneq ($(CONFIG_GCC_VERSION_4_2_4),)
70 UCI_MAKEOPTS += WOPTS=""
71 endif
72
73 define Build/Compile
74 $(MAKE) -C $(PKG_BUILD_DIR) $(UCI_MAKEOPTS)
75 $(MAKE) -C $(PKG_BUILD_DIR)/lua $(UCI_MAKEOPTS)
76 $(MAKE) -C $(PKG_BUILD_DIR)/trigger $(UCI_MAKEOPTS) \
77 LIBS="$(TARGET_LDFLAGS) -L$(PKG_BUILD_DIR) -luci -llua -lcrypt -lm"
78 endef
79
80 define Package/libuci/install
81 $(INSTALL_DIR) $(1)/lib
82 $(CP) $(PKG_BUILD_DIR)/libuci.so* $(1)/lib/
83 endef
84
85 define Package/libuci-lua/install
86 $(INSTALL_DIR) $(1)/usr/lib/lua
87 $(CP) $(PKG_BUILD_DIR)/lua/uci.so $(1)/usr/lib/lua/
88 endef
89
90 define Package/ucitrigger/install
91 $(INSTALL_DIR) $(1)/usr/lib/lua/uci $(1)/lib/config/trigger $(1)/usr/sbin
92 $(INSTALL_DATA) ./trigger/lib/trigger.lua $(1)/usr/lib/lua/uci/
93 $(INSTALL_DATA) ./trigger/modules/*.lua $(1)/lib/config/trigger/
94 $(INSTALL_DATA) $(PKG_BUILD_DIR)/trigger/uci_trigger.so $(1)/usr/lib/
95 $(INSTALL_BIN) ./trigger/apply_config $(1)/usr/sbin/
96 endef
97
98 define Package/uci/install
99 $(INSTALL_DIR) $(1)/etc/uci-defaults
100 $(INSTALL_DIR) $(1)/sbin
101 $(INSTALL_BIN) $(PKG_BUILD_DIR)/uci $(1)/sbin/
102 $(CP) ./files/* $(1)/
103 endef
104
105 define Build/InstallDev
106 $(INSTALL_DIR) $(1)/usr/include
107 $(CP) $(PKG_BUILD_DIR)/uci{,_config}.h $(1)/usr/include
108 $(INSTALL_DIR) $(1)/usr/lib
109 $(CP) $(PKG_BUILD_DIR)/libuci.so* $(1)/usr/lib
110 $(CP) $(PKG_BUILD_DIR)/libuci.a $(1)/usr/lib
111 endef
112
113 $(eval $(call BuildPackage,uci))
114 $(eval $(call BuildPackage,libuci))
115 $(eval $(call BuildPackage,libuci-lua))
116 $(eval $(call BuildPackage,ucitrigger))