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