From f928c81afc148393f381c4f762af975cc99430c8 Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Sun, 1 Jul 2018 15:14:55 +0300 Subject: [PATCH 1/5] OSX: Add support for building on macports --- CMakeLists.txt | 27 +++++++++++++++++++++------ osx_environment.sh | 34 +++++++++++++++++++++++++++------- 2 files changed, 48 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a2a4eb1..912d4354 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -302,13 +302,28 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") ${OPENSSL_ROOT}/lib/ssleay32.lib ) elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - set (OPENSSL_ROOT /usr/local/opt/openssl) - include_directories (BEFORE SYSTEM ${OPENSSL_ROOT}/include) - set (OPENSSL_LIBS - ${OPENSSL_ROOT}/lib/libssl.a - ${OPENSSL_ROOT}/lib/libcrypto.a - ) + if (IS_DIRECTORY /usr/local/opt/openssl) + # brew + set (OPENSSL_ROOT /usr/local/opt/openssl) + + include_directories (BEFORE SYSTEM ${OPENSSL_ROOT}/include) + + set (OPENSSL_LIBS + ${OPENSSL_ROOT}/lib/libssl.a + ${OPENSSL_ROOT}/lib/libcrypto.a + ) + else(IS_DIRECTORY /opt/local) + # macports + set (OPENSSL_ROOT /opt/local) + + set (OPENSSL_LIBS + ${OPENSSL_ROOT}/lib/libssl.a + ${OPENSSL_ROOT}/lib/libcrypto.a + z + ) + endif() + elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") set (OPENSSL_LIBS ssl crypto) else() diff --git a/osx_environment.sh b/osx_environment.sh index f05ba585..82b40f17 100644 --- a/osx_environment.sh +++ b/osx_environment.sh @@ -1,16 +1,36 @@ -#!/bin/sh +#!/bin/bash if [ ! $BARRIER_BUILD_ENV ]; then printf "Modifying environment for Barrier build..." - QT_PATH=$(brew --prefix qt) - OPENSSL_PATH=$(brew --prefix openssl) + if command -v brew; then + printf "Detected Homebrew" + QT_PATH=$(brew --prefix qt) + OPENSSL_PATH=$(brew --prefix openssl) + + export BARRIER_BUILD_BREW=1 + export CMAKE_PREFIX_PATH="$QT_PATH:$CMAKE_PREFIX_PATH" + export LD_LIBRARY_PATH="$OPENSSL_PATH/lib:$LD_LIBRARY_PATH" + export CPATH="$OPENSSL_PATH/include:$CPATH" + export PKG_CONFIG_PATH="$OPENSSL_PATH/lib/pkgconfig:$PKG_CONFIG_PATH" + + elif command -v port; then + printf "Detected Macports" + + if [ ! -d /opt/local/lib/cmake/Qt5 ]; then + printf "Please install qt5-qtbase port" + fi + export BARRIER_BUILD_MACPORTS=1 + export CMAKE_PREFIX_PATH="/opt/local/lib/cmake/Qt5:$CMAKE_PREFIX_PATH" + export LD_LIBRARY_PATH="/opt/local/lib:$LD_LIBRARY_PATH" + export CPATH="/opt/local/include:$CPATH" + export PKG_CONFIG_PATH="/opt/local/libexec/qt5/lib/pkgconfig:$PKG_CONFIG_PATH" + else + printf "Neither Homebrew nor Macports is installed. Can't get dependency paths" + exit 1 + fi - export CMAKE_PREFIX_PATH="$QT_PATH:$CMAKE_PREFIX_PATH" - export LD_LIBRARY_PATH="$OPENSSL_PATH/lib:$LD_LIBRARY_PATH" - export CPATH="$OPENSSL_PATH/include:$CPATH" - export PKG_CONFIG_PATH="$OPENSSL_PATH/lib/pkgconfig:$PKG_CONFIG_PATH" export BARRIER_BUILD_ENV=1 printf "done\n" From 5467b90982228db5ba3c70050f6590a5a9affffb Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Mon, 2 Jul 2018 20:50:28 +0300 Subject: [PATCH 2/5] OSX: Prefer Macports over Homebrew if available --- CMakeLists.txt | 20 ++++++++++---------- osx_environment.sh | 27 ++++++++++++++------------- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 912d4354..5bc2cfaf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -303,7 +303,16 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Windows") ) elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") - if (IS_DIRECTORY /usr/local/opt/openssl) + if (IS_DIRECTORY /opt/local) + # macports + set (OPENSSL_ROOT /opt/local) + + set (OPENSSL_LIBS + ${OPENSSL_ROOT}/lib/libssl.a + ${OPENSSL_ROOT}/lib/libcrypto.a + z + ) + elseif (IS_DIRECTORY /usr/local/opt/openssl) # brew set (OPENSSL_ROOT /usr/local/opt/openssl) @@ -313,15 +322,6 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") ${OPENSSL_ROOT}/lib/libssl.a ${OPENSSL_ROOT}/lib/libcrypto.a ) - else(IS_DIRECTORY /opt/local) - # macports - set (OPENSSL_ROOT /opt/local) - - set (OPENSSL_LIBS - ${OPENSSL_ROOT}/lib/libssl.a - ${OPENSSL_ROOT}/lib/libcrypto.a - z - ) endif() elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") diff --git a/osx_environment.sh b/osx_environment.sh index 82b40f17..e30a0c00 100644 --- a/osx_environment.sh +++ b/osx_environment.sh @@ -4,28 +4,29 @@ if [ ! $BARRIER_BUILD_ENV ]; then printf "Modifying environment for Barrier build..." - if command -v brew; then + if command -v port; then + printf "Detected Macports" + + if [ ! -d /opt/local/lib/cmake/Qt5 ]; then + printf "Please install qt5-qtbase port" + fi + export BARRIER_BUILD_MACPORTS=1 + export CMAKE_PREFIX_PATH="/opt/local/lib/cmake/Qt5:$CMAKE_PREFIX_PATH" + export LD_LIBRARY_PATH="/opt/local/lib:$LD_LIBRARY_PATH" + export CPATH="/opt/local/include:$CPATH" + export PKG_CONFIG_PATH="/opt/local/libexec/qt5/lib/pkgconfig:$PKG_CONFIG_PATH" + + elif command -v brew; then printf "Detected Homebrew" QT_PATH=$(brew --prefix qt) OPENSSL_PATH=$(brew --prefix openssl) - export BARRIER_BUILD_BREW=1 + export BARRIER_BUILD_BREW=1 export CMAKE_PREFIX_PATH="$QT_PATH:$CMAKE_PREFIX_PATH" export LD_LIBRARY_PATH="$OPENSSL_PATH/lib:$LD_LIBRARY_PATH" export CPATH="$OPENSSL_PATH/include:$CPATH" export PKG_CONFIG_PATH="$OPENSSL_PATH/lib/pkgconfig:$PKG_CONFIG_PATH" - elif command -v port; then - printf "Detected Macports" - - if [ ! -d /opt/local/lib/cmake/Qt5 ]; then - printf "Please install qt5-qtbase port" - fi - export BARRIER_BUILD_MACPORTS=1 - export CMAKE_PREFIX_PATH="/opt/local/lib/cmake/Qt5:$CMAKE_PREFIX_PATH" - export LD_LIBRARY_PATH="/opt/local/lib:$LD_LIBRARY_PATH" - export CPATH="/opt/local/include:$CPATH" - export PKG_CONFIG_PATH="/opt/local/libexec/qt5/lib/pkgconfig:$PKG_CONFIG_PATH" else printf "Neither Homebrew nor Macports is installed. Can't get dependency paths" exit 1 From af789958f055d48163842ce691d9420cba33c458 Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Mon, 2 Jul 2018 20:39:04 +0300 Subject: [PATCH 3/5] travis: Rewrite the CI config to use platform matrix --- .travis.yml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 82f36c5f..79d38763 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,14 @@ language: cpp -before_install: -- sudo apt-get update -qq -- sudo apt-get install -qq libxtst-dev -- sudo apt-get install -qq qtdeclarative5-dev -- sudo apt-get install -qq libavahi-compat-libdnssd-dev -script: sh -x ./clean_build.sh -# skip install phase since we have a customized install package -# creation tool for each supported platform + +matrix: + include: + - os: linux + addons: + apt: + packages: + - libxtst-dev + - qtdeclarative5-dev + - libavahi-compat-libdnssd-dev + script: sh -x ./clean_build.sh + install: true From 4c0690dd9668410aef73dbeef02c94144783584c Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Mon, 2 Jul 2018 20:42:58 +0300 Subject: [PATCH 4/5] travis: Add macports-based OSX script --- .travis.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.travis.yml b/.travis.yml index 79d38763..7c260942 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,4 +11,15 @@ matrix: - libavahi-compat-libdnssd-dev script: sh -x ./clean_build.sh + - os: osx + osx_image: xcode9 + script: + - export COLUMNS=80 + - curl -LO https://raw.githubusercontent.com/GiovanniBussi/macports-ci/master/macports-ci + - chmod +x ./macports-ci + - ./macports-ci install + - PATH="$PATH:/opt/local/bin" + - sudo port -N install qt5-qtbase openssl + - sh -x ./clean_build.sh + install: true From 55c74e9075b17376d8eff54493c964161400da5f Mon Sep 17 00:00:00 2001 From: Povilas Kanapickas Date: Mon, 2 Jul 2018 22:34:21 +0300 Subject: [PATCH 5/5] travis: Add homebrew-based OSX script --- .travis.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.travis.yml b/.travis.yml index 7c260942..032d9f52 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,4 +22,11 @@ matrix: - sudo port -N install qt5-qtbase openssl - sh -x ./clean_build.sh + - os: osx + osx_image: xcode9 + script: + - brew update + - brew install qt openssl + - sh -x ./clean_build.sh + install: true