Skip to content

Commit e2dcd16

Browse files
authored
Document modules (#49)
* Document modules * Updates
1 parent 8e5c09b commit e2dcd16

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

_data/docs_sidebar.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
link: /docs/dm.pl.html
3636
- title: Swift
3737
link: /docs/Swift.html
38+
- title: Modules
39+
link: /docs/Modules.html
3840

3941
- title: Tweak Development
4042
list:

docs/Modules.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
title: Modules
3+
layout: docs
4+
---
5+
6+
## Overview
7+
With Theos being Makefile-based, additional functionality can be provided as-desired through "modules."
8+
9+
Modules are directories containing Makefiles with additional rules, variables, and/or checks that you would like your Theos install to contain. A module structure may look something like
10+
```
11+
my-module/
12+
├── instance
13+
│ ├── framework.mk
14+
│ ├── library.mk
15+
│ └── rules.mk
16+
├── package
17+
│ └── deb.mk
18+
└── package.mk
19+
```
20+
where each `.mk` file contains custom code such as
21+
```makefile
22+
_THEOS_INTERNAL_LDFLAGS += -rpath my/path/here/ -rpath $(THEOS_PACKAGE_INSTALL_PREFIX)/Library/Frameworks -rpath $(THEOS_PACKAGE_INSTALL_PREFIX)/usr/lib
23+
```
24+
25+
## Structure
26+
Modules' structure and the respective `.mk` filenames tell Theos where to add your provided functionality. For example, `my-module/package/deb.mk` tells Theos to add the functionality contained in the module's `deb.mk` file to `$(THEOS_MAKE_PATH)/package/deb.mk`. Providing additional functionality through modules is only supported for specific parts of Theos, however. These parts include:
27+
28+
- `rules.mk`
29+
- `common.mk`
30+
- `package.mk`
31+
- `platform/*.mk`
32+
- `targets/**/*.mk`
33+
- `package/*.mk`
34+
- `install/*.mk`
35+
- `instance/*.mk`
36+
- Except `aggregate.mk`
37+
- `master/*.mk`
38+
39+
Modules should be placed in `$(THEOS_MODULE_PATH)` and are imported by Theos *only* when you explicitly ask them to be through `MODULES = my-module`. The exception to this are package schemes, which can be provided in module form (see `$THEOS/vendor/mod/rootless` for an example). For package schemes, the scheme specified by `THEOS_PACKAGE_SCHEME` will be imported without needing to specify the module explicitly via `MODULES`. These are "enabled" through Makefile's `-include` feature and are typically included *after* all of the stock Theos functionality has been defined. Thus, modules support all Theos variables that have been defined by the time your specific Module is imported.

0 commit comments

Comments
 (0)