1 # Reference: LuCI Modules
3 See [online wiki](https://github.com/openwrt/luci/wiki/Modules) for latest version.
7 The LuCI modules are divided into several category directories, namely:
8 * applications - Single applications or plugins for other modules
9 * i18n - Translation files
10 * libs - libraries of Luci
11 * modules - main modules of Luci itself
12 * protocols - network related plugins
13 * themes - Frontend themes
15 Each module goes into a subdirectory of this category-directories.
18 The contents of a module directory are as follows:
21 This is the module's makefile. If the module just contains Lua sourcecode or resources then the following Makefile should suffice.
23 include $(TOPDIR)/rules.mk
25 LUCI_TITLE:=Title of my example applications
26 LUCI_DEPENDS:=+some-package +libsome-library +luci-app-anotherthing
30 # call BuildPackage - OpenWrt buildroot signature
33 If you have C(++) code in your module you should include a `src/` subdirectory containing another Makefile supporting a `clean`, a `compile` and an `install` target.
34 The `install` target should deploy its files relative to the predefined `$(DESTDIR)` variable, e.g.
36 mkdir -p $(DESTDIR)/usr/bin; cp myexecutable $(DESTDIR)/usr/bin/myexecutable
40 The `src` directory is reserved for C sourcecode.
43 `luasrc` contains all Lua sourcecode files. These will automatically be stripped or compiled depending on the Make target and are installed in the LuCI installation directory.
46 `lua` is equivalent to `luasrc` but containing Lua files will be installed in the Lua document root.
49 All files under `htdocs` will be copied to the document root of the target webserver.
52 All directories and files under `root` will be copied to the installation target as they are.
55 `dist` is reserved for the builder to create a working installation tree that will represent the filesystem on the target machine.
56 **DO NOT** put any files there as they will get deleted.
59 `ipkg` contains IPKG package control files, like `preinst`, `posinst`, `prerm`, `postrm`. `conffiles`.
60 See IPKG documentation for details.
63 ## OpenWRT feed integration
64 If you want to add your module to the LuCI OpenWRT feed you have to add several sections to the `contrib/package/luci/Makefile`.
66 For a Web UI applications this is:
68 A package description:
70 define Package/luci-app-YOURMODULE
71 $(call Package/luci/webtemplate)
72 DEPENDS+=+some-package +some-other-package
73 TITLE:=SHORT DESCRIPTION OF YOURMODULE
77 A package installation target:
79 define Package/luci-app-YOURMODULE/install
80 $(call Package/luci/install/template,$(1),applications/YOURMODULE)
84 A module build instruction:
86 ifneq ($(CONFIG_PACKAGE_luci-app-YOURMODULE),)
87 PKG_SELECTED_MODULES+=applications/YOURMODULE
93 $(eval $(call BuildPackage,luci-app-YOURMODULE))