* luci-0.8: backport ushare application
[project/luci.git] / contrib / package / luci / Makefile
1 include $(TOPDIR)/rules.mk
2
3 PKG_BRANCH:=branches/luci-0.8
4
5 ifeq ($(DUMP),)
6   USELOCAL:=$(shell grep luci ../../../.project 2>/dev/null >/dev/null && echo 1)
7 endif
8
9 PKG_NAME:=luci
10 PKG_RELEASE:=1
11
12 ifeq ($(USELOCAL),1)
13   PKG_VERSION:=0.8+svn
14 else
15   PKG_SOURCE_URL:=http://dev.leipzig.freifunk.net/svn/ff-luci/$(PKG_BRANCH)
16   ifeq ($(DUMP),)
17     PKG_REV:=$(shell LC_ALL=C svn info ${PKG_SOURCE_URL} | sed -ne's/^Last Changed Rev: //p')
18     PKG_VERSION:=0.8+svn$(PKG_REV)
19   endif
20   PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
21   PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
22   PKG_SOURCE_PROTO:=svn
23   PKG_SOURCE_VERSION:=$(PKG_REV)
24 endif
25
26 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
27 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
28
29 PKG_BUILD_DEPENDS:=libnotimpl
30 LUA_TARGET:=source
31 PKG_SELECTED_MODULES:=
32
33
34 include $(INCLUDE_DIR)/package.mk
35
36 ifeq ($(USELOCAL),1)
37   define Build/Prepare
38         mkdir -p $(PKG_BUILD_DIR)
39         $(TAR) c -C ../../../ . \
40                 --exclude=.pc --exclude=.svn --exclude=.git \
41                 --exclude='boa-0*' --exclude='*.o' --exclude='*.so' \
42                 --exclude=dist | \
43                         tar x -C $(PKG_BUILD_DIR)/
44   endef
45 endif
46
47 define Build/Configure
48 endef
49
50 ### Templates ###
51
52 define Package/luci/libtemplate
53   SECTION:=admin
54   CATEGORY:=Administration
55   TITLE:=LuCI - Lua Configuration Interface
56   URL:=http://luci.freifunk-halle.net/
57   MAINTAINER:=Steven Barth <steven-at-midlink-dot-org>
58   SUBMENU:=LuCI Libraries
59   DEPENDS:=+luci-core
60 endef
61
62 define Package/luci/i18ntemplate
63   $(call Package/luci/libtemplate)
64   SUBMENU:=LuCI Translations
65   DEPENDS:=+luci-web
66 endef
67
68 define Package/luci/thtemplate
69   $(call Package/luci/libtemplate)
70   SUBMENU:=LuCI Themes
71   DEPENDS:=+luci-web
72 endef
73
74 define Package/luci/webtemplate
75   $(call Package/luci/libtemplate)
76   SUBMENU:=LuCI Components
77 endef
78
79
80 define Package/luci/install/template
81         $(CP) -a $(PKG_BUILD_DIR)/$(2)/dist/* $(1)/ -R
82         $(CP) -a $(PKG_BUILD_DIR)/$(2)/ipkg/* $(1)/CONTROL/ 2>/dev/null || true
83 endef
84
85
86
87 ### Core package ###
88
89 define Package/luci-core
90   $(call Package/luci/libtemplate)
91   DEPENDS:=+lua +luaposix +bitlib
92   TITLE:=LuCI core libraries
93 endef
94
95 define Package/luci-core/install
96         $(call Package/luci/install/template,$(1),libs/core)
97 endef
98
99 define Package/luci-core/config
100        choice
101                prompt "Build Target"
102                default PACKAGE_luci-core_source
103
104        config PACKAGE_luci-core_compile
105                bool "Precompiled"
106
107        config PACKAGE_luci-core_stripped
108                bool "Stripped"
109
110        config PACKAGE_luci-core_source
111                bool "Full Source"
112
113        endchoice
114 endef
115
116 ifneq ($(CONFIG_PACKAGE_luci-core_compile),)
117   LUA_TARGET:=compile
118 endif
119
120 ifneq ($(CONFIG_PACKAGE_luci-core_stripped),)
121   LUA_TARGET:=strip
122 endif
123
124
125 ### Libraries ###
126 define Package/luci-cbi
127   $(call Package/luci/libtemplate)
128   DEPENDS+=+luci-web +luci-uvl +luci-uci
129   TITLE:=Configuration Binding Interface
130 endef
131
132 define Package/luci-cbi/install
133         $(call Package/luci/install/template,$(1),libs/cbi)
134 endef
135
136
137 define Package/luci-uci
138   $(call Package/luci/libtemplate)
139   DEPENDS+=+libuci-lua
140   TITLE:=High-Level UCI API
141 endef
142
143 define Package/luci-uci/install
144         $(call Package/luci/install/template,$(1),libs/uci)
145 endef
146
147
148 define Package/luci-fastindex
149   $(call Package/luci/libtemplate)
150   TITLE:=Fastindex indexing module
151 endef
152
153 define Package/luci-fastindex/install
154         $(call Package/luci/install/template,$(1),libs/fastindex)
155 endef
156
157
158 define Package/luci-http
159   $(call Package/luci/libtemplate)
160   TITLE:=HTTP Protocol implementation
161 endef
162
163 define Package/luci-http/install
164         $(call Package/luci/install/template,$(1),libs/http)
165 endef
166
167
168 define Package/luci-ipkg
169   $(call Package/luci/libtemplate)
170   TITLE:=LuCI IPKG/OPKG call abstraction library
171 endef
172
173 define Package/luci-ipkg/install
174         $(call Package/luci/install/template,$(1),libs/ipkg)
175 endef
176
177
178 define Package/luci-json
179   $(call Package/luci/libtemplate)
180   TITLE:=LuCI JSON Library
181 endef
182
183 define Package/luci-json/install
184         $(call Package/luci/install/template,$(1),libs/json)
185 endef
186
187
188 define Package/luci-sys
189   $(call Package/luci/libtemplate)
190   TITLE:=LuCI Linux/POSIX system library
191 endef
192
193 define Package/luci-sys/install
194         $(call Package/luci/install/template,$(1),libs/sys)
195 endef
196
197
198 define Package/luci-web
199   $(call Package/luci/libtemplate)
200   DEPENDS+=+luci-http +luci-sys +luci-uci +luci-sgi-cgi
201   TITLE:=MVC Webframework
202 endef
203
204 define Package/luci-web/conffiles
205 /etc/config/luci
206 endef
207
208 define Package/luci-web/install
209         $(call Package/luci/install/template,$(1),libs/web)
210 endef
211
212
213 define Package/luci-uvl
214   $(call Package/luci/libtemplate)
215   DEPENDS+=+luci-sys +luci-uci +luci-core
216   TITLE:=UVL - UCI Validation Layer
217 endef
218
219 define Package/luci-uvl/install
220         $(call Package/luci/install/template,$(1),libs/uvl)
221 endef
222
223
224 ### Modules ###
225
226 define Package/luci-admin-core
227   $(call Package/luci/webtemplate)
228   DEPENDS+=+luci-web +luci-cbi +luci-theme-openwrt +luci-i18n-english
229   TITLE:=Web UI Core Module
230 endef
231
232 define Package/luci-admin-core/conffiles
233 /etc/config/luci_hosts
234 /etc/config/luci_ethers
235 endef
236
237 define Package/luci-admin-core/install
238         $(call Package/luci/install/template,$(1),modules/admin-core)
239 endef
240
241
242 define Package/luci-admin-mini
243   $(call Package/luci/webtemplate)
244   DEPENDS+=+luci-admin-core
245   TITLE:=LuCI Essentials - stripped down and user-friendly
246 endef
247
248 define Package/luci-admin-mini/install
249         $(call Package/luci/install/template,$(1),modules/admin-mini)
250 endef
251
252
253 define Package/luci-admin-full
254   $(call Package/luci/webtemplate)
255   DEPENDS+=+luci-admin-core +luci-ipkg
256   TITLE:=LuCI Administration - full-featured for full control
257 endef
258
259 define Package/luci-admin-full/install
260         $(call Package/luci/install/template,$(1),modules/admin-full)
261 endef
262
263
264 define Package/luci-admin-rpc
265   $(call Package/luci/webtemplate)
266   DEPENDS+=+luci-json
267   TITLE:=LuCI RPC - JSON-RPC API
268 endef
269
270 define Package/luci-admin-rpc/install
271         $(call Package/luci/install/template,$(1),modules/rpc)
272 endef
273
274
275 ### Applications ###
276
277 define Package/luci-app-firewall
278   $(call Package/luci/webtemplate)
279   DEPENDS+=+luci-admin-core
280   TITLE:=Firewall and Portforwarding application
281 endef
282
283 define Package/luci-app-firewall/install
284         $(call Package/luci/install/template,$(1),applications/luci-fw)
285 endef
286
287
288 define Package/luci-app-olsr
289   $(call Package/luci/webtemplate)
290   DEPENDS+=+luci-admin-full +olsrd-luci +olsrd-luci-mod-txtinfo
291   TITLE:=OLSR configuration and status module
292 endef
293
294 define Package/luci-app-olsr/install
295         $(call Package/luci/install/template,$(1),applications/luci-olsr)
296 endef
297
298
299 define Package/luci-app-qos
300   $(call Package/luci/webtemplate)
301   DEPENDS+=+luci-admin-core +qos-scripts
302   TITLE:=Quality of Service configuration module
303 endef
304
305 define Package/luci-app-qos/install
306         $(call Package/luci/install/template,$(1),applications/luci-qos)
307 endef
308
309
310 define Package/luci-app-statistics
311   $(call Package/luci/webtemplate)
312   DEPENDS+=+luci-admin-full +collectd +collectd-mod-rrdtool1 +rrdtool1
313   TITLE:=LuCI Statistics Application
314 endef
315
316 define Package/luci-app-statistics/conffiles
317 /etc/config/luci_statistics
318 endef
319
320 define Package/luci-app-statistics/install
321         $(call Package/luci/install/template,$(1),applications/luci-statistics)
322 endef
323
324
325 define Package/luci-app-upnp
326   $(call Package/luci/webtemplate)
327   DEPENDS+=+luci-admin-core +miniupnpd
328   TITLE:=Universal Plug & Play configuration module
329 endef
330
331 define Package/luci-app-upnp/install
332         $(call Package/luci/install/template,$(1),applications/luci-upnp)
333 endef
334
335
336 define Package/luci-app-ntpc
337   $(call Package/luci/webtemplate)
338   DEPENDS+=+luci-admin-core +ntpclient
339   TITLE:=NTP time synchronisation client configuration module
340 endef
341
342 define Package/luci-app-ntpc/install
343         $(call Package/luci/install/template,$(1),applications/luci-ntpc)
344 endef
345
346
347 define Package/luci-app-ddns
348   $(call Package/luci/webtemplate)
349   DEPENDS+=+luci-admin-core +ddns-scripts
350   TITLE:=Dynamic DNS configuration module
351 endef
352
353 define Package/luci-app-ddns/install
354         $(call Package/luci/install/template,$(1),applications/luci-ddns)
355 endef
356
357
358 define Package/luci-app-samba
359   $(call Package/luci/webtemplate)
360   DEPENDS+=+luci-admin-full +samba3
361   TITLE:=Network Shares - Samba SMB/CIFS module
362 endef
363
364 define Package/luci-app-samba/install
365         $(call Package/luci/install/template,$(1),applications/luci-samba)
366 endef
367
368
369 define Package/luci-app-uvc_streamer
370   $(call Package/luci/webtemplate)
371   DEPENDS+=+luci-admin-full +uvc-streamer
372   TITLE:=Webcam Streaming - UVC-Streamer module
373 endef
374
375 define Package/luci-app-uvc_streamer/install
376         $(call Package/luci/install/template,$(1),applications/luci-uvc_streamer)
377 endef
378
379
380 define Package/luci-app-p910nd
381   $(call Package/luci/webtemplate)
382   DEPENDS+=+luci-admin-full +p910nd
383   TITLE:=p910nd - Printer server module
384 endef
385
386 define Package/luci-app-p910nd/install
387         $(call Package/luci/install/template,$(1),applications/luci-p910nd)
388 endef
389
390
391 define Package/luci-app-ushare
392   $(call Package/luci/webtemplate)
393   DEPENDS+=+luci-admin-full +ushare
394   TITLE:=ushare - UPnP A/V & DLNA Media Server
395 endef
396
397 define Package/luci-app-ushare/install
398         $(call Package/luci/install/template,$(1),applications/luci-ushare)
399 endef
400
401
402 ### Server Gateway Interfaces ###
403
404 define Package/luci-sgi-cgi
405   $(call Package/luci/libtemplate)
406   TITLE:=SGI for CGI
407 endef
408
409 define Package/luci-sgi-cgi/install
410         $(call Package/luci/install/template,$(1),libs/sgi-cgi)
411 endef
412
413
414 ### Themes ###
415 define Package/luci-theme-openwrt
416   $(call Package/luci/thtemplate)
417   TITLE:=OpenWRT.org (default)
418 endef
419
420 define Package/luci-theme-openwrt/install
421         $(call Package/luci/install/template,$(1),themes/openwrt.org)
422 endef
423
424 define Package/luci-theme-openwrtlight
425   $(call Package/luci/thtemplate)
426   TITLE:=OpenWRT.org - light variant without images
427 endef
428
429 define Package/luci-theme-openwrtlight/install
430         $(call Package/luci/install/template,$(1),themes/openwrt-light)
431 endef
432
433
434 ### Translations ###
435 define Package/luci-i18n-german
436   $(call Package/luci/i18ntemplate)
437   TITLE:=German
438 endef
439
440 define Package/luci-i18n-german/install
441         $(call Package/luci/install/template,$(1),i18n/german)
442 endef
443
444
445 define Package/luci-i18n-english
446   $(call Package/luci/i18ntemplate)
447   TITLE:=English
448 endef
449
450 define Package/luci-i18n-english/install
451         $(call Package/luci/install/template,$(1),i18n/english)
452 endef
453
454
455 define Package/luci-i18n-french
456   $(call Package/luci/i18ntemplate)
457   TITLE:=French (by Florian Fainelli)
458 endef
459
460 define Package/luci-i18n-french/install
461         $(call Package/luci/install/template,$(1),i18n/french)
462 endef
463
464
465 define Package/luci-i18n-russian
466   $(call Package/luci/i18ntemplate)
467   TITLE:=Russian (by Skryabin Dmitry)
468 endef
469
470 define Package/luci-i18n-russian/install
471         $(call Package/luci/install/template,$(1),i18n/russian)
472 endef
473
474
475
476 ### Compile ###
477 ifneq ($(CONFIG_PACKAGE_luci-core),)
478         PKG_SELECTED_MODULES+=libs/core
479 endif
480 ifneq ($(CONFIG_PACKAGE_luci-cbi),)
481         PKG_SELECTED_MODULES+=libs/cbi
482 endif
483 ifneq ($(CONFIG_PACKAGE_luci-fastindex),)
484         PKG_SELECTED_MODULES+=libs/fastindex
485 endif
486 ifneq ($(CONFIG_PACKAGE_luci-http),)
487         PKG_SELECTED_MODULES+=libs/http
488 endif
489 ifneq ($(CONFIG_PACKAGE_luci-ipkg),)
490         PKG_SELECTED_MODULES+=libs/ipkg
491 endif
492 ifneq ($(CONFIG_PACKAGE_luci-json),)
493         PKG_SELECTED_MODULES+=libs/json
494 endif
495 ifneq ($(CONFIG_PACKAGE_luci-uci),)
496         PKG_SELECTED_MODULES+=libs/uci
497 endif
498 ifneq ($(CONFIG_PACKAGE_luci-sys),)
499         PKG_SELECTED_MODULES+=libs/sys
500 endif
501 ifneq ($(CONFIG_PACKAGE_luci-web),)
502         PKG_SELECTED_MODULES+=libs/web
503 endif
504 ifneq ($(CONFIG_PACKAGE_luci-uvl),)
505         PKG_SELECTED_MODULES+=libs/uvl
506 endif
507
508 ifneq ($(CONFIG_PACKAGE_luci-admin-core),)
509         PKG_SELECTED_MODULES+=modules/admin-core
510 endif
511 ifneq ($(CONFIG_PACKAGE_luci-admin-mini),)
512         PKG_SELECTED_MODULES+=modules/admin-mini
513 endif
514 ifneq ($(CONFIG_PACKAGE_luci-admin-full),)
515         PKG_SELECTED_MODULES+=modules/admin-full
516 endif
517 ifneq ($(CONFIG_PACKAGE_luci-admin-rpc),)
518         PKG_SELECTED_MODULES+=modules/rpc
519 endif
520
521 ifneq ($(CONFIG_PACKAGE_luci-app-firewall),)
522         PKG_SELECTED_MODULES+=applications/luci-fw
523 endif
524 ifneq ($(CONFIG_PACKAGE_luci-app-olsr),)
525         PKG_SELECTED_MODULES+=applications/luci-olsr
526 endif
527 ifneq ($(CONFIG_PACKAGE_luci-app-qos),)
528         PKG_SELECTED_MODULES+=applications/luci-qos
529 endif
530 ifneq ($(CONFIG_PACKAGE_luci-app-statistics),)
531         PKG_SELECTED_MODULES+=applications/luci-statistics
532 endif
533 ifneq ($(CONFIG_PACKAGE_luci-app-upnp),)
534         PKG_SELECTED_MODULES+=applications/luci-upnp
535 endif
536 ifneq ($(CONFIG_PACKAGE_luci-app-ntpc),)
537         PKG_SELECTED_MODULES+=applications/luci-ntpc
538 endif
539 ifneq ($(CONFIG_PACKAGE_luci-app-ddns),)
540         PKG_SELECTED_MODULES+=applications/luci-ddns
541 endif
542 ifneq ($(CONFIG_PACKAGE_luci-app-samba),)
543         PKG_SELECTED_MODULES+=applications/luci-samba
544 endif
545 ifneq ($(CONFIG_PACKAGE_luci-app-uvc_streamer),)
546         PKG_SELECTED_MODULES+=applications/luci-uvc_streamer
547 endif
548 ifneq ($(CONFIG_PACKAGE_luci-app-p910nd),)
549         PKG_SELECTED_MODULES+=applications/luci-p910nd
550 endif
551 ifneq ($(CONFIG_PACKAGE_luci-app-ushare),)
552         PKG_SELECTED_MODULES+=applications/luci-ushare
553 endif
554
555
556 ifneq ($(CONFIG_PACKAGE_luci-sgi-cgi),)
557         PKG_SELECTED_MODULES+=libs/sgi-cgi
558 endif
559
560 ifneq ($(CONFIG_PACKAGE_luci-theme-openwrt),)
561         PKG_SELECTED_MODULES+=themes/openwrt.org
562 endif
563 ifneq ($(CONFIG_PACKAGE_luci-theme-openwrtlight),)
564         PKG_SELECTED_MODULES+=themes/openwrt-light
565 endif
566
567 ifneq ($(CONFIG_PACKAGE_luci-i18n-german),)
568         PKG_SELECTED_MODULES+=i18n/german
569 endif
570 ifneq ($(CONFIG_PACKAGE_luci-i18n-english),)
571         PKG_SELECTED_MODULES+=i18n/english
572 endif
573 ifneq ($(CONFIG_PACKAGE_luci-i18n-french),)
574         PKG_SELECTED_MODULES+=i18n/french
575 endif
576 ifneq ($(CONFIG_PACKAGE_luci-i18n-russian),)
577         PKG_SELECTED_MODULES+=i18n/russian
578 endif
579
580
581 MAKE_FLAGS += \
582         MODULES="$(PKG_SELECTED_MODULES)" \
583         LUA_TARGET="$(LUA_TARGET)" \
584         LUA_SHLIBS="-llua -lm" \
585         CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include" \
586         LDFLAGS="$(TARGET_LDFLAGS) -L$(STAGING_DIR)/usr/lib" \
587         OS="Linux"
588
589
590 $(eval $(call BuildPackage,luci-core))
591 $(eval $(call BuildPackage,luci-cbi))
592 $(eval $(call BuildPackage,luci-fastindex))
593 $(eval $(call BuildPackage,luci-http))
594 $(eval $(call BuildPackage,luci-ipkg))
595 $(eval $(call BuildPackage,luci-json))
596 $(eval $(call BuildPackage,luci-uci))
597 $(eval $(call BuildPackage,luci-sys))
598 $(eval $(call BuildPackage,luci-web))
599 $(eval $(call BuildPackage,luci-uvl))
600
601 $(eval $(call BuildPackage,luci-admin-core))
602 $(eval $(call BuildPackage,luci-admin-mini))
603 $(eval $(call BuildPackage,luci-admin-full))
604 $(eval $(call BuildPackage,luci-admin-rpc))
605
606 $(eval $(call BuildPackage,luci-app-firewall))
607 $(eval $(call BuildPackage,luci-app-olsr))
608 $(eval $(call BuildPackage,luci-app-qos))
609 $(eval $(call BuildPackage,luci-app-statistics))
610 $(eval $(call BuildPackage,luci-app-upnp))
611 $(eval $(call BuildPackage,luci-app-ntpc))
612 $(eval $(call BuildPackage,luci-app-ddns))
613 $(eval $(call BuildPackage,luci-app-samba))
614 $(eval $(call BuildPackage,luci-app-uvc_streamer))
615 $(eval $(call BuildPackage,luci-app-p910nd))
616 $(eval $(call BuildPackage,luci-app-ushare))
617
618 $(eval $(call BuildPackage,luci-sgi-cgi))
619
620 $(eval $(call BuildPackage,luci-theme-openwrt))
621 $(eval $(call BuildPackage,luci-theme-openwrtlight))
622
623 $(eval $(call BuildPackage,luci-i18n-german))
624 $(eval $(call BuildPackage,luci-i18n-english))
625 $(eval $(call BuildPackage,luci-i18n-french))
626 $(eval $(call BuildPackage,luci-i18n-russian))