Software / code / prosody
Annotate
makefile @ 11148:1dc49accb58e
core.moduleapi: Return resource path from module:get_directory() (API BC)
:get_directory has so far returned the base directory of the current
module source code. This has worked well so far to load resources which
tend to be included in the same directory, but with the plugin installer
using LuaRocks, extra resources (e.g. templates and other assets) these
are saved in a completely different directory.
In be73df6765b9 core.modulemanager gained some code for finding that
directory and saving it in module.resource_path but now the question is
how this should be reflected in the API.
A survey of community modules suggest the vast majority use the
:get_directory method for locating templates and other assets, rather
than the code (which would use module:require instead).
Therefore this commit changes :get_directory to return the resource_path
when available. This should work for most modules.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Fri, 09 Oct 2020 16:37:15 +0200 |
| parent | 10882:1999bb052d49 |
| child | 11750:a8760562a096 |
| rev | line source |
|---|---|
|
8593
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
1 |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
2 include config.unix |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
3 |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
4 BIN = $(DESTDIR)$(PREFIX)/bin |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
5 CONFIG = $(DESTDIR)$(SYSCONFDIR) |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
6 MODULES = $(DESTDIR)$(LIBDIR)/prosody/modules |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
7 SOURCE = $(DESTDIR)$(LIBDIR)/prosody |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
8 DATA = $(DESTDIR)$(DATADIR) |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
9 MAN = $(DESTDIR)$(PREFIX)/share/man |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
10 |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
11 INSTALLEDSOURCE = $(LIBDIR)/prosody |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
12 INSTALLEDCONFIG = $(SYSCONFDIR) |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
13 INSTALLEDMODULES = $(LIBDIR)/prosody/modules |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
14 INSTALLEDDATA = $(DATADIR) |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
15 |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
16 INSTALL=install -p |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
17 INSTALL_DATA=$(INSTALL) -m644 |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
18 INSTALL_EXEC=$(INSTALL) -m755 |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
19 MKDIR=install -d |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
20 MKDIR_PRIVATE=$(MKDIR) -m750 |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
21 |
|
9682
814a9d89d2bd
makefile: Add lint target (to match GNUMakefile)
Matthew Wild <mwild1@gmail.com>
parents:
8593
diff
changeset
|
22 LUACHECK=luacheck |
|
9683
bf32f2282b18
makefile: Allow configuring path to busted (to match GNUMakefile)
Matthew Wild <mwild1@gmail.com>
parents:
9682
diff
changeset
|
23 BUSTED=busted |
|
9682
814a9d89d2bd
makefile: Add lint target (to match GNUMakefile)
Matthew Wild <mwild1@gmail.com>
parents:
8593
diff
changeset
|
24 |
|
8593
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
25 .PHONY: all test clean install |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
26 |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
27 all: prosody.install prosodyctl.install prosody.cfg.lua.install prosody.version |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
28 $(MAKE) -C util-src install |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
29 .if $(EXCERTS) == "yes" |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
30 $(MAKE) -C certs localhost.crt example.com.crt |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
31 .endif |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
32 |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
33 install: prosody.install prosodyctl.install prosody.cfg.lua.install util/encodings.so util/encodings.so util/pposix.so util/signal.so |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
34 $(MKDIR) $(BIN) $(CONFIG) $(MODULES) $(SOURCE) |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
35 $(MKDIR_PRIVATE) $(DATA) |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
36 $(MKDIR) $(MAN)/man1 |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
37 $(MKDIR) $(CONFIG)/certs |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
38 $(MKDIR) $(SOURCE)/core $(SOURCE)/net $(SOURCE)/util |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
39 $(INSTALL_EXEC) ./prosody.install $(BIN)/prosody |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
40 $(INSTALL_EXEC) ./prosodyctl.install $(BIN)/prosodyctl |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
41 $(INSTALL_DATA) core/*.lua $(SOURCE)/core |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
42 $(INSTALL_DATA) net/*.lua $(SOURCE)/net |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
43 $(MKDIR) $(SOURCE)/net/http $(SOURCE)/net/resolvers $(SOURCE)/net/websocket |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
44 $(INSTALL_DATA) net/http/*.lua $(SOURCE)/net/http |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
45 $(INSTALL_DATA) net/resolvers/*.lua $(SOURCE)/net/resolvers |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
46 $(INSTALL_DATA) net/websocket/*.lua $(SOURCE)/net/websocket |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
47 $(INSTALL_DATA) util/*.lua $(SOURCE)/util |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
48 $(INSTALL_DATA) util/*.so $(SOURCE)/util |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
49 $(MKDIR) $(SOURCE)/util/sasl |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
50 $(INSTALL_DATA) util/sasl/*.lua $(SOURCE)/util/sasl |
|
10881
0abd38e4ff3c
GNUmakefile: Install util.human.*
Kim Alvefur <zash@zash.se>
parents:
10880
diff
changeset
|
51 $(MKDIR) $(SOURCE)/util/human |
|
0abd38e4ff3c
GNUmakefile: Install util.human.*
Kim Alvefur <zash@zash.se>
parents:
10880
diff
changeset
|
52 $(INSTALL_DATA) util/human/*.lua $(SOURCE)/util/human |
|
10882
1999bb052d49
GNUmakefile: Install the new util/prosodyctl/* too (thanks pascal.pascher)
Kim Alvefur <zash@zash.se>
parents:
10881
diff
changeset
|
53 $(MKDIR) $(SOURCE)/util/prosodyctl |
|
1999bb052d49
GNUmakefile: Install the new util/prosodyctl/* too (thanks pascal.pascher)
Kim Alvefur <zash@zash.se>
parents:
10881
diff
changeset
|
54 $(INSTALL_DATA) util/prosodyctl/*.lua $(SOURCE)/util/prosodyctl |
|
10880
324c50ea0f1d
makefile: Remove installation of mod_s2s dir
Kim Alvefur <zash@zash.se>
parents:
9683
diff
changeset
|
55 $(MKDIR) $(MODULES)/mod_pubsub $(MODULES)/adhoc $(MODULES)/muc $(MODULES)/mod_mam |
|
8593
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
56 $(INSTALL_DATA) plugins/*.lua $(MODULES) |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
57 $(INSTALL_DATA) plugins/mod_pubsub/*.lua $(MODULES)/mod_pubsub |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
58 $(INSTALL_DATA) plugins/adhoc/*.lua $(MODULES)/adhoc |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
59 $(INSTALL_DATA) plugins/muc/*.lua $(MODULES)/muc |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
60 $(INSTALL_DATA) plugins/mod_mam/*.lua $(MODULES)/mod_mam |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
61 .if $(EXCERTS) == "yes" |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
62 $(INSTALL_DATA) certs/localhost.crt certs/localhost.key $(CONFIG)/certs |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
63 $(INSTALL_DATA) certs/example.com.crt certs/example.com.key $(CONFIG)/certs |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
64 .endif |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
65 $(INSTALL_DATA) man/prosodyctl.man $(MAN)/man1/prosodyctl.1 |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
66 test -f $(CONFIG)/prosody.cfg.lua || $(INSTALL_DATA) prosody.cfg.lua.install $(CONFIG)/prosody.cfg.lua |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
67 -test -f prosody.version && $(INSTALL_DATA) prosody.version $(SOURCE)/prosody.version |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
68 $(MAKE) install -C util-src |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
69 |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
70 clean: |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
71 rm -f prosody.install |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
72 rm -f prosodyctl.install |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
73 rm -f prosody.cfg.lua.install |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
74 rm -f prosody.version |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
75 $(MAKE) clean -C util-src |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
76 |
|
9682
814a9d89d2bd
makefile: Add lint target (to match GNUMakefile)
Matthew Wild <mwild1@gmail.com>
parents:
8593
diff
changeset
|
77 lint: |
|
814a9d89d2bd
makefile: Add lint target (to match GNUMakefile)
Matthew Wild <mwild1@gmail.com>
parents:
8593
diff
changeset
|
78 $(LUACHECK) -q $$(HGPLAIN= hg files -I '**.lua') prosody prosodyctl |
|
814a9d89d2bd
makefile: Add lint target (to match GNUMakefile)
Matthew Wild <mwild1@gmail.com>
parents:
8593
diff
changeset
|
79 @echo $$(sed -n '/^\tlocal exclude_files/,/^}/p;' .luacheckrc | sed '1d;$d' | wc -l) files ignored |
|
814a9d89d2bd
makefile: Add lint target (to match GNUMakefile)
Matthew Wild <mwild1@gmail.com>
parents:
8593
diff
changeset
|
80 shellcheck configure |
|
814a9d89d2bd
makefile: Add lint target (to match GNUMakefile)
Matthew Wild <mwild1@gmail.com>
parents:
8593
diff
changeset
|
81 |
|
8593
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
82 test: |
|
9683
bf32f2282b18
makefile: Allow configuring path to busted (to match GNUMakefile)
Matthew Wild <mwild1@gmail.com>
parents:
9682
diff
changeset
|
83 $(BUSTED) --lua=$(RUNWITH) |
|
8593
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
84 |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
85 |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
86 prosody.install: prosody |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
87 sed "1s| lua$$| $(RUNWITH)|; \ |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
88 s|^CFG_SOURCEDIR=.*;$$|CFG_SOURCEDIR='$(INSTALLEDSOURCE)';|; \ |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
89 s|^CFG_CONFIGDIR=.*;$$|CFG_CONFIGDIR='$(INSTALLEDCONFIG)';|; \ |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
90 s|^CFG_DATADIR=.*;$$|CFG_DATADIR='$(INSTALLEDDATA)';|; \ |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
91 s|^CFG_PLUGINDIR=.*;$$|CFG_PLUGINDIR='$(INSTALLEDMODULES)/';|;" < prosody > $@ |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
92 |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
93 prosodyctl.install: prosodyctl |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
94 sed "1s| lua$$| $(RUNWITH)|; \ |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
95 s|^CFG_SOURCEDIR=.*;$$|CFG_SOURCEDIR='$(INSTALLEDSOURCE)';|; \ |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
96 s|^CFG_CONFIGDIR=.*;$$|CFG_CONFIGDIR='$(INSTALLEDCONFIG)';|; \ |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
97 s|^CFG_DATADIR=.*;$$|CFG_DATADIR='$(INSTALLEDDATA)';|; \ |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
98 s|^CFG_PLUGINDIR=.*;$$|CFG_PLUGINDIR='$(INSTALLEDMODULES)/';|;" < prosodyctl > $@ |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
99 |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
100 prosody.cfg.lua.install: prosody.cfg.lua.dist |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
101 sed 's|certs/|$(INSTALLEDCONFIG)/certs/|' prosody.cfg.lua.dist > $@ |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
102 |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
103 prosody.version: |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
104 test -f prosody.release && \ |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
105 cp prosody.release $@ || \ |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
106 test -f .hg_archival.txt && \ |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
107 sed -n 's/^node: \(............\).*/\1/p' .hg_archival.txt > $@ || \ |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
108 test -f .hg/dirstate && \ |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
109 hexdump -n6 -e'6/1 "%02x"' .hg/dirstate > $@ || \ |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
110 echo unknown > $@ |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
111 |
|
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
112 |