* Reintroduced compiling support
[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:=source
20 PKG_SELECTED_MODULES:=
21
22
23 include $(INCLUDE_DIR)/package.mk
24
25 define Build/Configure
26 endef
27
28
29 define Build/Compile 
30         for i in $(PKG_SELECTED_MODULES); do $(MAKE) -C$(PKG_BUILD_DIR)/$$$$i build LUA_TARGET=$(LUA_TARGET); done
31 endef
32
33 ### Templates ###
34
35 define Package/luci/libtemplate
36   SECTION:=admin
37   CATEGORY:=Administration
38   TITLE:=LuCI - Lua Configuration Interface
39   URL:=http://luci.freifunk-halle.net/
40   MAINTAINER:=Steven Barth <steven-at-midlink-dot-org>
41   SUBMENU:=LuCI - Libraries
42   DEPENDS:=+luci-core
43 endef
44
45 define Package/luci/fftemplate
46   $(call Package/luci/libtemplate)
47   SUBMENU:=LuCI - Freifunk Support
48   DEPENDS:=+luci-mod-freifunk
49 endef
50
51 define Package/luci/thtemplate
52   $(call Package/luci/libtemplate)
53   SUBMENU:=LuCI - Themes
54   DEPENDS:=+luci-web
55 endef
56
57 define Package/luci/webtemplate
58   $(call Package/luci/libtemplate)
59   SUBMENU:=LuCI - Webinterface Components
60 endef
61
62
63 define Package/luci/install/template
64         $(CP) $(PKG_BUILD_DIR)/$(2)/dist/* $(1)/ -R
65 endef
66
67
68
69 ### Core package ###
70
71 define Package/luci-core
72   $(call Package/luci/libtemplate)
73   DEPENDS:=+lua +luaposix
74   TITLE:=LuCI core libraries
75 endef
76
77 define Package/luci-core/install                
78         $(call Package/luci/install/template,$(1),libs/core)
79 endef
80
81 define Package/luci-core/config
82        choice
83                prompt "Build Target"
84                default PACKAGE_luci-core_compile
85
86        config PACKAGE_luci-core_compile
87                bool "Production"
88
89        config PACKAGE_luci-core_source
90                bool "Debug"
91
92        endchoice
93 endef
94
95 ifneq ($(CONFIG_PACKAGE_luci-core_compile),)
96         LUA_TARGET:=compile
97 endif
98
99
100 ### Libraries ###
101 define Package/luci-cbi
102   $(call Package/luci/libtemplate)
103   DEPENDS+=+luci-web
104   TITLE:=Configuration Binding Interface
105 endef
106
107 define Package/luci-cbi/install
108         $(call Package/luci/install/template,$(1),libs/cbi)
109 endef
110
111
112 define Package/luci-web
113   $(call Package/luci/libtemplate)
114   DEPENDS+=+luci-addons
115   TITLE:=MVC Webframework
116 endef
117
118 define Package/luci-web/conffiles
119 /etc/config/luci
120 endef
121
122 define Package/luci-web/install
123         $(call Package/luci/install/template,$(1),libs/web)
124 endef
125
126
127
128 ### Community Packages ###
129
130 define Package/luci-ff-halle
131   $(call Package/luci/fftemplate)
132   DEPENDS+= \
133    +luci-sgi-haserl +luci-app-splash \
134    +luci-app-ffwizard-leipzig \
135    +olsrd +olsrd-mod-dyn-gw +olsrd-mod-txtinfo +olsrd-mod-nameservice \
136    +kmod-tun +ip
137   TITLE:=Freifunk Halle Community Meta-Package
138 endef
139
140 define Package/luci-ff-halle/install
141         $(call Package/luci/install/template,$(1),applications/community-halle)
142         $(CP) -a ./ipkg/luci-ff-halle.postinst $(1)/CONTROL/postinst
143 endef
144
145
146 define Package/luci-ff-leipzig
147   $(call Package/luci/fftemplate)
148   DEPENDS+= \
149    +luci-sgi-haserl +luci-app-splash \
150    +luci-app-ffwizard-leipzig \
151    +olsrd +olsrd-mod-dyn-gw +olsrd-mod-txtinfo +olsrd-mod-nameservice \
152    +kmod-tun +ip
153   TITLE:=Freifunk Leipzig Community Meta-Package
154 endef
155
156 define Package/luci-ff-leipzig/install
157         $(call Package/luci/install/template,$(1),applications/community-leipzig)
158         $(CP) -a ./ipkg/luci-ff-leipzig.postinst $(1)/CONTROL/postinst
159 endef
160
161
162 define Package/luci-ff-hannover
163   $(call Package/luci/fftemplate)
164   DEPENDS+= \
165    +luci-sgi-haserl +luci-app-splash \
166    +olsrd +olsrd-mod-dyn-gw +olsrd-mod-txtinfo +olsrd-mod-nameservice
167   TITLE:=Freifunk Hannover Community Meta-Package
168   URL:=http://www.freifunk-hannover.de/
169   MAINTAINER:=Mickey Knox <mickey-at-netfreaks-dot-org>
170 endef
171
172 define Package/luci-ff-hannover/install
173         $(call Package/luci/install/template,$(1),applications/community-hannover)
174         $(CP) -a ./ipkg/luci-ff-hannover.postinst $(1)/CONTROL/postinst
175 endef
176
177
178 ### Modules ###
179
180 define Package/luci-mod-admin-core
181   $(call Package/luci/webtemplate)
182   DEPENDS+=+luci-web +luci-cbi +luci-theme-fledermaus
183   TITLE:=Administration module
184 endef
185
186 define Package/luci-mod-admin-core/install
187         $(call Package/luci/install/template,$(1),modules/admin-core)
188 endef
189
190
191 define Package/luci-mod-freifunk
192   $(call Package/luci/fftemplate)
193   DEPENDS:=+luci-mod-admin-core
194   TITLE:=LuCI Freifunk module
195 endef
196
197 define Package/luci-mod-freifunk/conffiles
198 /etc/config/freifunk
199 endef
200
201 define Package/luci-mod-freifunk/install
202         $(call Package/luci/install/template,$(1),modules/freifunk)
203 endef
204
205
206
207 ### Applications ###
208
209 define Package/luci-app-ffwizard-leipzig
210   $(call Package/luci/fftemplate)
211   DEPENDS+=+luci-app-firewall
212   TITLE:=Freifunk Leipzig configuration wizard
213 endef
214
215 define Package/luci-app-ffwizard-leipzig/install
216         $(call Package/luci/install/template,$(1),applications/luci-ffwizard-leipzig)
217 endef
218
219
220 define Package/luci-app-firewall
221   $(call Package/luci/webtemplate)
222   DEPENDS+=+luci-mod-admin-core
223   TITLE:=Firewall and Portforwarding application
224 endef
225
226 define Package/luci-app-firewall/conffiles
227 /etc/config/luci_fw
228 endef
229
230 define Package/luci-app-firewall/install
231         $(call Package/luci/install/template,$(1),applications/luci-fw)
232         $(INSTALL_BIN) $(PKG_BUILD_DIR)/applications/luci-fw/dist/etc/init.d/luci_fw $(1)/etc/init.d
233 endef
234
235
236 define Package/luci-app-splash
237   $(call Package/luci/fftemplate)
238   DEPENDS+=+luci-sgi-haserl +iptables-mod-nat +iptables-mod-ipopt
239   TITLE:=Freifunk DHCP-Splash application
240 endef
241
242 define Package/luci-app-splash/conffiles
243 /etc/config/luci_splash
244 endef
245
246 define Package/luci-app-splash/install
247         $(call Package/luci/install/template,$(1),applications/luci-splash)
248         $(INSTALL_BIN) $(PKG_BUILD_DIR)/applications/luci-splash/dist/usr/sbin/luci-splash $(1)/usr/sbin
249         $(INSTALL_BIN) $(PKG_BUILD_DIR)/applications/luci-splash/dist/etc/init.d/luci_splash $(1)/etc/init.d
250         $(INSTALL_BIN) $(PKG_BUILD_DIR)/applications/luci-splash/dist/etc/cron.minutely/luci_splash $(1)/etc/cron.minutely
251         $(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
252         $(INSTALL_BIN) $(PKG_BUILD_DIR)/applications/luci-splash/dist/www/cgi-bin/luci-splash $(1)/www/cgi-bin/luci-splash
253 endef
254
255
256 define Package/luci-app-statistics
257   $(call Package/luci/webtemplate)
258   DEPENDS+=+luci-mod-admin-core +collectd +collectd-mod-rrdtool1 +rrdtool1
259   TITLE:=LuCI Statistics Application (incomplete)
260 endef
261
262 define Package/luci-app-statistics/conffiles
263 /etc/config/luci_statistics
264 endef
265
266 define Package/luci-app-statistics/install
267         $(call Package/luci/install/template,$(1),applications/luci-statistics)
268         $(INSTALL_BIN) $(PKG_BUILD_DIR)/applications/luci-statistics/dist/usr/bin/stat-genconfig $(1)/usr/bin
269         $(INSTALL_BIN) $(PKG_BUILD_DIR)/applications/luci-statistics/dist/etc/init.d/luci_statistics $(1)/etc/init.d
270 endef
271
272
273 ### Server Gateway Interfaces ###
274
275 define Package/luci-sgi-haserl
276   $(call Package/luci/libtemplate)
277   DEPENDS+=+luci-web +haserl-lua
278   TITLE:=SGI for Haserl
279 endef
280
281 define Package/luci-sgi-haserl/install
282         $(call Package/luci/install/template,$(1),libs/sgi-haserl)
283         $(CP) -a ./ipkg/luci-sgi-haserl.postinst $(1)/CONTROL/postinst
284 endef
285
286
287 define Package/luci-sgi-webuci
288   $(call Package/luci/libtemplate)
289   DEPENDS+=+luci-web
290   TITLE:=SGI for Webuci
291 endef
292
293 define Package/luci-sgi-webuci/install
294         $(call Package/luci/install/template,$(1),libs/sgi-webuci)
295 endef
296
297 ### Templates ###
298 define Package/luci-theme-fledermaus
299   $(call Package/luci/thtemplate)
300   TITLE:=Fledermaus (default)
301 endef
302
303 define Package/luci-theme-fledermaus/install
304         $(call Package/luci/install/template,$(1),themes/fledermaus)
305 endef
306
307
308 ### Compile ###
309 ifneq ($(CONFIG_PACKAGE_luci-core),)
310         PKG_SELECTED_MODULES+=libs/core
311 endif
312 ifneq ($(CONFIG_PACKAGE_luci-cbi),)
313         PKG_SELECTED_MODULES+=libs/cbi
314 endif
315 ifneq ($(CONFIG_PACKAGE_luci-web),)
316         PKG_SELECTED_MODULES+=libs/web
317 endif
318
319 ifneq ($(CONFIG_PACKAGE_luci-ff-halle),)
320         PKG_SELECTED_MODULES+=applications/community-halle
321 endif
322 ifneq ($(CONFIG_PACKAGE_luci-ff-leipzig),)
323         PKG_SELECTED_MODULES+=applications/community-leipzig
324 endif
325 ifneq ($(CONFIG_PACKAGE_luci-ff-hannover),)
326         PKG_SELECTED_MODULES+=applications/community-hannover
327 endif
328
329 ifneq ($(CONFIG_PACKAGE_luci-mod-admin-core),)
330         PKG_SELECTED_MODULES+=modules/admin-core
331 endif
332 ifneq ($(CONFIG_PACKAGE_luci-mod-freifunk),)
333         PKG_SELECTED_MODULES+=modules/freifunk
334 endif
335
336 ifneq ($(CONFIG_PACKAGE_luci-app-ffwizard-leipzig),)
337         PKG_SELECTED_MODULES+=applications/luci-ffwizard-leipzig
338 endif
339 ifneq ($(CONFIG_PACKAGE_luci-app-firewall),)
340         PKG_SELECTED_MODULES+=applications/luci-fw
341 endif
342 ifneq ($(CONFIG_PACKAGE_luci-app-splash),)
343         PKG_SELECTED_MODULES+=applications/luci-splash
344 endif
345 ifneq ($(CONFIG_PACKAGE_luci-app-statistics),)
346         PKG_SELECTED_MODULES+=applications/luci-statistics
347 endif
348
349 ifneq ($(CONFIG_PACKAGE_luci-sgi-haserl),)
350         PKG_SELECTED_MODULES+=libs/sgi-haserl
351 endif
352 ifneq ($(CONFIG_PACKAGE_luci-sgi-webuci),)
353         PKG_SELECTED_MODULES+=libs/sgi-webuci
354 endif
355
356 ifneq ($(CONFIG_PACKAGE_luci-theme-fledermaus),)
357         PKG_SELECTED_MODULES+=themes/fledermaus
358 endif
359
360
361 $(eval $(call BuildPackage,luci-core))
362 $(eval $(call BuildPackage,luci-cbi))
363 $(eval $(call BuildPackage,luci-web))
364
365 $(eval $(call BuildPackage,luci-ff-halle))
366 $(eval $(call BuildPackage,luci-ff-leipzig))
367 $(eval $(call BuildPackage,luci-ff-hannover))
368
369 $(eval $(call BuildPackage,luci-mod-admin-core))
370 $(eval $(call BuildPackage,luci-mod-freifunk))
371
372 $(eval $(call BuildPackage,luci-app-ffwizard-leipzig))
373 $(eval $(call BuildPackage,luci-app-firewall))
374 $(eval $(call BuildPackage,luci-app-splash))
375 $(eval $(call BuildPackage,luci-app-statistics))
376
377 $(eval $(call BuildPackage,luci-sgi-haserl))
378 $(eval $(call BuildPackage,luci-sgi-webuci))
379
380 $(eval $(call BuildPackage,luci-theme-fledermaus))