Software /
code /
prosody
Annotate
util/dependencies.lua @ 464:f1827353fd58
More Makefile improvements
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 29 Nov 2008 02:23:48 +0000 |
parent | 449:c0a4a1e63d70 |
child | 519:cccd610a0ef9 |
rev | line source |
---|---|
408
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
1 local fatal; |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
2 |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3 local function softreq(...) local ok, lib = pcall(require, ...); if ok then return lib; else return nil; end end |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
4 |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
5 local function missingdep(name, sources, msg) |
409
2269e9cbe153
Add MD5 to the list of checked dependencies
Matthew Wild <mwild1@gmail.com>
parents:
408
diff
changeset
|
6 print(""); |
2269e9cbe153
Add MD5 to the list of checked dependencies
Matthew Wild <mwild1@gmail.com>
parents:
408
diff
changeset
|
7 print("**************************"); |
408
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
8 print("Prosody was unable to find "..tostring(name)); |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
9 print("This package can be obtained in the following ways:"); |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
10 print(""); |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
11 for k,v in pairs(sources) do |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
12 print("", k, v); |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
13 end |
410
5ce6801ad2e4
Trivial whitespace fix in the missing dependency message
Matthew Wild <mwild1@gmail.com>
parents:
409
diff
changeset
|
14 print(""); |
408
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
15 print(msg or (name.." is required for Prosody to run, so we will now exit.")); |
409
2269e9cbe153
Add MD5 to the list of checked dependencies
Matthew Wild <mwild1@gmail.com>
parents:
408
diff
changeset
|
16 print("More help can be found on our website, at http://.../doc/depends"); |
2269e9cbe153
Add MD5 to the list of checked dependencies
Matthew Wild <mwild1@gmail.com>
parents:
408
diff
changeset
|
17 print("**************************"); |
2269e9cbe153
Add MD5 to the list of checked dependencies
Matthew Wild <mwild1@gmail.com>
parents:
408
diff
changeset
|
18 print(""); |
408
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
19 end |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
20 |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
21 local lxp = softreq "lxp" |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
22 |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
23 if not lxp then |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
24 missingdep("luaexpat", { ["Ubuntu 8.04 (Hardy)"] = "sudo apt-get install liblua5.1-expat0"; ["luarocks"] = "luarocks install luaexpat"; }); |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
25 fatal = true; |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
26 end |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
27 |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
28 local socket = softreq "socket" |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
29 |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
30 if not socket then |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
31 missingdep("luasocket", { ["Ubuntu 8.04 (Hardy)"] = "sudo apt-get install liblua5.1-socket2"; ["luarocks"] = "luarocks install luasocket"; }); |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
32 fatal = true; |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
33 end |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
34 |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
35 local ssl = softreq "ssl" |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
36 |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
37 if not ssl then |
413
4b61529d0884
Refuse to run without SSL/TLS unless run_without_ssl is set in config
Matthew Wild <mwild1@gmail.com>
parents:
410
diff
changeset
|
38 if config.get("*", "core", "run_without_ssl") then |
4b61529d0884
Refuse to run without SSL/TLS unless run_without_ssl is set in config
Matthew Wild <mwild1@gmail.com>
parents:
410
diff
changeset
|
39 log("warn", "Running without SSL support because run_without_ssl is defined in the config"); |
4b61529d0884
Refuse to run without SSL/TLS unless run_without_ssl is set in config
Matthew Wild <mwild1@gmail.com>
parents:
410
diff
changeset
|
40 else |
4b61529d0884
Refuse to run without SSL/TLS unless run_without_ssl is set in config
Matthew Wild <mwild1@gmail.com>
parents:
410
diff
changeset
|
41 missingdep("LuaSec", { ["Source"] = "http://www.inf.puc-rio.br/~brunoos/luasec/" }, "SSL/TLS support will not be available"); |
4b61529d0884
Refuse to run without SSL/TLS unless run_without_ssl is set in config
Matthew Wild <mwild1@gmail.com>
parents:
410
diff
changeset
|
42 end |
408
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
43 end |
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
44 |
409
2269e9cbe153
Add MD5 to the list of checked dependencies
Matthew Wild <mwild1@gmail.com>
parents:
408
diff
changeset
|
45 |
408
eb1a0960cefb
Friendlier messages on missing dependencies
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
46 if fatal then os.exit(1); end |