From a6b60971fccb3c76ff29aa220d2d6163aafd63d1 Mon Sep 17 00:00:00 2001
From: Alexandre Lision <alexandre.lision@gmail.com>
Date: Wed, 9 Mar 2016 23:20:51 -0500
Subject: [PATCH] osx: export qt5 dir

Automatize export of CMAKE_PREFIX_PATH
environnement variables created from make-ring are not passed to cmake
(cmake must fork the top level parent process, which does not have the
env var created by python)
We need to pass it in the cmake command line

Tuleap: #449
Change-Id: I28d57196d2963152d1708c286e96293a4cb005fb
---
 make-ring.py       | 3 +++
 scripts/install.sh | 8 ++++----
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/make-ring.py b/make-ring.py
index 544a789b..16ed51d2 100755
--- a/make-ring.py
+++ b/make-ring.py
@@ -134,6 +134,9 @@ def run_install(args):
     if args.global_install:
         install_args += ' -g'
     if args.distribution == "OSX":
+        proc= subprocess.Popen("brew --prefix qt5", shell=True, stdout=subprocess.PIPE)
+        qt5dir = proc.stdout.read()
+        os.environ['CMAKE_PREFIX_PATH'] = str(qt5dir.decode('ascii'))
         install_args += " -c client-macosx"
         execute_script(["CONFIGURE_FLAGS='--without-dbus' ./scripts/install.sh " + install_args])
     else:
diff --git a/scripts/install.sh b/scripts/install.sh
index 754fdb42..a3b2a0dd 100755
--- a/scripts/install.sh
+++ b/scripts/install.sh
@@ -71,9 +71,9 @@ cd "${TOP}/lrc"
 mkdir -p ${BUILDDIR}
 cd ${BUILDDIR}
 if $global; then
-  cmake .. -DCMAKE_BUILD_TYPE=Debug $static
+  cmake .. -DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH -DCMAKE_BUILD_TYPE=Debug $static
 else
-  cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX="${INSTALL}/lrc" -DRING_BUILD_DIR="${DAEMON}/src" $static
+  cmake .. -DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX="${INSTALL}/lrc" -DRING_BUILD_DIR="${DAEMON}/src" $static
 fi
 make
 make_install $global
@@ -82,9 +82,9 @@ cd "${TOP}/${client}"
 mkdir -p ${BUILDDIR}
 cd ${BUILDDIR}
 if $global; then
-  cmake .. $static
+  cmake .. -DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH $static
 else
-  cmake .. -DCMAKE_INSTALL_PREFIX="${INSTALL}/${client}" -DLibRingClient_DIR="${INSTALL}/lrc/lib/cmake/LibRingClient" $static
+  cmake .. -DCMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH -DCMAKE_INSTALL_PREFIX="${INSTALL}/${client}" -DLibRingClient_DIR="${INSTALL}/lrc/lib/cmake/LibRingClient" $static
 fi
 make
 make_install $global
-- 
GitLab