luci-app-statistics: stat-genconfig: don't emit bools for absent uci options
[project/luci.git] / docs / Modules.md
1 # Categories
2
3 The LuCI modules are divided into several category directories, namely:
4 * applications (Single applications or plugins for other modules or applications)
5 * i18n (Translation files)
6 * libs (Independent libraries)
7 * modules (Collections of applications)
8 * themes (Frontend themes)
9
10 Each module goes into a subdirectory of any of this category-directories.
11
12 # Module directory
13 The contents of a module directory are as follows:
14
15 ## Makefile
16 This is the module's makefile. If the module just contains Lua sourcecode or resources then the following Makefile should suffice.
17
18 include ../../build/config.mk
19 include ../../build/module.mk
20
21
22 If you have C(++) code in your module your Makefile should at least contain the following things.
23
24 include ../../build/config.mk
25 include ../../build/gccconfig.mk
26 include ../../build/module.mk
27
28 compile:
29 # Commands to compile and link your C-code
30 # and to install them under the dist/ hierarchy
31
32 clean: luaclean
33 # Commands to clean your compiled objects
34
35
36
37 ## src
38 The *src* directory is reserved for C sourcecode.
39
40 ## luasrc
41 *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.
42
43 ## lua
44 *lua* is equivalent to _luasrc_ but containing Lua files will be installed in the Lua document root.
45
46 ## htdocs
47 All files under *htdocs* will be copied to the document root of the target webserver.
48
49 ## root
50 All directories and files under *root* will be copied to the installation target as they are.
51
52 ## dist
53 *dist* is reserved for the builder to create a working installation tree that will represent the filesystem on the target machine.
54 *DO NOT* put any files there as they will get deleted.
55
56 ## ipkg
57 *ipkg* contains IPKG package control files, like _preinst'', ''posinst'', ''prerm'', ''postrm''. ''conffiles_.
58 See IPKG documentation for details.
59
60
61 # OpenWRT feed integration
62 If you want to add your module to the LuCI OpenWRT feed you have to add several sections to the contrib/package/luci/Makefile.
63
64 For a Web UI applications this is:
65
66 A package description:
67
68 define Package/luci-app-YOURMODULE
69 $(call Package/luci/webtemplate)
70 DEPENDS+=+some-package +some-other-package
71 TITLE:=SHORT DESCRIPTION OF YOURMODULE
72 endef
73
74
75
76 A package installation target:
77
78 define Package/luci-app-YOURMODULE/install
79 $(call Package/luci/install/template,$(1),applications/YOURMODULE)
80 endef
81
82
83 A module build instruction:
84
85 ifneq ($(CONFIG_PACKAGE_luci-app-YOURMODULE),)
86 PKG_SELECTED_MODULES+=applications/YOURMODULE
87 endif
88
89
90
91 A build package call:
92
93 $(eval $(call BuildPackage,luci-app-YOURMODULE))
94