]> Creatis software - cpPlugins.git/commitdiff
...
authorLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Mon, 3 Oct 2016 23:02:08 +0000 (18:02 -0500)
committerLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Mon, 3 Oct 2016 23:02:08 +0000 (18:02 -0500)
dependencies/cpPlugins_Install_Dependencies.py [new file with mode: 0644]
dependencies/cpPlugins_Install_QT4.sh [new file with mode: 0755]
dependencies/dependencies.py [new file with mode: 0644]
dependencies/qt-4.8.6.patch [new file with mode: 0644]

diff --git a/dependencies/cpPlugins_Install_Dependencies.py b/dependencies/cpPlugins_Install_Dependencies.py
new file mode 100644 (file)
index 0000000..b1d7813
--- /dev/null
@@ -0,0 +1,383 @@
+#!/usr/bin/python
+
+import glob, multiprocessing, os, platform, readline
+from distutils import spawn
+
+## --------------------
+## -- Various values --
+## --------------------
+
+system_name = platform.system( )
+process_count = multiprocessing.cpu_count( ) / 2
+home_dir = os.environ[ "HOME" ]
+
+## ------------------------
+## -- Filename completer --
+## ------------------------
+
+def filename_completer( text, state ):
+    return ( glob.glob( text + '*' ) + [ None ] )[ state ]
+# fed
+
+def get_filepath( message ):
+    readline.set_completer_delims( ' \t\n;' )
+    readline.parse_and_bind( "tab: complete" )
+    readline.set_completer( filename_completer )
+    return os.path.abspath( raw_input( message ) )
+# fed
+
+## --------------------
+## -- File extractor --
+## --------------------
+
+def file_extract( filename, outdir ):
+    real_ext = None
+    for ext in [ ".zip", ".tar", ".tar.gz", ".tar.bz2" ]:
+        if filename[ len( filename ) - len( ext ) : ] == ext:
+            real_ext = ext
+        # fi
+    # rof
+    command = None
+    if real_ext == ".zip":
+        command = "unzip " + filename + " -d " + outdir
+    elif real_ext == ".tar":
+        command = "tar xf " + filename + " -C " + outdir + " --strip-components=1"
+    elif real_ext == ".tar.gz":
+        command = "tar xzf " + filename + " -C " + outdir + " --strip-components=1"
+    elif real_ext == ".tar.bz2":
+        command = "tar xjf " + filename + " -C " + outdir + " --strip-components=1"
+    # fi
+    if command <> None:
+        print( "\tExtracting " + filename + "..." )
+        res = os.system( "mkdir -p " + outdir + " && " + command )
+        print( "\t\tdone." )
+        if res == 0:
+            return True
+        else:
+            return False
+    else:
+        return False
+    # fi
+# fed
+
+## ------------------
+## -- Look for Qt4 --
+## ------------------
+
+qmake_locations = []
+qmake_progs = []
+if system_name == "Linux":
+    qmake_locations = [
+        "/usr/bin",
+        "/usr/local/bin",
+        home_dir + "/bin",
+        home_dir + "/local/bin"
+        ]
+    qmake_progs = [ "qmake", "qmake-qt4" ]
+# fi
+
+qmake_paths = []
+for prog in qmake_progs:
+    for loc in qmake_locations:
+        path = spawn.find_executable( loc + "/" + prog )
+        if path <> None:
+            qmake_paths.append( path )
+    # rof
+# rof
+
+print( "Please choose one configuration for Qt4:" )
+for i in range( len( qmake_paths ) ):
+    print( "\t" + str( i ) + ": " + qmake_paths[ i ] )
+# rof
+print( "\t" + str( len( qmake_paths ) + 0 ) + ": Give another installation path (path to qmake)." )
+print( "\t" + str( len( qmake_paths ) + 1 ) + ": Build from scratch." )
+qmake_opt = -1
+while qmake_opt == -1:
+    qmake_opt = int( raw_input( "\t---> " ) )
+    if qmake_opt < 0 or qmake_opt > len( qmake_paths ) + 1:
+        qmake_opt = -1
+    # fi
+# elihw
+
+qmake_exec = None
+qmake_src = None
+if qmake_opt == len( qmake_paths ):
+    qmake_exec = get_filepath( "Choose your own Qt4 installation: " )
+    while not os.path.isfile( qmake_exec ):
+        qmake_exec = get_filepath( "Choose your own Qt4 installation: " )
+    # elihw
+elif qmake_opt == len( qmake_paths ) + 1:
+    qmake_src = get_filepath( "Choose your own Qt4 source file: " )
+    while not os.path.isfile( qmake_src ):
+        qmake_src = get_filepath( "Choose your own Qt4 source file: " )
+    # elihw
+else:
+    qmake_exec = qmake_paths[ qmake_opt ]
+# fi
+
+## --------------------
+## -- Look for CMake --
+## --------------------
+
+cmake_locations = []
+cmake_progs = []
+if system_name == "Linux":
+    cmake_locations = [
+        "/usr/bin",
+        "/usr/local/bin",
+        home_dir + "/bin",
+        home_dir + "/local/bin"
+        ]
+    cmake_progs = [ "cmake" ]
+# fi
+
+cmake_paths = []
+for prog in cmake_progs:
+    for loc in cmake_locations:
+        path = spawn.find_executable( loc + "/" + prog )
+        if path <> None:
+            cmake_paths.append( path )
+    # rof
+# rof
+
+print( "Please choose one configuration for CMake:" )
+for i in range( len( cmake_paths ) ):
+    print( "\t" + str( i ) + ": " + cmake_paths[ i ] )
+# rof
+print( "\t" + str( len( cmake_paths ) + 0 ) + ": Give another installation path (path to cmake)." )
+print( "\t" + str( len( cmake_paths ) + 1 ) + ": Build from scratch." )
+cmake_opt = -1
+while cmake_opt == -1:
+    cmake_opt = int( raw_input( "\t---> " ) )
+    if cmake_opt < 0 or cmake_opt > len( cmake_paths ) + 1:
+        cmake_opt = -1
+    # fi
+# elihw
+
+cmake_exec = None
+cmake_src = None
+if cmake_opt == len( cmake_paths ):
+    cmake_exec = get_filepath( "Choose your own CMake installation: " )
+    while not os.path.isfile( cmake_exec ):
+        cmake_exec = get_filepath( "Choose your own CMake installation: " )
+    # elihw
+elif cmake_opt == len( cmake_paths ) + 1:
+    cmake_src = get_filepath( "Choose your own CMake source file: " )
+    while not os.path.isfile( cmake_src ):
+        cmake_src = get_filepath( "Choose your own CMake source file: " )
+    # elihw
+else:
+    cmake_exec = cmake_paths[ cmake_opt ]
+# fi
+
+## ------------------
+## -- Look for ITK --
+## ------------------
+
+itk_src = get_filepath( "Choose your own ITK source file: " )
+while not os.path.isfile( itk_src ):
+    itk_src = get_filepath( "Choose your own ITK source file: " )
+# elihw
+
+## ------------------
+## -- Look for VTK --
+## ------------------
+
+vtk_src = get_filepath( "Choose your own VTK source file: " )
+while not os.path.isfile( vtk_src ):
+    vtk_src = get_filepath( "Choose your own VTK source file: " )
+# elihw
+
+## --------------------------
+## -- Miscelaneous options --
+## --------------------------
+
+build_prefix = get_filepath( "Build prefix: " )
+install_prefix = get_filepath( "Installation prefix: " )
+build_type = raw_input( "Build type [release/debug]: " ).lower( )
+
+os.system( "mkdir -p " + build_prefix )
+os.system( "mkdir -p " + install_prefix )
+
+## -------------------
+## -- Extract files --
+## -------------------
+
+print( "Extracting source code... " )
+if qmake_src <> None:
+    file_extract( qmake_src, build_prefix + "/qt4-source" )
+# fi
+if cmake_src <> None:
+    file_extract( cmake_src, build_prefix + "/cmake-source" )
+# fi
+file_extract( itk_src, build_prefix + "/itk-source" )
+file_extract( vtk_src, build_prefix + "/vtk-source" )
+print( " done!" )
+
+## ---------------
+## -- Build Qt4 --
+## ---------------
+
+if qmake_src <> None:
+    full = raw_input( "\tWould you like to perform a full Qt4 build [y/n]? " )
+    full.lower( )
+    
+    qt4_source = os.path.abspath( build_prefix + "/qt4-source" )
+    qt4_build = os.path.abspath( build_prefix + "/qt4-build" )
+    os.system( "mkdir -p " + qt4_build )
+
+    config_command = qt4_source + "/configure"
+    config_command += " -prefix " + install_prefix
+    config_command += " -" + build_type
+    config_command += " -opensource -shared -fast -no-webkit -optimized-qmake -confirm-license"
+    if full[ 0 ] == "n":
+        config_command += " -no-phonon -no-phonon-backend -no-openvg -nomake demos -nomake examples"
+    # fi
+    ## MACOS: -no-framework
+
+    ## Build and install
+    res = os.system( "cd " + qt4_build + " && " + config_command )
+    if res <> 0:
+        print( "Error configuring Qt4." )
+        exit( 1 )
+    # fi
+    res = os.system( "cd " + qt4_build + " && make -j" + str( process_count ) )
+    if res <> 0:
+        print( "Error compiling Qt4." )
+        exit( 1 )
+    # fi
+    res = os.system( "cd " + qt4_build + " && make -j install" )
+    if res <> 0:
+        print( "Error installing Qt4." )
+        exit( 1 )
+    # fi
+    qmake_exec = install_prefix + "/bin/qmake"
+# fi
+
+## -----------------
+## -- Build CMake --
+## -----------------
+
+if cmake_src <> None:
+    cmake_source = os.path.abspath( build_prefix + "/cmake-source" )
+    cmake_build = os.path.abspath( build_prefix + "/cmake-build" )
+    os.system( "mkdir -p " + cmake_build )
+
+    config_command = cmake_source + "/bootstrap"
+    config_command += " --prefix " + install_prefix
+    if qmake_exec <> None:
+        config_command += " --qt-gui --qt-qmake=" + qmake_exec
+    else:
+        config_command += " --no-qt-gui"
+    # fi
+
+    ## Build and install
+    res = os.system( "cd " + cmake_build + " && " + config_command )
+    if res <> 0:
+        print( "Error configuring CMake." )
+        exit( 1 )
+    # fi
+    res = os.system( "cd " + cmake_build + " && make -j" + str( process_count ) )
+    if res <> 0:
+        print( "Error compiling CMake." )
+        exit( 1 )
+    # fi
+    res = os.system( "cd " + cmake_build + " && make -j install" )
+    if res <> 0:
+        print( "Error installing CMake." )
+        exit( 1 )
+    # fi
+    cmake_exec = install_prefix + "/bin/cmake"
+# fi
+
+## ---------------
+## -- Build VTK --
+## ---------------
+
+vtk_source = os.path.abspath( build_prefix + "/vtk-source" )
+vtk_build = os.path.abspath( build_prefix + "/vtk-build" )
+os.system( "mkdir -p " + vtk_build )
+
+kitware_build = "MinSizeRel"
+if build_type == "debug":
+    kitware_build = "Debug"
+# fi
+
+vtk_configure = cmake_exec
+vtk_configure += " -DCMAKE_CXX_FLAGS:STRING=-std=c++11"
+vtk_configure += " -DBUILD_DOCUMENTATION:BOOL=OFF"
+vtk_configure += " -DBUILD_EXAMPLES:BOOL=OFF"
+vtk_configure += " -DBUILD_SHARED_LIBS:BOOL=ON"
+vtk_configure += " -DBUILD_TESTING:BOOL=OFF"
+vtk_configure += " -DCMAKE_BUILD_TYPE:STRING=" + kitware_build
+if qmake_exec <> None:
+    vtk_configure += " -DQT_QMAKE_EXECUTABLE:PATH=" + qmake_exec
+    vtk_configure += " -DModule_vtkGUISupportQt:BOOL=ON"
+    vtk_configure += " -DModule_vtkGUISupportQtOpenGL:BOOL=ON"
+    vtk_configure += " -DModule_vtkGUISupportQtSQL:BOOL=OFF"
+    vtk_configure += " -DModule_vtkGUISupportQtWebkit:BOOL=OFF"
+# fi
+vtk_configure += " -DCMAKE_INSTALL_PREFIX:PATH=" + install_prefix
+vtk_configure += " " + vtk_source
+    
+## Build and install
+res = os.system( "cd " + vtk_build + " && " + vtk_configure )
+if res <> 0:
+    print( "Error configuring VTK." )
+    exit( 1 )
+# fi
+res = os.system( "cd " + vtk_build + " && make -j" + str( process_count ) )
+if res <> 0:
+    print( "Error compiling VTK." )
+    exit( 1 )
+# fi
+res = os.system( "cd " + vtk_build + " && make -j install" )
+if res <> 0:
+    print( "Error installing VTK." )
+    exit( 1 )
+# fi
+
+## ---------------
+## -- Build ITK --
+## ---------------
+
+itk_source = os.path.abspath( build_prefix + "/itk-source" )
+itk_build = os.path.abspath( build_prefix + "/itk-build" )
+os.system( "mkdir -p " + itk_build )
+
+kitware_build = "MinSizeRel"
+if build_type == "debug":
+    kitware_build = "Debug"
+# fi
+
+itk_configure = cmake_exec
+itk_configure += " -DCMAKE_CXX_FLAGS:STRING=-std=c++11"
+itk_configure += " -DBUILD_DOCUMENTATION:BOOL=OFF"
+itk_configure += " -DBUILD_EXAMPLES:BOOL=OFF"
+itk_configure += " -DBUILD_SHARED_LIBS:BOOL=ON"
+itk_configure += " -DBUILD_TESTING:BOOL=OFF"
+itk_configure += " -DCMAKE_BUILD_TYPE:STRING=" + kitware_build
+itk_configure += " -DModule_ITKReview:BOOL=ON"
+itk_configure += " -DModule_ITKVtkGlue:BOOL=OFF"
+itk_configure += " -DModule_ParabolicMorphology:BOOL=ON"
+itk_configure += " -DCMAKE_INSTALL_PREFIX:PATH=" + install_prefix
+itk_configure += " " + itk_source
+
+## Build and install
+res = os.system( "cd " + itk_build + " && " + itk_configure )
+if res <> 0:
+    print( "Error configuring ITK." )
+    exit( 1 )
+# fi
+res = os.system( "cd " + itk_build + " && make -j" + str( process_count ) )
+if res <> 0:
+    print( "Error compiling ITK." )
+    exit( 1 )
+# fi
+res = os.system( "cd " + itk_build + " && make -j install" )
+if res <> 0:
+    print( "Error installing ITK." )
+    exit( 1 )
+# fi
+
+## eof - $RCSfile$
diff --git a/dependencies/cpPlugins_Install_QT4.sh b/dependencies/cpPlugins_Install_QT4.sh
new file mode 100755 (executable)
index 0000000..36c5d13
--- /dev/null
@@ -0,0 +1,219 @@
+#!/bin/bash
+
+function abspath()
+{
+    pushd . > /dev/null
+    if [ -d "$1" ]; then
+        cd "$1"
+        dirs -l +0
+    else
+        cd "`dirname \"$1\"`"
+        cur_dir=`dirs -l +0`
+        if [ "$cur_dir" == "/" ]; then
+            echo "$cur_dir`basename \"$1\"`"
+        else
+            echo "$cur_dir/`basename \"$1\"`"
+        fi
+    fi
+    popd > /dev/null
+}
+
+function get_file_extension
+{
+    valid_extensions=("zip" "tar" "tar.gz" "tar.bz2")
+    actual_file=`abspath $1`
+    actual_ext=""
+    for ext in ${valid_extensions[@]}; do
+        test_str=`dirname $actual_file`/`basename $actual_file $ext`
+        if [ $test_str != $actual_file ]; then
+            actual_ext=$ext
+        fi
+    done
+    echo "$actual_ext"
+}
+
+function print_help()
+{
+    echo "Usage: `basename $0` -f=compressed_code -c=source_dir -b=build_dir [-t=build_type[release/debug]] [-p=instalation_prefix] [--full]"
+}
+
+## Analyze command-line arguments
+if [ $# -eq 0 ]; then
+        print_help
+        exit 1
+fi
+full_compile="0"
+prefix="${HOME}/local"
+build_type="release"
+for i in "$@"; do
+    case $i in
+    -f=*|--file=*)
+    source_file="${i#*=}"
+    shift
+    ;;
+    -c=*|--source_dir=*)
+    source_dir="${i#*=}"
+    shift
+    ;;
+    -b=*|--build_dir=*)
+    build_dir="${i#*=}"
+    shift
+    ;;
+    -t=*|--build_type=*)
+    build_type="${i#*=}"
+    shift
+    ;;
+    -p=*|--prefix=*)
+    prefix="${i#*=}"
+    shift
+    ;;
+    --full)
+    full_compile="1"
+    shift
+    ;;
+    *)
+    ;;
+    esac
+done
+
+## Check command line arguments
+if [ "x$source_dir" == "x" ]; then
+    if [ "x$source_file" != "x" ]; then
+        base_path=`abspath $source_file`
+        base_ext=`get_file_extension $base_path`
+        base_dir=`dirname $base_path`
+        if [ "x$base_ext" != "x" ]; then
+            source_dir="$base_dir"/`basename $base_path .$base_ext`
+        else
+            echo "Error: Input compressed file extension not recognized."
+            exit 1
+        fi
+    else
+        print_help
+        exit 1
+    fi
+fi
+if [ "x$build_dir" == "x" ]; then
+    if [ "x$source_dir" != "x" ]; then
+        base_dir=$source_dir
+        if [ "${source_dir:$((${#str}-1)):1}" == "/" ]; then
+            base_dir=`echo $source_dir | rev | cut -c 2- | rev`
+        fi
+        build_dir="$base_dir-build"
+    else
+        print_help
+        exit 1
+    fi
+fi
+
+## Other configuration variables
+platform=`uname`
+particular_options=""
+patch_file=""
+if [ "$platform" == "Darwin" ]; then
+    particular_options=-no-framework
+    bash_path=`abspath $0`
+    bash_dir=`dirname $bash_path`
+    patch_file=$bash_dir/qt-4.8.6.patch
+fi
+number_of_cores=`grep -c ^processor /proc/cpuinfo`
+number_of_threads=`expr $number_of_cores / 2`
+if [ "x$source_file" != "x" ]; then
+    source_file=`abspath $source_file`
+fi
+source_dir=`abspath $source_dir`
+build_dir=`abspath $build_dir`
+
+echo "====================================================================="
+echo "==> Source file       : $source_file"
+echo "==> Source dir        : $source_dir"
+echo "==> Build dir         : $build_dir"
+echo "==> Build type        : $build_type"
+echo "==> Prefix            : $prefix"
+echo "==> Full compile      : $full_compile"
+echo "==> Platform          : $platform"
+echo "==> Number of cores   : $number_of_cores"
+echo "==> Number of threads : $number_of_threads"
+echo "==> Patch file        : $patch_file"
+echo "====================================================================="
+read -n1 -r -p "Continue? [Y/N]... " key
+echo
+if [ "$key" != 'Y' -a "$key" != 'y' ] ; then
+    exit 1
+fi
+
+## Create paths
+if [ "x$source_file" != "x" ]; then
+    echo -n "==> Cleaning directories... "
+    rm -rf $source_dir
+    rm -rf $build_dir
+    echo "done."
+    echo -n "==> Creating directories... "
+    mkdir -p $source_dir
+    mkdir -p $build_dir
+    echo "done."
+fi
+
+## Extract source code
+if [ "x$source_file" != "x" ]; then
+    echo -n "==> Extracting sources... "
+    base_path=`abspath $source_file`
+    base_ext=`get_file_extension $base_path`
+    if [ "$base_ext" == "zip" ]; then
+        echo unzip $base_path
+    elif [ "$base_ext" == "tar" ]; then
+        tar xf $base_path -C $source_dir --strip-components=1
+    elif [ "$base_ext" == "tar.gz" ]; then
+        tar xzf $base_path -C $source_dir --strip-components=1
+    elif [ "$base_ext" == "tar.bz2" ]; then
+        tar xjf $base_path -C $source_dir --strip-components=1
+    fi
+    echo "done."
+fi
+
+# Apply patch
+if [ "x$patch_file" != "x" ]; then
+    echo -n "==> Applying patch... "
+    cd $source_dir
+    patch -p0 < $patch_file
+    echo "done."
+fi
+
+echo "==> Configuring sources... "
+cd $build_dir
+if [ "x$full_compile" == "xfull" ]; then
+    $source_dir/configure \
+        -prefix $prefix \
+        -$build_type \
+        -opensource -shared -fast \
+        -no-webkit \
+        -optimized-qmake \
+        $particular_options \
+        -confirm-license
+else
+    $source_dir/configure \
+        -prefix $prefix \
+        -$build_type \
+        -opensource -shared -fast \
+        -no-phonon \
+        -no-phonon-backend \
+        -no-webkit \
+        -no-openvg \
+        -nomake demos -nomake examples \
+        -optimized-qmake \
+        $particular_options \
+        -confirm-license
+fi
+echo "==> Configuring sources... done."
+
+echo "==> Compiling sources..."
+cd $build_dir
+make -j$number_of_threads
+echo "==> Compiling sources... done."
+
+echo "==> Installing package..."
+cd $build_dir
+make -j install
+echo "==> Installing package... done."
+
+## eof - $RCSfile$
diff --git a/dependencies/dependencies.py b/dependencies/dependencies.py
new file mode 100644 (file)
index 0000000..cc1d917
--- /dev/null
@@ -0,0 +1,126 @@
+import os, platform, readline, glob, multiprocessing
+from distutils import spawn
+
+## ------------------------
+## -- Filename completer --
+## ------------------------
+
+def complete( text, state ):
+    return ( glob.glob( text + '*' ) + [ None ] )[ state ]
+# fed
+
+## -----------------------
+## -- File decompressor --
+## -----------------------
+
+def decompress( filename, outdir ):
+    real_ext = None
+    for ext in [ ".zip", ".tar", ".tar.gz", ".tar.bz2" ]:
+        if filename[ len( filename ) - len( ext ) : ] == ext:
+            real_ext = ext
+        # fi
+    # rof
+    command = None
+    if real_ext == ".zip":
+        command = "unzip " + filename + " -d " + outdir
+    elif real_ext == ".tar":
+        command = "tar xf " + filename + " -C " + outdir + " --strip-components=1"
+    elif real_ext == ".tar.gz":
+        command = "tar xzf " + filename + " -C " + outdir + " --strip-components=1"
+    elif real_ext == ".tar.bz2":
+        command = "tar xjf " + filename + " -C " + outdir + " --strip-components=1"
+    # fi
+    if command <> None:
+        print( "\tExtracting " + filename + "..." )
+        res = os.system( "mkdir -p " + outdir + " && " + command )
+        print( "\t\tdone." )
+        if res == 0:
+            return True
+        else:
+            return False
+    else:
+        return False
+    # fi
+# fed
+
+## -------------------------
+## -- Find necessary data --
+## -------------------------
+
+system_name = platform.system( )
+process_count = multiprocessing.cpu_count( ) / 2
+qmake_exec = spawn.find_executable( "qmake-qt4" )
+cmake_exec = spawn.find_executable( "cmake" )
+readline.set_completer_delims( ' \t\n;' )
+readline.parse_and_bind( "tab: complete" )
+readline.set_completer( complete )
+install_prefix = os.path.abspath( raw_input( "Install prefix: " ) )
+
+## --------------------------------------------
+## -- Ask if new versions should be compiled --
+## --------------------------------------------
+
+build_qmake = "y"
+if qmake_exec <> None:
+    build_qmake = raw_input( "Qt4 was found in \"" + qmake_exec + "\", do you want to install a new Qt4 [y/n]? " )
+# fi
+build_qmake.lower( )
+
+build_cmake = "y"
+if cmake_exec <> None:
+    build_cmake = raw_input( "CMake was found in \"" + cmake_exec + "\", do you want to install a new CMake [y/n]? " )
+# fi
+build_cmake.lower( )
+
+## -----------------
+## -- Compile Qt4 --
+## -----------------
+
+if build_qmake[ 0 ] == "y":
+    print( "Compiling Qt4..." )
+    readline.set_completer_delims( ' \t\n;' )
+    readline.parse_and_bind( "tab: complete" )
+    readline.set_completer( complete )
+    qt4_file = os.path.abspath(
+        raw_input( "\tCompressed file containing Qt4: " )
+        )
+    full = raw_input( "\tWould you like to perform a full build [y/n]? " )
+    full.lower( )
+    build_type = raw_input( "\tBuild type [release/debug]? " )
+    build_type.lower( )
+    if not decompress( qt4_file, "./qt4_source" ):
+        print( "Unable to decompress Qt4." )
+        exit( 1 )
+    # fi
+    qt4_source = os.path.abspath( "./qt4_source" )
+    os.system( "mkdir -p ./qt4_build" )
+    qt4_build = os.path.abspath( "./qt4_build" )
+
+    config_command = qt4_source + "/configure"
+    config_command += " -prefix " + install_prefix
+    config_command += " -" + build_type
+    config_command += " -opensource -shared -fast -no-webkit -optimized-qmake -confirm-license"
+    if full[ 0 ] == "n":
+        config_command += " -no-phonon -no-phonon-backend -no-openvg -nomake demos -nomake examples"
+    # fi
+    ## MACOS: -no-framework
+
+    ## Build and install
+    res = os.system( "cd " + qt4_build + " && " + config_command )
+    if res <> 0:
+        print( "Error configuring Qt4." )
+        exit( 1 )
+    # fi
+    res = os.system( "cd " + qt4_build + " && make -j" + str( process_count ) )
+    if res <> 0:
+        print( "Error compiling Qt4." )
+        exit( 1 )
+    # fi
+    res = os.system( "cd " + qt4_build + " && make -j install" )
+    if res <> 0:
+        print( "Error installing Qt4." )
+        exit( 1 )
+    # fi
+# fi
+
+## eof - $RCSfile$
diff --git a/dependencies/qt-4.8.6.patch b/dependencies/qt-4.8.6.patch
new file mode 100644 (file)
index 0000000..f0d2122
--- /dev/null
@@ -0,0 +1,18 @@
+--- src/gui/painting/qpaintengine_mac.cpp.orig 2015-05-07 14:14:43.000000000 +0000
++++ src/gui/painting/qpaintengine_mac.cpp
+@@ -340,13 +340,7 @@ CGColorSpaceRef QCoreGraphicsPaintEngine
+     }
+     // Get the color space from the display profile.
+-    CGColorSpaceRef colorSpace = 0;
+-    CMProfileRef displayProfile = 0;
+-    CMError err = CMGetProfileByAVID((CMDisplayIDType)displayID, &displayProfile);
+-    if (err == noErr) {
+-        colorSpace = CGColorSpaceCreateWithPlatformColorSpace(displayProfile);
+-        CMCloseProfile(displayProfile);
+-    }
++    CGColorSpaceRef colorSpace = CGDisplayCopyColorSpace(displayID);
+     // Fallback: use generic DeviceRGB
+     if (colorSpace == 0)
+