Software /
code /
prosody
Annotate
makefile @ 13652:a08065207ef0
net.server_epoll: Call :shutdown() on TLS sockets when supported
Comment from Matthew:
This fixes a potential issue where the Prosody process gets blocked on sockets
waiting for them to close. Unlike non-TLS sockets, closing a TLS socket sends
layer 7 data, and this can cause problems for sockets which are in the process
of being cleaned up.
This depends on LuaSec changes which are not yet upstream.
From Martijn's original email:
So first my analysis of luasec. in ssl.c the socket is put into blocking
mode right before calling SSL_shutdown() inside meth_destroy(). My best
guess to why this is is because meth_destroy is linked to the __close
and __gc methods, which can't exactly be called multiple times and
luasec does want to make sure that a tls session is shutdown as clean
as possible.
I can't say I disagree with this reasoning and don't want to change this
behaviour. My solution to this without changing the current behaviour is
to introduce a shutdown() method. I am aware that this overlaps in a
conflicting way with tcp's shutdown method, but it stays close to the
OpenSSL name. This method calls SSL_shutdown() in the current
(non)blocking mode of the underlying socket and returns a boolean
whether or not the shutdown is completed (matching SSL_shutdown()'s 0
or 1 return values), and returns the familiar ssl_ioerror() strings on
error with a false for completion. This error can then be used to
determine if we have wantread/wantwrite to finalize things. Once
meth_shutdown() has been called once a shutdown flag will be set, which
indicates to meth_destroy() that the SSL_shutdown() has been handled
by the application and it shouldn't be needed to set the socket to
blocking mode. I've left the SSL_shutdown() call in the
LSEC_STATE_CONNECTED to prevent TOCTOU if the application reaches a
timeout for the shutdown code, which might allow SSL_shutdown() to
clean up anyway at the last possible moment.
Another thing I've changed to luasec is the call to socket_setblocking()
right before calling close(2) in socket_destroy() in usocket.c.
According to the latest POSIX[0]:
Note that the requirement for close() on a socket to block for up to
the current linger interval is not conditional on the O_NONBLOCK
setting.
Which I read to mean that removing O_NONBLOCK on the socket before close
doesn't impact the behaviour and only causes noise in system call
tracers. I didn't touch the windows bits of this, since I don't do
windows.
For the prosody side of things I've made the TLS shutdown bits resemble
interface:onwritable(), and put it under a combined guard of self._tls
and self.conn.shutdown. The self._tls bit is there to prevent getting
stuck on this condition, and self.conn.shutdown is there to prevent the
code being called by instances where the patched luasec isn't deployed.
The destroy() method can be called from various places and is read by
me as the "we give up" error path. To accommodate for these unexpected
entrypoints I've added a single call to self.conn:shutdown() to prevent
the socket being put into blocking mode. I have no expectations that
there is any other use here. Same as previous, the self.conn.shutdown
check is there to make sure it's not called on unpatched luasec
deployments and self._tls is there to make sure we don't call shutdown()
on tcp sockets.
I wouldn't recommend logging of the conn:shutdown() error inside
close(), since a lot of clients simply close the connection before
SSL_shutdown() is done.
author | Martijn van Duren <martijn@openbsd.org> |
---|---|
date | Thu, 06 Feb 2025 15:04:38 +0000 |
parent | 12947:14a44b1a51d0 |
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 |
12313
469e4453ed01
make: Split up install targets to allow different subset
Kim Alvefur <zash@zash.se>
parents:
11750
diff
changeset
|
33 install-etc: prosody.cfg.lua.install |
469e4453ed01
make: Split up install targets to allow different subset
Kim Alvefur <zash@zash.se>
parents:
11750
diff
changeset
|
34 $(MKDIR) $(CONFIG) |
8593
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
35 $(MKDIR) $(CONFIG)/certs |
12313
469e4453ed01
make: Split up install targets to allow different subset
Kim Alvefur <zash@zash.se>
parents:
11750
diff
changeset
|
36 test -f $(CONFIG)/prosody.cfg.lua || $(INSTALL_DATA) prosody.cfg.lua.install $(CONFIG)/prosody.cfg.lua |
469e4453ed01
make: Split up install targets to allow different subset
Kim Alvefur <zash@zash.se>
parents:
11750
diff
changeset
|
37 .if $(EXCERTS) == "yes" |
469e4453ed01
make: Split up install targets to allow different subset
Kim Alvefur <zash@zash.se>
parents:
11750
diff
changeset
|
38 $(INSTALL_DATA) certs/localhost.crt certs/localhost.key $(CONFIG)/certs |
469e4453ed01
make: Split up install targets to allow different subset
Kim Alvefur <zash@zash.se>
parents:
11750
diff
changeset
|
39 $(INSTALL_DATA) certs/example.com.crt certs/example.com.key $(CONFIG)/certs |
469e4453ed01
make: Split up install targets to allow different subset
Kim Alvefur <zash@zash.se>
parents:
11750
diff
changeset
|
40 .endif |
469e4453ed01
make: Split up install targets to allow different subset
Kim Alvefur <zash@zash.se>
parents:
11750
diff
changeset
|
41 |
469e4453ed01
make: Split up install targets to allow different subset
Kim Alvefur <zash@zash.se>
parents:
11750
diff
changeset
|
42 install-bin: prosody.install prosodyctl.install |
469e4453ed01
make: Split up install targets to allow different subset
Kim Alvefur <zash@zash.se>
parents:
11750
diff
changeset
|
43 $(MKDIR) $(BIN) |
8593
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
44 $(INSTALL_EXEC) ./prosody.install $(BIN)/prosody |
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
45 $(INSTALL_EXEC) ./prosodyctl.install $(BIN)/prosodyctl |
12313
469e4453ed01
make: Split up install targets to allow different subset
Kim Alvefur <zash@zash.se>
parents:
11750
diff
changeset
|
46 |
12947
14a44b1a51d0
prosody.loader: Allow loading modules under 'prosody' namespace (#1223)
Kim Alvefur <zash@zash.se>
parents:
12465
diff
changeset
|
47 install-loader: |
14a44b1a51d0
prosody.loader: Allow loading modules under 'prosody' namespace (#1223)
Kim Alvefur <zash@zash.se>
parents:
12465
diff
changeset
|
48 $(MKDIR) $(SOURCE) |
14a44b1a51d0
prosody.loader: Allow loading modules under 'prosody' namespace (#1223)
Kim Alvefur <zash@zash.se>
parents:
12465
diff
changeset
|
49 $(INSTALL_DATA) loader.lua $(SOURCE) |
14a44b1a51d0
prosody.loader: Allow loading modules under 'prosody' namespace (#1223)
Kim Alvefur <zash@zash.se>
parents:
12465
diff
changeset
|
50 |
12313
469e4453ed01
make: Split up install targets to allow different subset
Kim Alvefur <zash@zash.se>
parents:
11750
diff
changeset
|
51 install-core: |
469e4453ed01
make: Split up install targets to allow different subset
Kim Alvefur <zash@zash.se>
parents:
11750
diff
changeset
|
52 $(MKDIR) $(SOURCE) |
469e4453ed01
make: Split up install targets to allow different subset
Kim Alvefur <zash@zash.se>
parents:
11750
diff
changeset
|
53 $(MKDIR) $(SOURCE)/core |
8593
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
54 $(INSTALL_DATA) core/*.lua $(SOURCE)/core |
12313
469e4453ed01
make: Split up install targets to allow different subset
Kim Alvefur <zash@zash.se>
parents:
11750
diff
changeset
|
55 |
469e4453ed01
make: Split up install targets to allow different subset
Kim Alvefur <zash@zash.se>
parents:
11750
diff
changeset
|
56 install-net: |
469e4453ed01
make: Split up install targets to allow different subset
Kim Alvefur <zash@zash.se>
parents:
11750
diff
changeset
|
57 $(MKDIR) $(SOURCE) |
469e4453ed01
make: Split up install targets to allow different subset
Kim Alvefur <zash@zash.se>
parents:
11750
diff
changeset
|
58 $(MKDIR) $(SOURCE)/net |
8593
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
59 $(INSTALL_DATA) net/*.lua $(SOURCE)/net |
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
60 $(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
|
61 $(INSTALL_DATA) net/http/*.lua $(SOURCE)/net/http |
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
62 $(INSTALL_DATA) net/resolvers/*.lua $(SOURCE)/net/resolvers |
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
63 $(INSTALL_DATA) net/websocket/*.lua $(SOURCE)/net/websocket |
12313
469e4453ed01
make: Split up install targets to allow different subset
Kim Alvefur <zash@zash.se>
parents:
11750
diff
changeset
|
64 |
469e4453ed01
make: Split up install targets to allow different subset
Kim Alvefur <zash@zash.se>
parents:
11750
diff
changeset
|
65 install-util: util/encodings.so util/encodings.so util/pposix.so util/signal.so |
469e4453ed01
make: Split up install targets to allow different subset
Kim Alvefur <zash@zash.se>
parents:
11750
diff
changeset
|
66 $(MKDIR) $(SOURCE) |
469e4453ed01
make: Split up install targets to allow different subset
Kim Alvefur <zash@zash.se>
parents:
11750
diff
changeset
|
67 $(MKDIR) $(SOURCE)/util |
8593
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
68 $(INSTALL_DATA) util/*.lua $(SOURCE)/util |
12313
469e4453ed01
make: Split up install targets to allow different subset
Kim Alvefur <zash@zash.se>
parents:
11750
diff
changeset
|
69 $(MAKE) install -C util-src |
8593
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
70 $(INSTALL_DATA) util/*.so $(SOURCE)/util |
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
71 $(MKDIR) $(SOURCE)/util/sasl |
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
72 $(INSTALL_DATA) util/sasl/*.lua $(SOURCE)/util/sasl |
10881
0abd38e4ff3c
GNUmakefile: Install util.human.*
Kim Alvefur <zash@zash.se>
parents:
10880
diff
changeset
|
73 $(MKDIR) $(SOURCE)/util/human |
0abd38e4ff3c
GNUmakefile: Install util.human.*
Kim Alvefur <zash@zash.se>
parents:
10880
diff
changeset
|
74 $(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
|
75 $(MKDIR) $(SOURCE)/util/prosodyctl |
1999bb052d49
GNUmakefile: Install the new util/prosodyctl/* too (thanks pascal.pascher)
Kim Alvefur <zash@zash.se>
parents:
10881
diff
changeset
|
76 $(INSTALL_DATA) util/prosodyctl/*.lua $(SOURCE)/util/prosodyctl |
12313
469e4453ed01
make: Split up install targets to allow different subset
Kim Alvefur <zash@zash.se>
parents:
11750
diff
changeset
|
77 |
469e4453ed01
make: Split up install targets to allow different subset
Kim Alvefur <zash@zash.se>
parents:
11750
diff
changeset
|
78 install-plugins: |
469e4453ed01
make: Split up install targets to allow different subset
Kim Alvefur <zash@zash.se>
parents:
11750
diff
changeset
|
79 $(MKDIR) $(MODULES) |
12465
4a087713cffe
make: Install stanza watcher library (thanks Menel)
Kim Alvefur <zash@zash.se>
parents:
12313
diff
changeset
|
80 $(MKDIR) $(MODULES)/mod_pubsub $(MODULES)/adhoc $(MODULES)/muc $(MODULES)/mod_mam $(MODULES)/mod_debug_stanzas |
8593
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
81 $(INSTALL_DATA) plugins/*.lua $(MODULES) |
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
82 $(INSTALL_DATA) plugins/mod_pubsub/*.lua $(MODULES)/mod_pubsub |
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
83 $(INSTALL_DATA) plugins/adhoc/*.lua $(MODULES)/adhoc |
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
84 $(INSTALL_DATA) plugins/muc/*.lua $(MODULES)/muc |
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
85 $(INSTALL_DATA) plugins/mod_mam/*.lua $(MODULES)/mod_mam |
12465
4a087713cffe
make: Install stanza watcher library (thanks Menel)
Kim Alvefur <zash@zash.se>
parents:
12313
diff
changeset
|
86 $(INSTALL_DATA) plugins/mod_debug_stanzas/*.lua $(MODULES)/mod_debug_stanzas |
12313
469e4453ed01
make: Split up install targets to allow different subset
Kim Alvefur <zash@zash.se>
parents:
11750
diff
changeset
|
87 |
469e4453ed01
make: Split up install targets to allow different subset
Kim Alvefur <zash@zash.se>
parents:
11750
diff
changeset
|
88 install-man: |
469e4453ed01
make: Split up install targets to allow different subset
Kim Alvefur <zash@zash.se>
parents:
11750
diff
changeset
|
89 $(MKDIR) $(MAN)/man1 |
8593
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
90 $(INSTALL_DATA) man/prosodyctl.man $(MAN)/man1/prosodyctl.1 |
12313
469e4453ed01
make: Split up install targets to allow different subset
Kim Alvefur <zash@zash.se>
parents:
11750
diff
changeset
|
91 |
469e4453ed01
make: Split up install targets to allow different subset
Kim Alvefur <zash@zash.se>
parents:
11750
diff
changeset
|
92 install-meta: |
8593
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
93 -test -f prosody.version && $(INSTALL_DATA) prosody.version $(SOURCE)/prosody.version |
12313
469e4453ed01
make: Split up install targets to allow different subset
Kim Alvefur <zash@zash.se>
parents:
11750
diff
changeset
|
94 |
469e4453ed01
make: Split up install targets to allow different subset
Kim Alvefur <zash@zash.se>
parents:
11750
diff
changeset
|
95 install-data: |
469e4453ed01
make: Split up install targets to allow different subset
Kim Alvefur <zash@zash.se>
parents:
11750
diff
changeset
|
96 $(MKDIR_PRIVATE) $(DATA) |
469e4453ed01
make: Split up install targets to allow different subset
Kim Alvefur <zash@zash.se>
parents:
11750
diff
changeset
|
97 |
12947
14a44b1a51d0
prosody.loader: Allow loading modules under 'prosody' namespace (#1223)
Kim Alvefur <zash@zash.se>
parents:
12465
diff
changeset
|
98 install: install-util install-net install-core install-plugins install-bin install-etc install-man install-meta install-data install-loader |
8593
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 clean: |
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
101 rm -f prosody.install |
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
102 rm -f prosodyctl.install |
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
103 rm -f prosody.cfg.lua.install |
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
104 rm -f prosody.version |
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
105 $(MAKE) clean -C util-src |
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
106 |
9682
814a9d89d2bd
makefile: Add lint target (to match GNUMakefile)
Matthew Wild <mwild1@gmail.com>
parents:
8593
diff
changeset
|
107 lint: |
814a9d89d2bd
makefile: Add lint target (to match GNUMakefile)
Matthew Wild <mwild1@gmail.com>
parents:
8593
diff
changeset
|
108 $(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
|
109 @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
|
110 shellcheck configure |
814a9d89d2bd
makefile: Add lint target (to match GNUMakefile)
Matthew Wild <mwild1@gmail.com>
parents:
8593
diff
changeset
|
111 |
8593
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
112 test: |
9683
bf32f2282b18
makefile: Allow configuring path to busted (to match GNUMakefile)
Matthew Wild <mwild1@gmail.com>
parents:
9682
diff
changeset
|
113 $(BUSTED) --lua=$(RUNWITH) |
8593
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
114 |
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
115 |
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
116 prosody.install: prosody |
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
117 sed "1s| lua$$| $(RUNWITH)|; \ |
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
118 s|^CFG_SOURCEDIR=.*;$$|CFG_SOURCEDIR='$(INSTALLEDSOURCE)';|; \ |
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
119 s|^CFG_CONFIGDIR=.*;$$|CFG_CONFIGDIR='$(INSTALLEDCONFIG)';|; \ |
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
120 s|^CFG_DATADIR=.*;$$|CFG_DATADIR='$(INSTALLEDDATA)';|; \ |
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
121 s|^CFG_PLUGINDIR=.*;$$|CFG_PLUGINDIR='$(INSTALLEDMODULES)/';|;" < prosody > $@ |
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
122 |
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
123 prosodyctl.install: prosodyctl |
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
124 sed "1s| lua$$| $(RUNWITH)|; \ |
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
125 s|^CFG_SOURCEDIR=.*;$$|CFG_SOURCEDIR='$(INSTALLEDSOURCE)';|; \ |
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
126 s|^CFG_CONFIGDIR=.*;$$|CFG_CONFIGDIR='$(INSTALLEDCONFIG)';|; \ |
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
127 s|^CFG_DATADIR=.*;$$|CFG_DATADIR='$(INSTALLEDDATA)';|; \ |
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
128 s|^CFG_PLUGINDIR=.*;$$|CFG_PLUGINDIR='$(INSTALLEDMODULES)/';|;" < prosodyctl > $@ |
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
129 |
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
130 prosody.cfg.lua.install: prosody.cfg.lua.dist |
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
131 sed 's|certs/|$(INSTALLEDCONFIG)/certs/|' prosody.cfg.lua.dist > $@ |
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
132 |
c4222e36333c
Add makefiles compatible with BSD make
Kim Alvefur <zash@zash.se>
parents:
diff
changeset
|
133 prosody.version: |
11748
88ba05494d17
makefile: fix prosody.version target
Lucas <lucas@sexy.is>
parents:
8593
diff
changeset
|
134 if [ -f prosody.release ]; then \ |
88ba05494d17
makefile: fix prosody.version target
Lucas <lucas@sexy.is>
parents:
8593
diff
changeset
|
135 cp prosody.release $@; \ |
88ba05494d17
makefile: fix prosody.version target
Lucas <lucas@sexy.is>
parents:
8593
diff
changeset
|
136 elif [ -f .hg_archival.txt ]; then \ |
88ba05494d17
makefile: fix prosody.version target
Lucas <lucas@sexy.is>
parents:
8593
diff
changeset
|
137 sed -n 's/^node: \(............\).*/\1/p' .hg_archival.txt > $@; \ |
88ba05494d17
makefile: fix prosody.version target
Lucas <lucas@sexy.is>
parents:
8593
diff
changeset
|
138 elif [ -f .hg/dirstate ]; then \ |
88ba05494d17
makefile: fix prosody.version target
Lucas <lucas@sexy.is>
parents:
8593
diff
changeset
|
139 hexdump -n6 -e'6/1 "%02x"' .hg/dirstate > $@; \ |
88ba05494d17
makefile: fix prosody.version target
Lucas <lucas@sexy.is>
parents:
8593
diff
changeset
|
140 else \ |
88ba05494d17
makefile: fix prosody.version target
Lucas <lucas@sexy.is>
parents:
8593
diff
changeset
|
141 echo unknown > $@; \ |
88ba05494d17
makefile: fix prosody.version target
Lucas <lucas@sexy.is>
parents:
8593
diff
changeset
|
142 fi |