Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
s-vincent committed Aug 10, 2017
2 parents 2129caa + 1ca4f43 commit c9f4df0
Show file tree
Hide file tree
Showing 10 changed files with 84 additions and 22 deletions.
13 changes: 11 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
language: cpp
compiler:
- g++
dist: trusty
sudo: false
matrix:
include:
- os: linux
dist: trusty
sudo: false
- os: osx
addons:
apt:
sources:
Expand All @@ -14,6 +18,11 @@ addons:
- libcurl4-openssl-dev
- gcc
- g++
before_install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew list scons &>/dev/null || brew install scons ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew list boost &>/dev/null || brew install boost ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew list openssl &>/dev/null || brew install openssl ; fi
cache:
apt: true
script: scons install apps samples
Expand Down
12 changes: 11 additions & 1 deletion BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ FreeLAN depends on the following libraries:
- OpenSSL
- iconv (Windows)

Generally Linux users can just use the binaries provided by their package manager, but other platforms such as Mac OSX or Windows may need to build these libraries explicitely.
Generally Linux users can just use the binaries provided by their package manager, Mac OSX users can use brew but other platforms such as Windows may need to build these libraries explicitely.

To build the third-party libraries, you can use [teapot](https://github.com/freelan-developers/teapot) (be sure to have `python 2.7` and `perl` installed). Check its [documentation](http://teapot-builder.readthedocs.org/en/latest/) for details, or just type the following command at the root of FreeLAN's repository:

Expand All @@ -25,6 +25,16 @@ To install the required dependencies on Debian Linux (Or Ubuntu), type the follo

> sudo apt-get install scons python libssl-dev libcurl4-openssl-dev libboost-system-dev libboost-thread-dev libboost-program-options-dev libboost-filesystem-dev libboost-iostreams-dev build-essential
### Mac OSX

To install the required dependencies on Mac OS, type the following commands:

> /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
> brew update
> brew install scons boost openssl
Building FreeLAN
----------------

Expand Down
4 changes: 2 additions & 2 deletions SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ for x in Glob('libs/*'):
if not sys.platform.startswith('linux'):
if name in 'netlinkplus':
continue
else:
if name in 'mongooseplus':

if env.mongoose == 'no' and name in 'mongooseplus':
continue

library, library_includes = SConscript(sconscript_path, exports='env dirs name')
Expand Down
22 changes: 20 additions & 2 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,23 @@ AddOption(
default='all',
help='The compilation mode.',
)
AddOption(
'--mongoose',
dest='mongoose',
nargs=1,
action='store',
choices=('yes', 'no'),
default='no',
help='Build webserver with mongoose (warning: it will violate GPLv3 license!)',
)


class FreelanEnvironment(Environment):
"""
A freelan specific environment class.
"""

def __init__(self, mode, prefix, bin_prefix=None, **kwargs):
def __init__(self, mode, prefix, bin_prefix=None, mongoose='no', **kwargs):
"""
Initialize the environment.
Expand Down Expand Up @@ -69,6 +78,7 @@ class FreelanEnvironment(Environment):
self.prefix = prefix
self.bin_prefix = bin_prefix if bin_prefix else prefix
self.destdir = self['ENV'].get('DESTDIR', '')
self.mongoose = mongoose

if self.destdir:
self.install_prefix = os.path.normpath(
Expand Down Expand Up @@ -107,14 +117,21 @@ class FreelanEnvironment(Environment):
self.Append(CXXFLAGS=['-arch', 'x86_64'])
self.Append(CXXFLAGS=['-DBOOST_ASIO_DISABLE_KQUEUE'])
self.Append(CXXFLAGS=['--stdlib=libc++'])
self.Append(CXXFLAGS=['-I/usr/local/opt/openssl/include'])
self.Append(CFLAGS=['-I/usr/local/opt/openssl/include'])
self.Append(LDFLAGS=['--stdlib=libc++'])
self.Append(LDFLAGS=['-L/usr/local/opt/openssl/lib'])
self.Append(LIBPATH=['/usr/local/opt/openssl/lib'])

if self.mode == 'debug':
self.Append(CXXFLAGS=['-g'])
self.Append(CXXFLAGS='-DFREELAN_DEBUG=1')
else:
self.Append(CXXFLAGS='-O3')

if self.mongoose == 'yes':
self.Append(CXXFLAGS=['-DUSE_MONGOOSE'])

self.Append(CPPDEFINES=r'FREELAN_INSTALL_PREFIX="\"%s\""' % self.prefix)

def RGlob(self, path, patterns=None):
Expand Down Expand Up @@ -159,6 +176,7 @@ class FreelanEnvironment(Environment):


mode = GetOption('mode')
mongoose = GetOption('mongoose')
prefix = os.path.normpath(os.path.abspath(ARGUMENTS.get('prefix', './install')))

if 'bin_prefix' in ARGUMENTS:
Expand All @@ -167,7 +185,7 @@ else:
bin_prefix = None

if mode in ('all', 'release'):
env = FreelanEnvironment(mode='release', prefix=prefix, bin_prefix=bin_prefix)
env = FreelanEnvironment(mode='release', prefix=prefix, bin_prefix=bin_prefix, mongoose=mongoose)
libraries, includes, apps, samples, configurations = SConscript('SConscript', exports='env', variant_dir=os.path.join('build', env.mode))
install = env.Install(os.path.join(env.bin_install_prefix, 'bin'), apps)
install.extend(env.Install(os.path.join(env.install_prefix, 'etc', 'freelan'), configurations))
Expand Down
20 changes: 14 additions & 6 deletions apps/freelan/SConscript
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import os
import sys


Import('env dirs name')

libraries = [
Expand All @@ -13,7 +12,6 @@ libraries = [
'kfather',
'iconvplus',
'boost_system',
'boost_thread',
'boost_filesystem',
'boost_date_time',
'boost_program_options',
Expand All @@ -23,23 +21,33 @@ libraries = [
'crypto',
]

if sys.platform.startswith('linux'):
if sys.platform.startswith('darwin'):
libraries.extend([
'pthread',
'netlinkplus',
'boost_thread-mt',
])
else:
libraries.extend([
'mongooseplus',
'boost_thread',
])

if sys.platform.startswith('linux'):
libraries.extend([
'pthread',
'netlinkplus',
])
else:
if sys.platform.startswith('darwin'):
libraries.extend([
'ldap',
'z',
'iconv',
])

if env.mongoose == 'yes':
libraries.extend([
'mongooseplus',
])

env = env.Clone()
env.Prepend(LIBS=libraries)

Expand Down
4 changes: 2 additions & 2 deletions libs/freelan/include/freelan/server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

#include "os.hpp"

#ifndef LINUX
#ifdef USE_MONGOOSE

#include "configuration.hpp"

Expand Down Expand Up @@ -113,4 +113,4 @@ namespace freelan
};
}

#endif
#endif
7 changes: 4 additions & 3 deletions libs/freelan/src/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2358,8 +2358,9 @@ namespace freelan
{
if (m_configuration.server.enabled)
{
#ifdef LINUX
// Due to GPL licensing issues, we can't include that in the LINUX build without violating the GPLv3 license.
#ifndef USE_MONGOOSE
// Due to GPL licensing issues, we can't include that in the build without violating the GPLv3 license.
// If you still want that support, adds USE_MONGOOSE define to the build options.
m_logger(fscp::log_level::warning) << "Web server support is not compiled in this version.";
#else
if (m_configuration.server.protocol == server_configuration::server_protocol_type::https)
Expand Down Expand Up @@ -2427,7 +2428,7 @@ namespace freelan

void core::close_web_server()
{
#ifndef LINUX
#ifdef USE_MONGOOSE
if (m_web_server)
{
m_logger(fscp::log_level::information) << "Closing web server...";
Expand Down
4 changes: 2 additions & 2 deletions libs/freelan/src/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

#include "server.hpp"

#ifndef LINUX
#ifdef USE_MONGOOSE

#include "tools.hpp"

Expand Down Expand Up @@ -471,4 +471,4 @@ namespace freelan
}
}

#endif
#endif
10 changes: 9 additions & 1 deletion samples/fscp/client/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,19 @@ import sys
libraries = [
'fscp',
'cryptoplus',
'boost_thread',
'boost_system',
'crypto',
]

if sys.platform.startswith('darwin'):
libraries.extend([
'boost_thread-mt',
])
else:
libraries.extend([
'boost_thread',
])

if sys.platform.startswith('linux'):
libraries.extend([
'pthread',
Expand Down
10 changes: 9 additions & 1 deletion samples/fscp/schat/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,19 @@ import sys
libraries = [
'fscp',
'cryptoplus',
'boost_thread',
'boost_system',
'crypto',
]

if sys.platform.startswith('darwin'):
libraries.extend([
'boost_thread-mt',
])
else:
libraries.extend([
'boost_thread',
])

if sys.platform.startswith('linux'):
libraries.extend([
'pthread',
Expand Down

0 comments on commit c9f4df0

Please sign in to comment.