Compile MongooseIM on OS X with openssl

Another tricky thing I always struggle with: Get MongooseIM compiled on OS X (since they removed openssl). So if you have openssl installed via homebrew just do

diff --git a/apps/ejabberd/rebar.config b/apps/ejabberd/rebar.config
index c693471..4e5ff1f 100644
--- a/apps/ejabberd/rebar.config
+++ b/apps/ejabberd/rebar.config
@@ -8,8 +8,15 @@
 {require_otp_vsn, "R?1[678]"}.

 {port_specs,
- [{".*", "priv/lib/tls_drv.so", ["c_src/tls_drv.c"], [{env, [{"LDFLAGS", "$LDFLAGS -lssl"}]}]},
-  {".*", "priv/lib/ejabberd_zlib_drv.so", ["c_src/ejabberd_zlib_drv.c"], [{env, [{"LDFLAGS", "$LDFLAGS -lz"}]}]}]}.
+ [{".*", "priv/lib/tls_drv.so", ["c_src/tls_drv.c"], [{env, [{".*apple-darwin.*", "CFLAGS", "$CFLAGS -I/usr/local/opt/openssl/include"},
+                                                             {".*apple-darwin.*", "LDFLAGS", "$LDFLAGS -L/usr/local/opt/openssl/lib"},
+                                                             {"LDFLAGS", "$LDFLAGS -lssl"}]}]},
+  {".*", "priv/lib/ejabberd_zlib_drv.so", ["c_src/ejabberd_zlib_drv.c"], [{env, [{"LDFLAGS", "$LDFLAGS -lz"}]}]},
+  {".*", "priv/lib/sha_drv.so", ["c_src/sha_drv.c"], [{env, [{".*apple-darwin.*", "CFLAGS", "$CFLAGS -I/usr/local/opt/openssl/include"},
+                                                             {".*apple-darwin.*", "LDFLAGS", "$LDFLAGS -L/usr/local/opt/openssl/lib"},
+                                                             {"LDFLAGS", "$LDFLAGS -lcrypto"}]}]},
+  {".*", "priv/lib/xml.so", ["c_src/xml.c"], []},
+  {".*", "priv/lib/expat_erl.so", ["c_src/expat_erl.c"], [{env, [{"LDFLAGS", "$LDFLAGS -lexpat"}]}]}]}.

 {xref_checks, [undefined_function_calls,
                undefined_functions,

Comments are closed