mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-20 16:15:59 +01:00
Always build eimp dependency
Even if no suitable C graphics libraries are detected at compile time, the package is still usable because it provides `eimp:get_type/1` which is used by mod_avatar.
This commit is contained in:
parent
d2427c98c3
commit
0f86559d83
@ -244,14 +244,6 @@ AC_ARG_ENABLE(sip,
|
||||
*) AC_MSG_ERROR(bad value ${enableval} for --enable-sip) ;;
|
||||
esac],[if test "x$sip" = "x"; then sip=false; fi])
|
||||
|
||||
AC_ARG_ENABLE(graphics,
|
||||
[AC_HELP_STRING([--enable-graphics], [enable support for graphic images manipulation (default: yes)])],
|
||||
[case "${enableval}" in
|
||||
yes) graphics=true ;;
|
||||
no) graphics=false ;;
|
||||
*) AC_MSG_ERROR(bad value ${enableval} for --enable-graphics) ;;
|
||||
esac],[if test "x$graphics" = "x"; then graphics=true; fi])
|
||||
|
||||
AC_CONFIG_FILES([Makefile
|
||||
vars.config
|
||||
src/ejabberd.app.src])
|
||||
@ -297,7 +289,6 @@ AC_SUBST(iconv)
|
||||
AC_SUBST(stun)
|
||||
AC_SUBST(sip)
|
||||
AC_SUBST(debug)
|
||||
AC_SUBST(graphics)
|
||||
AC_SUBST(tools)
|
||||
AC_SUBST(latest_deps)
|
||||
AC_SUBST(system_deps)
|
||||
|
@ -818,10 +818,7 @@ modules:
|
||||
mod_vcard:
|
||||
search: false
|
||||
mod_vcard_xupdate: {}
|
||||
## Convert all avatars posted by Android clients from WebP to JPEG
|
||||
## mod_avatar: # this module needs compile option --enable-graphics
|
||||
## convert:
|
||||
## webp: jpeg
|
||||
mod_avatar: {}
|
||||
mod_version: {}
|
||||
mod_stream_mgmt: {}
|
||||
## Non-SASL Authentication (XEP-0078) is now disabled by default
|
||||
|
@ -32,6 +32,7 @@
|
||||
{luerl, ".*", {git, "https://github.com/rvirding/luerl", {tag, "v0.2"}}},
|
||||
{jose, ".*", {git, "https://github.com/potatosalad/erlang-jose", {tag, "1.8.4"}}},
|
||||
{fs, ".*", {git, "https://github.com/synrc/fs", "bed9467"}},
|
||||
{eimp, ".*", {git, "https://github.com/processone/eimp", "4ba6363"}},
|
||||
{if_var_true, stun, {stun, ".*", {git, "https://github.com/processone/stun", {tag, "1.0.20"}}}},
|
||||
{if_var_true, sip, {esip, ".*", {git, "https://github.com/processone/esip", {tag, "1.0.21"}}}},
|
||||
{if_var_true, mysql, {p1_mysql, ".*", {git, "https://github.com/processone/p1_mysql",
|
||||
@ -46,7 +47,6 @@
|
||||
{tag, "1.0.3"}}}},
|
||||
{if_var_true, riak, {riakc, ".*", {git, "https://github.com/processone/riak-erlang-client",
|
||||
{tag, {if_version_above, "19", "develop", "2.5.3"}}}}},
|
||||
{if_var_true, graphics, {eimp, ".*", {git, "https://github.com/processone/eimp", {tag, "1.0.2"}}}},
|
||||
%% Elixir support, needed to run tests
|
||||
{if_var_true, elixir, {elixir, ".*", {git, "https://github.com/elixir-lang/elixir",
|
||||
{tag, {if_version_above, "17", "v1.4.4", "v1.1.1"}}}}},
|
||||
@ -93,7 +93,6 @@
|
||||
{if_var_true, debug, debug_info},
|
||||
{if_var_true, sip, {d, 'SIP'}},
|
||||
{if_var_true, stun, {d, 'STUN'}},
|
||||
{if_var_true, graphics, {d, 'GRAPHICS'}},
|
||||
{if_var_true, roster_gateway_workaround, {d, 'ROSTER_GATWAY_WORKAROUND'}},
|
||||
{if_var_match, db_type, mssql, {d, 'mssql'}},
|
||||
{if_var_true, elixir, {d, 'ELIXIR_ENABLED'}},
|
||||
@ -158,11 +157,11 @@
|
||||
{post_hook_configure, [{"fast_tls", []},
|
||||
{"stringprep", []},
|
||||
{"fast_yaml", []},
|
||||
{"eimp", []},
|
||||
{if_var_true, sip, {"esip", []}},
|
||||
{"fast_xml", [{if_var_true, full_xml, "--enable-full-xml"}]},
|
||||
{if_var_true, pam, {"epam", []}},
|
||||
{if_var_true, zlib, {"ezlib", []}},
|
||||
{if_var_true, graphics, {"eimp", []}},
|
||||
{if_var_true, iconv, {"iconv", []}}]}.
|
||||
|
||||
{port_env, [{"CFLAGS", "-g -O2 -Wall"}]}.
|
||||
|
@ -150,7 +150,7 @@ start_apps() ->
|
||||
ejabberd:start_app(fast_tls),
|
||||
ejabberd:start_app(xmpp),
|
||||
ejabberd:start_app(cache_tab),
|
||||
start_eimp().
|
||||
ejabberd:start_app(eimp).
|
||||
|
||||
setup_if_elixir_conf_used() ->
|
||||
case ejabberd_config:is_using_elixir_config() of
|
||||
@ -174,11 +174,3 @@ start_elixir_application() ->
|
||||
_ ->
|
||||
ok
|
||||
end.
|
||||
|
||||
-ifdef(GRAPHICS).
|
||||
start_eimp() ->
|
||||
ejabberd:start_app(eimp).
|
||||
-else.
|
||||
start_eimp() ->
|
||||
ok.
|
||||
-endif.
|
||||
|
@ -33,7 +33,7 @@
|
||||
atom_to_binary/1, binary_to_atom/1, tuple_to_binary/1,
|
||||
l2i/1, i2l/1, i2l/2, expr_to_term/1, term_to_expr/1,
|
||||
now_to_usec/1, usec_to_now/1, encode_pid/1, decode_pid/2,
|
||||
compile_exprs/2, join_atoms/2, try_read_file/1, have_eimp/0,
|
||||
compile_exprs/2, join_atoms/2, try_read_file/1,
|
||||
css_dir/0, img_dir/0, js_dir/0, read_css/1, read_img/1, read_js/1]).
|
||||
|
||||
%% Deprecated functions
|
||||
@ -214,12 +214,6 @@ try_read_file(Path) ->
|
||||
erlang:error(badarg)
|
||||
end.
|
||||
|
||||
-ifdef(GRAPHICS).
|
||||
have_eimp() -> true.
|
||||
-else.
|
||||
have_eimp() -> false.
|
||||
-endif.
|
||||
|
||||
-spec css_dir() -> file:filename().
|
||||
css_dir() ->
|
||||
case os:getenv("EJABBERD_CSS_PATH") of
|
||||
|
@ -38,21 +38,12 @@
|
||||
%%% API
|
||||
%%%===================================================================
|
||||
start(Host, _Opts) ->
|
||||
case misc:have_eimp() of
|
||||
true ->
|
||||
ejabberd_hooks:add(pubsub_publish_item, Host, ?MODULE,
|
||||
pubsub_publish_item, 50),
|
||||
ejabberd_hooks:add(vcard_iq_set, Host, ?MODULE,
|
||||
vcard_iq_convert, 30),
|
||||
ejabberd_hooks:add(vcard_iq_set, Host, ?MODULE,
|
||||
vcard_iq_publish, 100);
|
||||
false ->
|
||||
?CRITICAL_MSG("ejabberd is built without "
|
||||
"graphics support: reconfigure it with "
|
||||
"--enable-graphics or disable '~s'",
|
||||
[?MODULE]),
|
||||
{error, graphics_not_compiled}
|
||||
end.
|
||||
vcard_iq_publish, 100).
|
||||
|
||||
stop(Host) ->
|
||||
ejabberd_hooks:delete(pubsub_publish_item, Host, ?MODULE,
|
||||
@ -416,35 +407,21 @@ decode_mime_type(MimeType) ->
|
||||
encode_mime_type(Type) ->
|
||||
<<"image/", (atom_to_binary(Type, latin1))/binary>>.
|
||||
|
||||
mod_opt_type({convert, png}) ->
|
||||
fun(jpeg) -> jpeg;
|
||||
(webp) -> webp;
|
||||
(gif) -> gif
|
||||
end;
|
||||
mod_opt_type({convert, webp}) ->
|
||||
fun(jpeg) -> jpeg;
|
||||
(png) -> png;
|
||||
(gif) -> gif
|
||||
end;
|
||||
mod_opt_type({convert, jpeg}) ->
|
||||
fun(png) -> png;
|
||||
(webp) -> webp;
|
||||
(gif) -> gif
|
||||
end;
|
||||
mod_opt_type({convert, gif}) ->
|
||||
fun(png) -> png;
|
||||
(jpeg) -> jpeg;
|
||||
(webp) -> webp
|
||||
end;
|
||||
mod_opt_type({convert, default}) ->
|
||||
fun(png) -> png;
|
||||
(webp) -> webp;
|
||||
(jpeg) -> jpeg;
|
||||
(gif) -> gif
|
||||
warn(Format) ->
|
||||
?WARNING_MSG("ejabberd is not compiled with ~p support", [Format]).
|
||||
|
||||
mod_opt_type({convert, From}) when From == webp; From == jpeg;
|
||||
From == png; From == gif ->
|
||||
fun(To) when is_atom(To), To /= From ->
|
||||
case eimp:is_supported(From) of
|
||||
false ->
|
||||
warn(From);
|
||||
true ->
|
||||
case eimp:is_supported(To) of
|
||||
false -> warn(To);
|
||||
true -> To
|
||||
end
|
||||
end
|
||||
end;
|
||||
mod_opt_type(_) ->
|
||||
[{convert, default},
|
||||
{convert, webp},
|
||||
{convert, png},
|
||||
{convert, gif},
|
||||
{convert, jpeg}].
|
||||
[{convert, T} || T <- [default|eimp:supported_formats()]].
|
||||
|
@ -196,7 +196,19 @@ mod_opt_type(custom_headers) ->
|
||||
mod_opt_type(rm_on_unregister) ->
|
||||
fun(B) when is_boolean(B) -> B end;
|
||||
mod_opt_type(thumbnail) ->
|
||||
fun(B) when is_boolean(B) -> B end;
|
||||
fun(true) ->
|
||||
case eimp:supported_formats() of
|
||||
[] ->
|
||||
?WARNING_MSG("ejabberd is built without image converter "
|
||||
"support, option '~s' is ignored",
|
||||
[thumbnail]),
|
||||
erlang:error(badarg);
|
||||
_ ->
|
||||
true
|
||||
end;
|
||||
(false) ->
|
||||
false
|
||||
end;
|
||||
mod_opt_type(_) ->
|
||||
[host, hosts, name, access, max_size, secret_length, jid_in_url, file_mode,
|
||||
dir_mode, docroot, put_url, get_url, service_url, custom_headers,
|
||||
@ -237,20 +249,6 @@ init([ServerHost, Opts]) ->
|
||||
Mode ->
|
||||
file:change_mode(DocRoot2, Mode)
|
||||
end,
|
||||
case Thumbnail of
|
||||
true ->
|
||||
case misc:have_eimp() of
|
||||
false ->
|
||||
?ERROR_MSG("ejabberd is built without graphics support, "
|
||||
"please rebuild it with --enable-graphics or "
|
||||
"set 'thumbnail: false' for module '~s' in "
|
||||
"ejabberd.yml", [?MODULE]);
|
||||
_ ->
|
||||
ok
|
||||
end;
|
||||
false ->
|
||||
ok
|
||||
end,
|
||||
lists:foreach(
|
||||
fun(Host) ->
|
||||
ejabberd_router:register_route(Host, ServerHost)
|
||||
|
@ -43,7 +43,6 @@
|
||||
{iconv, @iconv@}.
|
||||
{stun, @stun@}.
|
||||
{sip, @sip@}.
|
||||
{graphics, @graphics@}.
|
||||
|
||||
%% Version
|
||||
{vsn, "@PACKAGE_VERSION@"}.
|
||||
|
Loading…
Reference in New Issue
Block a user