contrib: move luci-app-ocserv to luci-addons, fix recusrive deps
[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) iwinfo
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-base
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-base/install
47         $(call Package/luci/install/template,$(1),modules/base)
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-base/config
56        choice
57                prompt "Build Target"
58                default PACKAGE_luci-base_source
59
60        config PACKAGE_luci-base_compile
61                bool "Precompiled"
62
63        config PACKAGE_luci-base_stripped
64                bool "Stripped"
65
66        config PACKAGE_luci-base_srcdiet
67                bool "Compressed Source"
68
69        config PACKAGE_luci-base_source
70                bool "Full Source"
71
72        endchoice
73 endef
74
75 define Package/luci-base/conffiles
76 /etc/config/luci
77 endef
78
79 ifneq ($(CONFIG_PACKAGE_luci-base_compile),)
80   LUA_TARGET:=compile
81 endif
82
83 ifneq ($(CONFIG_PACKAGE_luci-base_stripped),)
84   LUA_TARGET:=strip
85 endif
86
87 ifneq ($(CONFIG_PACKAGE_luci-base_srcdiet),)
88   LUA_TARGET:=diet
89 endif
90
91 ifneq ($(CONFIG_PACKAGE_luci-base),)
92   LUCI_SELECTED_MODULES+=modules/base
93 endif
94
95 LUCI_BUILD_PACKAGES += luci-base
96
97
98 ### Libraries ###
99 define library
100   define Package/luci-lib-$(1)
101     SECTION:=luci
102     CATEGORY:=LuCI
103     TITLE:=LuCI - Lua Configuration Interface
104     URL:=http://luci.subsignal.org/
105     MAINTAINER:=LuCI Development Team <luci@lists.subsignal.org>
106     SUBMENU:=8. Libraries
107     TITLE:=$(if $(2),$(2),LuCI $(1) library)
108     $(if $(3),DEPENDS:=+luci-base $(3))
109   endef
110
111   define Package/luci-lib-$(1)/install
112         $(call Package/luci/install/template,$$(1),libs/$(1))
113         $(call Package/luci-lib-$(1)/extra-install)
114   endef
115
116   ifneq ($(CONFIG_PACKAGE_luci-lib-$(1)),)
117     LUCI_SELECTED_MODULES+=libs/$(1)
118   endif
119
120   LUCI_BUILD_PACKAGES += luci-lib-$(1)
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-base +luci-lib-nixio))
162 $(eval $(call library,json,LuCI JSON library))
163 $(eval $(call library,nixio,NIXIO POSIX library,+PACKAGE_luci-lib-nixio_openssl:libopenssl +PACKAGE_luci-lib-nixio_cyassl:libcyassl))
164 $(eval $(call library,px5g,RSA/X.509 Key Generator (required for LuCId SSL support),+luci-lib-nixio))
165 $(eval $(call library,luaneightbl,neightbl - Lua lib for IPv6 neighbors,+luci-base))
166
167
168 ### Protocols ###
169 define protocol
170   define Package/luci-proto-$(1)
171     SECTION:=luci
172     CATEGORY:=LuCI
173     TITLE:=LuCI - Lua Configuration Interface
174     URL:=http://luci.subsignal.org/
175     MAINTAINER:=LuCI Development Team <luci@lists.subsignal.org>
176     SUBMENU:=6. Protocols
177     TITLE:=$(if $(2),$(2),LuCI $(1) protocol support)
178     DEPENDS:=$(3)
179   endef
180
181   define Package/luci-proto-$(1)/install
182         $(call Package/luci/install/template,$$(1),protocols/$(1))
183   endef
184
185   ifneq ($(CONFIG_PACKAGE_luci-proto-$(1)),)
186     LUCI_SELECTED_MODULES+=protocols/$(1)
187   endif
188
189   LUCI_BUILD_PACKAGES += luci-proto-$(1)
190 endef
191
192 $(eval $(call protocol,ppp,Support for PPP/PPPoE/PPPoA/PPtP))
193 $(eval $(call protocol,ipv6,Support for DHCPv6/6in4/6to4/6rd/DS-Lite))
194 $(eval $(call protocol,3g,Support for 3G,+PACKAGE_luci-proto-3g:comgt))
195 $(eval $(call protocol,relay,Support for relayd pseudo bridges,+PACKAGE_luci-proto-relay:relayd))
196 $(eval $(call protocol,openconnect,Support for OpenConnect VPN,+openconnect))
197
198 ### Modules ###
199 define module
200   define Package/luci-mod-$(1)
201     SECTION:=luci
202     CATEGORY:=LuCI
203     TITLE:=LuCI - Lua Configuration Interface
204     URL:=http://luci.subsignal.org/
205     MAINTAINER:=LuCI Development Team <luci@lists.subsignal.org>
206     SUBMENU:=2. Modules
207     TITLE:=$(if $(2),$(2),LuCI $(1) module)
208     $(if $(3),DEPENDS+=$(3))
209   endef
210
211   define Package/luci-mod-$(1)/install
212         $(call Package/luci/install/template,$$(1),modules/$(1))
213         $(call Package/luci-mod-$(1)/extra-install)
214   endef
215
216   ifneq ($(CONFIG_PACKAGE_luci-mod-$(1)),)
217     LUCI_SELECTED_MODULES+=modules/$(1)
218   endif
219
220   LUCI_BUILD_PACKAGES += luci-mod-$(1)
221 endef
222
223
224 $(eval $(call module,admin-mini,LuCI Essentials - stripped down and user-friendly,+luci-base @BROKEN))
225 $(eval $(call module,admin-full,LuCI Administration - full-featured for full control,+luci-base))
226 $(eval $(call module,failsafe,LuCI Fail-Safe - Fail-Safe sysupgrade module,+luci-base))
227 $(eval $(call module,rpc,LuCI RPC - JSON-RPC API,+luci-lib-json))
228
229
230 ### Applications ###
231 define application
232   define Package/luci-app-$(1)
233     SECTION:=luci
234     CATEGORY:=LuCI
235     TITLE:=LuCI - Lua Configuration Interface
236     URL:=http://luci.subsignal.org/
237     MAINTAINER:=LuCI Development Team <luci@lists.subsignal.org>
238     SUBMENU:=3. Applications
239     TITLE:=$(if $(2),$(2),LuCI $(1) application)
240         DEPENDS:=$(3)
241   endef
242
243   define Package/luci-app-$(1)/install
244         $(call Package/luci/install/template,$$(1),applications/luci-$(1))
245   endef
246
247   ifneq ($(CONFIG_PACKAGE_luci-app-$(1)),)
248     LUCI_SELECTED_MODULES+=applications/luci-$(1)
249   endif
250
251   LUCI_BUILD_PACKAGES += luci-app-$(1)
252 endef
253
254 $(eval $(call application,firewall,Firewall and Portforwarding application,\
255         +PACKAGE_luci-app-firewall:firewall))
256
257 $(eval $(call application,qos,Quality of Service configuration module,\
258         +PACKAGE_luci-app-qos:qos-scripts))
259
260 $(eval $(call application,commands,LuCI Shell Command Module))
261
262
263 ### Themes ###
264 define theme
265   define Package/luci-theme-$(1)
266     SECTION:=luci
267     CATEGORY:=LuCI
268     TITLE:=LuCI - Lua Configuration Interface
269     URL:=http://luci.subsignal.org/
270     SUBMENU:=4. Themes
271     TITLE:=$(if $(2),$(2),LuCI $(1) theme)
272     MAINTAINER:=$(if $(3),$(3),LuCI Development Team <luci@lists.subsignal.org>)
273   endef
274
275   define Package/luci-theme-$(1)/install
276         $(call Package/luci/install/template,$$(1),themes/$(1))
277   endef
278
279   ifneq ($(CONFIG_PACKAGE_luci-theme-$(1)),)
280     LUCI_SELECTED_MODULES+=themes/$(1)
281   endif
282
283   LUCI_BUILD_PACKAGES += luci-theme-$(1)
284 endef
285
286 $(eval $(call theme,openwrt,OpenWrt.org))
287 $(eval $(call theme,bootstrap,Bootstrap Theme (default)))
288
289
290 ### Translations ###
291 define translation
292   define Package/luci-i18n-$(1)
293     SECTION:=luci
294     CATEGORY:=LuCI
295     TITLE:=LuCI - Lua Configuration Interface
296     URL:=http://luci.subsignal.org/
297     MAINTAINER:=LuCI Development Team <luci@lists.subsignal.org>
298     SUBMENU:=5. Translations
299     TITLE:=$(if $(2),$(2),$(1))
300   endef
301
302   define Package/luci-i18n-$(1)/install
303         $(call Package/luci/install/template,$$(1),i18n/$(1))
304   endef
305
306   ifneq ($(CONFIG_PACKAGE_luci-i18n-$(1)),)
307     LUCI_SELECTED_MODULES+=i18n/$(1)
308   endif
309
310   LUCI_BUILD_PACKAGES += luci-i18n-$(1)
311 endef
312
313 $(eval $(call translation,german,German))
314 $(eval $(call translation,english,English))
315 $(eval $(call translation,french,French (by Florian Fainelli)))
316 $(eval $(call translation,italian,Italian (by Matteo Croce)))
317 $(eval $(call translation,russian,Russian (by Skryabin Dmitry)))
318 $(eval $(call translation,portuguese-brazilian,Portuguese (Brazilian) (by Carlos Cesario)))
319 $(eval $(call translation,chinese,Chinese (by Chinese Translators)))
320 $(eval $(call translation,japanese,Japanese (by Tsukasa Hamano)))
321 $(eval $(call translation,greek,Greek (by Vasilis Tsiligiannis)))
322 $(eval $(call translation,catalan,Catalan (by Eduard Duran)))
323 $(eval $(call translation,portuguese,Portuguese (by Jose Monteiro)))
324 $(eval $(call translation,spanish,Spanish (by Guillermo Javier Nardoni)))
325 $(eval $(call translation,vietnamese,Vietnamese (by Hong Phuc Dang)))
326 $(eval $(call translation,malay,Malay (by Teow Wai Chet)))
327 $(eval $(call translation,norwegian,Norwegian (by Lars Hardy)))
328 $(eval $(call translation,hebrew,Hebrew))
329 $(eval $(call translation,romanian,Romanian))
330 $(eval $(call translation,ukrainian,Ukrainian))
331 $(eval $(call translation,hungarian,Hungarian))
332 $(eval $(call translation,polish,Polish))
333
334
335 ### Collections ###
336 define collection
337   define Package/luci$(if $(1),-$(1))
338     SECTION:=luci
339     CATEGORY:=LuCI
340     TITLE:=LuCI - Lua Configuration Interface
341     URL:=http://luci.subsignal.org/
342     MAINTAINER:=LuCI Development Team <luci@lists.subsignal.org>
343     SUBMENU:=1. Collections
344     TITLE:=$(if $(2),$(2),LuCI $(if $(1),$(1),general) collection)
345     $(if $(3),DEPENDS:=$(3))
346   endef
347
348   define Package/luci$(if $(1),-$(1))/install
349         true
350   endef
351
352   LUCI_BUILD_PACKAGES += luci$(if $(1),-$(1))
353 endef
354
355 $(eval $(call collection,,\
356         Standard OpenWrt set including full admin with ppp support and the \
357         default OpenWrt theme,\
358         +uhttpd +uhttpd-mod-ubus +luci-mod-admin-full +luci-theme-bootstrap \
359         +luci-app-firewall +luci-proto-ppp +libiwinfo-lua +luci-lib-nixio))
360
361 $(eval $(call collection,ssl,\
362         Standard OpenWrt set with HTTPS support,\
363         +luci +libustream-polarssl +px5g))
364
365 $(eval $(call collection,light,\
366         Minimum package set using only admin mini and the standard theme,\
367         +uhttpd +luci-mod-admin-mini +luci-theme-openwrt @BROKEN))
368
369
370 ### Compile ###
371 PKG_CONFIG_DEPENDS=$(patsubst %,CONFIG_PACKAGE_%,$(LUCI_BUILD_PACKAGES))
372
373 include $(INCLUDE_DIR)/package.mk
374
375 define Build/Prepare
376         @if [ ! -x $(LUCI_TOPDIR)/build/mkrevision.sh ]; then \
377                 echo "*** Repository layout changed!" >&2; \
378                 echo "*** Please change the LuCI url in feeds.conf to http://svn.luci.subsignal.org/luci/trunk and reinstall the feed with" >&2; \
379                 echo "*** ./scripts/feeds update luci; ./scripts/feeds install -a -p luci" >&2; \
380                 exit 1; \
381         fi
382         mkdir -p $(PKG_BUILD_DIR)
383         $(TAR) c -C $(LUCI_TOPDIR) . \
384                 --exclude=.pc --exclude=.svn --exclude=.git \
385                 --exclude='*.o' --exclude='*.so' \
386                 --exclude=dist | \
387                         tar x -C $(PKG_BUILD_DIR)/
388         $(call Build/Prepare/Default)
389 endef
390
391 define Build/Configure
392 endef
393
394 MAKE_FLAGS += \
395         MODULES="$(LUCI_SELECTED_MODULES)" \
396         LUA_TARGET="$(LUA_TARGET)" \
397         LUA_SHLIBS="-llua -lm -ldl -lcrypt" \
398         CFLAGS="$(TARGET_CFLAGS) $(LUCI_CFLAGS) -I$(STAGING_DIR)/usr/include" \
399         LDFLAGS="$(TARGET_LDFLAGS) -L$(STAGING_DIR)/usr/lib" \
400         NIXIO_TLS="$(NIXIO_TLS)" OS="Linux"
401
402
403 $(foreach b,$(LUCI_BUILD_PACKAGES),$(eval $(call BuildPackage,$(b))))