Remove remaining references to boa and lucid
[project/luci.git] / contrib / package / luci / Makefile
1 include $(TOPDIR)/rules.mk
2
3 LUCI_TOPDIR=../../..
4
5 PKG_NAME:=luci
6 PKG_RELEASE:=1
7
8 PKG_BUILD_PARALLEL:=0
9
10 PKG_VERSION:=$(shell $(LUCI_TOPDIR)/build/mkrevision.sh 2>/dev/null || echo unknown)
11
12 PKG_BUILD_DEPENDS:=$(if $(STAGING_DIR_ROOT),lua/host)
13 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
14 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
15 PKG_USE_MIPS16:=0
16
17 LUA_TARGET:=source
18 LUCI_CFLAGS:=
19 LUCI_BUILD_PACKAGES:=
20 LUCI_SELECTED_MODULES:=
21
22 ifeq ($(BOARD),brcm-2.4)
23   MAKE_FLAGS += CRAP="1"
24 endif
25
26
27 ### Templates ###
28 define Package/luci/install/template
29         $(CP) -a $(PKG_BUILD_DIR)/$(2)/dist/* $(1)/ -R
30         $(CP) -a $(PKG_BUILD_DIR)/$(2)/ipkg/* $(1)/CONTROL/ 2>/dev/null || true
31 endef
32
33
34 ### Core package ###
35 define Package/luci-lib-core
36   SECTION:=luci
37   CATEGORY:=LuCI
38   TITLE:=LuCI - Lua Configuration Interface
39   URL:=http://luci.subsignal.org/
40   MAINTAINER:=LuCI Development Team <luci@lists.subsignal.org>
41   SUBMENU:=8. Libraries
42   DEPENDS:=+lua +libuci-lua +libubus-lua
43   TITLE:=LuCI core libraries
44 endef
45
46 define Package/luci-lib-core/install
47         $(call Package/luci/install/template,$(1),libs/core)
48         $(PKG_BUILD_DIR)/build/mkversion.sh $(1)/usr/lib/lua/luci/version.lua \
49                 "OpenWrt Firmware" \
50                 "$(OPENWRTVERSION)" \
51                 "trunk" \
52                 "$(PKG_VERSION)"
53 endef
54
55 define Package/luci-lib-core/config
56        choice
57                prompt "Build Target"
58                default PACKAGE_luci-lib-core_source
59
60        config PACKAGE_luci-lib-core_compile
61                bool "Precompiled"
62
63        config PACKAGE_luci-lib-core_stripped
64                bool "Stripped"
65
66        config PACKAGE_luci-lib-core_srcdiet
67                bool "Compressed Source"
68
69        config PACKAGE_luci-lib-core_source
70                bool "Full Source"
71
72        endchoice
73 endef
74
75 ifneq ($(CONFIG_PACKAGE_luci-lib-core_compile),)
76   LUA_TARGET:=compile
77 endif
78
79 ifneq ($(CONFIG_PACKAGE_luci-lib-core_stripped),)
80   LUA_TARGET:=strip
81 endif
82
83 ifneq ($(CONFIG_PACKAGE_luci-lib-core_srcdiet),)
84   LUA_TARGET:=diet
85 endif
86
87 ifneq ($(CONFIG_PACKAGE_luci-lib-core),)
88   LUCI_SELECTED_MODULES+=libs/core
89 endif
90
91 LUCI_BUILD_PACKAGES += luci-lib-core
92
93
94 ### Libraries ###
95 define library
96   define Package/luci-lib-$(1)
97     SECTION:=luci
98     CATEGORY:=LuCI
99     TITLE:=LuCI - Lua Configuration Interface
100     URL:=http://luci.subsignal.org/
101     MAINTAINER:=LuCI Development Team <luci@lists.subsignal.org>
102     SUBMENU:=8. Libraries
103     TITLE:=$(if $(2),$(2),LuCI $(1) library)
104     $(if $(3),DEPENDS:=+luci-lib-core $(3))
105   endef
106
107   define Package/luci-lib-$(1)/install
108         $(call Package/luci/install/template,$$(1),libs/$(1))
109         $(call Package/luci-lib-$(1)/extra-install)
110   endef
111
112   ifneq ($(CONFIG_PACKAGE_luci-lib-$(1)),)
113     LUCI_SELECTED_MODULES+=libs/$(1)
114   endif
115
116   LUCI_BUILD_PACKAGES += luci-lib-$(1)
117 endef
118
119 define Package/luci-lib-web/conffiles
120 /etc/config/luci
121 endef
122
123 define Package/luci-lib-nixio/config
124         choice
125                 prompt "TLS Provider"
126                 default PACKAGE_luci-lib-nixio_notls
127
128                 config PACKAGE_luci-lib-nixio_notls
129                         bool "Disabled"
130
131                 config PACKAGE_luci-lib-nixio_axtls
132                         bool "Builtin (axTLS)"
133
134                 config PACKAGE_luci-lib-nixio_cyassl
135                         bool "CyaSSL"
136                         select PACKAGE_libcyassl
137
138                 config PACKAGE_luci-lib-nixio_openssl
139                         bool "OpenSSL"
140                         select PACKAGE_libopenssl
141         endchoice
142 endef
143
144
145 NIXIO_TLS:=
146
147 ifneq ($(CONFIG_PACKAGE_luci-lib-nixio_axtls),)
148   NIXIO_TLS:=axtls
149 endif
150
151 ifneq ($(CONFIG_PACKAGE_luci-lib-nixio_openssl),)
152   NIXIO_TLS:=openssl
153 endif
154
155 ifneq ($(CONFIG_PACKAGE_luci-lib-nixio_cyassl),)
156   NIXIO_TLS:=cyassl
157   LUCI_CFLAGS+=-I$(STAGING_DIR)/usr/include/cyassl
158 endif
159
160
161 $(eval $(call library,httpclient,HTTP(S) client library,+luci-lib-web +luci-lib-nixio))
162 $(eval $(call library,ipkg,LuCI IPKG/OPKG call abstraction library))
163 $(eval $(call library,json,LuCI JSON library))
164 $(eval $(call library,nixio,NIXIO POSIX library,+PACKAGE_luci-lib-nixio_openssl:libopenssl +PACKAGE_luci-lib-nixio_cyassl:libcyassl))
165 $(eval $(call library,px5g,RSA/X.509 Key Generator (required for LuCId SSL support),+luci-lib-nixio))
166 $(eval $(call library,sys,LuCI Linux/POSIX system library))
167 $(eval $(call library,web,MVC Webframework,+luci-lib-sys +luci-lib-nixio +luci-lib-core +luci-sgi-cgi))
168 $(eval $(call library,luaneightbl,neightbl - Lua lib for IPv6 neighbors,+luci-lib-core))
169
170
171 ### Protocols ###
172 define protocol
173   define Package/luci-proto-$(1)
174     SECTION:=luci
175     CATEGORY:=LuCI
176     TITLE:=LuCI - Lua Configuration Interface
177     URL:=http://luci.subsignal.org/
178     MAINTAINER:=LuCI Development Team <luci@lists.subsignal.org>
179     SUBMENU:=6. Protocols
180     TITLE:=$(if $(2),$(2),LuCI $(1) protocol support)
181     DEPENDS:=$(3)
182   endef
183
184   define Package/luci-proto-$(1)/install
185         $(call Package/luci/install/template,$$(1),protocols/$(1))
186   endef
187
188   ifneq ($(CONFIG_PACKAGE_luci-proto-$(1)),)
189     LUCI_SELECTED_MODULES+=protocols/$(1)
190   endif
191
192   LUCI_BUILD_PACKAGES += luci-proto-$(1)
193 endef
194
195 $(eval $(call protocol,core,Support for static/dhcp/none))
196 $(eval $(call protocol,ppp,Support for PPP/PPPoE/PPPoA/PPtP))
197 $(eval $(call protocol,ipv6,Support for DHCPv6/6in4/6to4/6rd/DS-Lite))
198 $(eval $(call protocol,3g,Support for 3G,+PACKAGE_luci-proto-3g:comgt))
199 $(eval $(call protocol,relay,Support for relayd pseudo bridges,+PACKAGE_luci-proto-relay:relayd))
200
201
202 ### Modules ###
203 define module
204   define Package/luci-mod-$(1)
205     SECTION:=luci
206     CATEGORY:=LuCI
207     TITLE:=LuCI - Lua Configuration Interface
208     URL:=http://luci.subsignal.org/
209     MAINTAINER:=LuCI Development Team <luci@lists.subsignal.org>
210     SUBMENU:=2. Modules
211     TITLE:=$(if $(2),$(2),LuCI $(1) module)
212     $(if $(3),DEPENDS+=$(3))
213   endef
214
215   define Package/luci-mod-$(1)/install
216         $(call Package/luci/install/template,$$(1),modules/$(1))
217         $(call Package/luci-mod-$(1)/extra-install)
218   endef
219
220   ifneq ($(CONFIG_PACKAGE_luci-mod-$(1)),)
221     LUCI_SELECTED_MODULES+=modules/$(1)
222   endif
223
224   LUCI_BUILD_PACKAGES += luci-mod-$(1)
225 endef
226
227
228 define Package/luci-mod-admin-core/extra-install
229         touch $(1)/etc/init.d/luci_fixtime || true
230 endef
231
232 $(eval $(call module,admin-core,Web UI Core module,+luci-lib-web +luci-proto-core +luci-i18n-english))
233 $(eval $(call module,admin-mini,LuCI Essentials - stripped down and user-friendly,+luci-mod-admin-core @BROKEN))
234 $(eval $(call module,admin-full,LuCI Administration - full-featured for full control,+luci-mod-admin-core +luci-lib-ipkg))
235 $(eval $(call module,failsafe,LuCI Fail-Safe - Fail-Safe sysupgrade module,+luci-mod-admin-core))
236 $(eval $(call module,rpc,LuCI RPC - JSON-RPC API,+luci-lib-json))
237
238
239 ### Applications ###
240 define application
241   define Package/luci-app-$(1)
242     SECTION:=luci
243     CATEGORY:=LuCI
244     TITLE:=LuCI - Lua Configuration Interface
245     URL:=http://luci.subsignal.org/
246     MAINTAINER:=LuCI Development Team <luci@lists.subsignal.org>
247     SUBMENU:=3. Applications
248     TITLE:=$(if $(2),$(2),LuCI $(1) application)
249         DEPENDS:=$(3)
250   endef
251
252   define Package/luci-app-$(1)/install
253         $(call Package/luci/install/template,$$(1),applications/luci-$(1))
254   endef
255
256   ifneq ($(CONFIG_PACKAGE_luci-app-$(1)),)
257     LUCI_SELECTED_MODULES+=applications/luci-$(1)
258   endif
259
260   LUCI_BUILD_PACKAGES += luci-app-$(1)
261 endef
262
263
264 $(eval $(call application,firewall,Firewall and Portforwarding application,\
265         +PACKAGE_luci-app-firewall:firewall))
266
267 $(eval $(call application,qos,Quality of Service configuration module,\
268         +PACKAGE_luci-app-qos:qos-scripts))
269
270 $(eval $(call application,commands,LuCI Shell Command Module))
271
272
273 ### Server Gateway Interfaces ###
274 define sgi
275   define Package/luci-sgi-$(1)
276     SECTION:=luci
277     CATEGORY:=LuCI
278     TITLE:=LuCI - Lua Configuration Interface
279     URL:=http://luci.subsignal.org/
280     MAINTAINER:=LuCI Development Team <luci@lists.subsignal.org>
281     SUBMENU:=7. Server Interfaces
282     TITLE:=$(if $(2),$(2),LuCI $(1) server gateway interface)
283         DEPENDS:=$(3)
284   endef
285
286   define Package/luci-sgi-$(1)/install
287         $(call Package/luci/install/template,$$(1),libs/sgi-$(1))
288   endef
289
290   ifneq ($(CONFIG_PACKAGE_luci-sgi-$(1)),)
291     LUCI_SELECTED_MODULES+=libs/sgi-$(1)
292   endif
293
294   LUCI_BUILD_PACKAGES += luci-sgi-$(1)
295 endef
296
297 $(eval $(call sgi,cgi,CGI Gateway behind existing Webserver))
298 $(eval $(call sgi,uhttpd,Binding for the uHTTPd server,+uhttpd +uhttpd-mod-lua))
299
300
301 ### Themes ###
302 define theme
303   define Package/luci-theme-$(1)
304     SECTION:=luci
305     CATEGORY:=LuCI
306     TITLE:=LuCI - Lua Configuration Interface
307     URL:=http://luci.subsignal.org/
308     SUBMENU:=4. Themes
309     TITLE:=$(if $(2),$(2),LuCI $(1) theme)
310         MAINTAINER:=$(if $(3),$(3),LuCI Development Team <luci@lists.subsignal.org>)
311         DEPENDS:=$(if $(filter-out base,$(1)),+luci-theme-base) $(4)
312         $(if $(5),DEFAULT:=PACKAGE_luci-lib-core)
313   endef
314
315   define Package/luci-theme-$(1)/install
316         $(call Package/luci/install/template,$$(1),themes/$(1))
317   endef
318
319   ifneq ($(CONFIG_PACKAGE_luci-theme-$(1)),)
320     LUCI_SELECTED_MODULES+=themes/$(1)
321   endif
322
323   LUCI_BUILD_PACKAGES += luci-theme-$(1)
324 endef
325
326 $(eval $(call theme,base,Common base for all themes))
327 $(eval $(call theme,openwrt,OpenWrt.org))
328 $(eval $(call theme,bootstrap,Bootstrap Theme (default),,,1))
329
330
331 ### Translations ###
332 define translation
333   define Package/luci-i18n-$(1)
334     SECTION:=luci
335     CATEGORY:=LuCI
336     TITLE:=LuCI - Lua Configuration Interface
337     URL:=http://luci.subsignal.org/
338     MAINTAINER:=LuCI Development Team <luci@lists.subsignal.org>
339     SUBMENU:=5. Translations
340     TITLE:=$(if $(2),$(2),$(1))
341   endef
342
343   define Package/luci-i18n-$(1)/install
344         $(call Package/luci/install/template,$$(1),i18n/$(1))
345   endef
346
347   ifneq ($(CONFIG_PACKAGE_luci-i18n-$(1)),)
348     LUCI_SELECTED_MODULES+=i18n/$(1)
349   endif
350
351   LUCI_BUILD_PACKAGES += luci-i18n-$(1)
352 endef
353
354 $(eval $(call translation,german,German))
355 $(eval $(call translation,english,English))
356 $(eval $(call translation,french,French (by Florian Fainelli)))
357 $(eval $(call translation,italian,Italian (by Matteo Croce)))
358 $(eval $(call translation,russian,Russian (by Skryabin Dmitry)))
359 $(eval $(call translation,portuguese-brazilian,Portuguese (Brazilian) (by Carlos Cesario)))
360 $(eval $(call translation,chinese,Chinese (by Chinese Translators)))
361 $(eval $(call translation,japanese,Japanese (by Tsukasa Hamano)))
362 $(eval $(call translation,greek,Greek (by Vasilis Tsiligiannis)))
363 $(eval $(call translation,catalan,Catalan (by Eduard Duran)))
364 $(eval $(call translation,portuguese,Portuguese (by Jose Monteiro)))
365 $(eval $(call translation,spanish,Spanish (by Guillermo Javier Nardoni)))
366 $(eval $(call translation,vietnamese,Vietnamese (by Hong Phuc Dang)))
367 $(eval $(call translation,malay,Malay (by Teow Wai Chet)))
368 $(eval $(call translation,norwegian,Norwegian (by Lars Hardy)))
369 $(eval $(call translation,hebrew,Hebrew))
370 $(eval $(call translation,romanian,Romanian))
371 $(eval $(call translation,ukrainian,Ukrainian))
372 $(eval $(call translation,hungarian,Hungarian))
373 $(eval $(call translation,polish,Polish))
374
375
376 ### Collections ###
377 define collection
378   define Package/luci$(if $(1),-$(1))
379     SECTION:=luci
380     CATEGORY:=LuCI
381     TITLE:=LuCI - Lua Configuration Interface
382     URL:=http://luci.subsignal.org/
383     MAINTAINER:=LuCI Development Team <luci@lists.subsignal.org>
384     SUBMENU:=1. Collections
385     TITLE:=$(if $(2),$(2),LuCI $(if $(1),$(1),general) collection)
386     $(if $(3),DEPENDS:=$(3))
387   endef
388
389   define Package/luci$(if $(1),-$(1))/install
390         true
391   endef
392
393   LUCI_BUILD_PACKAGES += luci$(if $(1),-$(1))
394 endef
395
396 $(eval $(call collection,,\
397         Standard OpenWrt set including full admin with ppp support and the \
398         default OpenWrt theme,\
399         +uhttpd +uhttpd-mod-ubus +luci-mod-admin-full +luci-theme-bootstrap \
400         +luci-app-firewall +luci-proto-core +luci-proto-ppp +libiwinfo-lua))
401
402 $(eval $(call collection,ssl,\
403         Standard OpenWrt set with HTTPS support,\
404         +luci +libustream-polarssl +px5g))
405
406 $(eval $(call collection,light,\
407         Minimum package set using only admin mini and the standard theme,\
408         +uhttpd +luci-mod-admin-mini +luci-theme-openwrt @BROKEN))
409
410
411 ### Compile ###
412 PKG_CONFIG_DEPENDS=$(patsubst %,CONFIG_PACKAGE_%,$(LUCI_BUILD_PACKAGES))
413
414 include $(INCLUDE_DIR)/package.mk
415
416 define Build/Prepare
417         @if [ ! -x $(LUCI_TOPDIR)/build/mkrevision.sh ]; then \
418                 echo "*** Repository layout changed!" >&2; \
419                 echo "*** Please change the LuCI url in feeds.conf to http://svn.luci.subsignal.org/luci/trunk and reinstall the feed with" >&2; \
420                 echo "*** ./scripts/feeds update luci; ./scripts/feeds install -a -p luci" >&2; \
421                 exit 1; \
422         fi
423         mkdir -p $(PKG_BUILD_DIR)
424         $(TAR) c -C $(LUCI_TOPDIR) . \
425                 --exclude=.pc --exclude=.svn --exclude=.git \
426                 --exclude='*.o' --exclude='*.so' \
427                 --exclude=dist | \
428                         tar x -C $(PKG_BUILD_DIR)/
429         $(call Build/Prepare/Default)
430 endef
431
432 define Build/Configure
433 endef
434
435 MAKE_FLAGS += \
436         MODULES="$(LUCI_SELECTED_MODULES)" \
437         LUA_TARGET="$(LUA_TARGET)" \
438         LUA_SHLIBS="-llua -lm -ldl -lcrypt" \
439         CFLAGS="$(TARGET_CFLAGS) $(LUCI_CFLAGS) -I$(STAGING_DIR)/usr/include" \
440         LDFLAGS="$(TARGET_LDFLAGS) -L$(STAGING_DIR)/usr/lib" \
441         NIXIO_TLS="$(NIXIO_TLS)" OS="Linux"
442
443
444 $(foreach b,$(LUCI_BUILD_PACKAGES),$(eval $(call BuildPackage,$(b))))