Merge pull request #222 from iXit/master
[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,upnp,Universal Plug & Play configuration module,miniupnpd))
175 $(eval $(call application,ntpc,NTP time synchronisation configuration module,ntpclient))
176 $(eval $(call application,ddns,Dynamic DNS configuration module,ddns-scripts))
177 $(eval $(call application,samba,Network Shares - Samba SMB/CIFS module,samba36-server))
178 $(eval $(call application,mmc-over-gpio,MMC-over-GPIO configuration module,kmod-mmc-over-gpio))
179 $(eval $(call application,p910nd,p910nd - Printer server module,p910nd))
180 $(eval $(call application,ushare,uShare - UPnP A/V & DLNA Media Server,ushare))
181 $(eval $(call application,hd-idle,Hard Disk Idle Spin-Down module,hd-idle))
182 $(eval $(call application,tinyproxy,Tinyproxy - HTTP(S)-Proxy configuration,tinyproxy))
183 $(eval $(call application,polipo,LuCI Support for the Polipo Proxy,polipo))
184 $(eval $(call application,openvpn,LuCI Support for OpenVPN,openvpn))
185 $(eval $(call application,p2pblock,LuCI Support for the Freifunk P2P-Block addon,luci-app-firewall freifunk-p2pblock))
186 $(eval $(call application,multiwan,LuCI Support for the OpenWrt MultiWAN agent,luci-app-firewall multiwan))
187 $(eval $(call application,wol,LuCI Support for Wake-on-LAN,etherwake))
188 $(eval $(call application,vnstat,LuCI Support for VnStat,vnstat vnstati))
189 $(eval $(call application,radvd,LuCI Support for Radvd,radvd))
190 $(eval $(call application,ahcp,LuCI Support for AHCPd,ahcpd))
191 $(eval $(call application,wshaper,LuCI Support for wshaper,wshaper))
192
193 $(eval $(call application,pbx,LuCI PBX Administration,\
194         asterisk18 \
195         asterisk18-app-authenticate \
196         asterisk18-app-disa \
197         asterisk18-app-setcallerid \
198         asterisk18-app-system \
199         asterisk18-chan-gtalk \
200         asterisk18-codec-a-mu \
201         asterisk18-codec-alaw \
202         asterisk18-func-cut \
203         asterisk18-res-clioriginate \
204         asterisk18-func-channel \
205         asterisk18-chan-local \
206         asterisk18-app-record \
207         asterisk18-app-senddtmf \
208         asterisk18-res-crypto))
209
210 $(eval $(call application,pbx-voicemail,LuCI PBX Administration Voicemail Support,luci-app-pbx asterisk18 msmtp coreutils-base64))
211 $(eval $(call application,ltqtapi,Lantiq voip))
212 $(eval $(call application,minidlna,LuCI Support for miniDLNA,minidlna))
213 $(eval $(call application,transmission,LuCI Support for Transmission,transmission-daemon))
214 $(eval $(call application,watchcat,LuCI Support for Watchcat,watchcat))
215
216
217 ### Themes ###
218 define theme
219   define Package/luci-theme-$(1)
220     SECTION:=luci
221     CATEGORY:=LuCI
222     TITLE:=LuCI - Lua Configuration Interface
223     URL:=http://luci.subsignal.org/
224     SUBMENU:=4. Themes
225     TITLE:=$(if $(2),$(2),LuCI $(1) theme)
226         MAINTAINER:=$(if $(3),$(3),LuCI Development Team <luci@lists.subsignal.org>)
227         DEPENDS:=+luci-base $(4)
228   endef
229
230   define Package/luci-theme-$(1)/install
231         $(call Package/luci-addons/install/template,$$(1),themes/$(1))
232   endef
233
234   ifneq ($(CONFIG_PACKAGE_luci-theme-$(1)),)
235     LUCI_SELECTED_MODULES+=themes/$(1)
236   endif
237
238   LUCI_BUILD_PACKAGES += luci-theme-$(1)
239 endef
240
241
242 $(eval $(call theme,freifunk-bno,Freifunk Berlin Nordost Theme,\
243         Stefan Pirwitz <stefan-at-freifunk-bno-dot-de>))
244
245 $(eval $(call theme,freifunk-generic,Freifunk Generic Theme,\
246         Manuel Munz <freifunk-at-somakoma-dot-de>))
247
248
249 ### Compile ###
250 PKG_CONFIG_DEPENDS=$(patsubst %,CONFIG_PACKAGE_%,$(LUCI_BUILD_PACKAGES))
251
252 include $(INCLUDE_DIR)/package.mk
253
254 define Build/Prepare
255         @if [ ! -x $(LUCI_TOPDIR)/build/mkrevision.sh ]; then \
256                 echo "*** Repository layout changed!" >&2; \
257                 echo "*** Please change the LuCI url in feeds.conf to http://svn.luci.subsignal.org/luci/trunk and reinstall the feed with" >&2; \
258                 echo "*** ./scripts/feeds update luci; ./scripts/feeds install -a -p luci" >&2; \
259                 exit 1; \
260         fi
261         mkdir -p $(PKG_BUILD_DIR)
262         $(TAR) c -C $(LUCI_TOPDIR) . \
263                 --exclude=.pc --exclude=.svn --exclude=.git \
264                 --exclude='*.o' --exclude='*.so' \
265                 --exclude=dist | \
266                         tar x -C $(PKG_BUILD_DIR)/
267         $(call Build/Prepare/Default)
268 endef
269
270 define Build/Configure
271 endef
272
273 MAKE_FLAGS += \
274         MODULES="$(LUCI_SELECTED_MODULES)" \
275         LUA_TARGET="$(LUA_TARGET)" \
276         LUA_SHLIBS="-llua -lm -ldl -lcrypt" \
277         CFLAGS="$(TARGET_CFLAGS) $(LUCI_CFLAGS) -I$(STAGING_DIR)/usr/include" \
278         LDFLAGS="$(TARGET_LDFLAGS) -L$(STAGING_DIR)/usr/lib" \
279         NIXIO_TLS="$(NIXIO_TLS)" OS="Linux"
280
281
282 $(foreach b,$(LUCI_BUILD_PACKAGES),$(eval $(call BuildPackage,$(b))))