-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FreeBSD support #2508
FreeBSD support #2508
Changes from 5 commits
d603b18
57e365f
383fb2a
90b43c1
0ff09a2
eb8d908
14a4673
054eabc
23a7751
b5925e3
46ad70b
4a24859
401f621
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -207,6 +207,30 @@ If Doxygen and graphviz are available, the process can also build the documentat | |
|
||
You can also selectively enable/disable other features (e.g., specific plugins you don't care about, or whether or not you want to build the recordings post-processor). Use the --help option when configuring for more info. | ||
|
||
### Building on FreeBSD | ||
pkg install libsrtp2 \ | ||
libusrsctp \ | ||
jansson \ | ||
libnice \ | ||
libmicrohttpd \ | ||
libwebsockets \ | ||
curl \ | ||
opus \ | ||
sofia-sip \ | ||
libogg \ | ||
jansson \ | ||
libnice \ | ||
libconfig \ | ||
libtool \ | ||
gmake \ | ||
autoconf \ | ||
autoconf-wrapper \ | ||
glib | ||
|
||
sh autogen.sh | ||
./configure | ||
gmake | ||
gmake install | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is there a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. gmake is for GNU make. BSDs has its own make |
||
|
||
### Building on MacOS | ||
While most of the above instructions will work when compiling Janus on MacOS as well, there are a few aspects to highlight when doing that. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
#define JANUS_RTP_H | ||
|
||
#include <arpa/inet.h> | ||
#ifdef __MACH__ | ||
#if defined (__MACH__) || defined(__FreeBSD__) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have the same definition in pp-rtp.h, which is in the post-processor code. Have you checked if postprocessing MJR recordings does indeed work as expected on FreeBSD? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry for the delay, I could not find the docs to acutally do a test, but I did change pp-rtp.h |
||
#include <machine/endian.h> | ||
#define __BYTE_ORDER BYTE_ORDER | ||
#define __BIG_ENDIAN BIG_ENDIAN | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -385,7 +385,9 @@ int janus_websockets_init(janus_transport_callbacks *callback, const char *confi | |
#ifndef LWS_WITH_IPV6 | ||
JANUS_LOG(LOG_WARN, "libwebsockets has been built without IPv6 support, will bind to IPv4 only\n"); | ||
#endif | ||
|
||
atoppi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
#ifdef __FreeBSD__ | ||
int ipv4_only = 0; | ||
#endif | ||
/* This is the callback we'll need to invoke to contact the Janus core */ | ||
gateway = callback; | ||
|
||
|
@@ -618,6 +620,12 @@ int janus_websockets_init(janus_transport_callbacks *callback, const char *confi | |
item = janus_config_get(config, config_general, janus_config_type_item, "ws_ip"); | ||
if(item && item->value) { | ||
ip = (char *)item->value; | ||
#ifdef __FreeBSD__ | ||
struct in_addr addr; | ||
if(inet_net_pton(AF_INET, ip, &addr, sizeof(addr))>0) { | ||
atoppi marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Code style: there should be spaces before and after the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
ipv4_only = 1; | ||
} | ||
#endif | ||
char *iface = janus_websockets_get_interface_name(ip); | ||
if(iface == NULL) { | ||
JANUS_LOG(LOG_WARN, "No interface associated with %s? Falling back to no interface...\n", ip); | ||
|
@@ -637,6 +645,12 @@ int janus_websockets_init(janus_transport_callbacks *callback, const char *confi | |
info.gid = -1; | ||
info.uid = -1; | ||
info.options = 0; | ||
#ifdef __FreeBSD__ | ||
if (ipv4_only) { | ||
info.options |= LWS_SERVER_OPTION_DISABLE_IPV6; | ||
ipv4_only=0; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. code style: spaces around = There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess this is the last code style nit. |
||
} | ||
#endif | ||
/* Create the WebSocket context */ | ||
wss = lws_create_vhost(wsc, &info); | ||
if(wss == NULL) { | ||
|
@@ -664,6 +678,12 @@ int janus_websockets_init(janus_transport_callbacks *callback, const char *confi | |
item = janus_config_get(config, config_general, janus_config_type_item, "wss_ip"); | ||
if(item && item->value) { | ||
ip = (char *)item->value; | ||
#ifdef __FreeBSD__ | ||
struct in_addr addr; | ||
if(inet_net_pton(AF_INET, ip, &addr, sizeof(addr))>0) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See above. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
ipv4_only = 1; | ||
} | ||
#endif | ||
char *iface = janus_websockets_get_interface_name(ip); | ||
if(iface == NULL) { | ||
JANUS_LOG(LOG_WARN, "No interface associated with %s? Falling back to no interface...\n", ip); | ||
|
@@ -706,6 +726,13 @@ int janus_websockets_init(janus_transport_callbacks *callback, const char *confi | |
#else | ||
info.options = 0; | ||
#endif | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. empty line There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. forgot this one |
||
#ifdef __FreeBSD__ | ||
if(ipv4_only) { | ||
info.options |= LWS_SERVER_OPTION_DISABLE_IPV6; | ||
ipv4_only = 0; | ||
} | ||
#endif | ||
/* Create the secure WebSocket context */ | ||
swss = lws_create_vhost(wsc, &info); | ||
if(swss == NULL) { | ||
|
@@ -735,6 +762,12 @@ int janus_websockets_init(janus_transport_callbacks *callback, const char *confi | |
item = janus_config_get(config, config_admin, janus_config_type_item, "admin_ws_ip"); | ||
if(item && item->value) { | ||
ip = (char *)item->value; | ||
#ifdef __FreeBSD__ | ||
struct in_addr addr; | ||
if(inet_net_pton(AF_INET, ip, &addr, sizeof(addr))>0) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See above. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
ipv4_only = 1; | ||
} | ||
#endif | ||
atoppi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
char *iface = janus_websockets_get_interface_name(ip); | ||
if(iface == NULL) { | ||
JANUS_LOG(LOG_WARN, "No interface associated with %s? Falling back to no interface...\n", ip); | ||
|
@@ -754,6 +787,12 @@ int janus_websockets_init(janus_transport_callbacks *callback, const char *confi | |
info.gid = -1; | ||
info.uid = -1; | ||
info.options = 0; | ||
#ifdef __FreeBSD__ | ||
if (ipv4_only) { | ||
info.options |= LWS_SERVER_OPTION_DISABLE_IPV6; | ||
ipv4_only = 0; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indentation seems broken? Spaces are used, but we use tabs. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||
#endif | ||
atoppi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
/* Create the WebSocket context */ | ||
admin_wss = lws_create_vhost(wsc, &info); | ||
if(admin_wss == NULL) { | ||
|
@@ -781,6 +820,12 @@ int janus_websockets_init(janus_transport_callbacks *callback, const char *confi | |
item = janus_config_get(config, config_admin, janus_config_type_item, "admin_wss_ip"); | ||
if(item && item->value) { | ||
ip = (char *)item->value; | ||
#ifdef __FreeBSD__ | ||
struct in_addr addr; | ||
if(inet_net_pton(AF_INET, ip, &addr, sizeof(addr))>0) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See above. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
ipv4_only = 1; | ||
} | ||
#endif | ||
atoppi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
char *iface = janus_websockets_get_interface_name(ip); | ||
if(iface == NULL) { | ||
JANUS_LOG(LOG_WARN, "No interface associated with %s? Falling back to no interface...\n", ip); | ||
|
@@ -818,10 +863,18 @@ int janus_websockets_init(janus_transport_callbacks *callback, const char *confi | |
info.ssl_cipher_list = ciphers; | ||
info.gid = -1; | ||
info.uid = -1; | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. empty lines There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. forgot these |
||
#if LWS_LIBRARY_VERSION_MAJOR >= 2 | ||
info.options = LWS_SERVER_OPTION_DO_SSL_GLOBAL_INIT; | ||
#else | ||
info.options = 0; | ||
#endif | ||
#ifdef __FreeBSD__ | ||
if (ipv4_only) { | ||
info.options |= LWS_SERVER_OPTION_DISABLE_IPV6; | ||
ipv4_only = 0; | ||
} | ||
#endif | ||
/* Create the secure WebSocket context */ | ||
admin_swss = lws_create_vhost(wsc, &info); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add some more descriptive description here too, as we do for MacOs. The
pkg
line should be "compacted" a bit too (like what we do above foryum
andapt-get
), as there's too many lines now I believe.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done