From 85984c26afc2a44c0a76394ea5684467011c3109 Mon Sep 17 00:00:00 2001 From: Sebastien Vincent Date: Tue, 8 Aug 2017 18:04:11 +0200 Subject: [PATCH 1/5] Modify scons scripts to be able to compile on macOS with brew packages. --- SConstruct | 4 ++++ apps/freelan/SConscript | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/SConstruct b/SConstruct index 0c3cb35f..36f78fd9 100644 --- a/SConstruct +++ b/SConstruct @@ -107,7 +107,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']) diff --git a/apps/freelan/SConscript b/apps/freelan/SConscript index b27286b9..4b7ad1b4 100644 --- a/apps/freelan/SConscript +++ b/apps/freelan/SConscript @@ -13,7 +13,6 @@ libraries = [ 'kfather', 'iconvplus', 'boost_system', - 'boost_thread', 'boost_filesystem', 'boost_date_time', 'boost_program_options', @@ -23,6 +22,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', From 54be93d69fb3c9206c568bed556c7b7ddfa227a2 Mon Sep 17 00:00:00 2001 From: Sebastien Vincent Date: Tue, 8 Aug 2017 18:04:20 +0200 Subject: [PATCH 2/5] Adds documentation to install brew packages on MacOS X. --- BUILD.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/BUILD.md b/BUILD.md index 313c8e18..6b3a423d 100644 --- a/BUILD.md +++ b/BUILD.md @@ -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: @@ -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 ---------------- From 7bdbd1044d2c2fbab6f7883bcc329ac25b72db62 Mon Sep 17 00:00:00 2001 From: Sebastien Vincent Date: Tue, 8 Aug 2017 18:08:15 +0200 Subject: [PATCH 3/5] Adds macOS build in Travis CI script (tentative). --- .travis.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9a40a3d7..69accb36 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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: @@ -14,6 +18,9 @@ addons: - libcurl4-openssl-dev - gcc - g++ +before_install: + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install scons boost openssl; fi cache: apt: true script: scons install apps samples From 7de9b70d5e621b56e6ca8d0d67a0fe67d6c40b7d Mon Sep 17 00:00:00 2001 From: Sebastien Vincent Date: Wed, 9 Aug 2017 15:19:35 +0200 Subject: [PATCH 4/5] Fixes Travis CI build file for macOS. The 'brew install' command will fail if package is already installed. So check if package is present first before installing it. --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 69accb36..e15daf58 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,7 +20,9 @@ addons: - g++ before_install: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install scons boost openssl; 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 From 8e86b5ac90d4bb252a5d1b504f88edb45b1ab358 Mon Sep 17 00:00:00 2001 From: Sebastien Vincent Date: Wed, 9 Aug 2017 15:48:35 +0200 Subject: [PATCH 5/5] Fixes compilation of FSCP samples on macOS (link with boost_thread-mt instead of boost_thread. --- samples/fscp/client/SConscript | 10 +++++++++- samples/fscp/schat/SConscript | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/samples/fscp/client/SConscript b/samples/fscp/client/SConscript index d3133279..b77fd312 100644 --- a/samples/fscp/client/SConscript +++ b/samples/fscp/client/SConscript @@ -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', diff --git a/samples/fscp/schat/SConscript b/samples/fscp/schat/SConscript index d3133279..b77fd312 100644 --- a/samples/fscp/schat/SConscript +++ b/samples/fscp/schat/SConscript @@ -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',