d1995f330c7cdb167841b6f896fb5873b4c8ee0a
[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:=compile LUAC=$(BUILD_DIR_HOST)/lua/luac
20 LUA_TARGET:=source
21 PKG_SELECTED_MODULES:=
22
23
24 include $(INCLUDE_DIR)/package.mk
25
26 define Build/Configure
27 endef
28
29
30 define Build/Compile 
31         for i in '$(PKG_SELECTED_MODULES)'; do $(MAKE) -C$(PKG_BUILD_DIR)/$$i build LUA_TARGET=$(LUA_TARGET); done
32 endef
33
34 ### Templates ###
35
36 define Package/luci/libtemplate
37   SECTION:=admin
38   CATEGORY:=Administration
39   TITLE:=LuCI - Lua Configuration Interface
40   URL:=http://luci.freifunk-halle.net/
41   MAINTAINER:=Steven Barth <steven-at-midlink-dot-org>
42   SUBMENU:=LuCI - Libraries
43   DEPENDS:=+luci-core
44 endef
45
46 define Package/luci/fftemplate
47   $(call Package/luci/libtemplate)
48   SUBMENU:=LuCI - Freifunk Support
49   DEPENDS:=+luci-mod-freifunk
50 endef
51
52 define Package/luci/webtemplate
53   $(call Package/luci/libtemplate)
54   SUBMENU:=LuCI - Webinterface Components
55 endef
56
57
58 define Package/luci/install/template
59         $(CP) $(PKG_BUILD_DIR)/$(2)/dist/* $(1)/ -R
60 endef
61
62
63
64 ### Core package ###
65
66 define Package/luci-core
67   $(call Package/luci/libtemplate)
68   DEPENDS:=+lua +luaposix
69   TITLE:=LuCI core libraries
70 endef
71
72 define Package/luci-core/install                
73         $(call Package/luci/install/template,$(1),libs/core)
74 endef
75
76
77 ### Libraries ###
78 define Package/luci-cbi
79   $(call Package/luci/libtemplate)
80   DEPENDS+=+luci-web
81   TITLE:=Configuration Binding Interface
82 endef
83
84 define Package/luci-cbi/install
85         $(call Package/luci/install/template,$(1),libs/cbi)
86 endef
87
88
89 define Package/luci-web
90   $(call Package/luci/libtemplate)
91   DEPENDS+=+luci-addons
92   TITLE:=MVC Webframework
93 endef
94
95 define Package/luci-web/conffiles
96 /etc/config/luci
97 endef
98
99 define Package/luci-web/install
100         $(call Package/luci/install/template,$(1),libs/web)
101         $(call Package/luci/install/template,$(1),themes/fledermaus)
102 endef
103
104
105
106 ### Community Packages ###
107
108 define Package/luci-ff-halle
109   $(call Package/luci/fftemplate)
110   DEPENDS+= \
111    +luci-sgi-haserl +luci-app-splash \
112    +luci-app-ffwizard-leipzig \
113    +olsrd +olsrd-mod-dyn-gw +olsrd-mod-txtinfo +olsrd-mod-nameservice \
114    +kmod-tun +ip
115   TITLE:=Freifunk Halle Community Meta-Package
116 endef
117
118 define Package/luci-ff-halle/install
119         $(call Package/luci/install/template,$(1),applications/community-halle)
120         $(CP) -a ./ipkg/luci-ff-halle.postinst $(1)/CONTROL/postinst
121 endef
122
123
124 define Package/luci-ff-leipzig
125   $(call Package/luci/fftemplate)
126   DEPENDS+= \
127    +luci-sgi-haserl +luci-app-splash \
128    +luci-app-ffwizard-leipzig \
129    +olsrd +olsrd-mod-dyn-gw +olsrd-mod-txtinfo +olsrd-mod-nameservice \
130    +kmod-tun +ip
131   TITLE:=Freifunk Leipzig Community Meta-Package
132 endef
133
134 define Package/luci-ff-leipzig/install
135         $(call Package/luci/install/template,$(1),applications/community-leipzig)
136         $(CP) -a ./ipkg/luci-ff-leipzig.postinst $(1)/CONTROL/postinst
137 endef
138
139
140 define Package/luci-ff-hannover
141   $(call Package/luci/fftemplate)
142   DEPENDS+= \
143    +luci-sgi-haserl +luci-app-splash \
144    +olsrd +olsrd-mod-dyn-gw +olsrd-mod-txtinfo +olsrd-mod-nameservice
145   TITLE:=Freifunk Hannover Community Meta-Package
146   URL:=http://www.freifunk-hannover.de/
147   MAINTAINER:=Mickey Knox <mickey-at-netfreaks-dot-org>
148 endef
149
150 define Package/luci-ff-hannover/install
151         $(call Package/luci/install/template,$(1),applications/community-hannover)
152         $(CP) -a ./ipkg/luci-ff-hannover.postinst $(1)/CONTROL/postinst
153 endef
154
155
156 ### Modules ###
157
158 define Package/luci-mod-admin-core
159   $(call Package/luci/webtemplate)
160   DEPENDS+=+luci-web +luci-cbi
161   TITLE:=Administration module
162 endef
163
164 define Package/luci-mod-admin-core/install
165         $(call Package/luci/install/template,$(1),modules/admin-core)
166 endef
167
168
169 define Package/luci-mod-freifunk
170   $(call Package/luci/fftemplate)
171   DEPENDS:=+luci-mod-admin-core
172   TITLE:=LuCI Freifunk module
173 endef
174
175 define Package/luci-mod-freifunk/conffiles
176 /etc/config/freifunk
177 endef
178
179 define Package/luci-mod-freifunk/install
180         $(call Package/luci/install/template,$(1),modules/freifunk)
181 endef
182
183
184
185 ### Applications ###
186
187 define Package/luci-app-ffwizard-leipzig
188   $(call Package/luci/fftemplate)
189   DEPENDS+=+luci-app-firewall
190   TITLE:=Freifunk Leipzig configuration wizard
191 endef
192
193 define Package/luci-app-ffwizard-leipzig/install
194         $(call Package/luci/install/template,$(1),applications/luci-ffwizard-leipzig)
195 endef
196
197
198 define Package/luci-app-firewall
199   $(call Package/luci/webtemplate)
200   DEPENDS+=+luci-mod-admin-core
201   TITLE:=Firewall and Portforwarding application
202 endef
203
204 define Package/luci-app-firewall/conffiles
205 /etc/config/luci_fw
206 endef
207
208 define Package/luci-app-firewall/install
209         $(call Package/luci/install/template,$(1),applications/luci-fw)
210         $(INSTALL_BIN) $(PKG_BUILD_DIR)/applications/luci-fw/dist/etc/init.d/luci_fw $(1)/etc/init.d
211 endef
212
213
214 define Package/luci-app-splash
215   $(call Package/luci/fftemplate)
216   DEPENDS+=+luci-sgi-haserl +iptables-mod-nat +iptables-mod-ipopt
217   TITLE:=Freifunk DHCP-Splash application
218 endef
219
220 define Package/luci-app-splash/conffiles
221 /etc/config/luci_splash
222 endef
223
224 define Package/luci-app-splash/install
225         $(call Package/luci/install/template,$(1),applications/luci-splash)
226         $(INSTALL_BIN) $(PKG_BUILD_DIR)/applications/luci-splash/dist/usr/sbin/luci-splash $(1)/usr/sbin
227         $(INSTALL_BIN) $(PKG_BUILD_DIR)/applications/luci-splash/dist/etc/init.d/luci_splash $(1)/etc/init.d
228         $(INSTALL_BIN) $(PKG_BUILD_DIR)/applications/luci-splash/dist/etc/cron.minutely/luci_splash $(1)/etc/cron.minutely
229         $(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
230         $(INSTALL_BIN) $(PKG_BUILD_DIR)/applications/luci-splash/dist/www/cgi-bin/luci-splash $(1)/www/cgi-bin/luci-splash
231 endef
232
233
234 define Package/luci-app-statistics
235   $(call Package/luci/webtemplate)
236   DEPENDS+=+luci-mod-admin-core +collectd +collectd-mod-rrdtool1 +rrdtool1
237   TITLE:=LuCI Statistics Application (incomplete)
238 endef
239
240 define Package/luci-app-statistics/conffiles
241 /etc/config/luci_statistics
242 endef
243
244 define Package/luci-app-statistics/install
245         $(call Package/luci/install/template,$(1),applications/luci-statistics)
246         $(INSTALL_BIN) $(PKG_BUILD_DIR)/applications/luci-statistics/dist/usr/bin/stat-genconfig $(1)/usr/bin
247         $(INSTALL_BIN) $(PKG_BUILD_DIR)/applications/luci-statistics/dist/etc/init.d/luci_statistics $(1)/etc/init.d
248 endef
249
250
251 ### Server Gateway Interfaces ###
252
253 define Package/luci-sgi-haserl
254   $(call Package/luci/libtemplate)
255   DEPENDS+=+luci-web +haserl-lua
256   TITLE:=SGI for Haserl
257 endef
258
259 define Package/luci-sgi-haserl/install
260         $(call Package/luci/install/template,$(1),libs/sgi-haserl)
261         $(CP) -a ./ipkg/luci-sgi-haserl.postinst $(1)/CONTROL/postinst
262 endef
263
264
265 define Package/luci-sgi-webuci
266   $(call Package/luci/libtemplate)
267   DEPENDS+=+luci-web
268   TITLE:=SGI for Webuci
269 endef
270
271 define Package/luci-sgi-webuci/install
272         $(call Package/luci/install/template,$(1),libs/sgi-webuci)
273 endef
274
275 ### Compile Templates ###
276 ifneq ($(CONFIG_PACKAGE_luci-core),)
277         PKG_SELECTED_MODULES+=libs/core
278 endif
279 ifneq ($(CONFIG_PACKAGE_luci-cbi),)
280         PKG_SELECTED_MODULES+=libs/cbi
281 endif
282 ifneq ($(CONFIG_PACKAGE_luci-web),)
283         PKG_SELECTED_MODULES+=libs/web
284 endif
285
286 ifneq ($(CONFIG_PACKAGE_luci-ff-halle),)
287         PKG_SELECTED_MODULES+=applications/community-halle
288 endif
289 ifneq ($(CONFIG_PACKAGE_luci-ff-leipzig),)
290         PKG_SELECTED_MODULES+=applications/community-leipzig
291 endif
292 ifneq ($(CONFIG_PACKAGE_luci-ff-hannover),)
293         PKG_SELECTED_MODULES+=applications/community-hannover
294 endif
295
296 ifneq ($(CONFIG_PACKAGE_luci-mod-admin-core),)
297         PKG_SELECTED_MODULES+=modules/admin-core
298 endif
299 ifneq ($(CONFIG_PACKAGE_luci-mod-freifunk),)
300         PKG_SELECTED_MODULES+=modules/freifunk
301 endif
302
303 ifneq ($(CONFIG_PACKAGE_luci-app-ffwizard-leipzig),)
304         PKG_SELECTED_MODULES+=applications/luci-ffwizard-leipzig
305 endif
306 ifneq ($(CONFIG_PACKAGE_luci-app-splash),)
307         PKG_SELECTED_MODULES+=applications/luci-splash
308 endif
309 ifneq ($(CONFIG_PACKAGE_luci-app-statistics),)
310         PKG_SELECTED_MODULES+=applications/luci-statistics
311 endif
312
313 ifneq ($(CONFIG_PACKAGE_luci-sgi-haserl),)
314         PKG_SELECTED_MODULES+=libs/sgi-haserl
315 endif
316 ifneq ($(CONFIG_PACKAGE_luci-sgi-webuci),)
317         PKG_SELECTED_MODULES+=libs/sgi-webuci
318 endif
319
320
321 $(eval $(call BuildPackage,luci-core))
322 $(eval $(call BuildPackage,luci-cbi))
323 $(eval $(call BuildPackage,luci-web))
324
325 $(eval $(call BuildPackage,luci-ff-halle))
326 $(eval $(call BuildPackage,luci-ff-leipzig))
327 $(eval $(call BuildPackage,luci-ff-hannover))
328
329 $(eval $(call BuildPackage,luci-mod-admin-core))
330 $(eval $(call BuildPackage,luci-mod-freifunk))
331
332 $(eval $(call BuildPackage,luci-app-ffwizard-leipzig))
333 $(eval $(call BuildPackage,luci-app-firewall))
334 $(eval $(call BuildPackage,luci-app-splash))
335 $(eval $(call BuildPackage,luci-app-statistics))
336
337 $(eval $(call BuildPackage,luci-sgi-haserl))
338 $(eval $(call BuildPackage,luci-sgi-webuci))