Merge pull request #237 from openwrt-es/luci-next2
[project/luci.git] / contrib / package / luci-addons / Makefile
1 include $(TOPDIR)/rules.mk
2
3 LUCI_TOPDIR=../../..
4
5 PKG_NAME:=luci-addons
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
23 # 1: luci component
24 # 2: package names
25 define add_deps
26         $(foreach dep,$(2), \
27                 $(if $(patsubst @%,,$(dep)), \
28                         $(if $(patsubst luci-%,,$(dep)), \
29                                 +PACKAGE_luci-$(1):$(dep), \
30                                 +$(dep)), \
31                         $(dep)))
32 endef
33
34 ### Templates ###
35 define Package/luci-addons/install/template
36         $(CP) -a $(PKG_BUILD_DIR)/$(2)/dist/* $(1)/ -R
37         $(CP) -a $(PKG_BUILD_DIR)/$(2)/ipkg/* $(1)/CONTROL/ 2>/dev/null || true
38 endef
39
40
41 ### Community Packages ###
42 define Package/luci-mod-freifunk-community
43   SECTION:=luci
44   CATEGORY:=LuCI
45   TITLE:=LuCI - Lua Configuration Interface
46   URL:=http://luci.subsignal.org/
47   MAINTAINER:=LuCI Development Team <luci@lists.subsignal.org>
48   SUBMENU:=9. Freifunk
49   TITLE:=Freifunk Community Meta-Package
50   DEPENDS+=$(call add_deps,mod-freifunk-community, \
51     iptables-mod-nat-extra iptables-mod-ipopt \
52         luci-app-splash luci-i18n-german \
53         olsrd olsrd-mod-dyn-gw-plain \
54         olsrd-mod-jsoninfo olsrd-mod-nameservice \
55         olsrd-mod-watchdog kmod-tun \
56         ip freifunk-watchdog luci-app-olsr \
57         luci-app-olsr-services freifunk-gwcheck freifunk-mapupdate \
58   )
59 endef
60
61 define Package/luci-mod-freifunk-community/install
62         $(call Package/luci-addons/install/template,$(1),applications/freifunk-community)
63 endef
64
65 ifneq ($(CONFIG_PACKAGE_luci-mod-freifunk-community),)
66         LUCI_SELECTED_MODULES+=applications/freifunk-community
67 endif
68
69 LUCI_BUILD_PACKAGES += luci-mod-freifunk-community
70
71
72 ### Modules ###
73 define module
74   define Package/luci-mod-$(1)
75     SECTION:=luci
76     CATEGORY:=LuCI
77     TITLE:=LuCI - Lua Configuration Interface
78     URL:=http://luci.subsignal.org/
79     MAINTAINER:=LuCI Development Team <luci@lists.subsignal.org>
80     SUBMENU:=2. Modules
81     TITLE:=$(if $(2),$(2),LuCI $(1) module)
82     $(if $(3),DEPENDS+=$(3))
83   endef
84
85   define Package/luci-mod-$(1)/install
86         $(call Package/luci-addons/install/template,$$(1),modules/$(1))
87         $(call Package/luci-mod-$(1)/extra-install)
88   endef
89
90   ifneq ($(CONFIG_PACKAGE_luci-mod-$(1)),)
91     LUCI_SELECTED_MODULES+=modules/$(1)
92   endif
93
94   LUCI_BUILD_PACKAGES += luci-mod-$(1)
95 endef
96
97
98 $(eval $(call module,freifunk,LuCI Freifunk module,+luci-mod-admin-full +luci-lib-json +PACKAGE_luci-mod-freifunk:freifunk-firewall +freifunk-common))
99
100
101 ### Applications ###
102 define application
103   define Package/luci-app-$(1)
104     SECTION:=luci
105     CATEGORY:=LuCI
106     TITLE:=LuCI - Lua Configuration Interface
107     URL:=http://luci.subsignal.org/
108     MAINTAINER:=LuCI Development Team <luci@lists.subsignal.org>
109     SUBMENU:=3. Applications
110     TITLE:=$(if $(2),$(2),LuCI $(1) application)
111         DEPENDS:=$(call add_deps,app-$(1),$(3))
112   endef
113
114   define Package/luci-app-$(1)/install
115         $(call Package/luci-addons/install/template,$$(1),applications/luci-$(1))
116   endef
117
118   ifneq ($(CONFIG_PACKAGE_luci-app-$(1)),)
119     LUCI_SELECTED_MODULES+=applications/luci-$(1)
120   endif
121
122   LUCI_BUILD_PACKAGES += luci-app-$(1)
123 endef
124
125 define Package/luci-app-splash/conffiles
126 /etc/config/luci_splash
127 /usr/lib/luci-splash/splashtext.html
128 /usr/lib/luci-splash/splashtextinclude.html
129 endef
130
131 define Package/luci-app-statistics/conffiles
132 /etc/config/luci_statistics
133 endef
134
135 define Package/luci-app-diag-devinfo/conffiles
136 /etc/config/luci_devinfo
137 endef
138
139
140 $(eval $(call application,siitwizard,SIIT IPv4-over-IPv6 configuration wizard,kmod-siit))
141 $(eval $(call application,freifunk-policyrouting,Policy routing for mesh traffic,freifunk-policyrouting))
142 $(eval $(call application,freifunk-widgets,Widgets for the Freifunk index page,luci-mod-freifunk))
143 $(eval $(call application,meshwizard, Shellscript based wizard to setup mesh networks,meshwizard))
144 $(eval $(call application,olsr,OLSR configuration and status module,olsrd olsrd-mod-jsoninfo luci-lib-luaneightbl))
145 $(eval $(call application,olsr-viz,OLSR Visualisation,luci-app-olsr olsrd olsrd-mod-txtinfo))
146 $(eval $(call application,freifunk-diagnostics,Tools for network diagnosis like traceroute and ping))
147 $(eval $(call application,olsr-services,Show services announced with the nameservice plugin,luci-app-olsr olsrd olsrd-mod-nameservice))
148 $(eval $(call application,splash,Freifunk DHCP-Splash application,luci-lib-nixio tc kmod-sched iptables-mod-nat-extra iptables-mod-ipopt))
149
150 $(eval $(call application,statistics,LuCI Statistics Application,\
151         collectd \
152         rrdtool1 \
153         collectd-mod-rrdtool \
154         collectd-mod-iwinfo \
155         collectd-mod-interface \
156         collectd-mod-load \
157         collectd-mod-network))
158
159
160 $(eval $(call application,diag-core,LuCI Diagnostics Tools (Core)))
161
162 $(eval $(call application,diag-devinfo,LuCI Diagnostics Tools (Device Info),\
163         luci-app-diag-core \
164         smap \
165         netdiscover \
166         mac-to-devinfo \
167         httping \
168         smap-to-devinfo \
169         netdiscover-to-devinfo))
170
171 $(eval $(call application,voice-core,LuCI Voice Software (Core)))
172 $(eval $(call application,voice-diag,LuCI Voice Software (Diagnostics),luci-app-diag-devinfo))
173
174 $(eval $(call application,udpxy,LuCI Support for udpxy,udpxy))
175 $(eval $(call application,upnp,Universal Plug & Play configuration module,miniupnpd))
176 $(eval $(call application,ntpc,NTP time synchronisation configuration module,ntpclient))
177 $(eval $(call application,ddns,Dynamic DNS configuration module,ddns-scripts))
178 $(eval $(call application,dump1090,LuCI Support for dump1090,dump1090))
179 $(eval $(call application,samba,Network Shares - Samba SMB/CIFS module,samba36-server))
180 $(eval $(call application,mmc-over-gpio,MMC-over-GPIO configuration module,kmod-mmc-over-gpio))
181 $(eval $(call application,p910nd,p910nd - Printer server module,p910nd))
182 $(eval $(call application,ushare,uShare - UPnP A/V & DLNA Media Server,ushare))
183 $(eval $(call application,hd-idle,Hard Disk Idle Spin-Down module,hd-idle))
184 $(eval $(call application,tinyproxy,Tinyproxy - HTTP(S)-Proxy configuration,tinyproxy))
185 $(eval $(call application,polipo,LuCI Support for the Polipo Proxy,polipo))
186 $(eval $(call application,openvpn,LuCI Support for OpenVPN,openvpn))
187 $(eval $(call application,p2pblock,LuCI Support for the Freifunk P2P-Block addon,luci-app-firewall freifunk-p2pblock))
188 $(eval $(call application,multiwan,LuCI Support for the OpenWrt MultiWAN agent,luci-app-firewall multiwan))
189 $(eval $(call application,wol,LuCI Support for Wake-on-LAN,etherwake))
190 $(eval $(call application,vnstat,LuCI Support for VnStat,vnstat vnstati))
191 $(eval $(call application,radvd,LuCI Support for Radvd,radvd))
192 $(eval $(call application,ahcp,LuCI Support for AHCPd,ahcpd))
193 $(eval $(call application,wshaper,LuCI Support for wshaper,wshaper))
194
195 $(eval $(call application,pbx,LuCI PBX Administration,\
196         asterisk18 \
197         asterisk18-app-authenticate \
198         asterisk18-app-disa \
199         asterisk18-app-setcallerid \
200         asterisk18-app-system \
201         asterisk18-chan-gtalk \
202         asterisk18-codec-a-mu \
203         asterisk18-codec-alaw \
204         asterisk18-func-cut \
205         asterisk18-res-clioriginate \
206         asterisk18-func-channel \
207         asterisk18-chan-local \
208         asterisk18-app-record \
209         asterisk18-app-senddtmf \
210         asterisk18-res-crypto))
211
212 $(eval $(call application,pbx-voicemail,LuCI PBX Administration Voicemail Support,luci-app-pbx asterisk18 msmtp coreutils-base64))
213 $(eval $(call application,ltqtapi,Lantiq voip))
214 $(eval $(call application,minidlna,LuCI Support for miniDLNA,minidlna))
215 $(eval $(call application,transmission,LuCI Support for Transmission,transmission-daemon))
216 $(eval $(call application,watchcat,LuCI Support for Watchcat,watchcat))
217
218
219 ### Themes ###
220 define theme
221   define Package/luci-theme-$(1)
222     SECTION:=luci
223     CATEGORY:=LuCI
224     TITLE:=LuCI - Lua Configuration Interface
225     URL:=http://luci.subsignal.org/
226     SUBMENU:=4. Themes
227     TITLE:=$(if $(2),$(2),LuCI $(1) theme)
228         MAINTAINER:=$(if $(3),$(3),LuCI Development Team <luci@lists.subsignal.org>)
229         DEPENDS:=+luci-base $(4)
230   endef
231
232   define Package/luci-theme-$(1)/install
233         $(call Package/luci-addons/install/template,$$(1),themes/$(1))
234   endef
235
236   ifneq ($(CONFIG_PACKAGE_luci-theme-$(1)),)
237     LUCI_SELECTED_MODULES+=themes/$(1)
238   endif
239
240   LUCI_BUILD_PACKAGES += luci-theme-$(1)
241 endef
242
243
244 $(eval $(call theme,freifunk-bno,Freifunk Berlin Nordost Theme,\
245         Stefan Pirwitz <stefan-at-freifunk-bno-dot-de>))
246
247 $(eval $(call theme,freifunk-generic,Freifunk Generic Theme,\
248         Manuel Munz <freifunk-at-somakoma-dot-de>))
249
250
251 ### Compile ###
252 PKG_CONFIG_DEPENDS=$(patsubst %,CONFIG_PACKAGE_%,$(LUCI_BUILD_PACKAGES))
253
254 include $(INCLUDE_DIR)/package.mk
255
256 define Build/Prepare
257         @if [ ! -x $(LUCI_TOPDIR)/build/mkrevision.sh ]; then \
258                 echo "*** Repository layout changed!" >&2; \
259                 echo "*** Please change the LuCI url in feeds.conf to http://svn.luci.subsignal.org/luci/trunk and reinstall the feed with" >&2; \
260                 echo "*** ./scripts/feeds update luci; ./scripts/feeds install -a -p luci" >&2; \
261                 exit 1; \
262         fi
263         mkdir -p $(PKG_BUILD_DIR)
264         $(TAR) c -C $(LUCI_TOPDIR) . \
265                 --exclude=.pc --exclude=.svn --exclude=.git \
266                 --exclude='*.o' --exclude='*.so' \
267                 --exclude=dist | \
268                         tar x -C $(PKG_BUILD_DIR)/
269         $(call Build/Prepare/Default)
270 endef
271
272 define Build/Configure
273 endef
274
275 MAKE_FLAGS += \
276         MODULES="$(LUCI_SELECTED_MODULES)" \
277         LUA_TARGET="$(LUA_TARGET)" \
278         LUA_SHLIBS="-llua -lm -ldl -lcrypt" \
279         CFLAGS="$(TARGET_CFLAGS) $(LUCI_CFLAGS) -I$(STAGING_DIR)/usr/include" \
280         LDFLAGS="$(TARGET_LDFLAGS) -L$(STAGING_DIR)/usr/lib" \
281         NIXIO_TLS="$(NIXIO_TLS)" OS="Linux"
282
283
284 $(foreach b,$(LUCI_BUILD_PACKAGES),$(eval $(call BuildPackage,$(b))))