summaryrefslogtreecommitdiffhomepage
path: root/docs/Modules.md
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2023-08-12 01:44:06 +0200
committerGitHub <noreply@github.com>2023-08-12 01:44:06 +0200
commit306da3c30ad9a334ba60e6e8431726b1220b8ccd (patch)
tree6839460fa242e64474ae98f2ccea2072fd1d0d3e /docs/Modules.md
parent4c3584bbdc1abe377c4b85099740f61d3213c1c5 (diff)
parent155d2bdd6ed787c553a1f338ee77478a1e3a1262 (diff)
Merge pull request #6513 from stokito/luci-docs
docs: Synchronize with Wiki
Diffstat (limited to 'docs/Modules.md')
-rw-r--r--docs/Modules.md132
1 files changed, 66 insertions, 66 deletions
diff --git a/docs/Modules.md b/docs/Modules.md
index 2897df9488..0c9852954e 100644
--- a/docs/Modules.md
+++ b/docs/Modules.md
@@ -1,94 +1,94 @@
-# Categories
+# Reference: LuCI Modules
+
+See [online wiki](https://github.com/openwrt/luci/wiki/Modules) for latest version.
+
+## Categories
The LuCI modules are divided into several category directories, namely:
-* applications (Single applications or plugins for other modules or applications)
-* i18n (Translation files)
-* libs (Independent libraries)
-* modules (Collections of applications)
-* themes (Frontend themes)
+* applications - Single applications or plugins for other modules
+* i18n - Translation files
+* libs - libraries of Luci
+* modules - main modules of Luci itself
+* protocols - network related plugins
+* themes - Frontend themes
-Each module goes into a subdirectory of any of this category-directories.
+Each module goes into a subdirectory of this category-directories.
-# Module directory
+## Module directory
The contents of a module directory are as follows:
-## Makefile
+### Makefile
This is the module's makefile. If the module just contains Lua sourcecode or resources then the following Makefile should suffice.
-
- include ../../build/config.mk
- include ../../build/module.mk
-
-
-If you have C(++) code in your module your Makefile should at least contain the following things.
-
- include ../../build/config.mk
- include ../../build/gccconfig.mk
- include ../../build/module.mk
-
- compile:
- # Commands to compile and link your C-code
- # and to install them under the dist/ hierarchy
-
- clean: luaclean
- # Commands to clean your compiled objects
-
+```Makefile
+include $(TOPDIR)/rules.mk
+
+LUCI_TITLE:=Title of my example applications
+LUCI_DEPENDS:=+some-package +libsome-library +luci-app-anotherthing
+
+include ../../luci.mk
+
+# call BuildPackage - OpenWrt buildroot signature
+```
+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.
+The `install` target should deploy its files relative to the predefined `$(DESTDIR)` variable, e.g.
+```
+mkdir -p $(DESTDIR)/usr/bin; cp myexecutable $(DESTDIR)/usr/bin/myexecutable
+```
-## src
-The *src* directory is reserved for C sourcecode.
+### src
+The `src` directory is reserved for C sourcecode.
-## luasrc
-*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.
+### luasrc
+`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.
-## lua
-*lua* is equivalent to _luasrc_ but containing Lua files will be installed in the Lua document root.
+### lua
+`lua` is equivalent to `luasrc` but containing Lua files will be installed in the Lua document root.
-## htdocs
-All files under *htdocs* will be copied to the document root of the target webserver.
+### htdocs
+All files under `htdocs` will be copied to the document root of the target webserver.
-## root
-All directories and files under *root* will be copied to the installation target as they are.
+### root
+All directories and files under `root` will be copied to the installation target as they are.
-## dist
-*dist* is reserved for the builder to create a working installation tree that will represent the filesystem on the target machine.
-*DO NOT* put any files there as they will get deleted.
+### dist
+`dist` is reserved for the builder to create a working installation tree that will represent the filesystem on the target machine.
+**DO NOT** put any files there as they will get deleted.
-## ipkg
-*ipkg* contains IPKG package control files, like _preinst'', ''posinst'', ''prerm'', ''postrm''. ''conffiles_.
+### ipkg
+`ipkg` contains IPKG package control files, like `preinst`, `posinst`, `prerm`, `postrm`. `conffiles`.
See IPKG documentation for details.
-# OpenWRT feed integration
-If you want to add your module to the LuCI OpenWRT feed you have to add several sections to the contrib/package/luci/Makefile.
+## OpenWRT feed integration
+If you want to add your module to the LuCI OpenWRT feed you have to add several sections to the `contrib/package/luci/Makefile`.
For a Web UI applications this is:
A package description:
-
- define Package/luci-app-YOURMODULE
- $(call Package/luci/webtemplate)
- DEPENDS+=+some-package +some-other-package
- TITLE:=SHORT DESCRIPTION OF YOURMODULE
- endef
-
-
+```Makefile
+define Package/luci-app-YOURMODULE
+ $(call Package/luci/webtemplate)
+ DEPENDS+=+some-package +some-other-package
+ TITLE:=SHORT DESCRIPTION OF YOURMODULE
+endef
+```
A package installation target:
-
- define Package/luci-app-YOURMODULE/install
- $(call Package/luci/install/template,$(1),applications/YOURMODULE)
- endef
-
+```Makefile
+define Package/luci-app-YOURMODULE/install
+ $(call Package/luci/install/template,$(1),applications/YOURMODULE)
+endef
+```
A module build instruction:
-
- ifneq ($(CONFIG_PACKAGE_luci-app-YOURMODULE),)
- PKG_SELECTED_MODULES+=applications/YOURMODULE
- endif
-
-
+```Makefile
+ifneq ($(CONFIG_PACKAGE_luci-app-YOURMODULE),)
+ PKG_SELECTED_MODULES+=applications/YOURMODULE
+endif
+```
A build package call:
-
- $(eval $(call BuildPackage,luci-app-YOURMODULE))
-
+```Makefile
+$(eval $(call BuildPackage,luci-app-YOURMODULE))
+```