* Reworked Makefiles
[project/luci.git] / contrib / package / luci / Makefile
1 include $(TOPDIR)/rules.mk
2
3 PKG_BRANCH:=trunk
4 PKG_SOURCE_URL:=https://dev.leipzig.freifunk.net/svn/ff-luci/$(PKG_BRANCH)
5 PKG_REV:=$(shell LC_ALL=C svn info ${PKG_SOURCE_URL} | sed -ne's/^Last Changed Rev: //p')
6
7 PKG_NAME:=luci
8 PKG_VERSION:=0.5+svn$(PKG_REV)
9 PKG_RELEASE:=1
10
11 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
12 PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
13 PKG_SOURCE_PROTO:=svn
14 PKG_SOURCE_VERSION:=$(PKG_REV)
15
16 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
17 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
18
19 # LUA_TARGET:=compile LUAC=$(BUILD_DIR_HOST)/lua/luac
20 LUA_TARGET:=source
21
22
23 include $(INCLUDE_DIR)/package.mk
24
25 define Build/Configure
26 endef
27
28 define Package/luci/compiletpl
29         ifneq ($(CONFIG_PACKAGE_$(1)),)
30                 $(MAKE) -C$(PKG_BUILD_DIR)/$(2) build LUA_TARGET=$(LUA_TARGET)
31         endif
32 endef
33
34 ### Templates ###
35
36 define Package/luci/libtemplate
37   SECTION:=admin
38   CATEGORY:=Administration
39   TITLE:=LuCI - Lua Configuration Interface
40   URL:=http://luci.freifunk-halle.net/
41   MAINTAINER:=Steven Barth <steven-at-midlink-dot-org>
42   SUBMENU:=LuCI - Libraries
43   DEPENDS:=+luci-core
44 endef
45
46 define Package/luci/fftemplate
47   $(call Package/luci/libtemplate)
48   SUBMENU:=LuCI - Freifunk Support
49   DEPENDS:=+luci-mod-freifunk
50 endef
51
52 define Package/luci/webtemplate
53   $(call Package/luci/libtemplate)
54   SUBMENU:=LuCI - Webinterface Components
55 endef
56
57
58 define Package/luci/install/template
59         $(CP) $(PKG_BUILD_DIR)/$(2)/dist/* $(1)/ -R
60 endef
61
62
63
64 ### Core package ###
65
66 define Package/luci-core
67   $(call Package/luci/libtemplate)
68   DEPENDS:=+lua +luaposix
69   TITLE:=LuCI core libraries
70 endef
71
72 define Package/luci-core/install                
73         $(call Package/luci/install/template,$(1),libs/core)
74 endef
75
76
77 ### Libraries ###
78 define Package/luci-cbi
79   $(call Package/luci/libtemplate)
80   DEPENDS+=+luci-web
81   TITLE:=Configuration Binding Interface
82 endef
83
84 define Package/luci-cbi/install
85         $(call Package/luci/install/template,$(1),libs/cbi)
86 endef
87
88
89 define Package/luci-web
90   $(call Package/luci/libtemplate)
91   DEPENDS+=+luci-addons
92   TITLE:=MVC Webframework
93 endef
94
95 define Package/luci-web/conffiles
96 /etc/config/luci
97 endef
98
99 define Package/luci-web/install
100         $(call Package/luci/install/template,$(1),libs/web)
101         $(call Package/luci/install/template,$(1),themes/fledermaus)
102 endef
103
104
105
106 ### Community Packages ###
107
108 define Package/luci-ff-halle
109   $(call Package/luci/fftemplate)
110   DEPENDS+= \
111    +luci-sgi-haserl +luci-app-splash \
112    +luci-app-ffwizard-leipzig \
113    +olsrd +olsrd-mod-dyn-gw +olsrd-mod-txtinfo +olsrd-mod-nameservice \
114    +kmod-tun +ip
115   TITLE:=Freifunk Halle Community Meta-Package
116 endef
117
118 define Package/luci-ff-halle/install
119         $(call Package/luci/install/template,$(1),applications/community-halle)
120         $(CP) -a ./ipkg/luci-ff-halle.postinst $(1)/CONTROL/postinst
121 endef
122
123
124 define Package/luci-ff-leipzig
125   $(call Package/luci/fftemplate)
126   DEPENDS+= \
127    +luci-sgi-haserl +luci-app-splash \
128    +luci-app-ffwizard-leipzig \
129    +olsrd +olsrd-mod-dyn-gw +olsrd-mod-txtinfo +olsrd-mod-nameservice \
130    +kmod-tun +ip
131   TITLE:=Freifunk Leipzig Community Meta-Package
132 endef
133
134 define Package/luci-ff-leipzig/install
135         $(call Package/luci/install/template,$(1),applications/community-leipzig)
136         $(CP) -a ./ipkg/luci-ff-leipzig.postinst $(1)/CONTROL/postinst
137 endef
138
139
140 define Package/luci-ff-hannover
141   $(call Package/luci/fftemplate)
142   DEPENDS+= \
143    +luci-sgi-haserl +luci-app-splash \
144    +olsrd +olsrd-mod-dyn-gw +olsrd-mod-txtinfo +olsrd-mod-nameservice
145   TITLE:=Freifunk Hannover Community Meta-Package
146   URL:=http://www.freifunk-hannover.de/
147   MAINTAINER:=Mickey Knox <mickey-at-netfreaks-dot-org>
148 endef
149
150 define Package/luci-ff-hannover/install
151         $(call Package/luci/install/template,$(1),applications/community-hannover)
152         $(CP) -a ./ipkg/luci-ff-hannover.postinst $(1)/CONTROL/postinst
153 endef
154
155
156 ### Modules ###
157
158 define Package/luci-mod-admin-core
159   $(call Package/luci/webtemplate)
160   DEPENDS+=+luci-web +luci-cbi
161   TITLE:=Administration module
162 endef
163
164 define Package/luci-mod-admin-core/install
165         $(call Package/luci/install/template,$(1),modules/admin-core)
166 endef
167
168
169 define Package/luci-mod-freifunk
170   $(call Package/luci/fftemplate)
171   DEPENDS:=+luci-mod-admin-core
172   TITLE:=LuCI Freifunk module
173 endef
174
175 define Package/luci-mod-freifunk/conffiles
176 /etc/config/freifunk
177 endef
178
179 define Package/luci-mod-freifunk/install
180         $(call Package/luci/install/template,$(1),modules/freifunk)
181 endef
182
183
184
185 ### Applications ###
186
187 define Package/luci-app-ffwizard-leipzig
188   $(call Package/luci/fftemplate)
189   DEPENDS+=+luci-app-firewall
190   TITLE:=Freifunk Leipzig configuration wizard
191 endef
192
193 define Package/luci-app-ffwizard-leipzig/install
194         $(call Package/luci/install/template,$(1),applications/luci-ffwizard-leipzig)
195 endef
196
197
198 define Package/luci-app-firewall
199   $(call Package/luci/webtemplate)
200   DEPENDS+=+luci-mod-admin-core
201   TITLE:=Firewall and Portforwarding application
202 endef
203
204 define Package/luci-app-firewall/conffiles
205 /etc/config/luci_fw
206 endef
207
208 define Package/luci-app-firewall/install
209         $(call Package/luci/install/template,$(1),applications/luci-fw)
210         $(INSTALL_BIN) $(PKG_BUILD_DIR)/applications/luci-fw/dist/etc/init.d/luci_fw $(1)/etc/init.d
211 endef
212
213
214 define Package/luci-app-splash
215   $(call Package/luci/fftemplate)
216   DEPENDS+=+luci-sgi-haserl +iptables-mod-nat +iptables-mod-ipopt
217   TITLE:=Freifunk DHCP-Splash application
218 endef
219
220 define Package/luci-app-splash/conffiles
221 /etc/config/luci_splash
222 endef
223
224 define Package/luci-app-splash/install
225         $(call Package/luci/install/template,$(1),applications/luci-splash)
226         $(INSTALL_BIN) $(PKG_BUILD_DIR)/applications/luci-splash/dist/usr/sbin/luci-splash $(1)/usr/sbin
227         $(INSTALL_BIN) $(PKG_BUILD_DIR)/applications/luci-splash/dist/etc/init.d/luci_splash $(1)/etc/init.d
228         $(INSTALL_BIN) $(PKG_BUILD_DIR)/applications/luci-splash/dist/etc/cron.minutely/luci_splash $(1)/etc/cron.minutely
229         $(INSTALL_BIN) $(PKG_BUILD_DIR)/applications/luci-splash/dist/usr/lib/luci-splash/htdocs/cgi-bin/index.cgi $(1)/usr/lib/luci-splash/htdocs/cgi-bin
230         $(INSTALL_BIN) $(PKG_BUILD_DIR)/applications/luci-splash/dist/www/cgi-bin/luci-splash $(1)/www/cgi-bin/luci-splash
231 endef
232
233
234 define Package/luci-app-statistics
235   $(call Package/luci/webtemplate)
236   DEPENDS+=+luci-mod-admin-core +collectd +collectd-mod-rrdtool1 +rrdtool1
237   TITLE:=LuCI Statistics Application (incomplete)
238 endef
239
240 define Package/luci-app-statistics/conffiles
241 /etc/config/luci_statistics
242 endef
243
244 define Package/luci-app-statistics/install
245         $(call Package/luci/install/template,$(1),applications/luci-statistics)
246         $(INSTALL_BIN) $(PKG_BUILD_DIR)/applications/luci-statistics/dist/usr/bin/stat-genconfig $(1)/usr/bin
247         $(INSTALL_BIN) $(PKG_BUILD_DIR)/applications/luci-statistics/dist/etc/init.d/luci_statistics $(1)/etc/init.d
248 endef
249
250
251 ### Server Gateway Interfaces ###
252
253 define Package/luci-sgi-haserl
254   $(call Package/luci/libtemplate)
255   DEPENDS+=+luci-web +haserl-lua
256   TITLE:=SGI for Haserl
257 endef
258
259 define Package/luci-sgi-haserl/install
260         $(call Package/luci/install/template,$(1),libs/sgi-haserl)
261         $(CP) -a ./ipkg/luci-sgi-haserl.postinst $(1)/CONTROL/postinst
262 endef
263
264
265 define Package/luci-sgi-webuci
266   $(call Package/luci/libtemplate)
267   DEPENDS+=+luci-web
268   TITLE:=SGI for Webuci
269 endef
270
271 define Package/luci-sgi-webuci/install
272         $(call Package/luci/install/template,$(1),libs/sgi-webuci)
273 endef
274
275
276 define Build/Compile 
277         $(call Package/luci/compiletpl,luci-core,libs/core)
278         $(call Package/luci/compiletpl,luci-cbi,libs/cbi)
279         $(call Package/luci/compiletpl,luci-web,libs/web)
280
281         $(call Package/luci/compiletpl,luci-ff-halle,applications/community-halle)
282         $(call Package/luci/compiletpl,luci-ff-leipzig,applications/community-leipzig)
283         $(call Package/luci/compiletpl,luci-ff-hannover,applications/community-hannover)
284
285         $(call Package/luci/compiletpl,luci-mod-admin-core,modules/admin-core)
286         $(call Package/luci/compiletpl,luci-mod-freifunk,modules/freifunk)
287
288         $(call Package/luci/compiletpl,luci-app-ffwizard-leipzig,applications/luci-ffwizard-leipzig)
289         $(call Package/luci/compiletpl,luci-app-firewall,applications/luci-fw)
290         $(call Package/luci/compiletpl,luci-app-splash,applications/luci-splash)
291         $(call Package/luci/compiletpl,luci-app-statistics,applications/luci-statistics)
292
293         $(call Package/luci/compiletpl,luci-sgi-haserl,libs/sgi-haserl)
294         $(call Package/luci/compiletpl,luci-sgi-webuci,libs/sgi-webuci)
295 endef
296
297
298 $(eval $(call BuildPackage,luci-core))
299 $(eval $(call BuildPackage,luci-cbi))
300 $(eval $(call BuildPackage,luci-web))
301
302 $(eval $(call BuildPackage,luci-ff-halle))
303 $(eval $(call BuildPackage,luci-ff-leipzig))
304 $(eval $(call BuildPackage,luci-ff-hannover))
305
306 $(eval $(call BuildPackage,luci-mod-admin-core))
307 $(eval $(call BuildPackage,luci-mod-freifunk))
308
309 $(eval $(call BuildPackage,luci-app-ffwizard-leipzig))
310 $(eval $(call BuildPackage,luci-app-firewall))
311 $(eval $(call BuildPackage,luci-app-splash))
312 $(eval $(call BuildPackage,luci-app-statistics))
313
314 $(eval $(call BuildPackage,luci-sgi-haserl))
315 $(eval $(call BuildPackage,luci-sgi-webuci))