Skip to content

Commit

Permalink
Merge pull request #140 from s-vincent/macos-brew-build
Browse files Browse the repository at this point in the history
Supports macOS with brew packages and adds an osx build to travis CI
  • Loading branch information
ereOn authored Aug 9, 2017
2 parents d36f18c + 8e86b5a commit 1ca4f43
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 6 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). 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: 4 additions & 0 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,11 @@ 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'])
Expand Down
10 changes: 9 additions & 1 deletion apps/freelan/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ libraries = [
'kfather',
'iconvplus',
'boost_system',
'boost_thread',
'boost_filesystem',
'boost_date_time',
'boost_program_options',
Expand All @@ -22,6 +21,15 @@ libraries = [
'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/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 1ca4f43

Please sign in to comment.