mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
Added build support for Solaris.
This commit is contained in:
parent
9de43fc9d7
commit
316960b87d
4 changed files with 36 additions and 13 deletions
|
@ -100,19 +100,19 @@ compiled in, use
|
|||
$ cmake .. -DCMAKE_BUILD_TYPE=DEBUG
|
||||
```
|
||||
|
||||
**NOTE6**
|
||||
To build on Solaris the linker needs to be informed to use lib socket
|
||||
and libnsl, and only builds in 64bit mode.
|
||||
**NOTE6**
|
||||
To build on Solaris the linker needs to be informed to use lib socket
|
||||
and libnsl, and only builds in 64bit mode.
|
||||
|
||||
```bash
|
||||
```bash
|
||||
$ cmake .. -DCMAKE_C_FLAGS=-m64 -DCMAKE_EXE_LINKER_FLAGS="-lsocket -lnsl"
|
||||
```
|
||||
```
|
||||
|
||||
4. Finally you can build using the generated Makefile:
|
||||
|
||||
```bash
|
||||
```bash
|
||||
$ make
|
||||
```
|
||||
```
|
||||
|
||||
@section cmq Quirk of cmake
|
||||
|
||||
|
|
|
@ -89,7 +89,11 @@ Building on Unix:</h1>
|
|||
<li>Generate the build files (default is Make files): <div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> $ cd /path/to/src</div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> $ mkdir build</div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> $ cd build</div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> $ cmake ..</div></div><!-- fragment --></li>
|
||||
<li>Finally you can build using the generated Makefile: <div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> $ make && sudo make install</div></div><!-- fragment --> <b>NOTE</b>: The <code>build/</code><code>directory can have any name and be located anywhere on your filesystem, and that the argument</code>..` given to cmake is simply the source directory of <b>libwebsockets</b> containing the <a href="CMakeLists.txt">CMakeLists.txt</a> project file. All examples in this file assumes you use ".."</li>
|
||||
</ol>
|
||||
<p><b>NOTE2</b>: A common option you may want to give is to set the install path, same as –prefix= with autotools. It defaults to /usr/local. You can do this by, eg </p><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> $ cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr .</div></div><!-- fragment --><p><b>NOTE3</b>: On machines that want libraries in lib64, you can also add the following to the cmake line </p><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> -DLIB_SUFFIX=64</div></div><!-- fragment --><p><b>NOTE4</b>: If you are building against a non-distro OpenSSL (eg, in order to get access to ALPN support only in newer OpenSSL versions) the nice way to express that in one cmake command is eg, </p><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> $ cmake .. -DOPENSSL_ROOT_DIR=/usr/local/ssl \</div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span>  -DCMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE=/usr/local/ssl \</div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span>  -DLWS_WITH_HTTP2=1</div></div><!-- fragment --><p>When you run the test apps using non-distro SSL, you have to force them to use your libs, not the distro ones </p><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> $ LD_LIBRARY_PATH=/usr/local/ssl/lib libwebsockets-test-server --ssl</div></div><!-- fragment --><p>To get it to build on latest openssl (2016-04-10) it needed this approach </p><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> cmake .. -DLWS_WITH_HTTP2=1 -DLWS_OPENSSL_INCLUDE_DIRS=/usr/local/include/openssl -DLWS_OPENSSL_LIBRARIES="/usr/local/lib64/libssl.so;/usr/local/lib64/libcrypto.so"</div></div><!-- fragment --><p><b>NOTE5</b>: To build with debug info and _DEBUG for lower priority debug messages compiled in, use </p><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> $ cmake .. -DCMAKE_BUILD_TYPE=DEBUG</div></div><!-- fragment --><h1><a class="anchor" id="cmq"></a>
|
||||
<p><b>NOTE2</b>: A common option you may want to give is to set the install path, same as –prefix= with autotools. It defaults to /usr/local. You can do this by, eg </p><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> $ cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr .</div></div><!-- fragment --><p><b>NOTE3</b>: On machines that want libraries in lib64, you can also add the following to the cmake line </p><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> -DLIB_SUFFIX=64</div></div><!-- fragment --><p><b>NOTE4</b>: If you are building against a non-distro OpenSSL (eg, in order to get access to ALPN support only in newer OpenSSL versions) the nice way to express that in one cmake command is eg, </p><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> $ cmake .. -DOPENSSL_ROOT_DIR=/usr/local/ssl \</div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span>  -DCMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE=/usr/local/ssl \</div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span>  -DLWS_WITH_HTTP2=1</div></div><!-- fragment --><p>When you run the test apps using non-distro SSL, you have to force them to use your libs, not the distro ones </p><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> $ LD_LIBRARY_PATH=/usr/local/ssl/lib libwebsockets-test-server --ssl</div></div><!-- fragment --><p>To get it to build on latest openssl (2016-04-10) it needed this approach </p><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> cmake .. -DLWS_WITH_HTTP2=1 -DLWS_OPENSSL_INCLUDE_DIRS=/usr/local/include/openssl -DLWS_OPENSSL_LIBRARIES="/usr/local/lib64/libssl.so;/usr/local/lib64/libcrypto.so"</div></div><!-- fragment --><p><b>NOTE5</b>: To build with debug info and _DEBUG for lower priority debug messages compiled in, use </p><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> $ cmake .. -DCMAKE_BUILD_TYPE=DEBUG</div></div><!-- fragment --><p><b>NOTE6</b> To build on Solaris the linker needs to be informed to use lib socket and libnsl, and only builds in 64bit mode.</p>
|
||||
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> $ cmake .. -DCMAKE_C_FLAGS=-m64 -DCMAKE_EXE_LINKER_FLAGS="-lsocket -lnsl"</div></div><!-- fragment --><ol type="1">
|
||||
<li>Finally you can build using the generated Makefile:</li>
|
||||
</ol>
|
||||
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> $ make</div></div><!-- fragment --><h1><a class="anchor" id="cmq"></a>
|
||||
Quirk of cmake</h1>
|
||||
<p>When changing cmake options, for some reason the only way to get it to see the changes sometimes is delete the contents of your build directory and do the cmake from scratch.</p>
|
||||
<h1><a class="anchor" id="cmw"></a>
|
||||
|
|
|
@ -215,7 +215,7 @@ lws_plat_set_socket_options(struct lws_vhost *vhost, int fd)
|
|||
#if defined(__APPLE__) || \
|
||||
defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \
|
||||
defined(__NetBSD__) || \
|
||||
defined(__CYGWIN__) || defined(__OpenBSD__)
|
||||
defined(__CYGWIN__) || defined(__OpenBSD__) || defined (__sun)
|
||||
|
||||
/*
|
||||
* didn't find a way to set these per-socket, need to
|
||||
|
@ -242,10 +242,13 @@ lws_plat_set_socket_options(struct lws_vhost *vhost, int fd)
|
|||
|
||||
/* Disable Nagle */
|
||||
optval = 1;
|
||||
#if !defined(__APPLE__) && \
|
||||
!defined(__FreeBSD__) && !defined(__FreeBSD_kernel__) && \
|
||||
!defined(__NetBSD__) && \
|
||||
!defined(__OpenBSD__)
|
||||
#if defined (__sun)
|
||||
if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (const void *)&optval, optlen) < 0)
|
||||
return 1;
|
||||
#elif !defined(__APPLE__) && \
|
||||
!defined(__FreeBSD__) && !defined(__FreeBSD_kernel__) && \
|
||||
!defined(__NetBSD__) && \
|
||||
!defined(__OpenBSD__)
|
||||
if (setsockopt(fd, SOL_TCP, TCP_NODELAY, (const void *)&optval, optlen) < 0)
|
||||
return 1;
|
||||
#else
|
||||
|
|
|
@ -178,6 +178,8 @@ char *ets_strchr(const char *s, int c);
|
|||
#if defined (__ANDROID__)
|
||||
#include <syslog.h>
|
||||
#include <sys/resource.h>
|
||||
#elif defined (__sun)
|
||||
#include <syslog.h>
|
||||
#else
|
||||
#if !defined(LWS_WITH_ESP8266)
|
||||
#include <sys/syslog.h>
|
||||
|
@ -377,6 +379,12 @@ extern "C" {
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__sun) && defined(__GNUC__)
|
||||
# define BYTE_ORDER __BYTE_ORDER__
|
||||
# define LITTLE_ENDIAN __ORDER_LITTLE_ENDIAN__
|
||||
# define BIG_ENDIAN __ORDER_BIG_ENDIAN__
|
||||
#endif
|
||||
|
||||
#if !defined(BYTE_ORDER)
|
||||
# define BYTE_ORDER __BYTE_ORDER
|
||||
#endif
|
||||
|
@ -397,6 +405,14 @@ extern "C" {
|
|||
#define MSG_NOSIGNAL SO_NOSIGPIPE
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Solaris 11.X only supports POSIX 2001, MSG_NOSIGNAL appears in
|
||||
* POSIX 2008.
|
||||
*/
|
||||
#ifdef __sun
|
||||
#define MSG_NOSIGNAL 0
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifndef FD_HASHTABLE_MODULUS
|
||||
#define FD_HASHTABLE_MODULUS 32
|
||||
|
|
Loading…
Add table
Reference in a new issue